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 () {