Skip to content

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

Merge remote-tracking branch 'origin/dev' into dev

Vanessa9ef21fb242dc
diff --cc app/src/dialog/processSystem.ts
index f9b718ade2,37987b4425..e2b7558cf9
--- a/app/src/dialog/processSystem.ts
+++ b/app/src/dialog/processSystem.ts
@@@ -20,6 -25,132 +20,7 @@@ import {App} from "../index"
import {saveScroll} from "../protyle/scroll/saveScroll";
import {isInAndroid, isInHarmony, isInIOS, setStorageVal} from "../protyle/util/compatibility";
import {Plugin} from "../plugin";
-
-const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => {
- fetchPost("/api/block/getDocInfo", {
- id: rootID
- }, (response) => {
- const titleEmpty = response.data.ial[Constants.CUSTOM_SY_TITLE_EMPTY] === "true";
- tab.updateTitle(getDocDisplayName(response.data.name, titleEmpty));
- if (protyle && protyle.title) {
- protyle.title.setTitle(response.data.name, titleEmpty);
- }
- });
-};
-
-export const reloadSync = (
- app: App,
- data: { upsertRootIDs: string[], removeRootIDs: string[] },
- hideMsg = true,
- // 同步的时候需要更新只读状态 https://github.com/siyuan-note/siyuan/issues/11517
- // 调整大纲的时候需要使用现有状态 https://github.com/siyuan-note/siyuan/issues/11808
- updateReadonly = true,
- onlyUpdateDoc = false
-) => {
- if (hideMsg) {
- hideMessage();
- }
- /// #if MOBILE
- if (window.siyuan.mobile.popEditor && window.siyuan.mobile.popEditor.protyle) {
- if (data.removeRootIDs.includes(window.siyuan.mobile.popEditor.protyle.block.rootID)) {
- hideElements(["dialog"]);
- } else {
- reloadProtyle(window.siyuan.mobile.popEditor.protyle, false, updateReadonly);
- }
- }
- if (document.getElementById("empty").classList.contains("fn__none") &&
- window.siyuan.mobile.editor && window.siyuan.mobile.editor.protyle) {
- if (data.removeRootIDs.includes(window.siyuan.mobile.editor.protyle.block.rootID)) {
- setEmpty(app);
- } else {
- reloadProtyle(window.siyuan.mobile.editor.protyle, false, updateReadonly);
- fetchPost("/api/block/getDocInfo", {
- id: window.siyuan.mobile.editor.protyle.block.rootID
- }, (response) => {
- setTitle(response.data.name);
- window.siyuan.mobile.editor.protyle.title.setTitle(response.data.name, response.data.ial[Constants.CUSTOM_SY_TITLE_EMPTY] === "true");
- });
- }
- }
- setNoteBook(() => {
- window.siyuan.mobile.docks.file.init(false);
- });
- /// #else
- const allModels = getAllModels();
- allModels.editor.forEach(item => {
- if (data.upsertRootIDs.includes(item.editor.protyle.block.rootID)) {
- fetchPost("/api/block/getDocInfo", {
- id: item.editor.protyle.block.rootID,
- }, (response) => {
- item.editor.protyle.wysiwyg.renderCustom(response.data.ial);
- reloadProtyle(item.editor.protyle, false, updateReadonly);
- updateTitle(item.editor.protyle.block.rootID, item.parent, item.editor.protyle);
- });
- } else if (data.removeRootIDs.includes(item.editor.protyle.block.rootID)) {
- item.parent.parent.removeTab(item.parent.id, false, false);
- delete window.siyuan.storage[Constants.LOCAL_FILEPOSITION][item.editor.protyle.block.rootID];
- setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]);
- }
- });
- allModels.graph.forEach(item => {
- if (item.type === "local" && data.removeRootIDs.includes(item.rootId)) {
- item.parent.parent.removeTab(item.parent.id, false, false);
- } else if (item.type !== "local" || data.upsertRootIDs.includes(item.rootId)) {
- item.searchGraph(false);
- if (item.type === "local") {
- updateTitle(item.rootId, item.parent);
- }
- }
- });
- allModels.outline.forEach(item => {
- if (item.type === "local" && data.removeRootIDs.includes(item.blockId)) {
- item.parent.parent.removeTab(item.parent.id, false, false);
- } else if (item.type !== "local" || data.upsertRootIDs.includes(item.blockId)) {
- fetchPost("/api/outline/getDocOutline", {
- id: item.blockId,
- preview: item.isPreview
- }, response => {
- item.update(response);
- });
- if (item.type === "local") {
- updateTitle(item.blockId, item.parent);
- }
- }
- });
- allModels.backlink.forEach(item => {
- if (item.type === "local" && data.removeRootIDs.includes(item.rootId)) {
- item.parent.parent.removeTab(item.parent.id, false, false);
- } else {
- item.refresh();
- if (item.type === "local") {
- updateTitle(item.rootId, item.parent);
- }
- }
- });
- if (!onlyUpdateDoc) {
- allModels.files.forEach(item => {
- setNoteBook(() => {
- item.init(false);
- });
- });
- }
- allModels.bookmark.forEach(item => {
- item.update();
- });
- allModels.tag.forEach(item => {
- item.update();
- });
- // NOTE asset 无法获取推送地址,先不处理
- allModels.search.forEach(item => {
- item.parent.panelElement.querySelector("#searchInput").dispatchEvent(new CustomEvent("input"));
- });
- allModels.custom.forEach(item => {
- if (item.update) {
- item.update();
- }
- });
- /// #endif
-};
++import {getWorkspaceName} from "../util/processTitle";
export const setRefDynamicText = (data: {
"blockID": string,