diff --git a/src/components/editor/EditorMenuBar.tsx b/src/components/editor/EditorMenuBar.tsx index f275b06..9d853a1 100644 --- a/src/components/editor/EditorMenuBar.tsx +++ b/src/components/editor/EditorMenuBar.tsx @@ -10,6 +10,7 @@ import { Code, Highlighter, Italic, + LinkIcon, Minus, Quote, Redo, @@ -28,6 +29,18 @@ type EditorMenuProps = { export default function EditorMenuBar({ editor }: EditorMenuProps) { if (!editor) return null; + const addLink = () => { + const url = prompt("Enter link URL:"); + if (url) { + editor + .chain() + .focus() + .extendMarkRange("link") + .setLink({ href: url }) + .run(); + } + }; + const buttons = [ { icon: , @@ -71,6 +84,12 @@ export default function EditorMenuBar({ editor }: EditorMenuProps) { disabled: false, isActive: editor.isActive("superscript"), }, + { + icon: , + onClick: addLink, + disabled: false, + isActive: editor.isActive("link"), + }, { icon: , onClick: () => editor.chain().focus().setHorizontalRule().run(),