fix(editor): improve affine-link toolbar (#11159)

Closes: [BS-2884](https://linear.app/affine-design/issue/BS-2884/[ui]-hover-邮箱的-toolbar)
This commit is contained in:
fundon
2025-03-25 07:58:40 +00:00
parent 4d15c32242
commit 583bbf3463
3 changed files with 59 additions and 3 deletions

View File

@@ -316,6 +316,17 @@ export const builtinInlineLinkToolbarConfig = {
)
return false;
const { link } = target;
try {
const url = new URL(link);
if (!url.protocol.startsWith('http')) {
return false;
}
} catch (err) {
console.error(err);
return false;
}
const { model } = target.block;
const parent = model.parent;
if (!parent) return false;