Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/9093

Vanessa8d467c7df253
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index f62c47ef78..fa539cdccf 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -969,9 +969,14 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.copyText.custom, event)) {
// 用于标识复制文本 *
- nodeElement.setAttribute("data-reftext", "true");
- focusByRange(getEditorRange(nodeElement));
- document.execCommand("copy");
+ if (selectText !== "") {
+ // 和复制块引用保持一致 https://github.com/siyuan-note/siyuan/issues/9093
+ writeText(`${Lute.EscapeHTMLStr(selectText)} ((${nodeElement.getAttribute("data-node-id")} "*"))`);
+ } else {
+ nodeElement.setAttribute("data-reftext", "true");
+ focusByRange(getEditorRange(nodeElement));
+ document.execCommand("copy");
+ }
event.preventDefault();
event.stopPropagation();
return true;