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/8554
Vanessa89abd02d35df
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 34f9e17983..d5eec26ae1 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -4,6 +4,7 @@ import {focusBlock,focusByRange,focusByWbr,+ getBlockRanges,getEditorRange,getSelectionOffset,getSelectionPosition,@@ -192,6 +193,29 @@ const getAdjacentInlineMath = (range: Range, editableElement: Element, previous:}};+const getRangeListItemElements = (editorElement: HTMLElement, range: Range) => {+ const listItemElements: HTMLElement[] = [];+ const blockRanges = getBlockRanges(editorElement, range);+ for (const blockRange of blockRanges) {+ const listItemElement = blockRange.blockElement.closest<HTMLElement>('[data-type="NodeListItem"]');+ if (!listItemElement || !editorElement.contains(listItemElement)) {+ return [];+ }+ if (!listItemElements.includes(listItemElement)) {+ listItemElements.push(listItemElement);+ }+ }+ if (listItemElements.length < 2) {+ return [];+ }+ const listElement = listItemElements[0].parentElement;+ if (listItemElements.some((item, index) => item.parentElement !== listElement ||+ index > 0 && item.previousElementSibling !== listItemElements[index - 1])) {+ return [];+ }+ return listItemElements;+};+export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {editorElement.addEventListener("keydown", async (event: KeyboardEvent & { target: HTMLElement }) => {if (event.target.localName === "protyle-html" || event.target.localName === "input") {@@ -1756,7 +1780,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {return true;}}- if (matchHotKey(window.siyuan.config.keymap.editor.list.outdent.custom, event)) {+ const isListOutdent = matchHotKey(window.siyuan.config.keymap.editor.list.outdent.custom, event);+ const isListIndent = matchHotKey(window.siyuan.config.keymap.editor.list.indent.custom, event);+ const rangeListItemElements = (isListOutdent || isListIndent) && isCrossBlock && selectText !== "" ?+ getRangeListItemElements(protyle.wysiwyg.element, range) : [];+ if (isListOutdent) {const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");if (selectElements.length > 0) {let isContinuous = true;@@ -1774,6 +1802,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {event.preventDefault();event.stopPropagation();return true;+ } else if (rangeListItemElements.length > 0) {+ listOutdent(protyle, rangeListItemElements, range);+ event.preventDefault();+ event.stopPropagation();+ return true;} else if (nodeElement.parentElement.classList.contains("li") && nodeType !== "NodeCodeBlock") {listOutdent(protyle, [nodeElement.parentElement], range);event.preventDefault();@@ -1782,7 +1815,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}}- if (matchHotKey(window.siyuan.config.keymap.editor.list.indent.custom, event)) {+ if (isListIndent) {const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");if (selectElements.length > 0) {let isContinuous = true;@@ -1800,6 +1833,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {event.preventDefault();event.stopPropagation();return true;+ } else if (rangeListItemElements.length > 0) {+ listIndent(protyle, rangeListItemElements, range);+ event.preventDefault();+ event.stopPropagation();+ return true;} else if (nodeElement.parentElement.classList.contains("li") && nodeType !== "NodeCodeBlock") {listIndent(protyle, [nodeElement.parentElement], range);event.preventDefault();