diff --git a/app/src/protyle/export/util.ts b/app/src/protyle/export/util.ts index 70cc16284..b047bef80 100644 --- a/app/src/protyle/export/util.ts +++ b/app/src/protyle/export/util.ts @@ -111,18 +111,18 @@ export const exportImage = (id: string) => { watermarkPreviewElement.innerHTML = window.siyuan.config.export.imageWatermarkDesc; } else if (window.siyuan.config.export.imageWatermarkStr) { if (window.siyuan.config.export.imageWatermarkStr.startsWith("http")) { - watermarkPreviewElement.setAttribute("style", `background-image: url(${window.siyuan.config.export.imageWatermarkStr});background-repeat: repeat;position: absolute;top: 0;left: 0;width: 100%;height: 100%;border-radius: var(--b3-border-radius-b);`) + watermarkPreviewElement.setAttribute("style", `background-image: url(${window.siyuan.config.export.imageWatermarkStr});background-repeat: repeat;position: absolute;top: 0;left: 0;width: 100%;height: 100%;border-radius: var(--b3-border-radius-b);`); } else { addScript("/stage/protyle/js/html2canvas.min.js?v=1.4.1", "protyleHtml2canvas").then(() => { - const width = Math.max(exportDialog.element.querySelector('.export-img').clientWidth / 3, 150); - watermarkPreviewElement.setAttribute("style", `width: ${width}px;height: ${width}px;display: flex;justify-content: center;align-items: center;color: var(--b3-border-color);font-size: 14px;`) + const width = Math.max(exportDialog.element.querySelector(".export-img").clientWidth / 3, 150); + watermarkPreviewElement.setAttribute("style", `width: ${width}px;height: ${width}px;display: flex;justify-content: center;align-items: center;color: var(--b3-border-color);font-size: 14px;`); watermarkPreviewElement.innerHTML = `
${window.siyuan.config.export.imageWatermarkStr}
`; window.html2canvas(watermarkPreviewElement, { useCORS: true, scale: 1, }).then((canvas) => { watermarkPreviewElement.innerHTML = ""; - watermarkPreviewElement.setAttribute("style", `background-image: url(${canvas.toDataURL("image/png")});background-repeat: repeat;position: absolute;top: 0;left: 0;width: 100%;height: 100%;border-radius: var(--b3-border-radius-b);`) + watermarkPreviewElement.setAttribute("style", `background-image: url(${canvas.toDataURL("image/png")});background-repeat: repeat;position: absolute;top: 0;left: 0;width: 100%;height: 100%;border-radius: var(--b3-border-radius-b);`); }); }); } @@ -130,7 +130,7 @@ export const exportImage = (id: string) => { } else { watermarkPreviewElement.removeAttribute("style"); } - } + }; const refreshPreview = (response: IWebSocketData) => { previewElement.innerHTML = response.data.content; // https://github.com/siyuan-note/siyuan/issues/9685 diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts index c8c453b24..51d39cb04 100644 --- a/app/src/protyle/render/av/asset.ts +++ b/app/src/protyle/render/av/asset.ts @@ -125,7 +125,7 @@ export const updateAssetCell = (options: { } const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item); const rowID = (hasClosestByClassName(item, "av__row") as HTMLElement).dataset.id; - const oldValue = JSON.parse(JSON.stringify(cellValue)) + const oldValue = JSON.parse(JSON.stringify(cellValue)); if (elementIndex === 0) { if (options.type === "remove") { cellValue.mAsset.find((oldItem, index) => { @@ -317,7 +317,7 @@ export const addAssetLink = (protyle: IProtyle, data: IAV, cellElements: HTMLEle }); }; -export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLElement, avID: string, blockElement: Element) => { +export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLElement, avID: string) => { const msgId = showMessage(window.siyuan.languages.uploading, 0); fetchPost("/api/asset/insertLocalAssets", { assetPaths: files, diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index d05d475ec..0810e9535 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -56,7 +56,7 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement) }); cellValue.mSelect = mSelect; } else if (["date", "created", "updated"].includes(colType)) { - cellValue[colType as "date"] = JSON.parse(cellElement.querySelector(".av__celltext").getAttribute("data-value")) + cellValue[colType as "date"] = JSON.parse(cellElement.querySelector(".av__celltext").getAttribute("data-value")); } else if (colType === "checkbox") { cellValue.checkbox = { checked: cellElement.querySelector("use").getAttribute("xlink:href") === "#iconCheck" ? true : false @@ -67,16 +67,16 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement) contents: Array.from(cellElement.querySelectorAll("span")).map((item: HTMLElement) => item.textContent), }; } else if (colType === "mAsset") { - const mAsset: IAVCellAssetValue[] = [] + const mAsset: IAVCellAssetValue[] = []; Array.from(cellElement.children).forEach((item) => { - const isImg = item.classList.contains("av__cellassetimg") + const isImg = item.classList.contains("av__cellassetimg"); mAsset.push({ type: isImg ? "image" : "file", content: isImg ? item.getAttribute("src") : item.getAttribute("data-url"), name: isImg ? "" : item.textContent - }) - }) - cellValue.mAsset = mAsset + }); + }); + cellValue.mAsset = mAsset; } if (colType === "block") { cellValue.isDetached = cellElement.dataset.detached === "true"; @@ -313,7 +313,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type event.preventDefault(); event.stopPropagation(); } - }) + }); } inputElement.addEventListener("keydown", (event) => { if (event.isComposing) { diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 25477d580..a053a1d93 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -894,7 +894,7 @@ export const openMenuPanel = (options: { break; } else if (type === "removeCol") { const colId = menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id"); - let previousID: string + let previousID: string; const colData = data.view.columns.find((item: IAVColumn, index) => { if (item.id === colId) { previousID = data.view.columns[index - 1]?.id; diff --git a/app/src/protyle/render/av/rollup.ts b/app/src/protyle/render/av/rollup.ts index d37843ade..8447310f0 100644 --- a/app/src/protyle/render/av/rollup.ts +++ b/app/src/protyle/render/av/rollup.ts @@ -13,7 +13,7 @@ const updateCol = (protyle: IProtyle, data: IAV, colId: string, itemElement: HTM if (item.id === colId) { return true; } - }) + }); transaction(protyle, [{ action: "updateAttrViewColRollup", id: colId, @@ -28,8 +28,8 @@ const updateCol = (protyle: IProtyle, data: IAV, colId: string, itemElement: HTM // operation.ParentID 汇总列基于的关联列 ID // operation.KeyID 目标列 ID // operation.Data 计算方式 - }]) -} + }]); +}; const genSearchList = (element: Element, keyword: string, avId: string, cb?: () => void) => { fetchPost("/api/av/searchAttributeViewRelationKey", { @@ -115,8 +115,8 @@ export const goSearchRollupCol = (options: { export const goSearchRollupTarget = (avId: string, target: HTMLElement) => { -} +}; export const goSearchRollupCalc = (avId: string, target: HTMLElement) => { -} +}; diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts index b06da6ea2..a5ccef810 100644 --- a/app/src/protyle/render/av/select.ts +++ b/app/src/protyle/render/av/select.ts @@ -500,7 +500,7 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H }); return true; } - }) + }); if (item.classList.contains("custom-attr__avvalue")) { item.innerHTML = genAVValueHTML(cellValue); } else { diff --git a/app/src/protyle/upload/index.ts b/app/src/protyle/upload/index.ts index 79c7e35f1..080f9de62 100644 --- a/app/src/protyle/upload/index.ts +++ b/app/src/protyle/upload/index.ts @@ -125,12 +125,12 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => { const path = response.data.succMap[key]; const type = pathPosix().extname(key).toLowerCase(); const filename = protyle.options.upload.filename(key); - const name = filename.substring(0, filename.length - type.length) + const name = filename.substring(0, filename.length - type.length); avAssets.push({ type: Constants.SIYUAN_ASSETS_IMAGE.includes(type) ? "image" : "file", content: path, name: name - }) + }); succFileText += genAssetHTML(type, path, name, filename); if (!Constants.SIYUAN_ASSETS_AUDIO.includes(type) && !Constants.SIYUAN_ASSETS_VIDEO.includes(type) && keys.length - 1 !== index) { @@ -146,7 +146,7 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => { if ((nodeElement && nodeElement.classList.contains("av"))) { updateCellsValue(protyle, nodeElement, avAssets); document.querySelector(".av__panel")?.remove(); - return + return; } if (document.querySelector(".av__panel")) { const blockElement = hasClosestBlock(protyle.wysiwyg.element.querySelector(".av__cell--select")); diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index 5a7bdcc92..362a5871d 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -1016,7 +1016,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { for (let i = 0; i < event.dataTransfer.files.length; i++) { files.push(event.dataTransfer.files[i].path); } - dragUpload(files, protyle, cellElement, avElement.dataset.avId, avElement); + dragUpload(files, protyle, cellElement, avElement.dataset.avId); } } }