From 82865e5bd479f4384d96faa7910d955dfbf2dc75 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 4 Feb 2023 10:50:01 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/7253 --- app/src/menus/protyle.ts | 5 +++++ app/src/protyle/gutter/index.ts | 2 +- app/src/protyle/toolbar/index.ts | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index b5c8b44a1..ae9fc7617 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -40,12 +40,14 @@ import {exportAsset} from "./util"; import {removeLink} from "../protyle/toolbar/Link"; import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey"; import {renameTag} from "../util/noRelyPCFunction"; +import {hideElements} from "../protyle/ui/hideElements"; export const refMenu = (protyle: IProtyle, element: HTMLElement) => { const nodeElement = hasClosestBlock(element); if (!nodeElement) { return; } + hideElements(["util", "toolbar", "hint"], protyle); const refBlockId = element.getAttribute("data-id"); const id = nodeElement.getAttribute("data-node-id"); let oldHTML = nodeElement.outerHTML; @@ -494,6 +496,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme if (!nodeElement) { return; } + hideElements(["util", "toolbar", "hint"], protyle); const id = nodeElement.getAttribute("data-node-id"); const imgElement = assetElement.querySelector("img"); const titleElement = assetElement.querySelector(".protyle-action__title") as HTMLElement; @@ -680,6 +683,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText if (!nodeElement) { return; } + hideElements(["util", "toolbar", "hint"], protyle); const id = nodeElement.getAttribute("data-node-id"); const html = nodeElement.outerHTML; const linkAddress = linkElement.getAttribute("data-href"); @@ -854,6 +858,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => { if (!nodeElement) { return; } + hideElements(["util", "toolbar", "hint"], protyle); const id = nodeElement.getAttribute("data-node-id"); let html = nodeElement.outerHTML; window.siyuan.menus.menu.append(new MenuItem({ diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index c759813a7..cbfa7a966 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -673,7 +673,7 @@ export class Gutter { } public renderMenu(protyle: IProtyle, buttonElement: Element) { - hideElements(["hint"], protyle); + hideElements(["util", "toolbar", "hint"], protyle); window.siyuan.menus.menu.remove(); const id = buttonElement.getAttribute("data-node-id"); const selectsElement = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"); diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 4ac621a83..541051a91 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -725,6 +725,8 @@ export class Toolbar { if (!nodeElement) { return; } + hideElements(["hint"], protyle); + window.siyuan.menus.menu.remove(); const id = nodeElement.getAttribute("data-node-id"); const html = nodeElement.outerHTML; this.subElement.style.width = isMobile() ? "80vw" : Math.min(480, window.innerWidth) + "px"; @@ -798,6 +800,8 @@ export class Toolbar { if (!nodeElement) { return; } + hideElements(["hint"], protyle); + window.siyuan.menus.menu.remove(); const id = nodeElement.getAttribute("data-node-id"); const types = (renderElement.getAttribute("data-type") || "").split(" "); const html = oldHTML || protyle.lute.SpinBlockDOM(nodeElement.outerHTML); @@ -1173,6 +1177,8 @@ export class Toolbar { if (!nodeElement) { return; } + hideElements(["hint"], protyle); + window.siyuan.menus.menu.remove(); this.range = getEditorRange(nodeElement); const id = nodeElement.getAttribute("data-node-id"); let oldHtml = nodeElement.outerHTML; @@ -1292,6 +1298,8 @@ export class Toolbar { public showTpl(protyle: IProtyle, nodeElement: HTMLElement, range: Range) { this.range = range; + hideElements(["hint"], protyle); + window.siyuan.menus.menu.remove(); fetchPost("/api/search/searchTemplate", { k: "", }, (response) => { @@ -1420,6 +1428,8 @@ export class Toolbar { public showWidget(protyle: IProtyle, nodeElement: HTMLElement, range: Range) { this.range = range; + hideElements(["hint"], protyle); + window.siyuan.menus.menu.remove(); fetchPost("/api/search/searchWidget", { k: "", }, (response) => { @@ -1480,6 +1490,8 @@ export class Toolbar { public showAssets(protyle: IProtyle, nodeElement: HTMLElement, range: Range) { this.range = range; + hideElements(["hint"], protyle); + window.siyuan.menus.menu.remove(); fetchPost("/api/search/searchAsset", { k: "", }, (response) => {