Replace Monaco with one CodeMirror editor and nest list items with Tab
Phase 4b. DocumentEditor.svelte replaces LiveWriter.svelte and the Monaco EditorHost.svelte. Each open document has one CodeMirror state. Write and Source are two compartment configurations of it, so they share the undo history. editorStates.ts keeps the state while the tab stays open. The Monaco model, the diff bridge, its timers, and sessions.ts are gone. - Source: syntax colors from the theme tokens, lazy language packages, line numbers, folding, and the current line in IDE, wrapped lines in Writing, several carets, and bracket matching and closing. - Lists (card 088e778b): Tab nests a list item and Shift+Tab moves it up, in Write and Source. Both renumber the list. The source keeps "1.". Write and Read show numbers, letters, then Roman numerals. - Indent (card 696c30ce): a fixed 4 spaces in Write and Source. - The code menu uses CodeMirror commands. The command palette item and the Monaco styles, search, theme, and workers are removed. - @codemirror/legacy-modes is pinned to 6.5.4. Version 6.5.5 uses parser types that do not match @codemirror/language 6.12. - 26 smoke tests use CodeMirror instead of Monaco. New tests: editor/listNesting and the markdownLists unit tests. - Docs: development, UI design, plugin host, user guide, and UI-040. pnpm check, pnpm test (341 of 341), and pnpm build pass. The full smoke suite passes, except one template test that passed on retry.
This commit is contained in:
@@ -753,3 +753,23 @@ Native shell, background image, and desktop acceptance remain open.
|
||||
- Evidence: The browser check also covers mixed tabs, pinned tabs, plugin tabs, and Cancel with unsaved edits.
|
||||
- Evidence files: .audit/secondary-last-tab-cancel.png and .audit/compact-tabs-{width}-{theme}.png.
|
||||
- Limits: Desktop calls use browser mocks. Native window closure and active terminal confirmation still need desktop acceptance.
|
||||
|
||||
### UI-040 — Nested lists and one editor for Write and Source
|
||||
|
||||
- Type: Rule change
|
||||
- Date: 2026-10-28
|
||||
- Status: Implemented for user review
|
||||
- Decision source: Cards 088e778b and 696c30ce, and the approved Phase 4 plan of 2026-10-28.
|
||||
- Previous rule: Tab in a list item added indentation and kept the number. Write indented by 2 spaces, and the IDE view by 2 spaces in Monaco.
|
||||
- New rule: Tab in a list item makes a nested item, and Shift+Tab moves it one level up. Both renumber the list.
|
||||
- New rule: Nested ordered lists show decimal numbers at level 1, letters at level 2, and Roman numerals at level 3 in Write and Read. The Markdown source keeps the numbers, for example `1.`.
|
||||
- New rule: The indent is a fixed 4 spaces in Write and Source, with no setting.
|
||||
- New rule: Write and Source are two configurations of one CodeMirror state. They share the undo history.
|
||||
- Reason: Lists behave as in common word processors. One editor removes the Monaco model bridge and its timers.
|
||||
- Scope: Markdown documents in Write and Source, and all source files.
|
||||
- Shared implementation: DocumentEditor.svelte, markdownLists.ts, liveMarkdown.ts, sourceView.ts, codeLanguages.ts, editorStates.ts, and the `.reading ol ol` styles in app.css.
|
||||
- Exceptions: An empty nested item cannot start a list inside a paragraph in CommonMark. Write labels it, and Read shows it as text until the item has text.
|
||||
- Evidence: editor/listNesting.smoke.mjs covers Tab, Shift+Tab, labels, Read letters, the shared history, and the 4-space indent in both themes at 1440 and 600 pixels.
|
||||
- Evidence files: output/smoke/editor/listNesting/.
|
||||
- Replaces / replaced by: None.
|
||||
- Limits: Source has no minimap, no command palette, and no bracket pair colors. Browser checks use desktop service mocks. Native desktop acceptance remains open.
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ Rust errors appear in the terminal that runs `pnpm tauri dev`.
|
||||
## Architecture
|
||||
|
||||
RuneStone is a Tauri 2 app. A Rust host gives native services to a Svelte 5 and TypeScript interface.
|
||||
CodeMirror drives the Writer view, and Monaco drives the source editor.
|
||||
CodeMirror drives the editor. Each open document has one editor state, and Write and Source are two configurations of it.
|
||||
Windows is the primary platform. macOS and Linux builds are experimental.
|
||||
|
||||
### Desktop host: `src-tauri/src/`
|
||||
@@ -81,7 +81,7 @@ A new command needs an entry in `generate_handler!` in `lib.rs`, in the command
|
||||
| Folder | Responsibility |
|
||||
| --- | --- |
|
||||
| `layout/` | The app shell (`Workbench.svelte`), the file tree, tabs, panes, Settings, and dialogs |
|
||||
| `editor/` | The Writer view (`LiveWriter.svelte`), the source editor (`EditorHost.svelte`), tables, links, images, and editor menus |
|
||||
| `editor/` | The document editor (`DocumentEditor.svelte`) with its Write and Source configurations, Markdown lists, tables, links, images, and editor menus |
|
||||
| `formulas/` | Table formulas: the parser and evaluator (`engine.ts`), the rendered results, the formula help, and the `tableFormulas` setting (`index.ts`) |
|
||||
| `workspace/` | Tauri wrappers, document buffers, the note index and backlinks, paths, templates, and tab transfer (`tabTransfer.ts`) |
|
||||
| `settings/` | The settings store (`store.ts`), and the code that moves the old browser values to the settings file (`migration.ts`) |
|
||||
|
||||
+4
-4
@@ -155,17 +155,17 @@ The policy stops a script that comes in through rendered content, for example a
|
||||
| --- | --- | --- |
|
||||
| `default-src` | `'self'` | All other types come only from the app. |
|
||||
| `script-src` | `'self' blob: 'wasm-unsafe-eval'` | `blob:`: plugin entry modules, which `external.ts` loads from Blob URLs. `'wasm-unsafe-eval'`: the PDF Viewer decodes JPEG 2000 and JBIG2 images and color profiles with WebAssembly in its worker. It does not permit `eval`. |
|
||||
| `style-src` | `'self' 'unsafe-inline'` | Svelte `style` attributes, the `style` attribute in `src/app.html`, Mermaid SVG styles, and the `<style>` elements of Monaco, the Vite dev server, and plugins (Terminal, CSV Viewer, PDF Viewer, Background Slideshow). |
|
||||
| `style-src` | `'self' 'unsafe-inline'` | Svelte `style` attributes, the `style` attribute in `src/app.html`, Mermaid SVG styles, and the `<style>` elements of CodeMirror, the Vite dev server, and plugins (Terminal, CSV Viewer, PDF Viewer, Background Slideshow). |
|
||||
| `img-src` | `'self' data: blob: https: http:` | `data:`: workspace images, browser frames, tab and site icons, and icons in CSS. `blob:`: background images. `https:` and `http:`: remote images in Markdown previews. |
|
||||
| `font-src` | `'self' data:` | The Monaco icon font, and fonts that the PDF Viewer embeds. |
|
||||
| `font-src` | `'self' data:` | `'self'`: fonts that the app serves. The app serves no font now. `data:`: fonts that the PDF Viewer embeds. |
|
||||
| `connect-src` | `'self' ipc: http://ipc.localhost blob:` | `ipc:` and `http://ipc.localhost`: Tauri commands. `blob:`: the Background Slideshow worker reads its image from a Blob URL. |
|
||||
| `worker-src` | `'self' blob:` | `'self'`: Monaco workers. `blob:`: the PDF Viewer and Background Slideshow workers. |
|
||||
| `worker-src` | `'self' blob:` | `'self'`: workers that the app serves. The app starts no worker now. `blob:`: the PDF Viewer and Background Slideshow workers. |
|
||||
| `object-src` | `'none'` | RuneStone uses no plugins of the web view. |
|
||||
| `base-uri` | `'self'` | |
|
||||
| `form-action` | `'none'` | No form sends data to an address. |
|
||||
| `frame-ancestors` | `'none'` | |
|
||||
|
||||
No source permits `'unsafe-eval'`. The app, Monaco, Mermaid, and the current plugins do not use `eval` or `new Function`.
|
||||
No source permits `'unsafe-eval'`. The app, CodeMirror, Mermaid, and the current plugins do not use `eval` or `new Function`.
|
||||
`style-src` needs `'unsafe-inline'`, because style attributes and generated `<style>` elements have no nonce.
|
||||
|
||||
Tauri sends the policy as a header with each HTML page of the installed app. It adds the SHA-256 hash of the inline start script of SvelteKit to `script-src`.
|
||||
|
||||
+1
-2
@@ -81,7 +81,6 @@ These rules apply to navigation rows, file and folder trees, lists, grids, and t
|
||||
- Find adjacency from the visible order, including sorting and expanded tree branches. At an indentation change, keep the exposed edges and omit the parts that selected rows share.
|
||||
- Ordinary table grid lines can stay inside a region. They must not become highlighted selection borders.
|
||||
- A menu choice and a file selection have different purposes. File selections use the selection fill and outer outline. Hover uses the shared active background on both.
|
||||
- The IDE command palette uses the shared selection fill, outline, and corner radius.
|
||||
|
||||
## Menus and pickers
|
||||
|
||||
@@ -190,7 +189,7 @@ Decisions: [UI-009](design-decisions.md#ui-009--character-theme-appearances), [U
|
||||
|
||||
- The app image fills the work area below the titlebar, including new tabs and document views. It stays fixed while content scrolls.
|
||||
- Sidebars use `--rs-image-sidebar-bg` (82% tint). Editor surfaces use `--rs-image-editor-bg` (90% tint). Without an image, both are opaque.
|
||||
- Writer, Reading, split, and IDE views share the editor surface. Monaco layers stay transparent above it.
|
||||
- Writer, Reading, split, and IDE views share the editor surface. CodeMirror layers stay transparent above it.
|
||||
- Code blocks in Writer and Reading use `--rs-code-block-bg`.
|
||||
- New-tab buttons use `--rs-image-control-bg` and `--rs-image-control-hover-bg`. Their tint keeps labels readable while the image stays visible. The new-tab screen shows only its action buttons, with icons, labels, and shortcuts.
|
||||
- Headers and dialogs keep their own surfaces.
|
||||
|
||||
@@ -79,6 +79,9 @@ Each document pane has two controls:
|
||||
Hover over a control, or focus it with the keyboard, to see its name.
|
||||
Writer keeps your Markdown source, frontmatter, and Windows line endings. Read shows frontmatter in a collapsed **Properties** section.
|
||||
Select a checkbox to complete a task. Copy code blocks without their Markdown fences with the **Copy code** button.
|
||||
In a list item, press Tab to make a nested item. Press Shift+Tab to move it one level up. RuneStone renumbers the list.
|
||||
Nested ordered lists show letters, then Roman numerals. The Markdown source keeps the numbers, for example `1.`.
|
||||
Tab in other text indents by 4 spaces.
|
||||
|
||||
To rename a note, select its title in Writer and type a new name. Press Enter or leave the field to save the name. Press Escape to cancel.
|
||||
The file keeps its folder, extension, contents, and edit history.
|
||||
@@ -209,6 +212,7 @@ This table lists the Windows and Linux keys.
|
||||
| Save | Ctrl+S |
|
||||
| Find in document / Search workspace | Ctrl+F / Ctrl+Shift+F |
|
||||
| Switch Writer and IDE | Ctrl+E |
|
||||
| Nest a list item / Move it up | Tab / Shift+Tab |
|
||||
| Show or hide the sidebar | Ctrl+B |
|
||||
| Rename | F2 |
|
||||
| Delete to the trash / Delete permanently | Delete / Shift+Delete |
|
||||
|
||||
Reference in New Issue
Block a user