mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 17:40:42 +08:00
🐛 windows 下 # 1 后刷新 loading 不消失
This commit is contained in:
parent
5b85d0e91b
commit
17928ee936
@ -9,7 +9,7 @@ import {saveScroll} from "../scroll/saveScroll";
|
|||||||
import {hideElements} from "../ui/hideElements";
|
import {hideElements} from "../ui/hideElements";
|
||||||
|
|
||||||
export const netImg2LocalAssets = (protyle: IProtyle) => {
|
export const netImg2LocalAssets = (protyle: IProtyle) => {
|
||||||
if (protyle.element.querySelector(".fn__loading")) {
|
if (protyle.element.querySelector(".wysiwygLoading")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addLoading(protyle);
|
addLoading(protyle);
|
||||||
|
@ -48,7 +48,14 @@ export const initUI = (protyle: IProtyle) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const addLoading = (protyle: IProtyle) => {
|
export const addLoading = (protyle: IProtyle) => {
|
||||||
protyle.element.insertAdjacentHTML("beforeend", "<div style=\"background-color: var(--b3-theme-background)\" class=\"fn__loading\"><img width=\"48px\" src=\"/stage/loading-pure.svg\"></div>");
|
protyle.element.insertAdjacentHTML("beforeend", '<div style="background-color: var(--b3-theme-background)" class="fn__loading wysiwygLoading"><img width="48px" src="/stage/loading-pure.svg"></div>');
|
||||||
|
};
|
||||||
|
|
||||||
|
export const removeLoading = (protyle: IProtyle) => {
|
||||||
|
const loadingElement = protyle.element.querySelector(".wysiwygLoading");
|
||||||
|
if (loadingElement) {
|
||||||
|
loadingElement.remove();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setPadding = (protyle: IProtyle) => {
|
export const setPadding = (protyle: IProtyle) => {
|
||||||
|
@ -15,6 +15,7 @@ import {focusBlock} from "./selection";
|
|||||||
import {hasClosestByAttribute, hasClosestByClassName} from "./hasClosest";
|
import {hasClosestByAttribute, hasClosestByClassName} from "./hasClosest";
|
||||||
import {preventScroll} from "../scroll/preventScroll";
|
import {preventScroll} from "../scroll/preventScroll";
|
||||||
import {restoreScroll} from "../scroll/saveScroll";
|
import {restoreScroll} from "../scroll/saveScroll";
|
||||||
|
import {removeLoading} from "../ui/initUI";
|
||||||
|
|
||||||
export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[] = [], scrollAttr?: IScrollAttr, renderTitle = false) => {
|
export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[] = [], scrollAttr?: IScrollAttr, renderTitle = false) => {
|
||||||
protyle.wysiwyg.element.removeAttribute("data-top");
|
protyle.wysiwyg.element.removeAttribute("data-top");
|
||||||
@ -84,10 +85,7 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]
|
|||||||
action,
|
action,
|
||||||
unScroll: false,
|
unScroll: false,
|
||||||
}, protyle);
|
}, protyle);
|
||||||
const loadingElement = protyle.element.querySelector(".fn__loading");
|
removeLoading(protyle);
|
||||||
if (loadingElement) {
|
|
||||||
loadingElement.remove();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,10 +120,7 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]
|
|||||||
if (scrollObj && protyle.options.mode !== "preview") {
|
if (scrollObj && protyle.options.mode !== "preview") {
|
||||||
restoreScroll(protyle, scrollObj);
|
restoreScroll(protyle, scrollObj);
|
||||||
}
|
}
|
||||||
const loadingElement = protyle.element.querySelector(".fn__loading");
|
removeLoading(protyle)
|
||||||
if (loadingElement) {
|
|
||||||
loadingElement.remove();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user