diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts
index 01fcce446..9c8923d7e 100644
--- a/app/src/menus/navigation.ts
+++ b/app/src/menus/navigation.ts
@@ -472,7 +472,7 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
}).element);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
}
- openEditorTab(app, id, notebookId, pathString)
+ openEditorTab(app, id, notebookId, pathString);
if (!window.siyuan.config.readonly) {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.fileHistory,
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index 2960ab15b..10c5e5d99 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -7,7 +7,7 @@ import {copySubMenu} from "../../../menus/commonMenuItem";
import {popTextCell} from "./cell";
const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellElement: HTMLElement) => {
- const type = cellElement.getAttribute("data-dtype") as TAVCol
+ const type = cellElement.getAttribute("data-dtype") as TAVCol;
const menu = new Menu("av-header-cell");
menu.addItem({
icon: getIconByType(type),
@@ -67,7 +67,7 @@ const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellEl
icon: "iconTrashcan",
label: window.siyuan.languages.delete,
click() {
- const id = cellElement.getAttribute("data-id")
+ const id = cellElement.getAttribute("data-id");
transaction(protyle, [{
action: "removeAttrViewCol",
id,
@@ -79,7 +79,7 @@ const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellEl
type: type,
id
}]);
- removeCol(cellElement)
+ removeCol(cellElement);
}
});
menu.addSeparator();
@@ -123,7 +123,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
- addCol(protyle, blockElement, id, type)
+ addCol(protyle, blockElement, id, type);
}
});
const addRect = addElement.getBoundingClientRect();
@@ -140,11 +140,11 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
const cellElement = hasClosestByClassName(event.target, "av__cell");
if (cellElement && blockElement) {
if (cellElement.parentElement.classList.contains("av__row--header")) {
- showHeaderCellMenu(protyle, blockElement, cellElement)
+ showHeaderCellMenu(protyle, blockElement, cellElement);
event.preventDefault();
event.stopPropagation();
} else {
- popTextCell(protyle, cellElement)
+ popTextCell(protyle, cellElement);
}
return true;
}
@@ -202,22 +202,22 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
click() {
}
- })
- const editAttrSubmenu: IMenu[] = []
+ });
+ const editAttrSubmenu: IMenu[] = [];
rowElement.parentElement.querySelectorAll(".av__row--header .av__cell").forEach((cellElement) => {
editAttrSubmenu.push({
icon: getIconByType(cellElement.getAttribute("data-dtype") as TAVCol),
label: cellElement.textContent.trim(),
click() {
}
- })
+ });
});
menu.addItem({
icon: "iconList",
label: window.siyuan.languages.attr,
type: "submenu",
submenu: editAttrSubmenu
- })
+ });
menu.open({
x: event.clientX,
y: event.clientY,
@@ -225,55 +225,55 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
event.preventDefault();
event.stopPropagation();
return true;
-}
+};
const addCol = (protyle: IProtyle, blockElement: HTMLElement, id: string, type: TAVCol) => {
- let index = "0"
+ let index = "0";
blockElement.querySelectorAll(".av__row--header .av__cell").forEach((item) => {
- const dataIndex = item.getAttribute("data-index")
+ const dataIndex = item.getAttribute("data-index");
if (dataIndex > index) {
- index = dataIndex
+ index = dataIndex;
}
- })
+ });
blockElement.querySelectorAll(".av__row").forEach((item, index) => {
- let html = ''
+ let html = "";
if (index === 0) {
html = `
Text
-
`
+`;
} else {
- html = ``
+ html = ``;
}
- item.lastElementChild.insertAdjacentHTML("beforebegin", html)
- })
- showHeaderCellMenu(protyle, blockElement, blockElement.querySelector(".av__row--header").lastElementChild.previousElementSibling as HTMLElement)
-}
+ item.lastElementChild.insertAdjacentHTML("beforebegin", html);
+ });
+ showHeaderCellMenu(protyle, blockElement, blockElement.querySelector(".av__row--header").lastElementChild.previousElementSibling as HTMLElement);
+};
const removeCol = (cellElement: HTMLElement) => {
- const index = cellElement.getAttribute("data-index")
+ const index = cellElement.getAttribute("data-index");
const blockElement = hasClosestBlock(cellElement);
if (!blockElement) {
return false;
}
blockElement.querySelectorAll(".av__row").forEach((item) => {
item.querySelector(`[data-index="${index}"]`).remove;
- })
-}
+ });
+};
export const addAVRow = (blockElement: HTMLElement, ids: string[], previousID: string) => {
- const rowElement = previousID ? blockElement.querySelector(`[data-id=${previousID}]`) : blockElement.querySelector(".av__row--header")
- let html = ''
+ const rowElement = previousID ? blockElement.querySelector(`[data-id=${previousID}]`) : blockElement.querySelector(".av__row--header");
+ let html = "";
ids.forEach((id) => {
- html += ``;
+ html += "
";
Array.from(rowElement.children).forEach((item: HTMLElement, index) => {
if (index === 0 || index === rowElement.childElementCount - 1) {
- return
+ return;
}
html += `
";
- })
+ });
rowElement.insertAdjacentHTML("afterend", html);
-}
+};
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 45dce8b7a..7259eebad 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -3,8 +3,8 @@ import {hasClosestBlock} from "../../util/hasClosest";
export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
const type = cellElement.parentElement.parentElement.firstElementChild.children[parseInt(cellElement.getAttribute("data-index")) + 1].getAttribute("data-dtype") as TAVCol;
- const cellRect = cellElement.getBoundingClientRect()
- let html = ""
+ const cellRect = cellElement.getBoundingClientRect();
+ let html = "";
if (type === "block") {
html = `
`;
}
@@ -16,33 +16,33 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
if (inputElement) {
inputElement.select();
inputElement.addEventListener("blur", () => {
- updateCellValue(protyle, cellElement, type)
- })
+ updateCellValue(protyle, cellElement, type);
+ });
inputElement.addEventListener("keydown", (event) => {
if (event.isComposing) {
- return
+ return;
}
if (event.key === "Escape" || event.key === "Enter") {
- updateCellValue(protyle, cellElement, type)
+ updateCellValue(protyle, cellElement, type);
event.preventDefault();
event.stopPropagation();
}
- })
+ });
}
avMaskElement.addEventListener("click", (event) => {
if ((event.target as HTMLElement).classList.contains("av__mask")) {
avMaskElement?.remove();
}
- })
+ });
};
const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVCol) => {
const avMaskElement = document.querySelector(".av__mask");
const inputElement = avMaskElement.querySelector(".b3-text-field") as HTMLInputElement;
- const blockElement = hasClosestBlock(cellElement)
+ const blockElement = hasClosestBlock(cellElement);
if (!blockElement) {
- return
+ return;
}
transaction(protyle, [{
action: "updateAttrViewCell",
@@ -60,5 +60,5 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC
cellElement.textContent = inputElement.value;
setTimeout(() => {
avMaskElement.remove();
- })
-}
+ });
+};
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 6aa1973e7..fe71dd1c6 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -29,7 +29,7 @@ export const avRender = (element: Element) => {
const data = response.data.av;
// header
let tableHTML = '