diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts index 7feae10f5..284a5d7c1 100644 --- a/app/src/layout/dock/index.ts +++ b/app/src/layout/dock/index.ts @@ -292,9 +292,9 @@ export class Dock { if (document.activeElement && this.layout.element.contains(document.activeElement) && document.activeElement.classList.contains("b3-text-field")) { return; } - const dialogElement = document.querySelector(".b3-dialog") as HTMLElement - const blockElement = document.querySelector(".block__popover") as HTMLElement - const menuElement = document.querySelector("#commonMenu:not(.fn__none)") as HTMLElement + const dialogElement = document.querySelector(".b3-dialog") as HTMLElement; + const blockElement = document.querySelector(".block__popover") as HTMLElement; + const menuElement = document.querySelector("#commonMenu:not(.fn__none)") as HTMLElement; if ((dialogElement && dialogElement.style.zIndex > this.layout.element.style.zIndex) || // 文档树上修改 emoji 时 (blockElement && blockElement.style.zIndex > this.layout.element.style.zIndex) || // 文档树上弹出悬浮层 (menuElement && menuElement.style.zIndex > this.layout.element.style.zIndex) // 面板上弹出菜单时 diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index e7359ba65..d52e817c4 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -58,9 +58,9 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle return false; } - let target = event.target + let target = event.target; while (target && !target.isEqualNode(blockElement)) { - const type = target.getAttribute("data-type") + const type = target.getAttribute("data-type"); if (type === "av-header-add") { const addMenu = addCol(protyle, blockElement); const addRect = target.getBoundingClientRect(); @@ -242,7 +242,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle return true; } else if (target.classList.contains("item") && target.parentElement.classList.contains("layout-tab-bar")) { if (target.classList.contains("item--focus")) { - openViewMenu({protyle, blockElement, element:target}) + openViewMenu({protyle, blockElement, element:target}); } else { blockElement.removeAttribute("data-render"); avRender(blockElement, protyle, undefined, target.dataset.id); diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 1d43a371d..5f35e6c0f 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -541,7 +541,7 @@ export const openMenuPanel = (options: { data: target.dataset.icon, }]); target.innerHTML = unicode ? unicode2Emoji(unicode) : ''; - target.dataset.icon = unicode + target.dataset.icon = unicode; }); event.preventDefault(); event.stopPropagation(); @@ -564,7 +564,7 @@ export const openMenuPanel = (options: { break; } else if (type === "delete-view") { if (data.views.length === 1) { - removeBlock(options.protyle, options.blockElement, getEditorRange(options.blockElement)) + removeBlock(options.protyle, options.blockElement, getEditorRange(options.blockElement)); } else { transaction(options.protyle, [{ action: "removeAttrViewView", @@ -598,7 +598,7 @@ export const openMenuPanel = (options: { }]); target.innerHTML = unicode ? unicode2Emoji(unicode) : ``; updateAttrViewCellAnimation(options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`)); - target.dataset.icon = unicode + target.dataset.icon = unicode; }); event.preventDefault(); event.stopPropagation(); diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index de25c5e35..7bf758c63 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -56,7 +56,7 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v if (typeof viewID === "string") { newViewID = viewID; } else if (typeof viewID === "undefined") { - newViewID = e.querySelector(".av__header .item--focus")?.getAttribute("data-id") + newViewID = e.querySelector(".av__header .item--focus")?.getAttribute("data-id"); } fetchPost(created ? "/api/av/renderHistoryAttributeView" : (snapshot ? "/api/av/renderSnapshotAttributeView" : "/api/av/renderAttributeView"), { id: e.getAttribute("data-av-id"), diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.ts index c0c75d67e..c07d7adab 100644 --- a/app/src/protyle/render/av/view.ts +++ b/app/src/protyle/render/av/view.ts @@ -19,11 +19,11 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle blockElement: options.blockElement, type: "config", cb: (avPanelElement) => { - (avPanelElement.querySelector('.b3-text-field[data-type="name"]') as HTMLInputElement).focus() + (avPanelElement.querySelector('.b3-text-field[data-type="name"]') as HTMLInputElement).focus(); } }); } - }) + }); menu.addItem({ icon: "iconSettings", label: window.siyuan.languages.config, @@ -34,7 +34,7 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle type: "config" }); } - }) + }); menu.addSeparator(); menu.addItem({ icon: "iconCopy", @@ -52,13 +52,13 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle id }]); } - }) + }); menu.addItem({ icon: "iconTrashcan", label: window.siyuan.languages.delete, click() { if (options.element.parentElement.querySelectorAll("item").length === 1) { - removeBlock(options.protyle, options.blockElement, getEditorRange(options.blockElement)) + removeBlock(options.protyle, options.blockElement, getEditorRange(options.blockElement)); } else { transaction(options.protyle, [{ action: "removeAttrViewView", @@ -67,20 +67,20 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle }]); } } - }) - const rect = options.element.getBoundingClientRect() + }); + const rect = options.element.getBoundingClientRect(); menu.open({ x: rect.left, y: rect.bottom - }) -} + }); +}; export const bindViewEvent = (options: { protyle: IProtyle, data: IAV, menuElement: HTMLElement }) => { - const inputElement = options.menuElement.querySelector('.b3-text-field[data-type="name"]') as HTMLInputElement + const inputElement = options.menuElement.querySelector('.b3-text-field[data-type="name"]') as HTMLInputElement; inputElement.addEventListener("blur", () => { if (inputElement.value !== inputElement.dataset.value) { transaction(options.protyle, [{ @@ -93,11 +93,11 @@ export const bindViewEvent = (options: { avID: options.data.id, id: options.data.viewID, data: inputElement.dataset.value - }]) - inputElement.dataset.value = inputElement.value + }]); + inputElement.dataset.value = inputElement.value; } - }) -} + }); +}; export const getViewHTML = (data: IAVTable) => { return `