Scheduling infrastructure for absolutely everyone.
fix(ui): prevent page scroll when link button clicked in toolbar (#26662)
simiondolha5364655f1409
diff --git a/packages/ui/components/editor/plugins/ToolbarPlugin.tsx b/packages/ui/components/editor/plugins/ToolbarPlugin.tsxindex 2aeca63a7bd..aea5cb558e7 100644--- a/packages/ui/components/editor/plugins/ToolbarPlugin.tsx+++ b/packages/ui/components/editor/plugins/ToolbarPlugin.tsx@@ -441,13 +441,17 @@ export default function ToolbarPlugin(props: TextEditorProps) {);}, [editor, updateToolbar]);- const insertLink = useCallback(() => {- if (!isLink) {- editor.dispatchCommand(TOGGLE_LINK_COMMAND, "https://");- } else {- editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);- }- }, [editor, isLink]);+ const insertLink = useCallback(+ (e: React.MouseEvent) => {+ e.preventDefault();+ if (!isLink) {+ editor.dispatchCommand(TOGGLE_LINK_COMMAND, "https://");+ } else {+ editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);+ }+ },+ [editor, isLink]+ );if (!props.editable) return null;return (