Skip to content

Add an Insert dropdown for supported document elements #25

Closed

Description

@BinaryOutlook

Stage 2 — Discoverable GUI editing

Synopsis

Add a clearly labeled Insert dropdown that exposes existing insertion commands, so users can create supported elements without memorizing syntax or pasting examples.

End goal

Users can insert inline/block equations, tables, code blocks, links, images, Mermaid, and a table of contents at the intended location through the GUI.

Start after

Start implementation only after every prerequisite is merged into main or has a maintainer-accepted technical freeze recorded in its linked issue. A freeze must identify the exact source/prototype commit and settled contracts; an open draft PR alone is insufficient. For an investigation prerequisite, acceptance must identify the approved design/report revision and prototype commit if one exists.

Fetch current origin/main before branching. If using a freeze, record an integration base containing all required prerequisite changes and link the freeze decisions in the PR. Validate the combined result again after the final prerequisite changes are integrated. The recorded freeze governs any agreed early start while a prerequisite issue remains open.

Agreed scope

  • Use a dropdown menu rather than a ribbon-style tab.
  • Include inline equation, block equation, table, code block, link, image, Mermaid diagram, and managed TOC insertion.
  • Reuse the established command dispatchers and existing dialogs/authoring behavior instead of maintaining a parallel insertion implementation.
  • Keep keyboard shortcuts and the action palette working; unsupported editing contexts should have understandable disabled states.

Acceptance criteria

  • Every agreed item is visible under Insert and invokes the correct existing action in both editor hosts.
  • Opening, searching/navigating if applicable, and dismissing the menu preserve selection; choosing an item uses the retained insertion location.
  • Keyboard focus, arrow navigation, Enter/Space activation, Escape dismissal, accessible labels, and narrow-pane placement are usable.
  • Each insertion creates the intended document structure and one coherent undo operation; source switching and save/reopen preserve it.
  • Inline and block equations enter a useful editing state; TOC insertion retains the managed-TOC contract rather than inserting a disconnected duplicate implementation.

Verification

  • Exercise every menu item with an empty document, a normal caret, selected text, and relevant list/table contexts.
  • Verify keyboard-only use, cancellation of image/link flows, undo/redo, source switching, and save/reopen.
  • Run browser regressions and installed-host smoke checks; update interface translations and the editor guide.

Source pointers

  • src/shared/editor-body-html.js
  • src/webview/editor.js
  • src/webview/styles.css
  • src/i18n/locales
  • test/specs/command-palette.spec.ts
  • test/specs/document-aux.spec.ts

Delivery contract

Implement the shared editor behavior in both VS Code and Electron. View-only settings/actions must preserve Markdown, selection/editing context, clean state, and undo history. For new or changed settings, keep host wiring, manifest descriptions, all supported translations, and documentation consistent. Preserve existing identifiers and defaults except for the deliberate changes specified above.

Work from the repository root using the Node version in .node-version and the maintained instructions in CONTRIBUTING.md, docs/building.md, and docs/testing/README.md; export changes also follow docs/export-verification.md. Run full compilation after webview JavaScript/CSS, shared-module, or translation changes, plus checks that exercise the changed behavior. Rebuild and reinstall for installed-extension evidence. Report failures/skips honestly; follow required CI and review gates. Update affected documentation and review any committed Markdown in source and rendered form.

Link the PR or investigation to this issue. Keep remediation on the same focused work item where practical. Completion requires the stated evidence and accepted outcome; opening a draft PR does not complete the issue. No deadline or assignee is imposed by this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions