From 27200abc582dea2ff9a58a6f35f5fb4b302e8e9a Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sun, 8 Aug 2021 23:44:36 +0200 Subject: [PATCH] Allow to fetch recursive metadata from pages in tables --- editor/src/editor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editor/src/editor.js b/editor/src/editor.js index cb6eb9e..de2ecee 100644 --- a/editor/src/editor.js +++ b/editor/src/editor.js @@ -274,11 +274,15 @@ function Editor(holder, input) { el("td", [renderInline(rowText)]), ..._.map(header.children, col => { let td = el("td") - let value = rowData[_.snakeCase(_.trim(col.text))]; + let key = _.trim(col.text); + let value = _.get(rowData, key) + if (_.isObject(value) && value.line) { + value = value.line + } if (col.children && col.children.length > 0) { value = col.children[0].text } - transform(value ? value.replace(/^:/, '=') : '', $(td), id, editor, rowData) + transform(typeof value === 'string' ? value.replace(/^:/, '=') : '', $(td), id, editor, rowData) return td }) ])