Skip to content

Commit

Permalink
fix(view-mode): cannot jump to the heading in the first line
Browse files Browse the repository at this point in the history
  • Loading branch information
guanglinn committed Aug 4, 2024
1 parent 384c593 commit 0c817ab
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,8 @@ public static void showHeadlineDialog(
final int line = headings.get(index).line;

TextViewUtils.selectLines(edit, line);
final String jumpJs = "document.querySelector('[line=\"" + line + "\"]').scrollIntoView();";
final String selectors = "\"h1[line='#'], h2[line='#'], h3[line='#'], h4[line='#'], h5[line='#'], h6[line='#']\"";
final String jumpJs = "document.querySelector(" + selectors.replaceAll("#", String.valueOf(line)) + ").scrollIntoView();";
webView.evaluateJavascript(jumpJs, null);
};

Expand Down

0 comments on commit 0c817ab

Please sign in to comment.