Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

fix: 带有空格的链接剪切粘贴后会变成 `%20` (#13991)

Jeffrey Chen6dff9b46880e
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 290ac84d48..7c8187d211 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -1518,10 +1518,11 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
icon: "iconCut",
label: window.siyuan.languages.cut,
click() {
- writeText(protyle.lute.BlockDOM2StdMd(linkElement.outerHTML));
+ const range = document.createRange();
+ range.selectNode(linkElement);
+ focusByRange(range);
+ document.execCommand("cut");
- linkElement.insertAdjacentHTML("afterend", "<wbr>");
- linkElement.remove();
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
focusByWbr(nodeElement, protyle.toolbar.range);