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/13068
Vanessace4e2c1dde1a
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex b005cb20d3..9922b90b93 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -662,10 +662,30 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va} else if (type === "mSelect") {// 不传入为删除if (typeof value === "string") {- value = oldValue.mSelect.concat({- content: value,- color: (oldValue.mSelect.length + 1).toString()- });+ const newMSelectValue: IAVCellSelectValue[] = [];+ let colorIndex = oldValue.mSelect.length;+ // 以逗号分隔,去重,去空,去换行后做为选项+ [...new Set(value.split(",").map(v => v.trim().replace(/\n|\r\n|\r|\u2028|\u2029/g, "")))].forEach((item) => {+ if (!item) {+ return;+ }+ let hasSameContent = false+ oldValue.mSelect.find((mSelectItem) => {+ if (mSelectItem.content === item) {+ hasSameContent = true+ return true+ }+ })+ if (hasSameContent) {+ return;+ }+ colorIndex++;+ newMSelectValue.push({+ content: item,+ color: colorIndex.toString()+ })+ })+ value = oldValue.mSelect.concat(newMSelectValue);}}const cellValue = genCellValue(type, value);diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex e9d1a1618c..2547204230 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -186,13 +186,29 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:}const text = protyle.lute.BlockDOM2Content(html);- const cellsElement: HTMLElement[] = Array.from(blockElement.querySelectorAll(".av__cell--select"));+ const cellsElement: HTMLElement[] = Array.from(blockElement.querySelectorAll(".av__cell--active, .av__cell--select"));const rowsElement = blockElement.querySelector(".av__row--select");if (rowsElement) {updateCellsValue(protyle, blockElement as HTMLElement, text, undefined, columns, html);} else if (cellsElement.length > 0) {- updateCellsValue(protyle, blockElement as HTMLElement, text, cellsElement, columns, html);+ if (cellsElement.length > 1) {+ // 选择多个单元格时,逐行填充+ let rowIndex = 0+ text.split("\n").find((row) => {+ if (!row) {+ return false;+ }+ if (cellsElement[rowIndex]) {+ updateCellsValue(protyle, blockElement as HTMLElement, row.trim(), [cellsElement[rowIndex]], columns, html);+ rowIndex++;+ } else {+ return true;+ }+ })+ } else {+ updateCellsValue(protyle, blockElement as HTMLElement, text, cellsElement, columns, html);+ }document.querySelector(".av__panel")?.remove();} else if (hasClosestByClassName(range.startContainer, "av__title")) {range.insertNode(document.createTextNode(text));