fix(core): should wrap link text (#8249)
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
This commit is contained in:
@@ -73,14 +73,13 @@ function createCopyLinkToBlockMenuItem(
|
|||||||
if (!str) return;
|
if (!str) return;
|
||||||
|
|
||||||
const type = model.flavour;
|
const type = model.flavour;
|
||||||
const title = editor.doc.title$.value;
|
|
||||||
const page = editor.editorContainer$.value;
|
const page = editor.editorContainer$.value;
|
||||||
|
|
||||||
page?.host?.std.clipboard
|
page?.host?.std.clipboard
|
||||||
.writeToClipboard(items => {
|
.writeToClipboard(items => {
|
||||||
items['text/plain'] = str;
|
items['text/plain'] = str;
|
||||||
// wrap a link
|
// wrap a link
|
||||||
items['text/html'] = `<a title="${title}" href="${str}">${title}</a>`;
|
items['text/html'] = `<a href="${str}">${str}</a>`;
|
||||||
return items;
|
return items;
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
@@ -114,13 +114,11 @@ function createCopyLinkToBlockMenuItem(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = editor.doc.title$.value;
|
|
||||||
|
|
||||||
ctx.std.clipboard
|
ctx.std.clipboard
|
||||||
.writeToClipboard(items => {
|
.writeToClipboard(items => {
|
||||||
items['text/plain'] = str;
|
items['text/plain'] = str;
|
||||||
// wrap a link
|
// wrap a link
|
||||||
items['text/html'] = `<a title="${title}" href="${str}">${title}</a>`;
|
items['text/html'] = `<a href="${str}">${str}</a>`;
|
||||||
return items;
|
return items;
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user