From 85448e2d6b4ce939b586a640f4c242fa7570f6e8 Mon Sep 17 00:00:00 2001 From: fundon Date: Fri, 13 Sep 2024 11:44:23 +0000 Subject: [PATCH] fix(core): should wrap link text (#8249) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes [BS-1418](https://linear.app/affine-design/issue/BS-1418/link-to-block-粘贴识别后,使用-undo-来撤销操作的效果不一样) https://github.com/user-attachments/assets/537cf8f4-cf13-466f-b68e-fc213891c548 --- .../block-suite-editor/specs/custom/database-block.ts | 3 +-- .../block-suite-editor/specs/custom/widgets/toolbar.ts | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/database-block.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/database-block.ts index 7cdb0a6c68..95736bf209 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/database-block.ts +++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/database-block.ts @@ -73,14 +73,13 @@ function createCopyLinkToBlockMenuItem( if (!str) return; const type = model.flavour; - const title = editor.doc.title$.value; const page = editor.editorContainer$.value; page?.host?.std.clipboard .writeToClipboard(items => { items['text/plain'] = str; // wrap a link - items['text/html'] = `${title}`; + items['text/html'] = `${str}`; return items; }) .then(() => { diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/toolbar.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/toolbar.ts index b8285b6e66..13981f92a1 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/toolbar.ts +++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/toolbar.ts @@ -114,13 +114,11 @@ function createCopyLinkToBlockMenuItem( return; } - const title = editor.doc.title$.value; - ctx.std.clipboard .writeToClipboard(items => { items['text/plain'] = str; // wrap a link - items['text/html'] = `${title}`; + items['text/html'] = `${str}`; return items; }) .then(() => {