chore: fix CodeMirror view accessor in diagnostic script
Build and Deploy Verso / deploy (push) Successful in 1m4s
Build and Deploy Verso / deploy (push) Successful in 1m4s
This commit is contained in:
+3
-3
@@ -4,10 +4,10 @@
|
|||||||
* while a Typst file is open in the editor.
|
* 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')]
|
const view = [...document.querySelectorAll('.cm-editor')]
|
||||||
.map(el => el.cmView?.view)
|
.map(el => el.cmView?.view ?? el.cmView ?? el['__cm'])
|
||||||
.find(Boolean)
|
.find(v => v?.state?.doc)
|
||||||
|
|
||||||
if (!view) {
|
if (!view) {
|
||||||
console.error('No CodeMirror view found — make sure a file is open in the editor')
|
console.error('No CodeMirror view found — make sure a file is open in the editor')
|
||||||
|
|||||||
Reference in New Issue
Block a user