1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

(bug) prevent links on nothing in wysiwyg editor

This commit is contained in:
Sylvain 2022-10-12 17:02:02 +02:00
parent 11c8b25357
commit 5be2c79569

View File

@ -47,6 +47,10 @@ export const MenuBar: React.FC<MenuBarProps> = ({ editor, heading, bulletList, b
if (submenu !== type) {
setSubmenu(type);
if (type === 'link') {
if (editor.view.state.selection.from === editor.view.state.selection.to) {
setSubmenu('');
return;
}
const previousUrl = {
href: editor.getAttributes('link').href,
target: editor.getAttributes('link').target || ''