diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index de7f8fd78..65d071cad 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -306,16 +306,16 @@ export const addAttrViewColAnimation = (options: { id: string }) => { if (!options.blockElement) { - return + return; } options.blockElement.querySelectorAll(".av__row").forEach((item, index) => { - let previousElement + let previousElement; if (options.previousId) { - previousElement = item.querySelector(`[data-col-id="${options.previousId}"]`) + previousElement = item.querySelector(`[data-col-id="${options.previousId}"]`); } else { previousElement = item.lastElementChild.previousElementSibling; } - let html = "" + let html = ""; if (index === 0) { html = `
@@ -323,40 +323,40 @@ export const addAttrViewColAnimation = (options: { ${options.name}
-
` +`; } else { - html = '
' + html = '
'; } - previousElement.insertAdjacentHTML("afterend", html) - }) + previousElement.insertAdjacentHTML("afterend", html); + }); window.siyuan.menus.menu.remove(); showColMenu(options.protyle, options.blockElement, options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${options.id}"]`)); }; export const updateAttrViewCellAnimation = (cellElement: HTMLElement) => { - cellElement.style.opacity = "0.38" + cellElement.style.opacity = "0.38"; cellElement.style.backgroundColor = "var(--b3-theme-surface-light)"; -} +}; export const removeAttrViewColAnimation = (blockElement: Element, id: string) => { blockElement.querySelectorAll(`.av__cell[data-col-id="${id}"]`).forEach(item => { item.remove(); - }) -} + }); +}; export const insertAttrViewBlockAnimation = (blockElement: Element, size: number, previousId: string) => { - const previousElement = blockElement.querySelector(`.av__row[data-id="${previousId}"]`) || blockElement.querySelector(`.av__row--header`); - let colHTML = "" + const previousElement = blockElement.querySelector(`.av__row[data-id="${previousId}"]`) || blockElement.querySelector(".av__row--header"); + let colHTML = ""; previousElement.querySelectorAll(".av__cell").forEach((item: HTMLElement) => { - colHTML += `
` - }) + colHTML += `
`; + }); - let html = "" + let html = ""; new Array(size).fill(1).forEach(() => { html += `
${colHTML} -
` - }) - previousElement.insertAdjacentHTML("afterend", html) -} +`; + }); + previousElement.insertAdjacentHTML("afterend", html); +}; diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index 5e7d11df2..39657f621 100644 --- a/app/src/protyle/render/av/col.ts +++ b/app/src/protyle/render/av/col.ts @@ -467,7 +467,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen type: type, id: colId }]); - removeAttrViewColAnimation(blockElement, colId) + removeAttrViewColAnimation(blockElement, colId); } }); menu.addSeparator(); diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index 593b7a73f..bfe9a139d 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -1,5 +1,5 @@ import {fetchPost} from "../../../util/fetch"; -import {getColIconByType, showColMenu} from "./col"; +import {getColIconByType} from "./col"; import {Constants} from "../../../constants"; import {getCalcValue} from "./cell"; import * as dayjs from "dayjs";