Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/14821

Vanessae376a5611463
diff --git a/app/src/protyle/toolbar/Link.ts b/app/src/protyle/toolbar/Link.ts
index 519ac5f7f3..870896e721 100644
--- a/app/src/protyle/toolbar/Link.ts
+++ b/app/src/protyle/toolbar/Link.ts
@@ -27,6 +27,7 @@ export class Link extends ToolbarItem {
let dataHref = "";
let dataText = range.toString().trim().replace(Constants.ZWSP, "");
+ let showMenu = false;
try {
// 选中链接时需忽略剪切板内容 https://ld246.com/article/1643035329737
dataHref = protyle.lute.GetLinkDest(dataText);
@@ -65,15 +66,19 @@ export class Link extends ToolbarItem {
if (dataHref.length > Constants.SIZE_LINK_TEXT_MAX) {
dataText = dataHref.substring(0, Constants.SIZE_LINK_TEXT_MAX) + "...";
}
+ showMenu = true;
}
}
} catch (e) {
console.log(e);
}
- protyle.toolbar.setInlineMark(protyle, "a", "range", {
+ const linkElements = protyle.toolbar.setInlineMark(protyle, "a", "range", {
type: "a",
color: dataHref + (dataText ? Constants.ZWSP + dataText : "")
});
+ if (showMenu) {
+ linkMenu(protyle, linkElements[0] as HTMLElement, true);
+ }
});
}
}
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 56c0c042d4..b99d836575 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -807,6 +807,7 @@ export class Toolbar {
}
}
}
+ return newNodes;
}
public showRender(protyle: IProtyle, renderElement: Element, updateElements?: Element[], oldHTML?: string) {