Fix mobile outline navigation (#109)

This commit is contained in:
Yuri Karamian
2026-08-03 01:53:29 +02:00
parent fc3e388b80
commit 213797a38e
+9 -1
View File
@@ -301,11 +301,19 @@
$outlineWidth = Math.max(160, Math.min(500, $outlineWidth - delta)); $outlineWidth = Math.max(160, Math.min(500, $outlineWidth - delta));
} }
function scrollToHeading(pos: number) { async function scrollToHeading(pos: number) {
if (isMobile) {
showOutline = false;
await tick();
}
if (!editor) return; if (!editor) return;
editor.commands.setTextSelection(pos + 1); editor.commands.setTextSelection(pos + 1);
editor.commands.scrollIntoView(); editor.commands.scrollIntoView();
editor.view.focus(); editor.view.focus();
if (isMobile) {
const heading = editor.view.nodeDOM(pos);
if (heading instanceof HTMLElement) heading.scrollIntoView({ block: 'start' });
}
} }
// Version history // Version history