diff --git a/mods/outliner/mod.js b/mods/outliner/mod.js index 56efa89..0dd85cf 100644 --- a/mods/outliner/mod.js +++ b/mods/outliner/mod.js @@ -14,7 +14,7 @@ module.exports = { tags: ['extension', 'panel'], name: 'outliner', desc: 'table of contents.', - version: '1.0.0', + version: '1.1.0', author: 'CloudHill', options: [ { diff --git a/mods/outliner/panel.js b/mods/outliner/panel.js index 044c8d7..428c8b6 100644 --- a/mods/outliner/panel.js +++ b/mods/outliner/panel.js @@ -69,16 +69,18 @@ module.exports = (store, __exports) => { const pageContent = document.querySelector('.notion-page-content'); const headerBlocks = pageContent.querySelectorAll('[class*="header-block"]'); - headerBlocks.forEach(block => { - const blockId = block.dataset.blockId.replace(/-/g, ''); - const placeholder = block.querySelector('[placeholder]').getAttribute('placeholder'); - const header = createElement(` + headerBlocks.forEach(header => { + const blockId = header.dataset.blockId.replace(/-/g, ''); + const headerEl = header.querySelector('[placeholder]'); + const placeholder = headerEl.getAttribute('placeholder'); + + const outlineHeader = createElement(`
${block.innerText} + outline-placeholder="${placeholder}">${headerEl.innerHTML}
`); - outline.append(header); + outline.append(outlineHeader); }) }