From 75893f4e1b2d894fed6a6e1053c03fca8993661a Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Mon, 27 Feb 2023 01:21:06 +0000 Subject: [PATCH] Fix mark toolbar button not applying mark properly (#2231) --- .changeset/old-cougars-destroy.md | 5 +++++ .../ui/toolbar/src/MarkToolbarButton/MarkToolbarButton.tsx | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changeset/old-cougars-destroy.md diff --git a/.changeset/old-cougars-destroy.md b/.changeset/old-cougars-destroy.md new file mode 100644 index 0000000000..f3bd134e6c --- /dev/null +++ b/.changeset/old-cougars-destroy.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate-ui-toolbar': patch +--- + +Fix mark toolbar button not applying mark properly diff --git a/packages/ui/toolbar/src/MarkToolbarButton/MarkToolbarButton.tsx b/packages/ui/toolbar/src/MarkToolbarButton/MarkToolbarButton.tsx index 04aef439d8..f545d8a535 100644 --- a/packages/ui/toolbar/src/MarkToolbarButton/MarkToolbarButton.tsx +++ b/packages/ui/toolbar/src/MarkToolbarButton/MarkToolbarButton.tsx @@ -29,9 +29,7 @@ export const MarkToolbarButton = ({ e.stopPropagation(); toggleMark(editor, { key: type!, clear }); - setTimeout(() => { - focusEditor(editor, editor.selection ?? editor.prevSelection!); - }, 0); + focusEditor(editor); }} {...props} />