Add a keyboard shortcut for adding a hyperlink

Use the conventional Ctrl+K keyboard shortcut for adding a hyperlink
This commit is contained in:
CorreyL
2024-01-21 10:38:12 -08:00
parent 37a869fa24
commit 8e8b695cbc

View File

@ -444,7 +444,16 @@ export const RichInput = forwardRef<Editor, RichInputProps>(
Image,
Underline,
Highlight,
Link.configure({ openOnClick: false }),
Link.extend({
addKeyboardShortcuts() {
return {
"Mod-k": () => {
setLinkGlobal(this.editor as Editor);
return true;
},
};
},
}).configure({ openOnClick: false }),
TextAlign.configure({ types: ["heading", "paragraph"] }),
],
editorProps: {