fix(editor): should check text length and stop event propagation when adding a link (#10391)

This commit is contained in:
fundon
2025-02-24 11:10:04 +00:00
parent 6289981fd1
commit 162b7adc1b
3 changed files with 21 additions and 29 deletions
@@ -20,8 +20,14 @@ export const textFormatKeymap = (std: BlockStdScope) =>
const textSelection = selection.find(TextSelection);
if (!textSelection) return;
const allowed = config.textChecker?.(std.host) ?? true;
if (!allowed) return;
const event = ctx.get('keyboardState').raw;
event.stopPropagation();
event.preventDefault();
config.action(std.host);
ctx.get('keyboardState').raw.preventDefault();
return true;
},
};