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/6864

Vanessa6148e5fd2937
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 48cd4557f0..d97b002219 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -1063,12 +1063,13 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
});
}
const thMatchElement = nodeElement.querySelectorAll("col")[colIndex];
- if (thMatchElement.style.width) {
+ if (thMatchElement.style.width || thMatchElement.style.minWidth) {
menus.push({
label: window.siyuan.languages.useDefaultWidth,
click: () => {
const html = nodeElement.outerHTML;
thMatchElement.style.width = "";
+ thMatchElement.style.minWidth = "";
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
}
});
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index 7b395a2cd3..e5667faec8 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -593,7 +593,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
// https://github.com/siyuan-note/siyuan/issues/6864
if (nodeElement.getAttribute("data-type") === "NodeTable") {
nodeElement.querySelectorAll("colgroup col").forEach((item: HTMLElement) => {
- item.style.width = "80px";
+ item.style.minWidth = "60px";
});
newHTML = nodeElement.outerHTML;
}
@@ -610,7 +610,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
// https://github.com/siyuan-note/siyuan/issues/6864
if (nodeElement.getAttribute("data-type") === "NodeTable") {
nodeElement.querySelectorAll("colgroup col").forEach((item: HTMLElement) => {
- item.style.width = "80px";
+ item.style.minWidth = "60px";
});
}
transaction(protyle, [{
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 9596cacd60..f573c58f74 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -389,6 +389,11 @@ export class WYSIWYG {
const id = nodeElement.getAttribute("data-node-id");
const x = event.clientX;
const colElement = nodeElement.querySelectorAll("table col")[parseInt(target.getAttribute("data-col-index"))] as HTMLElement;
+ // 清空初始化 table 时的最小宽度
+ if (colElement.style.minWidth) {
+ colElement.style.width = colElement.style.minWidth;
+ colElement.style.minWidth = "";
+ }
// 兼容 1.8.2
(nodeElement.querySelectorAll("table th")[parseInt(target.getAttribute("data-col-index"))] as HTMLElement).style.width = "";
const oldWidth = colElement.clientWidth;