Skip to content

Add export and import actions to the slash command menu #1165

@sw-factory-automations

Description

@sw-factory-automations

Description

The "Export as Markdown" and "Import Markdown" actions are only accessible via the page menu dropdown (⋯ button in the top-right). Usage data from the feedback digests consistently shows very low adoption — editor.export and editor.import each average ~1 use per week. Adding these actions to the slash command menu would improve discoverability since the slash menu is the primary command interface and users already use it to insert blocks.

Evidence

User feedback (Slack #memo-user-feedback): Multiple feedback digests (May 14, May 10, May 8, April 24) note that editor.export and editor.import have the lowest usage of all tracked events (1 use/week each). The May 10 digest explicitly states "Import/export each have only 1 event — low discoverability or niche use case." The slash command menu (src/components/editor/slash-command-plugin.tsx) currently has 16+ block insertion commands but no export/import actions.

Acceptance Criteria

  • Slash command menu includes an "Export as Markdown" option (icon: Download, description: "Download page as .md file")
  • Slash command menu includes an "Import Markdown" option (icon: Upload, description: "Import content from a .md file")
  • Export action triggers the same exportEditorToMarkdown + downloadMarkdown flow as the page menu
  • Import action triggers the same file picker flow as the page menu's Import Markdown
  • Both options appear at the bottom of the slash menu, after the existing block insertion commands
  • Both options are filterable by typing (e.g., /export, /import)
  • Storybook story for SlashCommandPlugin updated to show the new options
  • pnpm lint && pnpm typecheck && pnpm test pass

Technical Notes

  • Add two new SlashCommandOption entries to the baseOptions array in src/components/editor/slash-command-plugin.tsx
  • For Export: reuse exportEditorToMarkdown and downloadMarkdown from src/components/editor/markdown-utils.ts. Access the editor instance via the useLexicalComposerContext hook already in scope.
  • For Import: dispatch a custom command or use the existing useMarkdownImport hook pattern. Since the slash command plugin runs inside the editor context, it may need to trigger a file input click — follow the same pattern as openImagePicker in image-plugin.tsx.
  • Use Download and Upload icons from lucide-react (already imported in page-menu.tsx)
  • The page menu keyboard shortcuts (⌘⇧E for export) should still work independently

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions