Skip to content

New settings UI - #17675

Merged
Vanessa219 merged 10 commits into
siyuan-note:devfrom
TCOTC:feat/Group-settings
Jun 21, 2026
Merged

New settings UI#17675
Vanessa219 merged 10 commits into
siyuan-note:devfrom
TCOTC:feat/Group-settings

Conversation

@TCOTC

@TCOTC TCOTC commented May 13, 2026

Copy link
Copy Markdown
Contributor

Description / 描述

重构设置窗口 #17601

规模:116 个文件,约 +8439 / -7378 行


1. 做了什么

将设置页从「每个 Tab 一个上千行的 imperative 文件(手写 HTML + 事件绑定 + 保存逻辑)」重构为 项注册表 + 链式 DSL + 统一渲染 / 保存 / 搜索管线。桌面端与移动端共用同一套 Tab 实现;侧栏 Tab 内容做了合并归类。


2. 新架构

flowchart LR
    entry["openSetting"] --> tabs["setting/tabs.ts"]
    tabs --> builder["SettingBuilder DSL"]
    builder --> item["SettingItem 注册表"]
    builder --> group["SettingGroup 分组"]
    item --> mount["mount → render"]
    mount --> save["事件委托 save"]
    search["search/"] --> tabs
Loading

目录职责(app/src/config/

路径 职责
index.ts 桌面设置对话框;移动端 popMenu 入口
setting/builder.ts SettingBuilder 链式 DSL(switch / number / range / select / slot / stack 等)
setting/group.ts Tab 内分组注册与排序
setting/item.ts Map<id, SettingItem> 注册表
setting/control.ts 控件工厂;readConfig / readValue
setting/save.ts 全局 change / input 委托 → 按 id 路由保存
setting/mount.ts 首次挂载、搜索显隐
setting/tabs.ts 14 个一级 Tab 定义(settingTabs
tabs/*Tab.ts 各 Tab 的分组与控件注册
tabs/*Runtime.ts 命名空间 API(createConfigNamespaceApi / patch
tabs/*Ui.ts 复杂面板的动态 UI(同步、账号、快捷键等)
render/ 分组视图 HTML 生成
search/ 设置内搜索(归一化、扫描、Tab 切换)
util/dotPath.tsutil/namespaceApi.ts 点分路径读写、命名空间 patch

设计要点

  • 配置项 id 使用完整点分路径(如 editor.readOnly),与内核配置结构一一对应。
  • registerFn 延迟到首次 mountscanSearch 时执行,避免 languages 未就绪。
  • 首次打开 Tab 全量渲染;搜索时仅切换 CSS class,不重挂 DOM。
  • 保存路径:bindSettingSaveDelegationgetSettingItem(id)readValuesave

已删除

各 Tab 根单文件(editor.tsrepos.ts 等约 15 个)、全部 mobile/settings/*.ts(约 7 个)、util/setReadOnly.tsutil/setStatusBar.tsutil/updateAppearance.tsutil/genOptions.ts


3. Tab 重组

侧栏仍为 14 个一级 Tab(11 个 setting.tab + 3 个 setting.panel),对象键顺序即侧栏顺序。

新 Tab 类型 来源 / 说明
editor tab editor.ts
file tab fileTree.ts
appearance tab appearance.ts
bazaar panel bazaar.ts(移动端 / 华为 / 鸿蒙隐藏)
flashcard tab flashcard.ts
ai tab ai.ts
assets panel image.ts(重命名)
export tab exportConfig.ts
search tab search.ts
keymap panel keymap.ts
sync tab repos.ts + account.ts 合并
access tab publish.ts + query.ts 等认证 / 发布相关项
app tab 新增「应用」(自启动、网络代理、数据导入导出、维护等)
about tab about.ts

Tab id 变更影响调用方:repossyncfileTreefile 等。


4. UI 与样式

  • _config.scss:分组标题、间距、侧栏 + 内容区 + 搜索框的新布局。
  • _form.scss_responsive.scss_mobile.scss:表单控件与响应式适配。
  • 设置对话框:90vw × 90vh,最大宽度 1280px。
  • 主题列表类型:string[]{ label, name }[]
  • 编辑器配置新增 fontFamilyDisplay,用于设置面板展示字体名称。

5. 桌面 / 移动端统一

原先移动端 mobile/settings/*.ts 各写一套 HTML,现已删除。侧栏菜单由 getSettingTabDefs() 动态生成,点击后调用 getSettingTab(id).mount(),与桌面共享 tabs/*Tab.ts 和保存逻辑。settingTabToMenuId() 统一生成菜单 DOM id(如 menuConfigEditor)。


6. 调用方适配

以下模块改为使用 TSettingTabopenSetting(app, tab)

  • layout/topBar.tslayout/getAll.tssync/syncGuide.ts
  • boot/globalEvent/command/*protyle/util/hotKey.ts
  • plugin/Setting.tshistory/history.ts
  • mobile/menu/index.ts

7. 内核改动

文件 变更
kernel/conf/editor.go 新增 FontFamilyDisplay 字段
kernel/api/setting.go Pandoc 路径清空时恢复内置 Pandoc
kernel/model/cloud_service.go 激活码 TrimSpace + 空值校验
kernel/api/account.go checkActivationcode 参数绑定调整

Type of change / 变更类型

  • Bug fix
    缺陷修复
  • Refactoring
    代码重构
  • New feature
    新功能
  • Text updates or new language additions
    修改文案或增加新语言

Checklist / 检查清单

  • I have performed a self-review of my own code
    我对自己的代码进行了自我审查
  • I have full rights to the submitted code and agree to license it under this project's AGPL-3.0 license
    我拥有所提交代码的完整权利,并同意其以本项目的 AGPL-3.0 许可证授权
  • PR is submitted to the dev branch and has no merge conflicts
    PR 提交到 dev 分支,并且没有合并冲突

@TCOTC
TCOTC marked this pull request as draft May 13, 2026 04:48
@TCOTC
TCOTC force-pushed the feat/Group-settings branch 2 times, most recently from e8830dc to f21e239 Compare May 13, 2026 04:50
@TCOTC TCOTC mentioned this pull request May 13, 2026
@TCOTC
TCOTC force-pushed the feat/Group-settings branch 4 times, most recently from ae53e36 to ffe550a Compare May 17, 2026 14:42
@TCOTC TCOTC changed the title Improve settings New settings UI May 17, 2026
@TCOTC
TCOTC force-pushed the feat/Group-settings branch 4 times, most recently from 75dc18e to d764645 Compare May 22, 2026 06:38
@Vanessa219

Copy link
Copy Markdown
Member

大概还需要多久,久的话我要开写 #17691 这个了。

@TCOTC

TCOTC commented May 24, 2026

Copy link
Copy Markdown
Contributor Author

先不要做 #17691 ,跟我改的代码有冲突

@Vanessa219

Copy link
Copy Markdown
Member

如果久的话是要先处理的,后面解决一下冲突就行。

@TCOTC

TCOTC commented May 24, 2026

Copy link
Copy Markdown
Contributor Author

延后一点没问题,反正只是我的需求

@TCOTC
TCOTC force-pushed the feat/Group-settings branch 2 times, most recently from 919c1eb to a8d15f2 Compare May 25, 2026 18:41
Comment thread app/src/layout/getAll.ts
tag: [],
custom: [],
};
/// #if !MOBILE

@Vanessa219 Vanessa219 May 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改设置,不要去动这些和设置没有关系的地方。这些地方移动端是不会引入的。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是解决循环引用的问题

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为了去掉这个文件的变更,反而得引入更多的变更,我实在是搞不定这个

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些方法在移动端是不需要的,是不是移动端引入了 cofing 导致的?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移动端现在也统一使用 config 了

@Vanessa219

Copy link
Copy Markdown
Member

请还原非设置相关的改动,否则没有办法合并这个 PR。如果需要改动其他地方,可以单独 PR。

本来改动点就很多,再牵扯到其他地方就更不好 review,也不好检测 bug。请体谅,也请按照规则进行 PR。

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Settings UI to support categorized settings (per issue #17601) and to unify settings rendering/saving across desktop and mobile. It introduces a new settings-tab infrastructure (mounting, search indexing, delegated saving) and migrates several legacy settings panels to the new system.

Changes:

  • Introduce a tab/section-based settings UI framework (tab registry, mount helpers, delegated save routing, in-panel search/filtering).
  • Migrate multiple settings pages (e.g., File, Export, Search) and unify mobile settings to reuse the desktop tab implementation.
  • Adjust kernel/frontend behavior around activation codes, Pandoc path reset, appearance application, and several UI touchpoints.

Reviewed changes

Copilot reviewed 104 out of 105 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
kernel/model/cloud_service.go Trim/validate activation codes and return localized error on empty input.
kernel/go.mod Adds a local replace directive (currently points to a developer machine path).
kernel/conf/editor.go Adds fontFamilyDisplay and updates a config comment.
kernel/api/setting.go Adds Pandoc reset semantics when pandocBin is set to empty.
kernel/api/account.go Adjust activation-code arg parsing to allow empty values (handled downstream).
app/src/window/init.ts Switch to appearanceSettings.apply(...).
app/src/util/needSubscribe.ts Update iOS subscribe message language key usage.
app/src/util/iOSPurchase.ts Update selector for account refresh button (with optional chaining).
app/src/util/genOptions.ts Removes legacy option HTML generators.
app/src/util/cookie.ts Adds cookie helper and desktop-mode cookie accessor.
app/src/util/assets.ts Refactors setAppearance payload creation using object spread.
app/src/types/config.d.ts Updates config typings (themes list shape, new fontFamilyDisplay, stricter provider type).
app/src/sync/syncGuide.ts Refactors cloud list rendering/binding and settings navigation.
app/src/protyle/util/hotKey.ts Refactors hotkey parsing for special keys (F-keys, PageUp/Down, etc.).
app/src/protyle/ui/initUI.ts Ensure setEditor responses are applied back to window.siyuan.config.editor.
app/src/plugin/Setting.ts Updates plugin setting row markup/classes for the new config UI styling.
app/src/plugin/openTopBarMenu.ts Open Settings directly to the Bazaar tab.
app/src/plugin/loader.ts Use configTabToMenuId() for mobile menu insertion anchor.
app/src/plugin/index.ts Use configTabToMenuId() for mobile menu insertion anchor.
app/src/mobile/settings/riffCard.ts Removes legacy mobile-only riff card settings UI.
app/src/mobile/settings/fileTree.ts Removes legacy mobile-only file-tree settings UI.
app/src/mobile/settings/export.ts Removes legacy mobile-only export settings UI.
app/src/mobile/settings/assets.ts Removes legacy mobile-only assets settings UI.
app/src/mobile/settings/appearance.ts Removes legacy mobile-only appearance settings UI.
app/src/mobile/settings/ai.ts Removes legacy mobile-only AI settings UI.
app/src/mobile/menu/openConfigTab.ts Adds helper to open desktop-style config tabs inside mobile model.
app/src/mobile/dock/MobileFiles.ts Simplifies setFiletree payload and applies response data.
app/src/menus/onGetnotebookconf.ts Updates notebook config dialog markup to new config item structure.
app/src/layout/util.ts Uses new cookie helper, adjusts editor collection, dock serialization, and layout export flow.
app/src/layout/topBar.ts Update VIP toolbar behavior to open Settings sync tab.
app/src/layout/index.ts Wrap desktop-only layout code in /// #if !MOBILE.
app/src/layout/getAll.ts Adds getAllEditor() helper and refines mobile/desktop build guards; enhances dock hotkey derivation.
app/src/layout/dock/index.ts Removes data-hotkey attribute and relies on hotkeyLangId in DOM serialization.
app/src/layout/dock/Inbox.ts Updates iOS subscribe message language key usage.
app/src/layout/dock/Files.ts Simplifies setFiletree payload and applies response data.
app/src/layout/dock/Backlink.ts Apply setEditor response back to window.siyuan.config.editor.
app/src/index.ts Replace account.onSetaccount() call with onSetaccount() function.
app/src/config/util/updateAppearance.ts Switch to appearanceSettings.apply(...).
app/src/config/util/setStatusBar.ts Make handler binding null-safe and refactor appearance payload building.
app/src/config/util/setReadOnly.ts Removes legacy helper; read-only is now routed via editorSettings.send(...).
app/src/config/util/about.ts Removes setAccessAuthCode from this module (now handled elsewhere).
app/src/config/ui/search.ts Adds settings-row search matching and section filtering/index string collection.
app/src/config/ui/save.ts Adds delegated save routing for settings controls and mount-time bind helpers.
app/src/config/ui/formValue.ts Adds DOM value parsing, range snapping, and range UI sync helpers.
app/src/config/ui/dotPath.ts Adds dotted-path getters and immutable merge helpers for config payloads.
app/src/config/types.ts Introduces TConfigTab union for config tabs.
app/src/config/tabs.ts Adds tab definition registry and helpers (title/icon/menu id/hidden checks).
app/src/config/searchSettings.ts Adds new Search settings tab implementation using the new UI framework.
app/src/config/publish.ts Removes legacy publish settings implementation.
app/src/config/mountConfigTab.ts Adds tab mounting dispatcher for the new settings system.
app/src/config/fileTree.ts Removes legacy file-tree settings implementation.
app/src/config/file.ts Adds new File settings tab implementation using the new UI framework.
app/src/config/export.ts Adds new Export settings tab implementation using the new UI framework.
app/src/config/bazaar.ts Refactors trust UI generation and various settings payload updates; adds debug output.
app/src/config/assets.ts Renames config module from image to assets and updates references.
app/src/boot/onGetConfig.ts Switch to appearanceSettings.apply(...) and adds a temporary startup setting auto-open.
app/src/boot/globalEvent/keydown.ts Route read-only toggle through editorSettings.send(...).
app/src/boot/globalEvent/command/panel.ts Removes empty-state and initial focus logic for command panel list.
app/src/boot/globalEvent/command/global.ts Route read-only toggle through editorSettings.send(...).
app/src/assets/scss/util/_responsive.scss Updates responsive rules for new config layout wrappers and range UI.
app/src/assets/scss/mobile.scss Includes config business styles on mobile.
app/src/assets/scss/component/_form.scss Adjusts icon input padding.
app/src/assets/scss/business/_config.scss Significant config UI styling updates (sidebar, groups, account layout, etc.).
app/appearance/langs/zh_CN.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/zh_CHT.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/tr_TR.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/sk_SK.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/ru_RU.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/pt_BR.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/nl_NL.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/ko_KR.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/id_ID.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/fr_FR.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/es_ES.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/en_US.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.
app/appearance/langs/de_DE.json Adds new config grouping strings and new kernel message ids (294/295), plus copy tweaks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kernel/go.mod Outdated
Comment thread app/src/config/bazaar.ts Outdated
Comment thread app/src/config/bazaar.ts Outdated
Comment thread app/src/config/bazaar.ts Outdated
Comment thread app/src/config/export.ts Outdated
Comment thread app/src/boot/onGetConfig.ts Outdated
Comment thread app/src/boot/globalEvent/command/panel.ts
@TCOTC

TCOTC commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

重构整个设置不可避免会改到其他地方,因为设置关联到所有的功能。等我改完之后再看看有没有东西是可以不动的。

@Vanessa219

Copy link
Copy Markdown
Member

改的时候不要改动到不是配置的地方,这个应该是很好识别的吧。

现在用 AI 辅助到处改一通,会增加很多没有必要的工作量:

  1. 现在的修改
  2. 后面的 review
  3. 最后的回滚

@TCOTC

TCOTC commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

等我改完之后会整体看一下

@TCOTC
TCOTC force-pushed the feat/Group-settings branch 2 times, most recently from 2f097a2 to dbf2716 Compare May 31, 2026 13:31
@88250 88250 added the Feature label Jun 19, 2026
@88250 88250 added this to the 3.7.0 milestone Jun 19, 2026
@88250
88250 requested a review from Vanessa219 June 19, 2026 00:44

@88250 88250 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

内核侧的变更我认为没问题

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 114 out of 116 changed files in this pull request and generated 6 comments.

Comment thread app/src/config/tabs/appTab.ts
Comment thread app/src/config/tabs/appTab.ts
Comment thread app/src/layout/util.ts Outdated
Comment thread app/src/config/tabs/accessRuntime.ts Outdated
Comment thread app/src/config/tabs/accessRuntime.ts
Comment thread app/src/config/tabs/accessRuntime.ts
Comment thread app/src/assets/scss/component/_button.scss
Comment thread app/src/boot/globalEvent/command/panel.ts
Comment thread app/src/layout/getAll.ts
tag: [],
custom: [],
};
/// #if !MOBILE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些方法在移动端是不需要的,是不是移动端引入了 cofing 导致的?

Comment thread app/src/layout/index.ts
Comment thread app/src/layout/tabUtil.ts
Comment thread app/src/layout/util.ts Outdated
Comment thread app/src/layout/util.ts
Comment thread app/src/protyle/util/hotKey.ts Outdated
Comment thread app/src/types/config.d.ts
@@ -226,10 +226,6 @@ declare namespace Config {
* Light code block theme
*/
codeBlockThemeLight: string;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

petal 记得修改

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

等合并之后再改

TCOTC added a commit to TCOTC/siyuan that referenced this pull request Jun 20, 2026
@TCOTC
TCOTC force-pushed the feat/Group-settings branch from 5d52298 to 7d83291 Compare June 20, 2026 11:52
@TCOTC
TCOTC marked this pull request as draft June 20, 2026 11:52
TCOTC added a commit to TCOTC/siyuan that referenced this pull request Jun 20, 2026
TCOTC added a commit to TCOTC/siyuan that referenced this pull request Jun 20, 2026
@TCOTC
TCOTC force-pushed the feat/Group-settings branch from d0fd67b to 4bb8ea7 Compare June 20, 2026 12:01
@mozhuk

mozhuk commented Jun 22, 2026

Copy link
Copy Markdown

功能问题:
1、智能体模型选择无法影响侧栏智能体模型设置。 理想状态这两个应该是互通,两边互相影响。
2、创建提供商和模型应该合并成一个页面并支持搜索添加模型以及验证链接联通性
美观问题:
1、设置左栏过窄,整体宽度过宽影响比例。建议参考所谓黄金比例调整。
2、右栏设置内容字体过大,应缩小一号,集市详情排版 标题等名称都过大。

@mozhuk

mozhuk commented Jun 22, 2026

Copy link
Copy Markdown

手机端设置页面 无法实现一次完整闭环的云同步。对于新手非常不友好。
理想情况下。点击立即同步应和桌面端一致,要求登录账号,然后弹窗选择 同步方式,S3或其他,并设置初始化密码或导入密钥, 然后选择云端目录,确认后启动同步。 目前云端同步的各项内容虽合并在一个位置,但无桌面端的引导流程。

@TCOTC

TCOTC commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@mozhuk 在这里反馈问题:#17601

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants