An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: fix https://github.com/siyuan-note/siyuan/issues/6151
Vanessa6fd5bef8acc0
diff --git a/app/src/constants.ts b/app/src/constants.tsindex 04d0d448e8..db0661269b 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -69,6 +69,7 @@ export abstract class Constants {public static readonly LOCAL_EXPORTPDF = "local-exportpdf";public static readonly LOCAL_EXPORTWORD = "local-exportword";public static readonly LOCAL_BAZAAR = "local-bazaar";+ public static readonly LOCAL_PANEL = "local-panel";// timeoutpublic static readonly TIMEOUT_DBLCLICK = 190;diff --git a/app/src/layout/util.ts b/app/src/layout/util.tsindex b01d53ab1c..33759d7905 100644--- a/app/src/layout/util.ts+++ b/app/src/layout/util.ts@@ -148,6 +148,8 @@ export const exportLayout = (reload: boolean, cb?: () => void) => {cb();}});++ // TODO save panel};const JSONToDock = (json: any) => {diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex ab91020109..bb540976cd 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -309,6 +309,10 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: Eif (topSourceElement.isSameNode(item)) {topSourceElement = undefined;}+ if (topSourceElement.contains(item) && topSourceElement.contains(targetElement)) {+ // * * 1 列表项拖拽到父级列表项下 https://ld246.com/article/1665448570858+ topSourceElement = targetElement;+ }}undoOperations.push({action: "move",@@ -381,6 +385,10 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: Eif (topSourceElement.isSameNode(item)) {topSourceElement = undefined;}+ if (topSourceElement.contains(item) && topSourceElement.contains(targetElement)) {+ // * * 1 列表项拖拽到父级列表项上 https://ld246.com/article/1665448570858+ topSourceElement = targetElement;+ }}undoOperations.push({action: "move",@@ -621,7 +629,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {// 反链提及有高亮,如果拖拽到正文的话,应移除item.querySelectorAll('[data-type="search-mark"]').forEach(markItem => {markItem.outerHTML = markItem.innerHTML;- })+ });});if (event.altKey) {focusByRange(document.caretRangeFromPoint(event.clientX, event.clientY));diff --git a/app/src/protyle/util/table.ts b/app/src/protyle/util/table.tsindex 556aaa0cb9..bb1578b8b5 100644--- a/app/src/protyle/util/table.ts+++ b/app/src/protyle/util/table.ts@@ -65,7 +65,7 @@ export const setTableAlign = (protyle: IProtyle, cellElements: HTMLElement[], no});}updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);- focusByWbr(tableElement, range)+ focusByWbr(tableElement, range);};export const insertRow = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => {@@ -186,7 +186,7 @@ export const deleteRow = (protyle: IProtyle, range: Range, cellElement: HTMLElemconst tbodyElement = cellElement.parentElement.parentElement;let previousTrElement = tbodyElement.previousElementSibling.lastElementChild as HTMLTableRowElement;if (cellElement.parentElement.previousElementSibling) {- previousTrElement = cellElement.parentElement.previousElementSibling as HTMLTableRowElement+ previousTrElement = cellElement.parentElement.previousElementSibling as HTMLTableRowElement;}if (tbodyElement.childElementCount === 1) {@@ -208,7 +208,7 @@ export const deleteColumn = (protyle: IProtyle, range: Range, nodeElement: Elemeconst html = nodeElement.outerHTML;wbrElement.remove();const index = getColIndex(cellElement);- const sideCellElement = (cellElement.previousElementSibling || cellElement.nextElementSibling) as HTMLElement+ const sideCellElement = (cellElement.previousElementSibling || cellElement.nextElementSibling) as HTMLElement;if (sideCellElement) {range.selectNodeContents(sideCellElement);range.collapse(true);diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 94d45b9616..ab4f027fd8 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -447,16 +447,10 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: breturn;}if (operation.action === "move") {- let cloneRange;let range;if (focus && getSelection().rangeCount > 0) {range = getSelection().getRangeAt(0);- cloneRange = {- startContainer: range.startContainer,- startOffset: range.startOffset,- endContainer: range.endContainer,- endOffset: range.endOffset,- };+ range.insertNode(document.createElement("wbr"))}/// #if !MOBILEif (updateElements.length === 0) {@@ -502,13 +496,17 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: bremoveTopElement(item, protyle);}});- if (focus && cloneRange && range) {+ if (focus && range) {if (operation.data === "focus") {- focusBlock(updateElements[0]);+ // 标记需要 focus,https://ld246.com/article/1650018446988/comment/1650081404993?r=Vanessa#comments+ Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`)).find(item => {+ if (!hasClosestByAttribute(item.parentElement, "data-type", "NodeBlockQueryEmbed")) {+ focusBlock(item);+ return true;+ }+ });} else {- range.setStart(cloneRange.startContainer, cloneRange.startOffset);- range.setEnd(cloneRange.endContainer, cloneRange.endOffset);- focusByRange(range);+ focusByWbr(protyle.wysiwyg.element, range);}}// 更新 ws 嵌入块