This commit is contained in:
Vanessa 2023-07-01 17:06:28 +08:00
parent 23bece401f
commit 45c389629a
9 changed files with 32 additions and 32 deletions

View File

@ -68,7 +68,7 @@ export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement
} else {
refElement.innerHTML = "*";
}
}
};
anchorElement.addEventListener("input", (event: KeyboardEvent) => {
if (event.isComposing) {
return;

View File

@ -49,4 +49,4 @@ export const emitOpenMenu = (options: {
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
}
}
}
};

View File

@ -5,7 +5,7 @@ import {
} from "../util/selection";
import {fetchPost} from "../../util/fetch";
import {replaceFileName, validateName} from "../../editor/rename";
import {MenuItem, subMenu} from "../../menus/Menu";
import {MenuItem} from "../../menus/Menu";
import {
copySubMenu,
movePathToMenu,

View File

@ -133,18 +133,18 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
if (checkElement) {
window.siyuan.menus.menu.remove();
const rowElement = checkElement.parentElement;
const useElement = checkElement.querySelector("use")
const useElement = checkElement.querySelector("use");
if (rowElement.classList.contains("av__row--header")) {
if ("#iconCheck" === useElement.getAttribute("xlink:href")) {
rowElement.parentElement.querySelectorAll(".av__firstcol").forEach(item => {
item.querySelector("use").setAttribute("xlink:href", "#iconUncheck");
item.parentElement.classList.remove("av__row--select");
})
});
} else {
rowElement.parentElement.querySelectorAll(".av__firstcol").forEach(item => {
item.querySelector("use").setAttribute("xlink:href", "#iconCheck");
item.parentElement.classList.add("av__row--select");
})
});
}
} else {
if (useElement.getAttribute("xlink:href") === "#iconUncheck") {
@ -181,7 +181,7 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
return false;
}
if (rowElement.classList.contains("av__row--header")) {
return false
return false;
}
const blockElement = hasClosestBlock(rowElement);
if (!blockElement) {

View File

@ -51,9 +51,9 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC
}
const avMaskElement = document.querySelector(".av__mask");
const inputElement = avMaskElement.querySelector(".b3-text-field") as HTMLInputElement;
const cellId = cellElement.getAttribute("data-id")
const avId = blockElement.getAttribute("data-av-id")
const rowId = rowElement.getAttribute("data-id")
const cellId = cellElement.getAttribute("data-id");
const avId = blockElement.getAttribute("data-av-id");
const rowId = rowElement.getAttribute("data-id");
transaction(protyle, [{
action: "updateAttrViewCell",
id: cellId,
@ -90,7 +90,7 @@ const removeCol = (cellElement: HTMLElement) => {
export const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellElement: HTMLElement) => {
const type = cellElement.getAttribute("data-dtype") as TAVCol;
const menu = new Menu("av-header-cell", () => {
const newValue = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value
const newValue = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value;
if (newValue === cellElement.textContent.trim()) {
return;
}

View File

@ -14,26 +14,26 @@ export const updateHeader = (rowElement: HTMLElement) => {
if (!blockElement) {
return;
}
const selectCount = rowElement.parentElement.querySelectorAll(".av__row--select:not(.av__row--header)").length
const diffCount = rowElement.parentElement.childElementCount - 3 - selectCount
const headElement = rowElement.parentElement.firstElementChild
const headUseElement = headElement.querySelector("use")
const counterElement = blockElement.querySelector(".av__counter")
const avHeadElement = blockElement.querySelector(".av__header") as HTMLElement
const selectCount = rowElement.parentElement.querySelectorAll(".av__row--select:not(.av__row--header)").length;
const diffCount = rowElement.parentElement.childElementCount - 3 - selectCount;
const headElement = rowElement.parentElement.firstElementChild;
const headUseElement = headElement.querySelector("use");
const counterElement = blockElement.querySelector(".av__counter");
const avHeadElement = blockElement.querySelector(".av__header") as HTMLElement;
if (diffCount === 0) {
headElement.classList.add("av__row--select");
headUseElement.setAttribute("xlink:href", "#iconCheck");
} else if (diffCount === rowElement.parentElement.childElementCount - 3) {
headElement.classList.remove("av__row--select");
headUseElement.setAttribute("xlink:href", "#iconUncheck");
counterElement.classList.add("fn__none")
avHeadElement.style.position = ""
counterElement.classList.add("fn__none");
avHeadElement.style.position = "";
return;
} else if (diffCount > 0) {
headElement.classList.add("av__row--select");
headUseElement.setAttribute("xlink:href", "#iconIndeterminateCheck");
}
counterElement.classList.remove("fn__none")
counterElement.innerHTML = `${selectCount} selected`
avHeadElement.style.position = "sticky"
}
counterElement.classList.remove("fn__none");
counterElement.innerHTML = `${selectCount} selected`;
avHeadElement.style.position = "sticky";
};

View File

@ -48,19 +48,19 @@ export const avRender = (element: Element, cb?: () => void) => {
</div>
<div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>`;
row.cells.forEach((cell, index) => {
let text: string
let text: string;
if (cell.valueType === "text") {
text = cell.value?.text.content || ""
text = cell.value?.text.content || "";
} else if (cell.valueType === "block") {
text = cell.value?.block.content || ""
text = cell.value?.block.content || "";
} else if (cell.valueType === "number") {
text = cell.value?.number.content || ""
text = cell.value?.number.content || "";
} else if (cell.valueType === "select") {
text = cell.value?.select.content || ""
text = cell.value?.select.content || "";
} else if (cell.valueType === "mSelect") {
text = cell.value?.mSelect.content || ""
text = cell.value?.mSelect.content || "";
} else if (cell.valueType === "date") {
text = cell.value?.date.content || ""
text = cell.value?.date.content || "";
}
tableHTML += `<div class="av__cell" ${index === 0 ? 'data-block-id="' + (cell.value.block.id || "") + '"' : ""} data-id="${cell.id}" data-index="${index}" style="width: ${data.columns[index].width || 200}px;${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
});

View File

@ -15,7 +15,7 @@ import {Link} from "./Link";
import {setPosition} from "../../util/setPosition";
import {updateTransaction} from "../wysiwyg/transaction";
import {Constants} from "../../constants";
import {getEventName, openByMobile, setStorageVal} from "../util/compatibility";
import {openByMobile, setStorageVal} from "../util/compatibility";
import {upDownHint} from "../../util/upDownHint";
import {highlightRender} from "../render/highlightRender";
import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";

View File

@ -1015,7 +1015,7 @@ const replace = (element: Element, config: ISearchOption, edit: Protyle, app: Ap
if (isAll) {
return;
}
const rootId = currentList.getAttribute("data-root-id")
const rootId = currentList.getAttribute("data-root-id");
getAllModels().editor.forEach(item => {
if (rootId === item.editor.protyle.block.rootID) {
reloadProtyle(item.editor.protyle, false);