From 91e6d1ec82a2d7c569bbabf9deeaceebc2cfbe5e Mon Sep 17 00:00:00 2001 From: ZDDC Date: Mon, 1 Jun 2026 13:13:03 -0500 Subject: [PATCH] fix(browse): keep read-only YAML/.zddc selectable & copyable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- browse/js/preview-yaml.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/browse/js/preview-yaml.js b/browse/js/preview-yaml.js index c6b4883..fe017be 100644 --- a/browse/js/preview-yaml.js +++ b/browse/js/preview-yaml.js @@ -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.