Skip to content

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

:art: Unify database cell action styling

Daniel9f97b3123ced
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss
index 430f1af6dd..5155b460b4 100644
--- a/app/src/assets/scss/business/_av.scss
+++ b/app/src/assets/scss/business/_av.scss
@@ -901,11 +901,11 @@
justify-content: flex-end;
}
- &[data-dtype="number"]:not([data-align]) > .block__icon[data-type="copy"],
- &[data-dtype="number"][data-align=""] > .block__icon[data-type="copy"],
- &[data-align="right"] > .block__icon[data-type="copy"] {
+ &[data-dtype="number"]:not([data-align]) > .av__cell-action[data-type="copy"],
+ &[data-dtype="number"][data-align=""] > .av__cell-action[data-type="copy"],
+ &[data-align="right"] > .av__cell-action[data-type="copy"] {
right: auto;
- left: 5px;
+ left: 4px;
}
&[data-align="right"] > [data-type="block-more"] {
@@ -939,7 +939,7 @@
white-space: nowrap;
}
- &[data-dtype="block"] > .block__icon[data-type="copy"] {
+ &[data-dtype="block"] > .av__cell-action[data-type="copy"] {
display: none;
}
@@ -1057,10 +1057,22 @@
top: 5px;
}
+ & > .av__cell-action[data-type="copy"] {
+ opacity: 0;
+ position: absolute;
+ right: 4px;
+ top: 50%;
+ transform: translateY(-50%);
+ }
+
&:hover .block__icon {
opacity: 1;
- background-color: var(--b3-theme-background) !important;
- background-image: linear-gradient(var(--b3-theme-background-light), var(--b3-theme-background-light));
+ background-color: var(--b3-theme-background-light) !important;
+ }
+
+ &:hover > .av__cell-action[data-type="copy"],
+ &:focus-within > .av__cell-action[data-type="copy"] {
+ opacity: 1;
}
.b3-chip {
diff --git a/app/src/assets/scss/business/_custom.scss b/app/src/assets/scss/business/_custom.scss
index 1631212868..3a2f4d997f 100644
--- a/app/src/assets/scss/business/_custom.scss
+++ b/app/src/assets/scss/business/_custom.scss
@@ -365,50 +365,51 @@
}
}
+.av__cell-action {
+ align-items: center;
+ background-color: var(--b3-theme-background);
+ border: 0;
+ border-radius: var(--b3-border-radius);
+ color: var(--b3-theme-on-surface);
+ cursor: pointer;
+ display: inline-flex;
+ font: inherit;
+ height: 1.625em;
+ justify-content: center;
+ padding: 0;
+ width: 1.625em;
+
+ &:hover,
+ &:focus-visible {
+ background-color: var(--b3-theme-background);
+ background-image: linear-gradient(var(--b3-list-hover), var(--b3-list-hover));
+ color: var(--b3-theme-on-background);
+ outline: none;
+ }
+
+ svg {
+ height: 1em;
+ pointer-events: none;
+ width: 1em;
+ }
+}
+
.av__row-actions {
align-items: center;
+ background-color: transparent;
+ border-radius: var(--b3-border-radius);
display: inline-flex;
flex-shrink: 0;
gap: 4px;
margin: 0;
- padding: 0 6px;
opacity: 0;
+ padding: 0 6px;
pointer-events: none;
position: absolute;
right: 4px;
top: 50%;
transform: translateY(-50%);
transition: opacity 120ms ease-in-out;
- background-color: transparent;
- border-radius: var(--b3-border-radius);
-
- .av__row-action {
- align-items: center;
- background-color: var(--b3-theme-background);
- border: 0;
- border-radius: var(--b3-border-radius);
- color: var(--b3-theme-on-surface);
- cursor: pointer;
- display: inline-flex;
- height: calc(1.625em - 4px);
- justify-content: center;
- padding: 0;
- width: calc(1.625em - 4px);
-
- &:hover,
- &:focus-visible {
- background-color: var(--b3-theme-background);
- background-image: linear-gradient(var(--b3-list-hover), var(--b3-list-hover));
- color: var(--b3-theme-on-background);
- outline: none;
- }
-
- svg {
- height: calc(1em - 2px);
- pointer-events: none;
- width: calc(1em - 2px);
- }
- }
}
.av__cell[data-dtype="block"]:hover .av__row-actions,
diff --git a/app/src/assets/scss/protyle/_wysiwyg.scss b/app/src/assets/scss/protyle/_wysiwyg.scss
index 1115136147..48cc756872 100644
--- a/app/src/assets/scss/protyle/_wysiwyg.scss
+++ b/app/src/assets/scss/protyle/_wysiwyg.scss
@@ -997,7 +997,7 @@
}
}
- .av__row .av__cell[data-dtype="block"] > .block__icon[data-type="copy"] {
+ .av__row .av__cell[data-dtype="block"] > .av__cell-action[data-type="copy"] {
display: flex;
}
}
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 80a5e91f9e..a05ca64806 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -1104,7 +1104,7 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0, showIcon = tru
}
const bindLabel = cellValue?.isDetached ? window.siyuan.languages.bind : window.siyuan.languages.rebind;
const updateIcon = cellValue?.isDetached ? "iconLink" : "iconRefresh";
- text += `<span class="av__row-actions"><button class="av__row-action ariaLabel" type="button" data-position="4north" aria-label="${window.siyuan.languages.openBy}" data-type="av-row-open"><svg><use xlink:href="#iconOpen"></use></svg></button><button class="av__row-action ariaLabel" type="button" data-position="4north" aria-label="${bindLabel}" data-type="av-row-update"><svg><use xlink:href="#${updateIcon}"></use></svg></button></span>`;
+ text += `<span class="av__row-actions"><button class="av__row-action av__cell-action ariaLabel" type="button" data-position="4north" aria-label="${window.siyuan.languages.openBy}" data-type="av-row-open"><svg><use xlink:href="#iconOpen"></use></svg></button><button class="av__row-action av__cell-action ariaLabel" type="button" data-position="4north" aria-label="${bindLabel}" data-type="av-row-update"><svg><use xlink:href="#${updateIcon}"></use></svg></button></span>`;
} else if (cellValue.type === "number") {
text = `<span class="av__celltext" data-content="${cellValue?.number.isNotEmpty ? cellValue?.number.content : ""}">${cellValue?.number.formattedContent || cellValue?.number.content || ""}</span>`;
} else if (cellValue.type === "mSelect" || cellValue.type === "select") {
@@ -1189,7 +1189,7 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0, showIcon = tru
cellValue.type === "lineNumber" ||
(cellValue.type === "number" && cellValue.number?.isNotEmpty) ||
(cellValue.type === "block" && cellValue.block?.content)) {
- text += '<span data-type="copy" class="block__icon"><svg><use xlink:href="#iconCopy"></use></svg></span>';
+ text += `<button class="av__cell-action ariaLabel" type="button" data-position="4north" aria-label="${window.siyuan.languages.copy}" data-type="copy"><svg><use xlink:href="#iconCopy"></use></svg></button>`;
}
return text;
};