Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/8234

Vanessa8f92edb99b9e
diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.ts
index 366f1abc7a..3b60c46173 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 6678209e5e..6153040b9d 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 2842f2da54..d80e13b413 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 => {