diff --git a/app/src/assets/scss/base.scss b/app/src/assets/scss/base.scss
index 2d257305b..72e0f6d4c 100644
--- a/app/src/assets/scss/base.scss
+++ b/app/src/assets/scss/base.scss
@@ -304,6 +304,31 @@ progressLoading: 400
font-size: 12px;
}
+ &__backgroundtask {
+ display: flex;
+ color: var(--b3-theme-on-surface);
+ font-size: 12px;
+
+ & > div {
+ height: 4px;
+ border-radius: 4px;
+ overflow: hidden;
+ background-color: #fff;
+ width: 64px;
+ align-self: center;
+ margin: 0 8px 0 4px;
+ cursor: pointer;
+
+ & > div {
+ background-color: var(--b3-theme-primary-light);
+ height: 4px;
+ background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
+ animation: stripMove 450ms linear infinite;
+ background-size: 50px 50px;
+ }
+ }
+ }
+
#barDock .b3-menu__item:hover {
background-color: var(--b3-list-hover);
}
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts
index 2426fe83d..f13edec39 100644
--- a/app/src/dialog/processSystem.ts
+++ b/app/src/dialog/processSystem.ts
@@ -247,6 +247,24 @@ export const progressLoading = (data: IWebSocketData) => {
}
};
+export const progressBackgroundTask = (tasks:{action:string}[]) => {
+ const backgroundTaskElement = document.querySelector(".status__backgroundtask");
+ if (!backgroundTaskElement) {
+ return;
+ }
+ if (tasks.length === 0) {
+ backgroundTaskElement.classList.add("fn__none");
+ if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
+ window.siyuan.menus.menu.element.getAttribute("data-name") === "statusBackgroundTask") {
+ window.siyuan.menus.menu.remove();
+ }
+ } else {
+ backgroundTaskElement.classList.remove("fn__none");
+ backgroundTaskElement.setAttribute("data-tasks", JSON.stringify(tasks));
+ backgroundTaskElement.innerHTML = tasks[0].action + "
";
+ }
+}
+
export const bootSync = () => {
fetchPost("/api/sync/getBootSync", {}, response => {
if (response.code === 1) {
diff --git a/app/src/index.ts b/app/src/index.ts
index e7f021fc9..3b9b7b120 100644
--- a/app/src/index.ts
+++ b/app/src/index.ts
@@ -13,7 +13,7 @@ import {openFileById} from "./editor/util";
import {
bootSync,
downloadProgress,
- processSync,
+ processSync, progressBackgroundTask,
progressLoading,
progressStatus,
setTitle,
@@ -100,7 +100,10 @@ class App {
transactionError(data);
break;
case "syncing":
- processSync(data)
+ processSync(data);
+ break;
+ case "backgroundtask":
+ progressBackgroundTask(data.data.tasks);
break;
case "refreshtheme":
if (!window.siyuan.config.appearance.customCSS && data.data.theme.indexOf("custom.css") > -1) {
diff --git a/app/src/layout/status.ts b/app/src/layout/status.ts
index dfc952ffc..5daba3964 100644
--- a/app/src/layout/status.ts
+++ b/app/src/layout/status.ts
@@ -10,6 +10,7 @@ import {getCurrentWindow} from "@electron/remote";
/// #endif
/// #endif
import {MenuItem} from "../menus/Menu";
+import {Constants} from "../constants";
export const initStatus = () => {
/// #if !MOBILE
@@ -28,6 +29,7 @@ export const initStatus = () => {
+
@@ -67,6 +69,25 @@ export const initStatus = () => {
target.querySelector(".b3-menu").classList.add("fn__none");
event.stopPropagation();
break;
+ } else if (target.classList.contains("status__backgroundtask")) {
+ if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
+ window.siyuan.menus.menu.element.getAttribute("data-name") === "statusBackgroundTask") {
+ window.siyuan.menus.menu.remove();
+ return;
+ }
+ window.siyuan.menus.menu.remove();
+ window.siyuan.menus.menu.element.setAttribute("data-name", "statusBackgroundTask");
+ JSON.parse(target.getAttribute("data-tasks")).forEach((item: { action: string }) => {
+ window.siyuan.menus.menu.append(new MenuItem({
+ type: "readonly",
+ iconHTML: Constants.ZWSP,
+ label: item.action
+ }).element);
+ })
+ const rect = target.getBoundingClientRect();
+ window.siyuan.menus.menu.popup({x: rect.right, y: rect.top}, true);
+ event.stopPropagation();
+ break;
} else if (target.id === "statusHelp") {
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
window.siyuan.menus.menu.element.getAttribute("data-name") === "statusHelp") {
diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.ts
index f71c1e4d1..49a31957e 100644
--- a/app/src/util/onGetConfig.ts
+++ b/app/src/util/onGetConfig.ts
@@ -18,7 +18,7 @@ import {addGA, initAssets, setInlineStyle, setMode} from "./assets";
import {renderSnippet} from "../config/util/snippets";
import {openFileById} from "../editor/util";
import {focusByRange} from "../protyle/util/selection";
-import {exitSiYuan, processSync} from "../dialog/processSystem";
+import {exitSiYuan, processSync, progressLoading} from "../dialog/processSystem";
import {openSetting} from "../config";
import {getSearch} from "./functions";
import {initStatus} from "../layout/status";
@@ -28,7 +28,7 @@ import {editor} from "../config/editor";
import {goBack, goForward} from "./backForward";
import {replaceLocalPath} from "../editor/rename";
import {workspaceMenu} from "../menus/workspace";
-import { getWorkspaceName } from "./noRelyPCFunction";
+import {getWorkspaceName} from "./noRelyPCFunction";
const matchKeymap = (keymap: Record, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
if (key1 === "general") {