New settings UI - #17675
Conversation
e8830dc to
f21e239
Compare
ae53e36 to
ffe550a
Compare
75dc18e to
d764645
Compare
|
大概还需要多久,久的话我要开写 #17691 这个了。 |
|
先不要做 #17691 ,跟我改的代码有冲突 |
|
如果久的话是要先处理的,后面解决一下冲突就行。 |
|
延后一点没问题,反正只是我的需求 |
919c1eb to
a8d15f2
Compare
| tag: [], | ||
| custom: [], | ||
| }; | ||
| /// #if !MOBILE |
There was a problem hiding this comment.
改设置,不要去动这些和设置没有关系的地方。这些地方移动端是不会引入的。
There was a problem hiding this comment.
这些方法在移动端是不需要的,是不是移动端引入了 cofing 导致的?
|
请还原非设置相关的改动,否则没有办法合并这个 PR。如果需要改动其他地方,可以单独 PR。 本来改动点就很多,再牵扯到其他地方就更不好 review,也不好检测 bug。请体谅,也请按照规则进行 PR。 |
There was a problem hiding this comment.
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.
|
重构整个设置不可避免会改到其他地方,因为设置关联到所有的功能。等我改完之后再看看有没有东西是可以不动的。 |
|
改的时候不要改动到不是配置的地方,这个应该是很好识别的吧。 现在用 AI 辅助到处改一通,会增加很多没有必要的工作量:
|
|
等我改完之后会整体看一下 |
2f097a2 to
dbf2716
Compare
| tag: [], | ||
| custom: [], | ||
| }; | ||
| /// #if !MOBILE |
There was a problem hiding this comment.
这些方法在移动端是不需要的,是不是移动端引入了 cofing 导致的?
| @@ -226,10 +226,6 @@ declare namespace Config { | |||
| * Light code block theme | |||
| */ | |||
| codeBlockThemeLight: string; | |||
5d52298 to
7d83291
Compare
d0fd67b to
4bb8ea7
Compare
|
功能问题: |
|
手机端设置页面 无法实现一次完整闭环的云同步。对于新手非常不友好。 |

Description / 描述
重构设置窗口 #17601
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目录职责(
app/src/config/)index.tspopMenu入口setting/builder.tsSettingBuilder链式 DSL(switch/number/range/select/slot/stack等)setting/group.tssetting/item.tsMap<id, SettingItem>注册表setting/control.tsreadConfig/readValuesetting/save.tschange/input委托 → 按 id 路由保存setting/mount.tssetting/tabs.tssettingTabs)tabs/*Tab.tstabs/*Runtime.tscreateConfigNamespaceApi/patch)tabs/*Ui.tsrender/search/util/dotPath.ts、util/namespaceApi.ts设计要点
editor.readOnly),与内核配置结构一一对应。registerFn延迟到首次mount或scanSearch时执行,避免languages未就绪。bindSettingSaveDelegation→getSettingItem(id)→readValue→save。已删除
各 Tab 根单文件(
editor.ts、repos.ts等约 15 个)、全部mobile/settings/*.ts(约 7 个)、util/setReadOnly.ts、util/setStatusBar.ts、util/updateAppearance.ts、util/genOptions.ts。3. Tab 重组
侧栏仍为 14 个一级 Tab(11 个
setting.tab+ 3 个setting.panel),对象键顺序即侧栏顺序。editoreditor.tsfilefileTree.tsappearanceappearance.tsbazaarbazaar.ts(移动端 / 华为 / 鸿蒙隐藏)flashcardflashcard.tsaiai.tsassetsimage.ts(重命名)exportexportConfig.tssearchsearch.tskeymapkeymap.tssyncrepos.ts+account.ts合并accesspublish.ts+query.ts等认证 / 发布相关项appaboutabout.tsTab id 变更影响调用方:
repos→sync、fileTree→file等。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. 调用方适配
以下模块改为使用
TSettingTab和openSetting(app, tab):layout/topBar.ts、layout/getAll.ts、sync/syncGuide.tsboot/globalEvent/command/*、protyle/util/hotKey.tsplugin/Setting.ts、history/history.tsmobile/menu/index.ts7. 内核改动
kernel/conf/editor.goFontFamilyDisplay字段kernel/api/setting.gokernel/model/cloud_service.goTrimSpace+ 空值校验kernel/api/account.gocheckActivationcode参数绑定调整Type of change / 变更类型
缺陷修复
代码重构
新功能
修改文案或增加新语言
Checklist / 检查清单
我对自己的代码进行了自我审查
我拥有所提交代码的完整权利,并同意其以本项目的 AGPL-3.0 许可证授权
devbranch and has no merge conflictsPR 提交到
dev分支,并且没有合并冲突