This commit is contained in:
parent
c74f1ce0d9
commit
8f92edb99b
3 changed files with 6 additions and 31 deletions
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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 => {
|
||||
|
|
Loading…
Add table
Reference in a new issue