维刻 Vex
GitHub
维刻 Vex / 文档 / 工作区菜单

工作区菜单

The native app shares a typed command tree between Windows/Linux flyouts, macOS system menus, and phone/tablet touch sheets. The seven categories are File, Edit, Paragraph, Format, View, Tools, and Help.

  • macOS uses native window chrome and Command shortcuts. About, Preferences, Services, Hide, and Quit live in the application menu. Quit follows the same unsaved-document and recovery checks as closing the window.
  • Phone and tablet menus navigate one level at a time in a bottom sheet, with a fixed title, Back and Close controls. Only the item list scrolls. System Back returns to the preceding menu level before dismissing the sheet.
  • Phone layout commands expose single views; tablet layout commands expose at most two panes. Desktop menus retain all eight workspace arrangements.
  • Submenu, dropdown, and window-control glyphs use the same 16px size.
  • Paragraph conversion replaces existing heading/list/task/quote prefixes and applies to all selected lines. Repeating a paragraph style toggles it off.
  • Inline formatting toggles around the selection. Formula, code, rule, table, Mermaid, and footnote insertion preserve document line endings and share one-step undo with source/instant editing.
  • Clipboard operations capture the original document and selection; async completion cannot paste or cut in another document or a changed selection.

Automated coverage: workspace_menu_test.dart, formatting_commands_test.dart, and the native Windows integration capture integration_test/menus_test.dart. The macOS menu structure and shortcuts are widget-tested on this Windows host; native macOS appearance still requires a macOS runner/device check.

Viewport limits also apply to restored layouts, the layout picker, find results and guided exercises. Phones remain single-pane in landscape; tablets never show the desktop three-pane arrangement. Resizing projects the saved layout without overwriting it, so a narrow desktop window regains its arrangement when expanded. Guide cards sit beside the highlighted area with an 8px triangular pointer and respect reduced motion. Shared dialogs keep the title/footer fixed and scroll only the body, with right-aligned actions.

Coverage: adaptive_workspace_test.dart and native Windows guide screenshots from integration_test/adaptive_workspace_test.dart. Phone/tablet platforms and phone rotation are widget-tested, not physical iOS-device certification.

Tables

Paragraph > Table and the table-cell context menu share the same commands: insert, move and delete rows/columns; set column alignment; copy, format and delete the table. Header rows cannot move into the body, and the final column cannot be deleted. Every structural change is one undo step and restores the selection to the affected cell. Escaped pipes, code spans and CRLF are retained.

Unfocused cells render inline Markdown with the same formula, chemistry and text-mark preferences as the document. Focus reveals the original cell source; Tab/Shift+Tab keep native traversal and editing retains the shared history. Cells wrap long text and preserve column alignment in both states. Leading heading/list markers remain literal cell content, not nested block elements. Coverage: table_rich_test.dart at phone and desktop widths.

Desktop cells use an anchored secondary-click menu. Phone/tablet long-press opens the fixed-header touch sheet. Reading mode only permits copying a table. Commands captured before a document change or switch cannot modify new content. Coverage: table_commands_test.dart, test/table_menu_test.dart, and native Windows screenshots in integration_test/table_menu_test.dart.

Element Context Menus

Source, instant editing and reading use the same captured source targets. Desktop secondary click opens a flyout; phone and tablet long-press use a fixed-header sheet with hierarchical submenus. Clipboard and inline-format tools share the prototype icons; submenu arrows match the titlebar menus. Source, active instant blocks and table cells also support the Context Menu key and Shift+F10. Keyboard invocation preserves backward selections, anchors to the actual caret and focuses the first enabled command. Enter executes it; Escape returns focus to editing. Composing IME text is never interrupted.

  • Links: open, copy address, edit text/address/title, unlink without losing inline formatting. Images: preview, copy address, replace, edit description, delete. Local replacement follows the image copy/relative-path preferences.
  • Code: copy bare source, edit code/language, delete. Formulas expose bare LaTeX source and retain their original delimiter convention. Mermaid adds preview and source-plus-preview expansion with live rendering in its edit dialog.
  • Text: copy as Markdown, HTML source or plain text; cut, paste, literal-text paste, selection deletion, formatting and paragraph conversion. Lists add indentation and task toggling. All editable elements support insertion above or below and deletion through shared undo history.
  • Read-only panes permit preview/open/copy only. Menu snapshots, edit dialogs and asynchronous clipboard operations reject changed/switched documents. Source-editor keyboard paste also rejects changed selections.

CommonMark supplies media parsing, including reference definitions, nested destinations, escaped labels, repeated links and linked images. URLs are not double-encoded on repeated editing. Opening links allows HTTP, HTTPS and mailto; other schemes are never executed by these menus.

Document-only #heading links stay inside the workspace. Heading anchors use rendered Unicode text, with punctuation removed, whitespace replaced by hyphens, and collision-safe -1, -2 suffixes. Percent-encoded Chinese anchors, inline formatting, reference labels and Setext headings are supported. An empty # returns to the document start; missing targets leave the selection unchanged. The same IDs are written into HTML exports and copied HTML fragments. Outline, map and anchor navigation reveal the source/instant/reading target without changing Markdown, taking input focus or adding undo history. Repeated jumps work even when the same heading remains selected, and respect reduced motion.

Coverage: package heading_anchors_test.dart, document_navigation_test.dart, app document_navigation_test.dart, export_service_test.dart and native integration_test/document_navigation_test.dart.

Coverage: element_target_test.dart, element_input_test.dart, context_keyboard_test.dart, test/element_menu_test.dart and integration_test/element_menu_test.dart. Native screenshot checks run on Windows at 1280px and 390px in light/dark mode; iOS phone/tablet long-press is covered by widget tests, not physical-device tests.

💬 评论暂未开启
有疑问或建议,欢迎到 GitHub 提交 Issue 参与讨论。
tems[selIndex] as HTMLAnchorElement).click(); } } });