🎨 Improve "Use Default Column Width" (#15046)

fix https://github.com/siyuan-note/siyuan/issues/12776
This commit is contained in:
Jeffrey Chen 2025-07-10 16:58:12 +08:00 committed by GitHub
parent 6f37e913f5
commit d968055aa7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -2153,14 +2153,14 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
});
}
const thMatchElement = nodeElement.querySelectorAll("col")[colIndex];
if (thMatchElement.style.width || thMatchElement.style.minWidth) {
if (thMatchElement.style.width || thMatchElement.style.minWidth !== "60px") {
otherMenus.push({
id: "useDefaultWidth",
label: window.siyuan.languages.useDefaultWidth,
click: () => {
const html = nodeElement.outerHTML;
thMatchElement.style.width = "";
thMatchElement.style.minWidth = "";
thMatchElement.style.minWidth = "60px";
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
}
});

View file

@ -188,7 +188,7 @@ export const insertColumn = (protyle: IProtyle, nodeElement: Element, cellElemen
newCellElement.textContent = " ";
}
}
tableElement.querySelectorAll("col")[index].insertAdjacentHTML(type, "<col>");
tableElement.querySelectorAll("col")[index].insertAdjacentHTML(type, "<col style='min-width: 60px;'>");
focusByWbr(nodeElement, range);
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
};