There was an error while loading. Please reload this page.
1 parent 5eb994e commit e06a316Copy full SHA for e06a316
1 file changed
app/src/util/processTitle.ts
@@ -5,8 +5,10 @@ import {pathPosix} from "./pathName";
5
export const getWorkspaceName = () => {
6
const dir = window.siyuan.config.system.workspaceDir;
7
// 浏览器环境下内核不返回工作空间绝对路径,回退到应用名以避免标题/顶栏出现空段
8
+ // 注意:该函数可能在 languages 加载前(如 setBodyHighlight)被调用,故用可选链,
9
+ // 此时返回 undefined,由调用方(setBodyHighlight 的 if(!name) return)跳过处理
10
// https://github.com/siyuan-note/siyuan/issues/17410
- return dir ? pathPosix().basename(dir.replace(/\\/g, "/")) : window.siyuan.languages.siyuanNote;
11
+ return dir ? pathPosix().basename(dir.replace(/\\/g, "/")) : window.siyuan.languages?.siyuanNote;
12
};
13
14
export const setTitle = (title: string, showVersionTitle = false) => {
0 commit comments