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: https://github.com/siyuan-note/siyuan/issues/13949
Vanessa37d82649aa18
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 7aabb7a3db..04297677c7 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -819,6 +819,22 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}const position = getSelectionOffset(editElement, protyle.wysiwyg.element, range);if (event.key === "Delete" || matchHotKey("⌃D", event)) {+ // 图片后为空格,在空格后删除 https://github.com/siyuan-note/siyuan/issues/13949+ if (range.startOffset === 0 && range.startContainer.textContent.length === 1) {+ const rangePreviousElement = hasPreviousSibling(range.startContainer) as HTMLElement+ const rangeNextElement = hasNextSibling(range.startContainer) as HTMLElement+ if (rangePreviousElement && rangePreviousElement.nodeType === 1 && rangePreviousElement.classList.contains("img") &&+ rangeNextElement && rangeNextElement.nodeType === 1 && rangeNextElement.classList.contains("img")) {+ const wbrElement = document.createElement("wbr")+ range.insertNode(wbrElement)+ const oldHTML = nodeElement.outerHTML;+ wbrElement.nextSibling.textContent = Constants.ZWSP;+ updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML)+ focusByWbr(nodeElement, range);+ event.preventDefault();+ return;+ }+ }// 需使用 innerText,否则 br 无法传唤为 /n https://github.com/siyuan-note/siyuan/issues/12066// 段末反向删除 https://github.com/siyuan-note/insider/issues/274if (position.end === editElement.innerText.length ||@@ -902,6 +918,22 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {event.preventDefault();return;}+ // 图片后为空格,在空格后删除 https://github.com/siyuan-note/siyuan/issues/13949+ if (range.startOffset === 1 && range.startContainer.textContent.length === 1) {+ const rangePreviousElement = hasPreviousSibling(range.startContainer) as HTMLElement+ const rangeNextElement = hasNextSibling(range.startContainer) as HTMLElement+ if (rangePreviousElement && rangePreviousElement.nodeType === 1 && rangePreviousElement.classList.contains("img") &&+ rangeNextElement && rangeNextElement.nodeType === 1 && rangeNextElement.classList.contains("img")) {+ const wbrElement = document.createElement("wbr")+ range.insertNode(wbrElement)+ const oldHTML = nodeElement.outerHTML;+ wbrElement.previousSibling.textContent = Constants.ZWSP;+ updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML)+ focusByWbr(nodeElement, range);+ event.preventDefault();+ return;+ }+ }// 代码块中空行 ⌘+Del 异常 https://ld246.com/article/1663166544901if (nodeElement.classList.contains("code-block") && isOnlyMeta(event) &&range.startContainer.nodeType === 3 && range.startContainer.textContent.substring(range.startOffset - 1, range.startOffset) === "\n") {