Repository navigation
Scholiast 0.10.1
- 批注与文字编辑合并为单一撤销时间线:此前 ⌘Z 是两条平行历史——编辑器里只撤文字、阅读区只撤批注,撤销顺序与真实操作顺序不符。现在每步批注提交会以 CodeMirror
invertedEffects纯 effect 事务埋进该文件打开的 Markdown 编辑器历史,⌘Z 按真实发生顺序倒放:先打字后批注就「先撤文字、再撤批注」,交错操作交错回放。标记携带步骤 ID 按位对账,跨文件批量操作与预览区先行撤销产生的陈旧标记静默消耗,绝不误撤别人的步骤。 - 修复 ⌘Z 劫持文字撤销:把 ⌘Z 绑给批注撤销命令后,Obsidian 会在窗口捕获阶段消费按键,
checkCallback拒绝也不会把键还给编辑器,Markdown 的文字历史就此失效。现在在宿主按键表最前注册只放行处理:焦点在编辑器/输入框且按键命中批注命令绑定时放给原生实现,其余照旧。 - ⌘Y 重做在 macOS 可用:CodeMirror 的
historyKeymap在 mac 上只认 Mod-Shift-z,Mod-y 是死键。现在编辑器统一接管 Mod-z / Mod-y / Mod-Shift-z:CM 栈空时兜底到批注历史(批注先于编辑器存在的场景退化为批注优先),⌘Y 与 ⌘⇧Z 都能重做。 - 已知边界(设计使然,见 docs/design §6):批注提交时该文件若无打开的 Markdown 编辑器,该步不进编辑器栈(历史随编辑器实例生灭),栈空兜底保证可撤销、顺序粗粒度;刻意不做打开时补种。
已通过 140 项自动测试、lint、类型检查、生产构建;真实 Obsidian 端到端验证「批注→打字→⌘Z 撤字→⌘Z 撤批注→⌘Y×2 重做」全链。
最低 Obsidian 版本为 1.13.0。更新时一起替换 main.js、manifest.json 和 styles.css,保留插件设置 data.json 及知识库内 scholiast/ 数据。
English
- Annotation and text edits share a single undo timeline: previously ⌘Z ran two parallel histories—text in the editor, annotations in reading surfaces—so the replay order diverged from the actual operation order. Each annotation commit now plants a pure-effect transaction (CodeMirror
invertedEffects) into the file's open Markdown editors, so ⌘Z replays in real chronological order: text typed after an annotation undoes first, interleaved ops interleave. Markers carry the operation's entry ID and reconcile against the annotation stack; stale markers from cross-file batches or preview-side undos are consumed silently without touching unrelated steps. - Fixed ⌘Z hijacking text undo: binding ⌘Z to the annotation-undo command made Obsidian consume the key during window capture—
checkCallbackreturning false never handed it back to the editor, silently breaking Markdown's text history. A pass-through handler now sits at the front of the host key table: keys matching the annotation commands while focus sits in an editor or input are released to the native implementation; everything else flows through unchanged. - ⌘Y redo works on macOS: CodeMirror's
historyKeymaponly maps redo to Mod-Shift-z on Mac, leaving Mod-y dead. The editor now handles Mod-z / Mod-y / Mod-Shift-z uniformly, falling back to annotation history when the CM stack is empty (annotations made before the editor existed degrade gracefully to annotation-first), so both ⌘Y and ⌘⇧Z redo. - Known boundary (by design, see docs/design §6): annotations committed while the file has no open Markdown editor can't enter the editor's stack (history lives and dies with the editor instance); the empty-stack fallback keeps them undoable with coarser ordering. Late marker backfilling was evaluated and deliberately rejected.
140 automated tests, lint, type-check and production build all pass; verified end-to-end in real Obsidian: annotate → type → ⌘Z undoes text → ⌘Z undoes annotation → ⌘Y ×2 redoes.
Minimum Obsidian version: 1.13.0. Replace main.js, manifest.json and styles.css together when upgrading; keep data.json and the vault's scholiast/ data directory.