Skip to content

feat(settings): add developer settings section and mermaid rendering switch#77

Open
gushishang wants to merge 1 commit into
mainfrom
codex/add-developer-options-in-settings
Open

feat(settings): add developer settings section and mermaid rendering switch#77
gushishang wants to merge 1 commit into
mainfrom
codex/add-developer-options-in-settings

Conversation

@gushishang
Copy link
Copy Markdown
Member

Motivation

  • 在设置中需要新增“开发人员选项”以允许输入自定义 API 服务器和图床的 Base URL,方便调试和自定义运行时资源地址。
  • 将错误日志导出与收集调试信息归并到开发者选项中以减少普通用户界面的杂项设置暴露。
  • 增加一个全局开关来控制富文本解析器中 Mermaid 图表的渲染,从而按需关闭可能导致性能或兼容性问题的渲染逻辑。

Description

  • 新增并调整设置配置:在 src/config/user.config.ts 中添加 mermaid 开关以及新的 developer 分组,包含 apiBaseUrlstaticBaseUrl 两个 input 类型的配置项,并将 debuggerexportLogs 移入该分组。
  • 扩展设置页面:在 src/views/Settings.vue 中增加 input 控件支持(使用 n-input),实现 handleInputChange、持久化到 userConfig 并保留回调机制以即时生效或触发提示。
  • 运行时 URL 解析优先使用用户配置:在 src/services/utils.tsgetPath 中读取 userConfig.apiBaseUrluserConfig.staticBaseUrl(回退到 import.meta.env 的默认值),以支持自定义服务器与图床。
  • 可选化 Mermaid 渲染:在 src/services/pltxt2htm/advancedParser.ts 中根据 userConfig.mermaid 的值决定是否执行 Mermaid 渲染流程;同时加入对 storageManager 的引用以读取设置。
  • 国际化:在 src/i18n/zh.ts, src/i18n/en.ts, src/i18n/de.ts, src/i18n/ja.ts, src/i18n/fr.ts 中添加/更新了 developermermaidapiBaseUrlstaticBaseUrl 等文案键以保持多语言一致性。

Testing

  • 运行 npm run lint:i18n,i18n 检查通过(i18n check passed)。
  • 运行 npm run build,项目构建成功(生成 dist/,构建完成且无阻断错误)。

Codex Task

@gushishang
Copy link
Copy Markdown
Member Author

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4009823fbd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config/user.config.ts
Comment on lines +36 to 38
const languageItem = settingsConfig[0]?.items.find((item) => item.key === 'language')
if (languageItem?.type === 'link') {
languageItem.options = createLanguageOptions()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Refresh binary option labels after language switch

After changing i18n.global.locale.value, this callback only rebuilds the language selector options, but the mermaid and debugger selects keep the old createBinaryOptions() labels because their option arrays are created once at config initialization. In practice, switching language in Settings leaves those dropdowns translated in the previous locale until a reload/reopen, which is a regression from the previous behavior that refreshed debugger options on language change.

Useful? React with 👍 / 👎.

@gushishang
Copy link
Copy Markdown
Member Author

gushishang commented May 20, 2026 via email

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Fixed the Settings i18n regression by adding refreshLinkOptionsAfterLocaleSwitch() to rebuild translated option lists for all relevant link items after locale changes (language, mermaid, and debugger). src/config/user.config.tsL24-L32
  • Updated the language setting callback to call the new refresh helper immediately after i18n.global.locale.value is changed, so binary dropdown labels update without reload/reopen. src/config/user.config.tsL44-L47
  • Committed the fix on the current branch with commit message: fix(settings): refresh binary options on language switch (commit 1dc6907).
  • Created a follow-up PR message via make_pr summarizing this incremental fix on top of the original PR.

Testing

  • npm run build

View task →

@gushishang
Copy link
Copy Markdown
Member Author

gushishang commented May 20, 2026 via email

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant