From f7fdb38c8c3a5bced558c5dc38b372f2cb9dfd72 Mon Sep 17 00:00:00 2001 From: Achiya Elyasaf <10044875+achiyae@users.noreply.github.com> Date: Wed, 15 Nov 2023 09:39:42 +0200 Subject: [PATCH] Update client.mjs Fix issue #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, --- src/extensions/outliner/client.mjs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/extensions/outliner/client.mjs b/src/extensions/outliner/client.mjs index 73942fd..9a1aa1c 100644 --- a/src/extensions/outliner/client.mjs +++ b/src/extensions/outliner/client.mjs @@ -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`