🎨 Title localization when creating a document https://github.com/siyuan-note/siyuan/issues/10719

This commit is contained in:
Daniel 2024-03-24 22:15:19 +08:00
parent f5043a8c46
commit 2a8809bc7e
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
25 changed files with 72 additions and 61 deletions

View file

@ -40,13 +40,13 @@ export const openBacklink = async (options: {
}
options.rootId = response.data.rootID;
options.useBlockId = response.data.rootID !== response.data.id;
options.title = response.data.name || "Untitled";
options.title = response.data.name || window.siyuan.languages.untitled;
} else if (!options.title) {
const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
if (response.code === -1) {
return;
}
options.title = response.data.name || "Untitled";
options.title = response.data.name || window.siyuan.languages.untitled;
}
const newWnd = wnd.split("lr");
newWnd.addTab(new Tab({
@ -96,13 +96,13 @@ export const openGraph = async (options: {
}
options.rootId = response.data.rootID;
options.useBlockId = response.data.rootID !== response.data.id;
options.title = response.data.name || "Untitled";
options.title = response.data.name || window.siyuan.languages.untitled;
} else if (!options.title) {
const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId});
if (response.code === -1) {
return;
}
options.title = response.data.name || "Untitled";
options.title = response.data.name || window.siyuan.languages.untitled;
}
const newWnd = wnd.split("lr");
newWnd.addTab(new Tab({
@ -142,9 +142,9 @@ export const openOutline = async (protyle: IProtyle) => {
let title = "";
if (!protyle.title) {
const response = await fetchSyncPost("api/block/getDocInfo", {id: protyle.block.rootID});
title = response.data.name || "Untitled";
title = response.data.name || window.siyuan.languages.untitled;
} else {
title = protyle.title.editElement.textContent || "Untitled";
title = protyle.title.editElement.textContent || window.siyuan.languages.untitled;
}
newWnd.addTab(new Tab({
icon: "iconAlignCenter",