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/15300
Vanessadda46341267b
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex f44d335fb4..2c702542e4 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -59,7 +59,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:const firstColIndex = cellElements[0].getAttribute("data-col-id");values.find(rowItem => {if (!currentRowElement) {- currentRowElement = cellElements[0].parentElement;+ currentRowElement = hasClosestByClassName(cellElements[0].parentElement, "av__row") as HTMLElement;} else {currentRowElement = currentRowElement.nextElementSibling;}@@ -71,7 +71,11 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:if (!cellElement) {cellElement = currentRowElement.querySelector(`.av__cell[data-col-id="${firstColIndex}"]`) as HTMLElement;} else {- cellElement = cellElement.nextElementSibling as HTMLElement;+ if (cellElement.nextElementSibling) {+ cellElement = cellElement.nextElementSibling as HTMLElement;+ } else if (cellElement.parentElement.classList.contains("av__colsticky")) {+ cellElement = cellElement.parentElement.nextElementSibling as HTMLElement;+ }}if (!cellElement.classList.contains("av__cell")) {return true;@@ -156,7 +160,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:const firstColIndex = cellElements[0].getAttribute("data-col-id");textJSON.forEach((rowValue) => {if (!currentRowElement) {- currentRowElement = cellElements[0].parentElement;+ currentRowElement = hasClosestByClassName(cellElements[0].parentElement, "av__row") as HTMLElement;} else {currentRowElement = currentRowElement.nextElementSibling;}@@ -168,7 +172,11 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:if (!cellElement) {cellElement = currentRowElement.querySelector(`.av__cell[data-col-id="${firstColIndex}"]`) as HTMLElement;} else {- cellElement = cellElement.nextElementSibling as HTMLElement;+ if (cellElement.nextElementSibling) {+ cellElement = cellElement.nextElementSibling as HTMLElement;+ } else if (cellElement.parentElement.classList.contains("av__colsticky")) {+ cellElement = cellElement.parentElement.nextElementSibling as HTMLElement;+ }}if (!cellElement.classList.contains("av__cell")) {return true;diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 8a891d68de..916ce6b345 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -318,14 +318,22 @@ export class WYSIWYG {html = "[";cellElements.forEach((item: HTMLElement, index) => {const cellText = getCellText(item);- if (index === 0 || !cellElements[index - 1].isSameNode(item.previousElementSibling)) {+ if (index === 0 || (+ !cellElements[index - 1].isSameNode(item.previousElementSibling) &&+ !(item.previousElementSibling?.classList.contains("av__colsticky") && !cellElements[index - 1].nextElementSibling && cellElements[index - 1].parentElement.isSameNode(item.previousElementSibling))+ )) {html += "[";}html += JSON.stringify(genCellValueByElement(getTypeByCellElement(item), item)) + ",";- if (index === cellElements.length - 1 || !cellElements[index + 1].isSameNode(item.nextElementSibling)) {+ if (index === cellElements.length - 1 || (+ !cellElements[index + 1].isSameNode(item.nextElementSibling) &&+ !(!item.nextElementSibling && item.parentElement.nextElementSibling.isSameNode(cellElements[index + 1]))+ )) {html = html.substring(0, html.length - 1) + "],";+ textPlain += cellText + "\n";+ } else {+ textPlain += cellText + "\t";}- textPlain += cellText + ((cellElements[index + 1] && item.nextElementSibling && item.nextElementSibling.isSameNode(cellElements[index + 1])) ? "\t" : "\n\n");});textPlain = textPlain.substring(0, textPlain.length - 2);html = html.substring(0, html.length - 1) + "]";