style: Improve database entry select

This commit is contained in:
Jeffrey Chen 2024-12-22 10:16:36 +08:00
parent 811636d051
commit 9c4879e6be

View file

@ -52,7 +52,7 @@ import {hideTooltip} from "../../dialog/tooltip";
import {appearanceMenu} from "../toolbar/Font";
import {setPosition} from "../../util/setPosition";
import {emitOpenMenu} from "../../plugin/EventBus";
import {insertAttrViewBlockAnimation} from "../render/av/row";
import {insertAttrViewBlockAnimation, updateHeader} from "../render/av/row";
import {avContextmenu, duplicateCompletely} from "../render/av/action";
import {getPlainText} from "../util/paste";
import {addEditorToDatabase} from "../render/av/addToDatabase";
@ -94,7 +94,10 @@ export class Gutter {
return true;
}
});
avElement.querySelector(`.av__row[data-id="${buttonElement.dataset.rowId}"]`).classList.add("av__row--select");
const rowElement = avElement.querySelector(`.av__row[data-id="${buttonElement.dataset.rowId}"]`);
rowElement.classList.add("av__row--select");
rowElement.querySelector(".av__firstcol use").setAttribute("xlink:href", "#iconCheck");
updateHeader(rowElement as HTMLElement);
avElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach(item => {
selectIds.push(item.getAttribute("data-id"));
selectElements.push(item);
@ -437,7 +440,7 @@ export class Gutter {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${buttonElement.getAttribute("data-node-id")}"]`)).find(item => {
if (!isInEmbedBlock(item) && this.isMatchNode(item)) {
const rowItem = item.querySelector(`.av__row[data-id="${buttonElement.dataset.rowId}"]`);
Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--hl, av__row--hl")).forEach(hlItem => {
Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--hl, .av__row--hl")).forEach(hlItem => {
if (!item.isSameNode(hlItem)) {
hlItem.classList.remove("protyle-wysiwyg--hl");
}