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/11164
Vanessacb28d919b6f0
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex dea7472c59..772bd0f69c 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -33,7 +33,7 @@ import {enter, softEnter} from "./enter";import {fixTable} from "../util/table";import {turnsIntoOneTransaction, turnsIntoTransaction, updateBatchTransaction, updateTransaction} from "./transaction";import {fontEvent} from "../toolbar/Font";-import {listIndent, listOutdent} from "./list";+import {addSubList, listIndent, listOutdent} from "./list";import {newFileContentBySelect, rename, replaceFileName} from "../../editor/rename";import {insertEmptyBlock, jumpToParentNext} from "../../block/util";import {isLocalPath} from "../../util/pathName";@@ -866,16 +866,20 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}// 回车- if (!event.altKey && isNotCtrl(event) && event.key === "Enter") {- if (!event.shiftKey) {- enter(nodeElement, range, protyle);- event.stopPropagation();- event.preventDefault();- return;- } else if (nodeElement.getAttribute("data-type") === "NodeAttributeView") {- event.stopPropagation();- event.preventDefault();- return;+ if (isNotCtrl(event) && event.key === "Enter") {+ if (event.altKey) {+ addSubList(protyle, nodeElement, range);+ } else {+ if (!event.shiftKey) {+ enter(nodeElement, range, protyle);+ event.stopPropagation();+ event.preventDefault();+ return;+ } else if (nodeElement.getAttribute("data-type") === "NodeAttributeView") {+ event.stopPropagation();+ event.preventDefault();+ return;+ }}}diff --git a/app/src/protyle/wysiwyg/list.ts b/app/src/protyle/wysiwyg/list.tsindex 6692a6510f..14b9a870f1 100644--- a/app/src/protyle/wysiwyg/list.ts+++ b/app/src/protyle/wysiwyg/list.ts@@ -4,6 +4,8 @@ import {genEmptyBlock} from "../../block/util";import * as dayjs from "dayjs";import {Constants} from "../../constants";import {moveToPrevious} from "./remove";+import {hasClosestByClassName} from "../util/hasClosest";+import {setFold} from "../../menus/protyle";export const updateListOrder = (listElement: Element, sIndex?: number) => {if (listElement.getAttribute("data-subtype") !== "o") {@@ -42,6 +44,34 @@ export const genListItemElement = (listItemElement: Element, offset = 0, wbr = freturn element.content.firstElementChild as HTMLElement;};+export const addSubList = (protyle: IProtyle, nodeElement: Element, range: Range) => {+ const parentItemElement = hasClosestByClassName(nodeElement, "li");+ if (!parentItemElement) {+ return;+ }+ const lastSubItem = parentItemElement.querySelector(".list")?.lastElementChild.previousElementSibling;+ if (!lastSubItem) {+ return;+ }+ const newListElement = genListItemElement(lastSubItem, 0, true);+ const id = newListElement.getAttribute("data-node-id");+ lastSubItem.after(newListElement);++ if (lastSubItem.parentElement.getAttribute("fold") === "1") {+ setFold(protyle, lastSubItem.parentElement, true);+ }+ transaction(protyle, [{+ action: "insert",+ id,+ data: newListElement.outerHTML,+ previousID: lastSubItem.getAttribute("data-node-id"),+ }], [{+ action: "delete",+ id,+ }]);+ focusByWbr(newListElement, range);+};+export const listIndent = (protyle: IProtyle, liItemElements: Element[], range: Range) => {const previousElement = liItemElements[0].previousElementSibling as HTMLElement;if (!previousElement) {