Skip to content

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

:art: Move double-click tab option to document configuration https://github.com/siyuan-note/siyuan/issues/18784

Daniel091a9f274827
diff --git a/app/src/config/tabs/fileTab.ts b/app/src/config/tabs/fileTab.ts
index 52b73862b8..5297ab4e96 100644
--- a/app/src/config/tabs/fileTab.ts
+++ b/app/src/config/tabs/fileTab.ts
@@ -3,7 +3,6 @@ import {genNotebookOption} from "../../menus/onGetnotebookconf";
import {fetchPost} from "../../util/fetch";
import {editorConfigApi} from "./editorRuntime";
import {fileConfigApi} from "./fileRuntime";
-import {appearanceConfigApi} from "./appearanceRuntime";
import type {SettingTabBuilder} from "../setting/builder";
import {controlNumber, controlSelect, controlString} from "../setting/control";
import {genConfigItemName} from "../render/fragments";
@@ -75,10 +74,9 @@ const registerFileTreeBehaviorGroup = (tab: SettingTabBuilder) => {
const registerTabStartupGroup = (tab: SettingTabBuilder) => {
const group = tab.group("tabStartup", window.siyuan.languages.tabStartup);
- group.switch("appearance.closeTabOnDoubleClick", {
+ group.switch("fileTree.closeTabOnDoubleClick", {
title: window.siyuan.languages.closeTabOnDoubleClick,
desc: window.siyuan.languages.closeTabOnDoubleClickTip,
- save: (value) => appearanceConfigApi.patch("closeTabOnDoubleClick", value),
});
group.number("fileTree.maxOpenTabCount", {
title: window.siyuan.languages.tabLimit,
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index 9b19efdd53..6ac04da03a 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -177,7 +177,7 @@ export class Wnd {
if (!tabElement || !this.headersElement.contains(tabElement)) {
return;
}
- if (window.siyuan.config.appearance.closeTabOnDoubleClick) {
+ if (window.siyuan.config.fileTree.closeTabOnDoubleClick) {
this.removeTab(tabElement.getAttribute("data-id"));
} else if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {
tabElement.classList.remove("item--unupdate");
diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.ts
index 3b737ff869..8aedda7dcd 100644
--- a/app/src/types/config.d.ts
+++ b/app/src/types/config.d.ts
@@ -304,10 +304,6 @@ declare namespace Config {
* - `1`: Minimize to pallets
*/
closeButtonBehavior: number;
- /**
- * Whether to close tabs by double-clicking
- */
- closeTabOnDoubleClick: boolean;
/**
* Dark code block theme
*/
@@ -904,6 +900,10 @@ declare namespace Config {
* Whether to open the file in the current tab
*/
openFilesUseCurrentTab: boolean;
+ /**
+ * Whether to close tabs by double-clicking
+ */
+ closeTabOnDoubleClick: boolean;
/**
* The storage path of the new document created using block references
*/
diff --git a/kernel/conf/appearance.go b/kernel/conf/appearance.go
index 045cf1c36d..908de478f4 100644
--- a/kernel/conf/appearance.go
+++ b/kernel/conf/appearance.go
@@ -19,46 +19,44 @@ package conf
import "github.com/siyuan-note/siyuan/kernel/util"
type Appearance struct {
- Mode int `json:"mode"` // 模式:0:明亮,1:暗黑
- ModeOS bool `json:"modeOS"` // 模式是否跟随系统
- DarkThemes []*AppearanceTheme `json:"darkThemes"` // 暗黑模式外观主题列表
- LightThemes []*AppearanceTheme `json:"lightThemes"` // 明亮模式外观主题列表
- ThemeDark string `json:"themeDark"` // 选择的暗黑模式外观主题
- ThemeLight string `json:"themeLight"` // 选择的明亮模式外观主题
- ThemeVer string `json:"themeVer"` // 选择的主题版本
- Icons []*AppearanceIcon `json:"icons"` // 图标列表
- Icon string `json:"icon"` // 选择的图标
- IconVer string `json:"iconVer"` // 选择的图标版本
- CodeBlockThemeLight string `json:"codeBlockThemeLight"` // 明亮模式下代码块主题
- CodeBlockThemeDark string `json:"codeBlockThemeDark"` // 暗黑模式下代码块主题
- Lang string `json:"lang"` // 选择的界面语言,同 AppConf.Lang
- ThemeJS bool `json:"themeJS"` // 是否启用了主题 JavaScript
- CloseButtonBehavior int `json:"closeButtonBehavior"` // 关闭按钮行为,0:退出,1:最小化到托盘
- CloseTabOnDoubleClick bool `json:"closeTabOnDoubleClick"` // 是否使用双击关闭页签
- HideToolbar bool `json:"hideToolbar"` // 是否隐藏顶栏工具栏
- HideStatusBar bool `json:"hideStatusBar"` // 是否隐藏底部状态栏
- StatusBar *util.StatusBar `json:"statusBar"` // 底部状态栏配置
- Notifications *util.Notifications `json:"notifications"` // 外观通知开关配置
- EntryVisibility *EntryVisibility `json:"entryVisibility"` // 桌面端入口可见性配置
+ Mode int `json:"mode"` // 模式:0:明亮,1:暗黑
+ ModeOS bool `json:"modeOS"` // 模式是否跟随系统
+ DarkThemes []*AppearanceTheme `json:"darkThemes"` // 暗黑模式外观主题列表
+ LightThemes []*AppearanceTheme `json:"lightThemes"` // 明亮模式外观主题列表
+ ThemeDark string `json:"themeDark"` // 选择的暗黑模式外观主题
+ ThemeLight string `json:"themeLight"` // 选择的明亮模式外观主题
+ ThemeVer string `json:"themeVer"` // 选择的主题版本
+ Icons []*AppearanceIcon `json:"icons"` // 图标列表
+ Icon string `json:"icon"` // 选择的图标
+ IconVer string `json:"iconVer"` // 选择的图标版本
+ CodeBlockThemeLight string `json:"codeBlockThemeLight"` // 明亮模式下代码块主题
+ CodeBlockThemeDark string `json:"codeBlockThemeDark"` // 暗黑模式下代码块主题
+ Lang string `json:"lang"` // 选择的界面语言,同 AppConf.Lang
+ ThemeJS bool `json:"themeJS"` // 是否启用了主题 JavaScript
+ CloseButtonBehavior int `json:"closeButtonBehavior"` // 关闭按钮行为,0:退出,1:最小化到托盘
+ HideToolbar bool `json:"hideToolbar"` // 是否隐藏顶栏工具栏
+ HideStatusBar bool `json:"hideStatusBar"` // 是否隐藏底部状态栏
+ StatusBar *util.StatusBar `json:"statusBar"` // 底部状态栏配置
+ Notifications *util.Notifications `json:"notifications"` // 外观通知开关配置
+ EntryVisibility *EntryVisibility `json:"entryVisibility"` // 桌面端入口可见性配置
}
func NewAppearance() *Appearance {
return &Appearance{
- Mode: 0,
- ModeOS: true,
- ThemeDark: "midnight",
- ThemeLight: "daylight",
- Icon: "litheness",
- CodeBlockThemeLight: "github",
- CodeBlockThemeDark: "base16/dracula",
- Lang: "en",
- CloseButtonBehavior: 0,
- CloseTabOnDoubleClick: false,
- HideToolbar: true,
- HideStatusBar: false,
- StatusBar: &util.StatusBar{},
- Notifications: util.NewNotifications(),
- EntryVisibility: NewEntryVisibility(EntryVisibilityProfileSimple),
+ Mode: 0,
+ ModeOS: true,
+ ThemeDark: "midnight",
+ ThemeLight: "daylight",
+ Icon: "litheness",
+ CodeBlockThemeLight: "github",
+ CodeBlockThemeDark: "base16/dracula",
+ Lang: "en",
+ CloseButtonBehavior: 0,
+ HideToolbar: true,
+ HideStatusBar: false,
+ StatusBar: &util.StatusBar{},
+ Notifications: util.NewNotifications(),
+ EntryVisibility: NewEntryVisibility(EntryVisibilityProfileSimple),
}
}
diff --git a/kernel/conf/filetree.go b/kernel/conf/filetree.go
index cdab0b9131..bda1d3193f 100644
--- a/kernel/conf/filetree.go
+++ b/kernel/conf/filetree.go
@@ -23,6 +23,7 @@ import (
type FileTree struct {
AlwaysSelectOpenedFile bool `json:"alwaysSelectOpenedFile"` // 是否自动选中当前打开的文件
OpenFilesUseCurrentTab bool `json:"openFilesUseCurrentTab"` // 在当前页签打开文件
+ CloseTabOnDoubleClick bool `json:"closeTabOnDoubleClick"` // 是否使用双击关闭页签
DocIconClickExpand bool `json:"docIconClickExpand"` // 单击文档或笔记本图标时展开或折叠下级文档
ParentDocClickExpand bool `json:"parentDocClickExpand"` // 单击父文档标题时展开或折叠下级文档
BoxDocEnabled *bool `json:"boxDocEnabled"` // 是否启用顶层笔记本文档
@@ -51,6 +52,7 @@ func NewFileTree() *FileTree {
return &FileTree{
AlwaysSelectOpenedFile: false,
OpenFilesUseCurrentTab: false,
+ CloseTabOnDoubleClick: false,
DocIconClickExpand: false,
ParentDocClickExpand: false,
BoxDocEnabled: new(bool),