fix(browse): keep read-only YAML/.zddc selectable & copyable
The YAML viewer mounted CodeMirror with readOnly:'nocursor', which removes the textarea from focus and kills click-drag selection — so copying a read-only .zddc snippet was impossible without flipping on admin mode to make it writable. Use readOnly:true instead: non-editable but focusable, so the user can select and copy. autofocus:false still keeps arrow-key tree navigation intact until they click into the editor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e258b0fa3d
commit
91e6d1ec82
1 changed files with 8 additions and 3 deletions
|
|
@ -484,9 +484,14 @@
|
|||
// .zddc files without diverting into the editor. User
|
||||
// clicks (or tabs) into the editor when they want to type.
|
||||
autofocus: false,
|
||||
// CodeMirror's "nocursor" mode is the truest read-only:
|
||||
// selection allowed for copy, no caret, no edit affordances.
|
||||
readOnly: !writable ? 'nocursor' : false,
|
||||
// Read-only uses readOnly:true (NOT "nocursor"): the editor
|
||||
// stays focusable so the user can click in, select text, and
|
||||
// copy — they just can't edit. "nocursor" removes the textarea
|
||||
// from focus, which also kills click-drag selection (the whole
|
||||
// reason a viewer would otherwise force admin mode just to copy
|
||||
// a .zddc snippet). autofocus:false keeps arrow-key tree nav
|
||||
// intact until the user deliberately clicks into the editor.
|
||||
readOnly: !writable,
|
||||
});
|
||||
// Stash the node on the editor so the lint helper can decide
|
||||
// whether to apply the .zddc schema layer.
|
||||
|
|
|
|||
Loading…
Reference in a new issue