fix: live-reload theme CSS vars on editor save and frontmatter changes
Wire notifyThemeSaved through the frontmatter update chain so CSS variables update immediately when: - The user edits a theme note in raw mode and presses Cmd+S - A frontmatter property is changed via the inspector panel Also expose CodeMirror EditorView on the DOM for Playwright test access, add unit tests for onNotePersisted, and a new Playwright smoke test that verifies the full raw-editor → save → CSS-vars-update flow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -126,6 +126,9 @@ export function useCodeMirror(
|
||||
|
||||
const view = new EditorView({ state, parent })
|
||||
viewRef.current = view
|
||||
// Expose EditorView on the parent DOM for Playwright test access
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
;(parent as any).__cmView = view
|
||||
|
||||
// When CSS zoom changes on the document, CodeMirror's cached measurements
|
||||
// (scaleX/scaleY, line heights, character widths) become stale because
|
||||
@@ -136,6 +139,8 @@ export function useCodeMirror(
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('laputa-zoom-change', handleZoomChange)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
delete (parent as any).__cmView
|
||||
view.destroy()
|
||||
viewRef.current = null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user