# The Editor *Rewritten for RC3.* ClioDeck's writing surface changed completely: the previous pair of editors (a WYSIWYG one and a "source" one, with a toggle between them) is gone. There is now **one editor**, built on CodeMirror 6, which renders your text as you write it. --- ## One editor, live rendering You write markdown; the editor shows it formatted. Headings are large, emphasis is italic, links show their text — but the moment your cursor enters a construct, its markdown reappears so you can edit it. Nothing is hidden from you, and nothing is rewritten behind your back. **Your file is the source of truth.** ClioDeck loads a string and saves the same string, changed only by your own edits. Opening a document and saving it without touching it produces a byte-for-byte identical file — line endings, trailing spaces and all. This is enforced by a test corpus, not a promise. The dialect is **Pandoc markdown**: footnotes, Pandoc citations, YAML front matter, GFM tables. --- ## Footnotes - `[^1]` renders as a superscript. - **Hover** an note reference to read the note without leaving your line. - **Cmd/Ctrl+click** it to open a small editing popup for the note itself. - **Click** it to jump to the definition; click a definition label to come back to the first reference. If the note has no definition yet, clicking opens the popup so you can write it. - `Cmd/Ctrl+Shift+F` inserts a new footnote (reference plus definition, with the cursor placed in the definition). - The **Renumber footnotes** button renumbers them in reading order. It is a deliberate command, never automatic — ClioDeck does not rewrite your document behind your back. Free-form identifiers (`[^danzig]`) are left alone, and `[^99]` inside a code block is not touched. --- ## Citations - Type `@` to get **autocompletion from your Zotero bibliography**; pick an entry and the key is inserted. - `[@lester1932]`, `[@lester1932, p. 12]` and clusters `[@a; @b]` render as discreet pills. - Hovering a pill shows the resolved reference (author, year, title). - A key that is **not** in your bibliography is underlined with a wavy line — visible, but never blocking. - **Check citations** lists the missing keys (and, in a book, the chapter each one is in). --- ## Front matter A YAML front matter block at the top of a file is **folded** into a single discreet line. Click to unfold and edit it; it never reaches your exported text as a heading. --- ## Formatting shortcuts | Shortcut | Action | |---|---| | `Cmd/Ctrl+B` | Bold | | `Cmd/Ctrl+I` | Italic | | `Cmd/Ctrl+L` | Link | | `Cmd/Ctrl+'` | Citation | | `Cmd/Ctrl+Shift+T` | Table | | `Cmd/Ctrl+Shift+F` | Footnote | | `Cmd/Ctrl+Shift+Q` | Blockquote | | `Cmd/Ctrl+F` | Search in the current document | In a book project, a separate button searches **the whole manuscript** — see [Books and Chapters](./1.15-Books-and-Chapters.md). --- ## Saving Auto-save runs a few seconds after you stop typing. The status bar tells you where you stand: *Unsaved changes*, or *Saved at 14:32*. Switching files (or chapters) saves the outgoing document first, and refuses to open the next one if that save fails — nothing is lost in silence. > **⚠️ Real bug, verified against code:** that guard exists only for > switching *within* a project (chapter-to-chapter, or a plain document > reload) — `editorStore.ts`'s `loadFile()` explicitly checks `isDirty` and > awaits `saveFile()` before proceeding. Switching to a **different > project** goes through a completely separate path, `projectStore.ts`'s > `loadProject()`, which has no such check anywhere: it doesn't read > `isDirty`, doesn't call `saveFile()`, and the main-process > `project:load` handler didn't either, so opening a different project with > unsaved changes discarded them silently — the exact class of bug the > chapter-switch guard was built to prevent, one level up. **Fixed in RC4**, > which also added the guard that was missing at the other end: quitting the > application now flushes the editor before exiting. --- ## Presentations use the same editor A presentation project opens the same editor, with slide-specific additions: `---` separators are drawn as numbered **slide boundaries**, a slide navigator sits on the left, and a preview follows the slide your cursor is in. See [Export Presentations](./1.10-Export-Presentations.md). --- ## When the assistant writes Anything the AI writes into your document arrives as a **proposal**, not as text silently inserted: you see the suggestion in place and accept it (`Tab`), reject it (`Esc`) or edit it before applying. Every decision is recorded — in your research journal with the full text, and in the AI usage journal as a bare decision without any content. This is a rule of the architecture, not a feature of one panel: no AI writing path bypasses it. > **⚠️ Real bug, verified against code:** for the **expired** decision > specifically — the one recorded when [switching chapters](./1.15-Books-and-Chapters.md) > with a proposal still pending — the chapter path attached to the journal > entry can be wrong. `recordAdjudication()` (`proposals-ipc.ts`) reads > `useEditorStore.getState().filePath` at the moment it's called; but > expiry fires from the CodeMirror view's `destroy()` teardown > (`ui.ts`/`proposalExpiry`), which for a chapter switch runs *after* > `loadFile()` (`editorStore.ts`) has already written the **incoming** > chapter's path into the store in the same `set()` call that triggers the > view teardown. The expired proposal — which belonged to the chapter you > just left — gets journaled under the chapter you just arrived at. > `accept`/`reject`/`modify` were unaffected: those fire synchronously while > the outgoing chapter is still the current one. **Fixed in RC4** — the > chapter context is captured when the proposal is created, not when the > expiry is journaled. --- ## See also - [Books and Chapters](./1.15-Books-and-Chapters.md) - [Keyboard Shortcuts](./1.4-Keyboard-Shortcuts.md) - [Journal and History](./1.9-Journal-and-History.md)