diff --git a/app/src/editor/index.ts b/app/src/editor/index.ts index 48188ff..c1425fd 100644 --- a/app/src/editor/index.ts +++ b/app/src/editor/index.ts @@ -57,7 +57,7 @@ export class Editor extends Model { if (data) { switch (data.cmd) { case "get": - this.parent.headElement.setAttribute("data-node-id", data.data.rootID) + this.parent.headElement.setAttribute("data-node-id", data.data.rootID); if (data.callback === Constants.CB_PUT_RELOAD) { this.reloadHTML(data.data.content); this.saved = true; @@ -289,7 +289,7 @@ export class Editor extends Model { this.saved = false; this.parent.headElement.classList.add("item--unsave"); if (process.env.NODE_ENV === "development") { - return + return; } clearTimeout(inputTimeout); inputTimeout = window.setTimeout(() => { @@ -364,7 +364,7 @@ export class Editor extends Model { return; } if (data.callback === Constants.CB_GETBLOCK_EMBED) { - const blockVditorElement = this.vditore.vditor.ir.element.querySelector(`[data-block-def-id="${data.id}"]`) as HTMLElement + const blockVditorElement = this.vditore.vditor.ir.element.querySelector(`[data-block-def-id="${data.id}"]`) as HTMLElement; blockVditorElement.setAttribute("data-render", "1"); blockVditorElement.innerHTML = data.block.content; mathRender(blockVditorElement, { diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index 4c5eb36..6924281 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -33,7 +33,7 @@ export const getIconByType = (type: string) => { iconName = "vditor-icon-table"; break; case "NodeMathBlock": - iconName = "iconMath" + iconName = "iconMath"; break; } return iconName; diff --git a/app/src/graph/index.ts b/app/src/graph/index.ts index 09dbc4b..7ae1d0d 100644 --- a/app/src/graph/index.ts +++ b/app/src/graph/index.ts @@ -115,12 +115,12 @@ export class Graph extends Model { public hlNode(id: string) { this.nodes.forEach((item) => { if (item.name === id) { - item.symbolSize = 30 + item.symbolSize = 30; } else { - item.symbolSize = item.originalSize + item.symbolSize = item.originalSize; } - }) - this.onGraph({nodes: this.nodes, links: this.links}) + }); + this.onGraph({nodes: this.nodes, links: this.links}); } public onGraph(data: { nodes: Record[], links: Record[], url?: string, path?: string }) { @@ -141,7 +141,7 @@ export class Graph extends Model { if (nodeElement && nodeElement.getClientRects().length > 0) { bgFade(nodeElement); vditorElement.scrollTop = nodeElement.offsetTop - vditorElement.clientHeight / 2; - this.hlNode(params.name) + this.hlNode(params.name); } return true; } @@ -151,10 +151,10 @@ export class Graph extends Model { } else { this.chart.resize(); } - this.nodes = data.nodes - this.links = data.links - const labelColor = window.liandi.config.theme === "dark" ? "#d1d5da" : "#24292e" - const labelLightColor = window.liandi.config.theme === "dark" ? "#959da5" : "#6a737d" + this.nodes = data.nodes; + this.links = data.links; + const labelColor = window.liandi.config.theme === "dark" ? "#d1d5da" : "#24292e"; + const labelLightColor = window.liandi.config.theme === "dark" ? "#959da5" : "#6a737d"; this.chart.setOption({ legend: { data: [{ @@ -207,7 +207,7 @@ export class Graph extends Model { }], draggable: false, label: { - position: 'bottom', + position: "bottom", color: labelColor, fontSize: 10, formatter: (params: IEchartsFormatter) => { @@ -228,11 +228,11 @@ export class Graph extends Model { }, emphasis: { lineStyle: { - color: '#f3a92f', + color: "#f3a92f", opacity: 0.38, }, itemStyle: { - color: '#f3a92f', + color: "#f3a92f", } }, edgeSymbol: ["none", "arrow"], diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts index d952f9c..bfcae7a 100644 --- a/app/src/menus/commonMenuItem.ts +++ b/app/src/menus/commonMenuItem.ts @@ -16,8 +16,8 @@ export const copyBlockId = () => { const itemData = window.liandi.menus.itemData; clipboard.writeText(itemData.target.getAttribute("data-node-id")); } - }) -} + }); +}; export const showInFolder = () => { return new remote.MenuItem({ label: i18n[window.liandi.config.lang].showInFolder, diff --git a/app/src/menus/file.ts b/app/src/menus/file.ts index b19f784..5fa1a49 100644 --- a/app/src/menus/file.ts +++ b/app/src/menus/file.ts @@ -1,5 +1,5 @@ import {remote} from "electron"; -import {copyBlockId, deleteMenu, newFileMenu, newFolderMenu, renameMenu, showInFolder} from "./commonMenuItem"; +import {deleteMenu, newFileMenu, newFolderMenu, renameMenu, showInFolder} from "./commonMenuItem"; export const initFolderMenu = () => { const menu = new remote.Menu(); diff --git a/app/src/menus/tab.ts b/app/src/menus/tab.ts index 19a1621..23df774 100644 --- a/app/src/menus/tab.ts +++ b/app/src/menus/tab.ts @@ -64,18 +64,18 @@ export const initEditorMenu = () => { }); newWnd.addTab(tab); - newWnd.element.classList.remove("fn__flex-1") - newWnd.element.style.width = "200px" - newWnd.element.after(currentTab.parent.element) - newWnd.element.after(newWnd.element.previousElementSibling) + newWnd.element.classList.remove("fn__flex-1"); + newWnd.element.style.width = "200px"; + newWnd.element.after(currentTab.parent.element); + newWnd.element.after(newWnd.element.previousElementSibling); newWnd.parent.children.find((item, index) => { if (item.id === newWnd.id) { const temp = item; newWnd.parent.children[index] = newWnd.parent.children[index - 1]; newWnd.parent.children[index - 1] = temp; - return true + return true; } - }) + }); } })); return menu; diff --git a/app/src/menus/vditor.ts b/app/src/menus/vditor.ts index e9c9b9d..02350db 100644 --- a/app/src/menus/vditor.ts +++ b/app/src/menus/vditor.ts @@ -1,4 +1,4 @@ -import {remote, clipboard} from "electron"; +import {remote} from "electron"; import {i18n} from "../i18n"; import {copyBlockId} from "./commonMenuItem"; diff --git a/app/src/outline/index.ts b/app/src/outline/index.ts index 548c182..30b4c32 100644 --- a/app/src/outline/index.ts +++ b/app/src/outline/index.ts @@ -22,16 +22,16 @@ export class Outline extends Model { case "reload": getAllModels().editor.find((item) => { if (data.data.url === item.url && data.data.path === item.path) { - this.render(item.vditore.vditor.ir.element) - return true + this.render(item.vditore.vditor.ir.element); + return true; } - }) - break + }); + break; } } - } - this.element = options.tab.panelElement - this.element.classList.add("vditor-outline") + }; + this.element = options.tab.panelElement; + this.element.classList.add("vditor-outline"); this.element.addEventListener("click", (event) => { let target = event.target as HTMLElement; while (target && !target.isEqualNode(this.element)) { @@ -44,7 +44,7 @@ export class Outline extends Model { } item.vditore.vditor.ir.element.scrollTop = headingElement.offsetTop - 10; bgFade(headingElement); - }) + }); this.element.querySelectorAll(".vditor-outline__item").forEach((item) => { item.classList.remove("vditor-outline__item--current"); }); @@ -53,16 +53,16 @@ export class Outline extends Model { target = target.parentElement; } }); - this.render(options.contentElement) + this.render(options.contentElement); } private render(contentElement: HTMLElement | string) { if (typeof contentElement === "string") { this.element.innerHTML = contentElement; - return + return; } - let tocHTML = '' - Array.from(contentElement.children).forEach((item: HTMLElement, index) => { + let tocHTML = ""; + Array.from(contentElement.children).forEach((item: HTMLElement) => { if (hasClosestByHeadings(item)) { const headingNo = parseInt(item.tagName.substring(1), 10); const space = new Array(headingNo - 1).fill(" ").join(""); diff --git a/app/src/util/bgFade.ts b/app/src/util/bgFade.ts index 5cea243..f74db6c 100644 --- a/app/src/util/bgFade.ts +++ b/app/src/util/bgFade.ts @@ -1,13 +1,13 @@ export const bgFade = (element: HTMLElement) => { - element.style.backgroundColor = 'var(--border-color)' - element.style.borderRadius = '3px' - element.style.boxShadow = '5px 0px 0 var(--border-color), -5px 0px 0 var(--border-color)' + element.style.backgroundColor = "var(--border-color)"; + element.style.borderRadius = "3px"; + element.style.boxShadow = "5px 0px 0 var(--border-color), -5px 0px 0 var(--border-color)"; setTimeout(function () { - element.style.transition = 'all 2s cubic-bezier(0.4, 0, 1, 1)' - element.style.backgroundColor = 'var(--toolbar-background-color)' - element.style.boxShadow = '5px 0px 0 var(--toolbar-background-color), -5px 0px 0 var(--toolbar-background-color)' - }) + element.style.transition = "all 2s cubic-bezier(0.4, 0, 1, 1)"; + element.style.backgroundColor = "var(--toolbar-background-color)"; + element.style.boxShadow = "5px 0px 0 var(--toolbar-background-color), -5px 0px 0 var(--toolbar-background-color)"; + }); setTimeout(function () { element.removeAttribute("style"); - }, 2001) -} + }, 2001); +}; diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index b65a5c9..9a38cd1 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -8,8 +8,8 @@ import {showMessage} from "./message"; export const newFile = (editor?: Editor, callback?: string) => { if (window.liandi.config.boxes.length === 0) { - showMessage(i18n[window.liandi.config.lang].newFileTip) - return + showMessage(i18n[window.liandi.config.lang].newFileTip); + return; } dialog({ diff --git a/app/src/websocket/onSetTheme.ts b/app/src/websocket/onSetTheme.ts index b06dffb..97e12ae 100644 --- a/app/src/websocket/onSetTheme.ts +++ b/app/src/websocket/onSetTheme.ts @@ -10,11 +10,11 @@ export const onSetTheme = (theme:TTheme) => { } else { document.body.classList.remove("theme--dark"); } - const models = getAllModels() + const models = getAllModels(); models.editor.forEach((item) => { item.vditore.setTheme(theme === "dark" ? "dark" : "classic", theme); }); models.graph.forEach((item) => { - item.onGraph({nodes: item.nodes, links: item.links}) - }) + item.onGraph({nodes: item.nodes, links: item.links}); + }); };