Skip to content

Comments

Desktop: Fixes #13411: Fix header links only work if the note viewer is visible#13442

Merged
laurent22 merged 7 commits intolaurent22:devfrom
personalizedrefrigerator:pr/desktop/fix-jump-to-header
Oct 16, 2025
Merged

Desktop: Fixes #13411: Fix header links only work if the note viewer is visible#13442
laurent22 merged 7 commits intolaurent22:devfrom
personalizedrefrigerator:pr/desktop/fix-jump-to-header

Conversation

@personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Oct 15, 2025

Summary

Fixes #13411 by ensuring that the editor.jumpToHash logic runs even when the viewer is not visible.

In particular, this pull request:

  1. Updates v6/CodeMirror.tsx's scrollTo logic to call editor.jumpToHash even if the viewer is not visible.
  2. Updates the NoteEditor's useMessageHandler: If the note viewer is hidden (only the Markdown editor is visible), emitting a noteRenderComplete after the editor's content is set. Previously, this event was not emitted at all when the viewer was hidden.
    • The noteRenderComplete event causes the logic that handles scrollWhenReady to run.
  3. Updates the NoteEditor's useScrollWhenReadyOptions logic to set the value of scrollWhenReady sooner, so that it is set before the noteRenderComplete emitted in (2).

This may also fix an issue in which the initial editor scroll was not set unless the note viewer was also visible. Edit: The initial editor scroll issue will be partially fixed by #13447.

Testing

This pull request includes an automated Playwright test.

… viewer is

hidden

This change is a proof of concept. It currently relies on a setTimeout
to work around a state update timing issue. The setTimeout use should be
removed before a pull request is created from this change.

const editor = mainScreen.noteEditor;
await editor.expectToHaveText('');
await editor.expectToHaveText('\n');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change in expected test output is required due to a change to editor.expectToHaveText. Previously, newlines were not included in the content fetched from the editor.

@laurent22 laurent22 merged commit c2c37b3 into laurent22:dev Oct 16, 2025
11 checks passed
bwat47 added a commit to bwat47/joplin-heading-navigator that referenced this pull request Nov 2, 2025
…pects

joplin md viewer seems to expect that first instance of a given heading has no suffix, and the next instance has a -2 suffix (skipping -1 suffix)

NOTE: ctrl clicking a heading link with a suffix in the markdown editor doesn't work (brings you to top of file), but it works fine in reading view (as long as suffix increment starts with -2 as noted above).

This is probably a bug with the markdown editor, since following headings in the editor view didn't work at all until very recently, see:

laurent22/joplin#13411
laurent22/joplin#13442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ctrl + clicking internal link to another note (with heading specified in link) doesn't auto-scroll to heading

2 participants