🎨 database

This commit is contained in:
Vanessa 2023-08-01 22:09:07 +08:00
parent 7e1d5c0a26
commit e467744165
2 changed files with 6 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import {addCol} from "./addCol";
import {openMenuPanel} from "./openMenuPanel";
import {hintRef} from "../../hint/extend";
import {hideElements} from "../../ui/hideElements";
import {focusByRange} from "../../util/selection";
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
const blockElement = hasClosestBlock(event.target);
@ -135,6 +136,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
if (protyle.hint.element.classList.contains("fn__none")) {
protyle.toolbar.range = document.createRange();
protyle.toolbar.range.selectNodeContents(blockElement.querySelector(".av__title"));
focusByRange(protyle.toolbar.range);
hintRef("", protyle, "av");
} else {
hideElements(["hint"], protyle);
@ -187,6 +189,7 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
icon: "iconTrashcan",
label: window.siyuan.languages.delete,
click() {
const previousElement = rowElement.previousElementSibling as HTMLElement;
transaction(protyle, [{
action: "removeAttrViewBlock",
srcIDs: blockIds,
@ -194,10 +197,11 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
}], [{
action: "insertAttrViewBlock",
avID: blockElement.getAttribute("data-av-id"),
previousID: rowElement.previousElementSibling?.getAttribute("data-id") || "",
previousID: previousElement?.getAttribute("data-id") || "",
srcIDs: rowIds,
}]);
rowElement.remove();
updateHeader(previousElement);
}
});
if (rowIds.length === 1) {

View file

@ -240,7 +240,7 @@ export const updateHeader = (rowElement: HTMLElement) => {
const headUseElement = headElement.querySelector("use");
const counterElement = blockElement.querySelector(".av__counter");
const avHeadElement = blockElement.querySelector(".av__header") as HTMLElement;
if (diffCount === 0) {
if (diffCount === 0 && rowElement.parentElement.childElementCount - 3 !== 0) {
headElement.classList.add("av__row--select");
headUseElement.setAttribute("xlink:href", "#iconCheck");
} else if (diffCount === rowElement.parentElement.childElementCount - 3) {