From f9ba4931453af619f602e23e6f005ef5074c04ab Mon Sep 17 00:00:00 2001 From: ZDDC Date: Tue, 19 May 2026 08:43:45 -0500 Subject: [PATCH] feat(tables): row context-menu opens the form, not raw YAML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace "Edit YAML" with "Edit row" — navigates to row.url, which is already the schema-driven form-mode editor URL. The form handler unwraps virtual-view URLs server-side so SSR and rollup rows route to their per-party canonical paths automatically; no client-side URL rewriting needed. This fills the gap where row-click only opens the form for complex-type cells (objects, arrays) — for plain scalars it enters inline edit mode. Right-click → Edit row is now the discoverable way to reach the full form for any row. Raw YAML editing remains available via the browse tool directly (navigate to the file's parent folder and click it in the tree). Co-Authored-By: Claude Opus 4.7 (1M context) --- tables/js/row-ops.js | 43 ++++++----------------------- zddc/internal/handler/tables.html | 45 +++++++------------------------ 2 files changed, 17 insertions(+), 71 deletions(-) diff --git a/tables/js/row-ops.js b/tables/js/row-ops.js index 6d03748..2b55660 100644 --- a/tables/js/row-ops.js +++ b/tables/js/row-ops.js @@ -150,49 +150,22 @@ return { status: 'ok', deleted: okCount, failed: failCount }; } - // Map a row's yamlUrl to the browse-tool deep-link that opens the - // file in the YAML editor (preview-yaml.js). Three URL shapes: - // - // //archive//<...>/.yaml - // → //archive//<...>/?file=.yaml - // (already canonical — just split into dir + file) - // - // //ssr/.yaml (virtual SSR row) - // → //archive//?file=ssr.yaml - // - // //(mdl|rsk)/__.yaml (virtual rollup row) - // → //archive//(mdl|rsk)/?file=.yaml - // - // Returns null when no editable URL is reachable (unsaved row, or - // a yamlUrl shape we don't recognize). - function browseEditUrl(row) { - if (!row || !row.yamlUrl) return null; - const url = row.yamlUrl; - - let m = url.match(/^(\/[^/]+)\/ssr\/([^/]+)\.yaml$/); - if (m) return m[1] + '/archive/' + m[2] + '/?file=ssr.yaml'; - - m = url.match(/^(\/[^/]+)\/(mdl|rsk)\/([^/]+)__(.+)\.yaml$/); - if (m) return m[1] + '/archive/' + m[3] + '/' + m[2] + '/?file=' + m[4] + '.yaml'; - - const slash = url.lastIndexOf('/'); - if (slash < 0) return null; - return url.slice(0, slash + 1) + '?file=' + url.slice(slash + 1); - } - function buildRowMenu(ctx) { const rangeRows = ctx.rangeRowIds || []; const inRange = rangeRows.length > 1 && rangeRows.indexOf(ctx.rowId) !== -1; const targets = inRange ? rangeRows : [ctx.rowId]; const items = []; - // Edit YAML — opens the row's backing .yaml file in the browse - // tool's YAML editor. Disabled on multi-row range and unsaved - // draft rows (no file on disk yet). + // Edit row — opens the schema-driven form-mode editor for + // this row. row.url is already the .yaml.html form URL + // (the form handler unwraps virtual-view URLs server-side, so + // SSR + rollup rows route to their per-party canonical paths + // automatically). Disabled on multi-row range and unsaved + // draft rows (no backing file yet). const singleRow = targets.length === 1 ? ctx.row : null; - const editUrl = singleRow && !singleRow.isNew ? browseEditUrl(singleRow) : null; + const editUrl = singleRow && !singleRow.isNew && singleRow.url ? singleRow.url : null; items.push({ - label: 'Edit YAML', + label: 'Edit row', icon: '✎', disabled: !editUrl, action: function () { diff --git a/zddc/internal/handler/tables.html b/zddc/internal/handler/tables.html index a37dc9c..fc53225 100644 --- a/zddc/internal/handler/tables.html +++ b/zddc/internal/handler/tables.html @@ -1515,7 +1515,7 @@ body.is-elevated::after {
ZDDC Table - v0.0.17-alpha · 2026-05-19 13:37:29 · 1604b62-dirty + v0.0.17-alpha · 2026-05-19 13:42:33 · 1721b4b-dirty
@@ -5817,49 +5817,22 @@ body.is-elevated::after { return { status: 'ok', deleted: okCount, failed: failCount }; } - // Map a row's yamlUrl to the browse-tool deep-link that opens the - // file in the YAML editor (preview-yaml.js). Three URL shapes: - // - // //archive//<...>/.yaml - // → //archive//<...>/?file=.yaml - // (already canonical — just split into dir + file) - // - // //ssr/.yaml (virtual SSR row) - // → //archive//?file=ssr.yaml - // - // //(mdl|rsk)/__.yaml (virtual rollup row) - // → //archive//(mdl|rsk)/?file=.yaml - // - // Returns null when no editable URL is reachable (unsaved row, or - // a yamlUrl shape we don't recognize). - function browseEditUrl(row) { - if (!row || !row.yamlUrl) return null; - const url = row.yamlUrl; - - let m = url.match(/^(\/[^/]+)\/ssr\/([^/]+)\.yaml$/); - if (m) return m[1] + '/archive/' + m[2] + '/?file=ssr.yaml'; - - m = url.match(/^(\/[^/]+)\/(mdl|rsk)\/([^/]+)__(.+)\.yaml$/); - if (m) return m[1] + '/archive/' + m[3] + '/' + m[2] + '/?file=' + m[4] + '.yaml'; - - const slash = url.lastIndexOf('/'); - if (slash < 0) return null; - return url.slice(0, slash + 1) + '?file=' + url.slice(slash + 1); - } - function buildRowMenu(ctx) { const rangeRows = ctx.rangeRowIds || []; const inRange = rangeRows.length > 1 && rangeRows.indexOf(ctx.rowId) !== -1; const targets = inRange ? rangeRows : [ctx.rowId]; const items = []; - // Edit YAML — opens the row's backing .yaml file in the browse - // tool's YAML editor. Disabled on multi-row range and unsaved - // draft rows (no file on disk yet). + // Edit row — opens the schema-driven form-mode editor for + // this row. row.url is already the .yaml.html form URL + // (the form handler unwraps virtual-view URLs server-side, so + // SSR + rollup rows route to their per-party canonical paths + // automatically). Disabled on multi-row range and unsaved + // draft rows (no backing file yet). const singleRow = targets.length === 1 ? ctx.row : null; - const editUrl = singleRow && !singleRow.isNew ? browseEditUrl(singleRow) : null; + const editUrl = singleRow && !singleRow.isNew && singleRow.url ? singleRow.url : null; items.push({ - label: 'Edit YAML', + label: 'Edit row', icon: '✎', disabled: !editUrl, action: function () {