diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.ts index 366f1abc7..3b60c4617 100644 --- a/app/src/editor/rename.ts +++ b/app/src/editor/rename.ts @@ -9,9 +9,9 @@ import {fetchPost} from "../util/fetch"; import {Constants} from "../constants"; import {showTooltip} from "../dialog/tooltip"; /// #if !MOBILE -import {getAllEditor, getAllModels} from "../layout/getAll"; -import {getCurrentEditor} from "../mobile/editor"; +import {getAllModels} from "../layout/getAll"; /// #endif +import {getAllEditor} from "../layout/getAll"; export const validateName = (name: string, targetElement?: HTMLElement) => { if (/\r\n|\r|\n|\u2028|\u2029|\t|\//.test(name)) { @@ -138,19 +138,17 @@ export const renameAsset = (assetPath: string) => { } fetchPost("/api/asset/renameAsset", {oldPath: assetPath, newName: inputElement.value}, (response) => { - /// #if MOBILE - getCurrentEditor()?.reload(false); - /// #else + /// #if !MOBILE getAllModels().asset.forEach(item => { if (item.path === assetPath) { item.path = response.data.newPath; item.parent.updateTitle(getDisplayName(response.data.newPath)); } }); + /// #endif getAllEditor().forEach(item => { item.reload(false); }); - /// #endif dialog.destroy(); }); }); diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.ts index 6678209e5..6153040b9 100644 --- a/app/src/emoji/index.ts +++ b/app/src/emoji/index.ts @@ -5,8 +5,9 @@ import {Constants} from "../constants"; import {Files} from "../layout/dock/Files"; /// #if !MOBILE import {getDockByType} from "../layout/tabUtil"; -import {getAllEditor, getAllModels} from "../layout/getAll"; +import {getAllModels} from "../layout/getAll"; /// #endif +import {getAllEditor} from "../layout/getAll"; import {setNoteBook} from "../util/pathName"; import {Dialog} from "../dialog"; import {setPosition} from "../util/setPosition"; @@ -543,17 +544,8 @@ const putEmojis = (protyle: IProtyle) => { export const reloadEmoji = () => { fetchPost("/api/system/getEmojiConf", {}, response => { window.siyuan.emojis = response.data as IEmoji[]; - /// #if MOBILE - if (window.siyuan.mobile.editor) { - putEmojis(window.siyuan.mobile.editor.protyle); - } - if (window.siyuan.mobile.popEditor) { - putEmojis(window.siyuan.mobile.popEditor.protyle); - } - /// #else getAllEditor().forEach(item => { putEmojis(item.protyle); }); - /// #endif }); }; diff --git a/app/src/protyle/ui/hideElements.ts b/app/src/protyle/ui/hideElements.ts index 2842f2da5..d80e13b41 100644 --- a/app/src/protyle/ui/hideElements.ts +++ b/app/src/protyle/ui/hideElements.ts @@ -1,8 +1,4 @@ -/// #if MOBILE -import {getCurrentEditor} from "../../mobile/editor"; -/// #else import {getAllEditor} from "../../layout/getAll"; -/// #endif // "gutter", "toolbar", "select", "hint", "util", "dialog", "gutterOnly" export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = false) => { @@ -64,16 +60,6 @@ export const hideAllElements = (types: string[]) => { }); } if (types.includes("util")) { - /// #if MOBILE - const editor = getCurrentEditor(); - if (editor) { - editor.protyle.toolbar.subElement.classList.add("fn__none"); - if (editor.protyle.toolbar.subElementCloseCB) { - editor.protyle.toolbar.subElementCloseCB(); - editor.protyle.toolbar.subElementCloseCB = undefined; - } - } - /// #else getAllEditor().forEach(item => { if (item.protyle.toolbar) { item.protyle.toolbar.subElement.classList.add("fn__none"); @@ -83,7 +69,6 @@ export const hideAllElements = (types: string[]) => { } } }); - /// #endif } if (types.includes("pdfutil")) { document.querySelectorAll(".pdf__util").forEach(item => {