An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/5485
Vanessae86e8e242f1c
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 21d03a71a2..d7bf22a9a4 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -25,7 +25,7 @@ import {dropEvent} from "../util/editorCommonEvent";import {input} from "./input";import {getContenteditableElement,- getLastBlock,+ getLastBlock, getNextBlock,getPreviousHeading,getTopAloneElement,hasNextSibling,@@ -297,7 +297,12 @@ export class WYSIWYG {html = `<div data-subtype="${selectElements[0].getAttribute("data-subtype")}" data-node-id="${Lute.NewNodeID()}" data-type="NodeList" class="list">${html}<div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div></div>`;}}+ const nextElement = getNextBlock(selectElements[selectElements.length - 1]);removeBlock(protyle, nodeElement, range);+ if (nextElement) {+ // Ctrl+X 剪切后光标应跳到下一行行首 https://github.com/siyuan-note/siyuan/issues/5485+ focusBlock(nextElement);+ }} else {const id = nodeElement.getAttribute("data-node-id");const oldHTML = nodeElement.outerHTML;diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 03cc94ba90..6ab32d9590 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1362,11 +1362,19 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {if (isNotEditBlock(nodeElement) && matchHotKey("⌘X", event)) {let html = "";- protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select").forEach(item => {+ nodeElement.classList.add("protyle-wysiwyg--select");+ const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")+ selectElements.forEach(item => {html += removeEmbed(item);});writeText(protyle.lute.BlockDOM2StdMd(html).trimEnd());+ const nextElement = getNextBlock(selectElements[selectElements.length - 1]);removeBlock(protyle, nodeElement, range);+ if (nextElement) {+ focusBlock(nextElement);+ }+ event.preventDefault();+ event.stopPropagation();}if (matchHotKey(window.siyuan.config.keymap.editor.general.vLayout.custom, event)) {diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.tsindex 507c6362ed..abfb9e4324 100644--- a/app/src/protyle/wysiwyg/remove.ts+++ b/app/src/protyle/wysiwyg/remove.ts@@ -443,7 +443,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: RanfocusSideBlock(previousElement);} else {const previousLastEditElement = getContenteditableElement(previousLastElement);- if (editableElement.textContent !== "") {+ if (editableElement && editableElement.textContent !== "") {// 非空块range.setEndAfter(editableElement.lastChild);// 数学公式会车后再删除 https://github.com/siyuan-note/siyuan/issues/3850