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/8554

Vanessa6c0cf134f6d3
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 4a59841f0e..bac0287b93 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -8,6 +8,7 @@ import {
getSelectionOffset,
getSelectionPosition,
selectAll,
+ selectBlocksByRange,
setFirstNodeRange,
setInsertWbrHTML,
setLastNodeRange,
@@ -1409,19 +1410,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
} else {
if (isCrossBlock) {
hideElements(["toolbar", "hint", "util", "select"], protyle);
- const selectElements: HTMLElement[] = [];
- protyle.wysiwyg.element.querySelectorAll("[data-node-id]").forEach((item: HTMLElement) => {
- if (!item.querySelector("[data-node-id]") && range.intersectsNode(item)) {
- const embedElement = isInEmbedBlock(item);
- const selectElement = getTopAloneElement(embedElement || item) as HTMLElement;
- if (!selectElements.includes(selectElement)) {
- selectElements.push(selectElement);
- selectElement.classList.add("protyle-wysiwyg--select");
- }
- }
- });
- range.collapse(false);
- countBlockWord(selectElements.map(item => item.getAttribute("data-node-id")), protyle.block.rootID);
+ selectBlocksByRange(protyle, range);
} else if (!protyle.toolbar.element.classList.contains("fn__none") ||
!protyle.hint.element.classList.contains("fn__none") ||
!protyle.toolbar.subElement.classList.contains("fn__none")) {