assets/layouts/obsidian.html in jekyll-obsidian-1.0.6 vs assets/layouts/obsidian.html in jekyll-obsidian-1.0.7

- old
+ new

@@ -82,19 +82,21 @@ <script> let isDraggingDivider = false; let startX, startWidth; DIVIDER.addEventListener('mousedown', (e) => { + const EXPLORER = OBSIDIAN.querySelector('#explorer'); isDraggingDivider = true; startX = e.clientX; startWidth = EXPLORER.getBoundingClientRect().width; document.addEventListener('mousemove', onMouseMove); document.addEventListener('mouseup', onMouseUp); }); function onMouseMove(e) { if (!isDraggingDivider) return; + const EXPLORER = OBSIDIAN.querySelector('#explorer'); let offset = e.clientX - startX; let newWidthPx = startWidth + offset; let newWidthPercent = newWidthPx / window.innerWidth * 100; newWidthPercent = Math.max(minWidth, Math.min(newWidthPercent, maxWidth)); @@ -125,9 +127,11 @@ dispatchFileSelectEvt(lastFileCookie, null); } else console.info('No color-scheme cookie found.'); }); function refreshScreenSize() { + const EXPLORER = OBSIDIAN.querySelector('#explorer'); + let explorerWidthPx = parseFloat(getComputedStyle(EXPLORER).width); let parentWidthPx = parseFloat(getComputedStyle(EXPLORER.parentElement).width); let explorerWidthPercent = (explorerWidthPx / parentWidthPx) * 100; updateNotePadding(explorerWidthPercent); if (window.innerWidth < 481) { \ No newline at end of file