diff --git a/browse/css/tree.css b/browse/css/tree.css index 4767ddf..29affa9 100644 --- a/browse/css/tree.css +++ b/browse/css/tree.css @@ -249,6 +249,7 @@ body { content's natural size (which clips the YAML editor's bottom when there are many lines, even with the editor's own scroll) */ + min-width: 0; overflow: auto; display: flex; flex-direction: column; @@ -256,10 +257,16 @@ body { } /* The body's children fill the available space. Plugins inject - different content here — img, iframe, pre, custom markdown editor. */ + different content here — img, iframe, pre, custom markdown editor. + min-width:0 is load-bearing: a flex item defaults to min-width:auto + (its min-content width), so the markdown editor's wide internal + min-content would push the whole pane past the viewport's right edge + instead of shrinking. With min-width:0 the editor shrinks and its own + (and the grid's minmax(0)) scrolling takes over. */ .preview-pane__body > * { flex: 1; min-height: 0; + min-width: 0; } .preview-empty { diff --git a/browse/js/preview.js b/browse/js/preview.js index bc6eb07..99d5235 100644 --- a/browse/js/preview.js +++ b/browse/js/preview.js @@ -485,6 +485,25 @@ } async function renderInPopup(node) { + // Editor-type files (markdown, yaml/.zddc, code text) can't be hosted + // in the lightweight popup window — they need the bundled editor. Pop + // them out as the FULL browse app deep-linked to the file, which loads + // the real editor in a new window. Server mode only; HTML keeps its + // rendered popup. Falls through to the lightweight popup otherwise. + var pext = (node.ext || '').toLowerCase(); + var ym = window.app.modules.yamledit; + var isEditorType = pext === 'md' || pext === 'markdown' + || (ym && ym.handles && ym.handles(node) && pext !== 'html' && pext !== 'htm'); + if (isEditorType && window.app.state.source === 'server' && node.url) { + var slash = node.url.lastIndexOf('/'); + var pdir = slash >= 0 ? node.url.slice(0, slash + 1) : '/'; + var pbase = slash >= 0 ? node.url.slice(slash + 1) : node.url; + var pp = new URLSearchParams(); + try { pp.set('file', decodeURIComponent(pbase)); } catch (_e) { pp.set('file', pbase); } + if (window.app.state.showHidden) pp.set('hidden', '1'); + window.open(pdir + '?' + pp.toString(), '_blank', 'noopener'); + return; + } var info; try { info = await getBlobUrl(node);