Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/17587

Vanessa091ee6eb6203
diff --git a/app/src/protyle/util/table.ts b/app/src/protyle/util/table.ts
index e0db56220c..17c73bb902 100644
--- a/app/src/protyle/util/table.ts
+++ b/app/src/protyle/util/table.ts
@@ -510,7 +510,23 @@ export const fixTable = (protyle: IProtyle, event: KeyboardEvent, range: Range)
if (!previousElement || previousElement?.tagName === "COL") {
return false;
}
- range.selectNodeContents(previousElement.cells[getColIndex(cellElement)]);
+ const currentColIndex = getColIndex(cellElement);
+ let newCellElement = previousElement.cells[currentColIndex];
+ while (previousElement) {
+ let i = 0;
+ while (newCellElement && newCellElement.classList.contains("fn__none")) {
+ i++;
+ newCellElement = newCellElement.previousElementSibling as HTMLTableCellElement;
+ }
+ if (newCellElement.colSpan < 2 && i !== 0) {
+ previousElement = previousElement.previousElementSibling as HTMLTableRowElement;
+ newCellElement = previousElement.cells[currentColIndex];
+ } else if (newCellElement.colSpan > i) {
+ break;
+ }
+ }
+
+ range.selectNodeContents(newCellElement);
range.collapse(false);
scrollCenter(protyle);
event.preventDefault();