Skip to content

Commit

Permalink
rerender() no longer moves the cursor to the head of the file
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaUshio committed Nov 28, 2023
1 parent 259439e commit a54cb0b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export default class MathInCalloutPlugin extends Plugin {
rerender() {
this.app.workspace.iterateAllLeaves((leaf) => {
if (leaf.view instanceof MarkdownView) {
const eState = leaf.view.getEphemeralState();
const editor = leaf.view.editor;
editor.setValue(editor.getValue());
leaf.view.setEphemeralState(eState);
} else if (leaf.view.getViewType() === 'canvas') {
for (const node of (leaf.view as any).canvas.nodes.values()) {
node.setText(node.text);
Expand Down

0 comments on commit a54cb0b

Please sign in to comment.