Diffdown is a real-time collaborative Markdown editor/previewer built on the AT Protocol diffdown.com

Add debug logging to comment click/jump flow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

+6 -1
+6 -1
templates/document_edit.html
··· 823 823 container.addEventListener('click', e => { 824 824 const thread = e.target.closest('.comment-thread'); 825 825 if (!thread) return; 826 - jumpToParagraph(thread.dataset.paragraph || ''); 826 + const pid = thread.dataset.paragraph || ''; 827 + console.debug('[comment-click] pid:', pid, 'thread:', thread); 828 + jumpToParagraph(pid); 827 829 }); 828 830 })(); 829 831 ··· 880 882 } 881 883 882 884 function jumpToParagraph(pid) { 885 + console.debug('[jumpToParagraph] pid:', pid, 'milkdownEditor:', !!milkdownEditor); 883 886 if (pid === 'general') return; 884 887 const idx = parseInt(pid.replace('p-', ''), 10); 885 888 if (isNaN(idx)) return; 886 889 if (!milkdownEditor) return; 887 890 const pmView = milkdownEditor.action(ctx => ctx.get(editorViewCtx)); 891 + console.debug('[jumpToParagraph] pmView:', !!pmView, 'dom:', pmView && pmView.dom); 888 892 if (!pmView) return; 889 893 const pmEl = pmView.dom; 890 894 const blocks = Array.from(pmEl.children); 895 + console.debug('[jumpToParagraph] idx:', idx, 'blocks.length:', blocks.length, 'target:', blocks[idx]); 891 896 const target = blocks[idx]; 892 897 if (!target) return; 893 898 target.scrollIntoView({ behavior: 'smooth', block: 'center' });