Skip to content

Commit

Permalink
Update client.mjs
Browse files Browse the repository at this point in the history
Fix issue notion-enhancer#813 with the outliner extension.
Instead of inc-/dec- rementing the indentation by 18 each iteration, the fix multiplies the header level by 18. This way, jumping from level 3 to level 1 results in the correct indentation,
  • Loading branch information
achiyae committed Nov 15, 2023
1 parent a88c45c commit f7fdb38
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/extensions/outliner/client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ export default async function ({ web, components }, db) {
const id = $header.dataset.blockId.replace(/-/g, ''),
placeholder = $header.querySelector('[placeholder]').getAttribute('placeholder'),
headerDepth = +[...placeholder].reverse()[0];
if (depth && depth < headerDepth) {
indent += 18;
} else if (depth > headerDepth) {
indent = Math.max(indent - 18, 0);
}
indent = (headerDepth-1) * 18;
depth = headerDepth;
const $outlineHeader = web.render(
web.html`<a href="#${id}" class="outliner--header"
Expand Down

0 comments on commit f7fdb38

Please sign in to comment.