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:
+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`.
|
||||
|
||||
Reference in New Issue
Block a user