From 91db712c4e6426becdf1a40d357a7ac605aa9f2e Mon Sep 17 00:00:00 2001 From: sibiraj-s Date: Fri, 25 Dec 2020 20:49:21 +0530 Subject: [PATCH] fix: scroll only with selection --- src/commands/applyMark.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/applyMark.ts b/src/commands/applyMark.ts index e24b15ae..29e5f23a 100644 --- a/src/commands/applyMark.ts +++ b/src/commands/applyMark.ts @@ -38,15 +38,16 @@ export const applyMark = (type: MarkType, attrs: Record = {}) => { } 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; }; };