Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
4a0bfa4b8e
12 changed files with 45 additions and 24 deletions
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"autoLaunchMode0": "Do not launch automatically",
|
||||
"autoLaunchMode1": "Auto launch after booting",
|
||||
"autoLaunchMode2": "Auto launch and minimize the main interface after booting",
|
||||
"editorMarkdownInlineSup": "Markdown inline superscript syntax",
|
||||
"editorMarkdownInlineSupTip": "After enabling, <code class='fn__code'>^foo^</code> inline superscript syntax input will be supported",
|
||||
"editorMarkdownInlineSub": "Markdown inline subscript syntax",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"autoLaunchMode0": "No iniciar automáticamente",
|
||||
"autoLaunchMode1": "Inicio automático después del arranque",
|
||||
"autoLaunchMode2": "Iniciar automáticamente y minimizar la interfaz principal después del arranque",
|
||||
"editorMarkdownInlineSup": "Sintaxis de superíndice en línea de Markdown",
|
||||
"editorMarkdownInlineSupTip": "Después de habilitar, se admitirá la entrada de sintaxis de superíndice en línea <code class='fn__code'>^foo^</code>",
|
||||
"editorMarkdownInlineSub": "Sintaxis del subíndice en línea de Markdown",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"autoLaunchMode0": "Ne pas lancer automatiquement",
|
||||
"autoLaunchMode1": "Lancement automatique après le démarrage",
|
||||
"autoLaunchMode2": "Lancement automatique et minimisation de l'interface principale après le démarrage",
|
||||
"editorMarkdownInlineSup": "Syntaxe exposant Markdown en ligne",
|
||||
"editorMarkdownInlineSupTip": "Après l'activation, la saisie de la syntaxe en exposant <code class='fn__code'>^foo^</code> en ligne sera prise en charge",
|
||||
"editorMarkdownInlineSub": "Syntaxe d'indice en ligne Markdown",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"autoLaunchMode0": "不自動啟動",
|
||||
"autoLaunchMode1": "開機自動啟動",
|
||||
"autoLaunchMode2": "開機後自動啟動並最小化主介面",
|
||||
"editorMarkdownInlineSup": "Markdown 行級上標語法",
|
||||
"editorMarkdownInlineSupTip": "啟用後將支援 <code class='fn__code'>^foo^</code> 行級上標語法輸入",
|
||||
"editorMarkdownInlineSub": "Markdown 行級下標語法",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"autoLaunchMode0": "不自动启动",
|
||||
"autoLaunchMode1": "开机后自动启动",
|
||||
"autoLaunchMode2": "开机后自动启动并最小化主界面",
|
||||
"editorMarkdownInlineSup": "Markdown 行级上标语法",
|
||||
"editorMarkdownInlineSupTip": "启用后将支持 <code class='fn__code'>^foo^</code> 行级上标语法输入",
|
||||
"editorMarkdownInlineSub": "Markdown 行级下标语法",
|
||||
|
|
|
@ -230,7 +230,7 @@ const writeLog = (out) => {
|
|||
}
|
||||
};
|
||||
|
||||
const boot = () => {
|
||||
const initMainWindow = () => {
|
||||
let windowStateInitialized = true;
|
||||
// 恢复主窗体状态
|
||||
let oldWindowState = {};
|
||||
|
@ -1019,7 +1019,7 @@ app.whenReady().then(() => {
|
|||
if (!foundWorkspace) {
|
||||
initKernel(data.workspace, "", "").then((isSucc) => {
|
||||
if (isSucc) {
|
||||
boot();
|
||||
initMainWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ app.whenReady().then(() => {
|
|||
ipcMain.on("siyuan-first-init", (event, data) => {
|
||||
initKernel(data.workspace, "", data.lang).then((isSucc) => {
|
||||
if (isSucc) {
|
||||
boot();
|
||||
initMainWindow();
|
||||
}
|
||||
});
|
||||
firstOpenWindow.destroy();
|
||||
|
@ -1173,7 +1173,7 @@ app.whenReady().then(() => {
|
|||
}
|
||||
initKernel(workspace, port, "").then((isSucc) => {
|
||||
if (isSucc) {
|
||||
boot();
|
||||
initMainWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1280,7 +1280,7 @@ app.on("second-instance", (event, argv) => {
|
|||
if (workspace) {
|
||||
initKernel(workspace, port, "").then((isSucc) => {
|
||||
if (isSucc) {
|
||||
boot();
|
||||
initMainWindow();
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
@ -1306,7 +1306,7 @@ app.on("activate", () => {
|
|||
}
|
||||
}
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
boot();
|
||||
initMainWindow();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -16,14 +16,18 @@ import {setKey} from "../sync/syncGuide";
|
|||
export const about = {
|
||||
element: undefined as Element,
|
||||
genHTML: () => {
|
||||
return `<label class="fn__flex b3-label${isBrowser() || window.siyuan.config.system.isMicrosoftStore || "std" !== window.siyuan.config.system.container || "linux" === window.siyuan.config.system.os ? " fn__none" : ""}">
|
||||
return `<div class="fn__flex b3-label config__item${isBrowser() || window.siyuan.config.system.isMicrosoftStore || "std" !== window.siyuan.config.system.container || "linux" === window.siyuan.config.system.os ? " fn__none" : ""}">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.autoLaunch}
|
||||
<div class="b3-label__text">${window.siyuan.languages.autoLaunchTip}</div>
|
||||
</div>
|
||||
<div class="fn__space"></div>
|
||||
<input class="b3-switch fn__flex-center" id="autoLaunch" type="checkbox"${window.siyuan.config.system.autoLaunch ? " checked" : ""}>
|
||||
</label>
|
||||
<span class="fn__space"></span>
|
||||
<select class="b3-select fn__flex-center fn__size200" id="autoLaunch">
|
||||
<option value="0" ${window.siyuan.config.system.autoLaunch === 0 ? "selected" : ""}>${window.siyuan.languages.autoLaunchMode0}</option>
|
||||
<option value="1" ${window.siyuan.config.system.autoLaunch === 1 ? "selected" : ""}>${window.siyuan.languages.autoLaunchMode1}</option>
|
||||
<option value="2" ${window.siyuan.config.system.autoLaunch === 2 ? "selected" : ""}>${window.siyuan.languages.autoLaunchMode2}</option>
|
||||
</select>
|
||||
</div>
|
||||
<label class="fn__flex b3-label${isBrowser() || window.siyuan.config.system.isMicrosoftStore || window.siyuan.config.system.container !== "std" ? " fn__none" : ""}">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.autoDownloadUpdatePkg}
|
||||
|
@ -348,9 +352,10 @@ export const about = {
|
|||
/// #if !BROWSER
|
||||
const autoLaunchElement = about.element.querySelector("#autoLaunch") as HTMLInputElement;
|
||||
autoLaunchElement.addEventListener("change", () => {
|
||||
fetchPost("/api/system/setAutoLaunch", {autoLaunch: autoLaunchElement.checked}, () => {
|
||||
window.siyuan.config.system.autoLaunch = autoLaunchElement.checked;
|
||||
ipcRenderer.send(Constants.SIYUAN_AUTO_LAUNCH, {openAtLogin: autoLaunchElement.checked});
|
||||
const autoLaunchMode = parseInt(autoLaunchElement.value)
|
||||
fetchPost("/api/system/setAutoLaunch", {autoLaunch: autoLaunchMode}, () => {
|
||||
window.siyuan.config.system.autoLaunch = autoLaunchMode;
|
||||
ipcRenderer.send(Constants.SIYUAN_AUTO_LAUNCH, {openAtLogin: 0 != autoLaunchMode});
|
||||
});
|
||||
});
|
||||
/// #endif
|
||||
|
|
5
app/src/types/config.d.ts
vendored
5
app/src/types/config.d.ts
vendored
|
@ -1351,8 +1351,11 @@ declare namespace Config {
|
|||
appDir: string;
|
||||
/**
|
||||
* Boot automatically
|
||||
* - `0`: Do not boot automatically
|
||||
* - `1`: Boot automatically
|
||||
* - `2`: Boot automatically + Minimize UI
|
||||
*/
|
||||
autoLaunch: boolean;
|
||||
autoLaunch: number;
|
||||
/**
|
||||
* The absolute path of the `conf` directory of the current workspace
|
||||
*/
|
||||
|
|
|
@ -421,8 +421,8 @@ func setAutoLaunch(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
autoLaunch := arg["autoLaunch"].(bool)
|
||||
model.Conf.System.AutoLaunch = autoLaunch
|
||||
autoLaunch := int(arg["autoLaunch"].(float64))
|
||||
model.Conf.System.AutoLaunch2 = autoLaunch
|
||||
model.Conf.Save()
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ type System struct {
|
|||
UploadErrLog bool `json:"uploadErrLog"`
|
||||
DisableGoogleAnalytics bool `json:"disableGoogleAnalytics"`
|
||||
DownloadInstallPkg bool `json:"downloadInstallPkg"`
|
||||
AutoLaunch bool `json:"autoLaunch"`
|
||||
AutoLaunch2 int `json:"autoLaunch2"` // 0:不自动启动,1:自动启动,2:自动启动+隐藏主窗口
|
||||
LockScreenMode int `json:"lockScreenMode"` // 0:手动,1:手动+跟随系统 https://github.com/siyuan-note/siyuan/issues/9087
|
||||
}
|
||||
|
||||
|
|
|
@ -112,13 +112,6 @@ func (conf *AppConf) SetUser(user *conf.User) {
|
|||
func InitConf() {
|
||||
initLang()
|
||||
|
||||
windowStateConf := filepath.Join(util.ConfDir, "windowState.json")
|
||||
if !gulu.File.IsExist(windowStateConf) {
|
||||
if err := gulu.File.WriteFileSafer(windowStateConf, []byte("{}"), 0644); nil != err {
|
||||
logging.LogErrorf("create [windowState.json] failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
Conf = &AppConf{LogLevel: "debug", m: &sync.Mutex{}}
|
||||
confPath := filepath.Join(util.ConfDir, "conf.json")
|
||||
if gulu.File.IsExist(confPath) {
|
||||
|
|
|
@ -244,6 +244,11 @@ func searchTreeInFilesystem(rootID string) {
|
|||
treePath = strings.TrimPrefix(treePath, string(os.PathSeparator))
|
||||
treePath = strings.TrimPrefix(treePath, boxID)
|
||||
treePath = filepath.ToSlash(treePath)
|
||||
if nil == Conf.Box(boxID) {
|
||||
logging.LogInfof("box [%s] not found", boxID)
|
||||
// 如果笔记本不存在或者已经关闭,则不处理 https://github.com/siyuan-note/siyuan/issues/11149
|
||||
return
|
||||
}
|
||||
|
||||
tree, err := filesys.LoadTree(boxID, treePath, util.NewLute())
|
||||
if nil != err {
|
||||
|
|
Loading…
Add table
Reference in a new issue