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/11275#issuecomment-2119783575

Vanessad0f3ac29b6af
diff --git a/app/src/menus/index.ts b/app/src/menus/index.ts
index 34cafe9b43..3281609582 100644
--- a/app/src/menus/index.ts
+++ b/app/src/menus/index.ts
@@ -15,7 +15,6 @@ import {App} from "../index";
import {Constants} from "../constants";
import {textMenu} from "./text";
-
export class Menus {
public menu: Menu;
diff --git a/app/src/menus/text.ts b/app/src/menus/text.ts
index 1dc1f98971..07cbe0f47f 100644
--- a/app/src/menus/text.ts
+++ b/app/src/menus/text.ts
@@ -9,6 +9,13 @@ export const textMenu = (target: Element) => {
label: window.siyuan.languages.copy,
icon: "iconCopy",
click() {
+ if (getSelection().rangeCount === 0) {
+ return;
+ }
+ const range = getSelection().getRangeAt(0);
+ if (!range.toString()) {
+ getSelection().getRangeAt(0).selectNode(target);
+ }
document.execCommand("copy");
}
});