mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-13 16:22:59 +10:00
Move core logic of setLink to outer scope
Will allow code changes in a subsequent commit to access the function and utilize the same core logic
This commit is contained in:
@ -113,8 +113,7 @@ const InsertImageForm = ({ onInsert }: InsertImageProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Toolbar = ({ editor }: { editor: Editor }) => {
|
const setLinkGlobal = (editor: Editor) => {
|
||||||
const setLink = useCallback(() => {
|
|
||||||
const previousUrl = editor.getAttributes("link").href;
|
const previousUrl = editor.getAttributes("link").href;
|
||||||
const url = window.prompt("URL", previousUrl);
|
const url = window.prompt("URL", previousUrl);
|
||||||
|
|
||||||
@ -132,6 +131,11 @@ const Toolbar = ({ editor }: { editor: Editor }) => {
|
|||||||
|
|
||||||
// update link
|
// update link
|
||||||
editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
|
editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
|
||||||
|
};
|
||||||
|
|
||||||
|
const Toolbar = ({ editor }: { editor: Editor }) => {
|
||||||
|
const setLink = useCallback(() => {
|
||||||
|
setLinkGlobal(editor);
|
||||||
}, [editor]);
|
}, [editor]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user