Vanessa 2025-06-25 13:22:04 +08:00
parent d5f415ba3f
commit a9fb82a5fc
4 changed files with 48 additions and 14 deletions

View file

@ -410,12 +410,6 @@
display: none;
}
&[data-dtype="mAsset"],
&[data-dtype="mSelect"],
&[data-dtype="select"] {
margin-left: -2px;
}
&:hover .b3-chip[data-type=block-more] {
top: 2px;
display: block;
@ -427,14 +421,28 @@
white-space: pre-wrap;
}
&:not(.av__gallery-fields--edit) .av__cell {
&[data-dtype="mAsset"],
&[data-dtype="mSelect"],
&[data-dtype="select"] {
margin-left: -2px;
}
}
&--edit {
.av__cell {
min-height: 1.625em;
}
&[data-empty="true"]:after {
content: attr(aria-label);
position: absolute;
color: var(--b3-theme-on-surface-light);
.av__cell[data-empty="true"] .av__gallery-tip {
display: flex;
}
.av__cell {
&[data-dtype="mAsset"][data-empty="false"],
&[data-dtype="mSelect"][data-empty="false"],
&[data-dtype="select"][data-empty="false"] {
margin-left: -2px;
}
}
}
@ -470,6 +478,26 @@
transition: var(--b3-transition);
z-index: 2;
}
&-tip {
display: none;
align-items: center;
opacity: 0.38;
img, svg {
height: calc(1.625em - 8px);
width: calc(1.625em - 8px);
margin: 0 5px 0 0;
font-size: 1em;
}
span {
width: calc(1.625em - 8px);
margin: 0 5px 0 0;
height: 1.625em;
font-size: 1em;
}
}
}
&__layout {

View file

@ -124,7 +124,7 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement)
} else if (colType === "mAsset") {
const mAsset: IAVCellAssetValue[] = [];
Array.from(cellElement.children).forEach((item) => {
if (item.classList.contains("av__drag-fill")) {
if (!item.classList.contains("av__celltext--url") && !item.classList.contains("av__cellassetimg")) {
return;
}
const isImg = item.classList.contains("av__cellassetimg");

View file

@ -10,6 +10,7 @@ import {addClearButton} from "../../../../util/addClearButton";
import {avRender, updateSearch} from "../render";
import {getViewIcon} from "../view";
import {processRender} from "../../../util/processCode";
import {getColIconByType} from "../col";
export const renderGallery = (options: {
blockElement: HTMLElement,
@ -92,7 +93,7 @@ export const renderGallery = (options: {
const isEmpty = cellValueIsEmpty(cell.value);
galleryHTML += `<div class="av__cell${checkClass} ariaLabel"
data-empty="${isEmpty}"
aria-label="${isEmpty ? window.siyuan.languages.edit + " " : ""}${escapeAttr(view.fields[fieldsIndex].name)}"
aria-label="${escapeAttr(view.fields[fieldsIndex].name)}"
data-position="5west"
data-id="${cell.id}"
data-field-id="${view.fields[fieldsIndex].id}"
@ -100,7 +101,13 @@ ${cell.valueType === "block" ? 'data-block-id="' + (cell.value.block.id || "") +
data-dtype="${cell.valueType}"
${cell.value?.isDetached ? ' data-detached="true"' : ""}
style="${cell.bgColor ? `background-color:${cell.bgColor};` : ""}
${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex, view.showIcon, "gallery")}</div>`;
${cell.color ? `color:${cell.color};` : ""}">
${renderCell(cell.value, rowIndex, view.showIcon, "gallery")}
<div class="av__gallery-tip">
${view.fields[fieldsIndex].icon ? unicode2Emoji(view.fields[fieldsIndex].icon, undefined, true) : `<svg><use xlink:href="#${getColIconByType(view.fields[fieldsIndex].type)}"></use></svg>`}
${window.siyuan.languages.edit} ${ Lute.EscapeHTMLStr(view.fields[fieldsIndex].name)}
</div>
</div>`;
});
galleryHTML += `</div>
<div class="av__gallery-actions">

View file

@ -659,7 +659,6 @@ export const getSelectHTML = (fields: IAVColumn[], cellElements: HTMLElement[],
return item;
}
});
let selectedHTML = "";
const selected: string[] = [];
cellValues[0].mSelect?.forEach((item) => {