chore: fix CodeMirror view accessor in diagnostic script

This commit is contained in:
claude
2026-06-08 19:27:06 +00:00
parent 031f65224c
commit c65bb80512
+3 -3
View File
@@ -4,10 +4,10 @@
* while a Typst file is open in the editor.
*/
// 1. Find the active CodeMirror editor view
// 1. Find the active CodeMirror editor view (try several accessor patterns)
const view = [...document.querySelectorAll('.cm-editor')]
.map(el => el.cmView?.view)
.find(Boolean)
.map(el => el.cmView?.view ?? el.cmView ?? el['__cm'])
.find(v => v?.state?.doc)
if (!view) {
console.error('No CodeMirror view found — make sure a file is open in the editor')