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/8098

Vanessad9813b016f92
diff --git a/app/src/boot/globalShortcut.ts b/app/src/boot/globalShortcut.ts
index 73f6666a9e..a05df1099a 100644
--- a/app/src/boot/globalShortcut.ts
+++ b/app/src/boot/globalShortcut.ts
@@ -1094,7 +1094,7 @@ const editKeydown = (event: KeyboardEvent) => {
}
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event)) {
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
- openCardByData(response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent);
+ openCardByData(response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent || "Untitled");
});
event.preventDefault();
return true;
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts
index b0ab1ec105..6c188c574e 100644
--- a/app/src/dialog/processSystem.ts
+++ b/app/src/dialog/processSystem.ts
@@ -17,12 +17,22 @@ import {needSubscribe} from "../util/needSubscribe";
import {redirectToCheckAuth} from "../util/pathName";
import {getAllModels} from "../layout/getAll";
import {reloadProtyle} from "../protyle/util/reload";
+import {Tab} from "../layout/Tab";
-export const reloadSync = (data:{upsertRootIDs: string[], removeRootIDs: string[]}) => {
+
+const updateTitle = (rootID: string, tab: Tab) => {
+ fetchPost("/api/block/getDocInfo", {
+ id: rootID
+ }, (response) => {
+ tab.updateTitle(response.data.name)
+ })
+}
+export const reloadSync = (data: { upsertRootIDs: string[], removeRootIDs: string[] }) => {
const allModels = getAllModels()
allModels.editor.forEach(item => {
if (data.upsertRootIDs.includes(item.editor.protyle.block.rootID)) {
- reloadProtyle(item.editor.protyle)
+ reloadProtyle(item.editor.protyle);
+ updateTitle(item.editor.protyle.block.rootID, item.parent);
} else if (data.removeRootIDs.includes(item.editor.protyle.block.rootID)) {
item.parent.parent.removeTab(item.parent.id, false, false, false);
}
@@ -30,19 +40,25 @@ export const reloadSync = (data:{upsertRootIDs: string[], removeRootIDs: string[
allModels.graph.forEach(item => {
if (item.type === "local" && data.removeRootIDs.includes(item.rootId)) {
item.parent.parent.removeTab(item.parent.id, false, false, false);
- } else if (item.type !== "local" || data.upsertRootIDs.includes(item.rootId)){
+ } 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, false);
- } else if (item.type !== "local" || data.upsertRootIDs.includes(item.blockId)){
+ } else if (item.type !== "local" || data.upsertRootIDs.includes(item.blockId)) {
fetchPost("/api/outline/getDocOutline", {
id: item.blockId,
}, response => {
item.update(response);
});
+ if (item.type === "local") {
+ updateTitle(item.blockId, item.parent);
+ }
}
})
allModels.backlink.forEach(item => {
@@ -50,6 +66,9 @@ export const reloadSync = (data:{upsertRootIDs: string[], removeRootIDs: string[
item.parent.parent.removeTab(item.parent.id, false, false, false);
} else {
item.refresh();
+ if (item.type === "local") {
+ updateTitle(item.rootId, item.parent);
+ }
}
})
allModels.files.forEach(item => {
diff --git a/app/src/layout/dock/util.ts b/app/src/layout/dock/util.ts
index 1a23b132f4..bf75911b02 100644
--- a/app/src/layout/dock/util.ts
+++ b/app/src/layout/dock/util.ts
@@ -18,7 +18,7 @@ export const openBacklink = (protyle: IProtyle) => {
const newWnd = protyle.model.parent.parent.split("lr");
const tab = new Tab({
icon: "iconLink",
- title: protyle.title.editElement.textContent,
+ title: protyle.title.editElement.textContent || "Untitled",
callback(tab: Tab) {
tab.addModel(new Backlink({
type: "local",
@@ -45,7 +45,7 @@ export const openGraph = (protyle: IProtyle) => {
const wnd = protyle.model.parent.parent.split("lr");
const tab = new Tab({
icon: "iconGraph",
- title: protyle.title.editElement.textContent,
+ title: protyle.title.editElement.textContent || "Untitled",
callback(tab: Tab) {
tab.addModel(new Graph({
type: "local",
@@ -71,7 +71,7 @@ export const openOutline = (protyle: IProtyle) => {
const newWnd = protyle.model.parent.parent.split("lr");
const tab = new Tab({
icon: "iconAlignCenter",
- title: protyle.title.editElement.textContent,
+ title: protyle.title.editElement.textContent || "Untitled",
callback(tab: Tab) {
tab.addModel(new Outline({
type: "local",