Skip to content

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

:bug: Keep table background color submenu aligned https://github.com/siyuan-note/siyuan/issues/4785

Daniel816b8c4aac7d
diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scss
index 9b7aa1edc7..4f4e3ab3bc 100644
--- a/app/src/assets/scss/protyle/_protyle.scss
+++ b/app/src/assets/scss/protyle/_protyle.scss
@@ -813,4 +813,20 @@ table + .protyle-action__table {
border: 1px solid var(--b3-border-color);
border-radius: 50%;
}
+
+ &__color-menu {
+ box-sizing: border-box;
+ width: min(360px, calc(100vw - 16px));
+
+ & > .b3-menu__items {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+
+ .b3-menu__label {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ }
}
diff --git a/app/src/protyle/util/tableControl.ts b/app/src/protyle/util/tableControl.ts
index e699cc0c3b..9f6b6ea047 100644
--- a/app/src/protyle/util/tableControl.ts
+++ b/app/src/protyle/util/tableControl.ts
@@ -764,11 +764,14 @@ export class TableControl {
label: window.siyuan.languages.clear,
click: () => this.clearCells(),
}).element);
- menu.append(new MenuItem({
+ const backgroundMenuItem = new MenuItem({
icon: "iconTheme",
label: window.siyuan.languages.colorPrimary,
submenu: this.getBackgroundMenus(),
- }).element);
+ }).element;
+ backgroundMenuItem.querySelector(":scope > .b3-menu__submenu")
+ ?.classList.add("protyle-table-control__color-menu");
+ menu.append(backgroundMenuItem);
if (this.selection.mode === "cell") {
this.appendCellMenus(rectangle);
} else {