Skip to content

Commit

Permalink
fix: scroll only with selection
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Dec 25, 2020
1 parent 6cfebfb commit 91db712
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/commands/applyMark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ export const applyMark = (type: MarkType, attrs: Record<string, any> = {}) => {
}

tr.addStoredMark(type.create(attrs));
dispatch?.(tr);
} else {
tr.addMark($from.pos, $to.pos, type.create(attrs));

if (!tr.docChanged) {
return false;
}
dispatch?.(tr.scrollIntoView());
}

dispatch?.(tr.scrollIntoView());
return true;
};
};

0 comments on commit 91db712

Please sign in to comment.