diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 375a1d8a1..4c882af05 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -631,7 +631,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { label: window.siyuan.languages.copy, icon: "iconCopy", click() { - writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML)); + writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML).trim()); } }).element); if (!protyle.disabled) { diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts index 589b76677..675b87f0d 100644 --- a/app/src/protyle/util/paste.ts +++ b/app/src/protyle/util/paste.ts @@ -398,12 +398,22 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven // 编辑器内部粘贴 const tempElement = document.createElement("div"); tempElement.innerHTML = siyuanHTML; - if (tempElement.childElementCount === 1 && ((tempElement.firstElementChild as HTMLElement).dataset?.type || "").split(" ").includes("block-ref")) { - protyle.toolbar.setInlineMark(protyle, "block-ref", "range", { - type: "id", - color: `${(tempElement.firstElementChild as HTMLElement).dataset.id}${Constants.ZWSP}s${Constants.ZWSP}${range.toString()}` - }); - return; + if (tempElement.childElementCount === 1) { + const types = ((tempElement.firstElementChild as HTMLElement).dataset?.type || "").split(" ") + if(types.includes("block-ref")) { + protyle.toolbar.setInlineMark(protyle, "block-ref", "range", { + type: "id", + color: `${(tempElement.firstElementChild as HTMLElement).dataset.id}${Constants.ZWSP}s${Constants.ZWSP}${range.toString()}` + }); + return; + } + if(types.includes("a")) { + protyle.toolbar.setInlineMark(protyle, "a", "range", { + type: "a", + color: `${(tempElement.firstElementChild as HTMLElement).dataset.href}${Constants.ZWSP}${range.toString()}` + }); + return; + } } let isBlock = false; tempElement.querySelectorAll("[data-node-id]").forEach((e) => {