From d1fad76bf89c5744fc546cb517e540c5237c99d5 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 27 Oct 2022 11:34:34 +0800 Subject: [PATCH] :rotating_light: --- app/src/block/util.ts | 2 +- app/src/config/appearance.ts | 38 ++++++++++++++++----------------- app/src/layout/index.ts | 2 +- app/src/layout/util.ts | 2 +- app/src/protyle/scroll/event.ts | 8 +++---- app/src/util/onGetConfig.ts | 6 +++--- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/app/src/block/util.ts b/app/src/block/util.ts index 8a105154b..02fb86085 100644 --- a/app/src/block/util.ts +++ b/app/src/block/util.ts @@ -111,7 +111,7 @@ export const insertEmptyBlock = (protyle: IProtyle, position: InsertPosition, id updateListOrder(newElement.parentElement, orderIndex); updateTransaction(protyle, newElement.parentElement.getAttribute("data-node-id"), newElement.parentElement.outerHTML, parentOldHTML); } else { - let doOperations: IOperation[] + let doOperations: IOperation[]; if (position === "beforebegin") { doOperations = [{ action: "insert", diff --git a/app/src/config/appearance.ts b/app/src/config/appearance.ts index 89e271908..32e63f234 100644 --- a/app/src/config/appearance.ts +++ b/app/src/config/appearance.ts @@ -267,7 +267,7 @@ export const appearance = { _bindSnippet: (element: HTMLElement) => { const itemContentElement = hasClosestByClassName(element, "b3-label"); if (!itemContentElement) { - return + return; } fetchPost("/api/snippet/setSnippet", { id: itemContentElement.getAttribute("data-id"), @@ -276,9 +276,9 @@ export const appearance = { content: itemContentElement.querySelector("textarea").value, enabled: (itemContentElement.querySelector(".b3-switch") as HTMLInputElement).checked }, (response) => { - itemContentElement.setAttribute("data-id", response.data.id) + itemContentElement.setAttribute("data-id", response.data.id); renderSnippet(); - }) + }); }, _genSnippet: (options: ISnippet) => { return `
@@ -295,7 +295,7 @@ export const appearance = {
-` +`; }, bindEvent: () => { if (window.siyuan.config.appearance.customCSS) { @@ -329,19 +329,19 @@ export const appearance = { }); codeSnippetPanelElement.innerHTML = html; response.data.snippets.forEach((item: ISnippet) => { - const nameElement = (codeSnippetPanelElement.querySelector(`[data-id="${item.id}"] input`) as HTMLInputElement) + const nameElement = (codeSnippetPanelElement.querySelector(`[data-id="${item.id}"] input`) as HTMLInputElement); nameElement.value = item.name; const contentElement = codeSnippetPanelElement.querySelector(`[data-id="${item.id}"] textarea`) as HTMLTextAreaElement; contentElement.textContent = item.content; - nameElement.addEventListener("blur", (event) => { + nameElement.addEventListener("blur", () => { appearance._bindSnippet(nameElement); - }) - contentElement.addEventListener("blur", (event) => { + }); + contentElement.addEventListener("blur", () => { appearance._bindSnippet(contentElement); - }) - codeSnippetPanelElement.querySelector(`[data-id="${item.id}"] .b3-switch`).addEventListener("change", (event) => { + }); + codeSnippetPanelElement.querySelector(`[data-id="${item.id}"] .b3-switch`).addEventListener("change", () => { appearance._bindSnippet(contentElement); - }) + }); }); }); }); @@ -353,19 +353,19 @@ export const appearance = { name: "", content: "", enabled: false - })) + })); codeSnippetPanelElement.querySelector(".b3-text-field").addEventListener("blur", (event) => { appearance._bindSnippet(event.target as HTMLElement); - }) + }); codeSnippetPanelElement.querySelector("textarea.b3-text-field").addEventListener("blur", (event) => { appearance._bindSnippet(event.target as HTMLElement); - }) - codeSnippetPanelElement.querySelector('.b3-switch').addEventListener("change", (event) => { + }); + codeSnippetPanelElement.querySelector(".b3-switch").addEventListener("change", (event) => { appearance._bindSnippet(event.target as HTMLElement); - }) + }); return; } - const removeElement = hasClosestByClassName(target, "b3-tooltips") + const removeElement = hasClosestByClassName(target, "b3-tooltips"); if (removeElement) { const id = removeElement.parentElement.parentElement.getAttribute("data-id"); removeElement.parentElement.parentElement.remove(); @@ -379,9 +379,9 @@ export const appearance = { if (exitElement) { exitElement.remove(); } - }) + }); } - }) + }); const appearanceCustomElement = appearance.element.querySelector("#appearanceCustom"); appearanceCustomElement.addEventListener("click", () => { if (window.siyuan.config.appearance.customCSS) { diff --git a/app/src/layout/index.ts b/app/src/layout/index.ts index 5ff3dd580..00c7910d8 100644 --- a/app/src/layout/index.ts +++ b/app/src/layout/index.ts @@ -82,7 +82,7 @@ export class Layout { if (this.direction === "lr") { // 向右分屏,左侧文档抖动,移除动画和边距 item.element.querySelectorAll(".protyle-wysiwyg").forEach((element: HTMLElement) => { - element.style.transition = "none" + element.style.transition = "none"; element.style.paddingRight = "16px"; element.style.paddingLeft = "24px"; }); diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 9764c0fb1..4ab45ef1c 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -455,7 +455,7 @@ export const resizeTabs = () => { } item.editors.forEach(editorItem => { hideElements(["gutter"], editorItem.protyle); - }) + }); }); pdfResize(); }, 200); diff --git a/app/src/protyle/scroll/event.ts b/app/src/protyle/scroll/event.ts index 436df0a76..782306833 100644 --- a/app/src/protyle/scroll/event.ts +++ b/app/src/protyle/scroll/event.ts @@ -7,10 +7,10 @@ import {updateHotkeyTip} from "../util/compatibility"; import {isMobile} from "../../util/functions"; import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest"; -let getIndexTimeout: number +let getIndexTimeout: number; export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => { let elementRect = element.getBoundingClientRect(); - element.addEventListener("scroll", (event) => { + element.addEventListener("scroll", () => { if (!protyle.toolbar.element.classList.contains("fn__none")) { const initY = protyle.toolbar.element.getAttribute("data-inity").split(Constants.ZWSP); const top = parseInt(initY[0]) + (parseInt(initY[1]) - element.scrollTop); @@ -46,7 +46,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => { clearTimeout(getIndexTimeout); getIndexTimeout = window.setTimeout(() => { elementRect = element.getBoundingClientRect(); - const targetElement = document.elementFromPoint(elementRect.left + elementRect.width / 2, elementRect.top + 10) + const targetElement = document.elementFromPoint(elementRect.left + elementRect.width / 2, elementRect.top + 10); const blockElement = hasClosestBlock(targetElement); if (!blockElement) { if (hasClosestByClassName(targetElement, "protyle-background") || @@ -61,7 +61,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => { if (!response.data) { return; } - const inputElement = protyle.scroll.element.querySelector(".b3-slider") as HTMLInputElement + const inputElement = protyle.scroll.element.querySelector(".b3-slider") as HTMLInputElement; inputElement.value = response.data; protyle.scroll.element.setAttribute("aria-label", `Blocks ${response.data}/${protyle.block.blockCount}`); }); diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.ts index 73223eba8..a93e71d86 100644 --- a/app/src/util/onGetConfig.ts +++ b/app/src/util/onGetConfig.ts @@ -160,17 +160,17 @@ export const onGetConfig = (isStart: boolean) => { mountHelp(); } - let para = { + const para = { "version": Constants.SIYUAN_VERSION, "isLoggedIn": "false", "subscriptionStatus": "-1", "subscriptionPlan": "-1", "subscriptionType": "-1", - } + }; if (window.siyuan.user) { para.isLoggedIn = "true"; if (0 === window.siyuan.user.userSiYuanSubscriptionStatus) { - console.log(window.siyuan.user) + console.log(window.siyuan.user); para.subscriptionStatus = window.siyuan.user.userSiYuanSubscriptionStatus.toString(); para.subscriptionPlan = window.siyuan.user.userSiYuanSubscriptionPlan.toString(); para.subscriptionType = window.siyuan.user.userSiYuanSubscriptionType.toString();