An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: 划选结束后再统计字数
Vanessa548f55e6082f
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex b99f6d8a14..30e79e86ad 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -823,7 +823,6 @@ export class WYSIWYG {mouseElement = newMouseElement;}hideElements(["select"], protyle);- countBlockWord([]);let firstElement = document.elementFromPoint(newLeft - 1, newTop);if (!firstElement) {return;@@ -886,14 +885,11 @@ export class WYSIWYG {// 只有一个 p 时不选中protyle.selectElement.style.backgroundColor = "transparent";} else {- const ids: string[] = [];selectElements.forEach(item => {if (!hasClosestByClassName(item, "protyle-wysiwyg__embed")) {item.classList.add("protyle-wysiwyg--select");- ids.push(item.getAttribute("data-node-id"));}});- countBlockWord(ids);protyle.selectElement.style.backgroundColor = "";}};@@ -1125,6 +1121,13 @@ export class WYSIWYG {setPosition(window.siyuan.menus.menu.element, mouseUpEvent.clientX - 16, mouseUpEvent.clientY - 46);}}++ const ids: string[] = [];+ const selectElement = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")+ selectElement.forEach(item => {+ ids.push(item.getAttribute("data-node-id"));+ });+ countBlockWord(ids);// 划选后不能存在跨块的 range https://github.com/siyuan-note/siyuan/issues/4473if (getSelection().rangeCount > 0) {const range = getSelection().getRangeAt(0);@@ -1133,7 +1136,7 @@ export class WYSIWYG {) {return;}- if (protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select")) {+ if (selectElement.length > 0) {range.collapse(true);return;}diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.tsindex bd239a1724..855fde25d3 100644--- a/app/src/util/globalShortcut.ts+++ b/app/src/util/globalShortcut.ts@@ -157,6 +157,7 @@ export const globalShortcut = () => {});window.addEventListener("keyup", (event) => {+ console.log(event)window.siyuan.ctrlIsPressed = false;window.siyuan.shiftIsPressed = false;window.siyuan.altIsPressed = false;