Skip to content

fix(web): inject app styles into isolated HTML - #5860

Merged
Calcium-Ion merged 1 commit into
mainfrom
fix/isolated-html-app-styles
Jul 2, 2026
Merged

fix(web): inject app styles into isolated HTML#5860
Calcium-Ion merged 1 commit into
mainfrom
fix/isolated-html-app-styles

Conversation

@QuentinHsu

Copy link
Copy Markdown
Collaborator

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

自定义 HTML 使用 Shadow DOM 隔离渲染后,主应用已生成的 CSS 不会自动作用到隔离内容,导致自定义首页中的布局、字号、按钮等样式丢失。

本次在隔离 HTML 渲染时克隆主文档中已加载的 stylelink[rel="stylesheet"] 节点到 ShadowRoot,再渲染隔离基础样式和净化后的 HTML。这样保留 Shadow DOM 隔离,同时恢复依赖应用 CSS 的自定义 HTML 样式。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

  • bun run typecheck 通过。
  • bunx oxlint -c .oxlintrc.json src/components/html-content.tsx 通过。
  • 已在 http://localhost:5173/ 手动验证自定义首页渲染正常,Shadow DOM 内样式注入生效。

- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 79406eee-5b22-4056-8dcd-5311825b5f05

📥 Commits

Reviewing files that changed from the base of the PR and between 52858ad and 53c8bdc.

📒 Files selected for processing (1)
  • web/default/src/components/html-content.tsx
👮 Files not reviewed due to content moderation or server errors (1)
  • web/default/src/components/html-content.tsx

Warning

Walkthrough skipped

File diffs could not be summarized.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/isolated-html-app-styles

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Calcium-Ion
Calcium-Ion merged commit 1f4d8d2 into main Jul 2, 2026
2 checks passed
henrydontbbai added a commit to henrydontbbai/henry-newapi that referenced this pull request Jul 2, 2026
* feat: improve advanced custom route editor

* Bump Electron lockfile dependencies

* feat: bill doubao seedance-2.0 by output resolution and video input (QuantumNous#5300)

* feat: support doubao seedance 2.0 safety_identifier/priority and 4k billing (QuantumNous#5824)

* feat: support safety_identifier and priority for doubao video

* feat: add 4k resolution billing tier for doubao video

* chore: run `bun format` to automatically format the frontend code

* fix(web): 修复自定义 HTML 样式被过滤及排版间距异常的问题 (QuantumNous#5795)

* fix(web): 修复自定义 HTML 样式被过滤及排版间距异常的问题

* fix(web): isolate custom HTML rendering

---------

Co-authored-by: CaIon <i@caion.me>

* feat: support Wan2.7 i2v media mapping (QuantumNous#4984)

* feat: support Wan2.7 i2v media mapping

* fix: normalize wan2.7 i2v image inputs

* perf(web): optimize web Rsbuild and Tailwind build pipeline (QuantumNous#5786)

* fix(dev): run only default frontend in dev-web

- simplify make dev-web to install default dependencies and start web/default only.
- keep dev-web-classic as the standalone classic entry and scope its install to classic.

* chore(build): align make targets with web naming

- rename frontend make targets and variables to use the web terminology consistently.
- keep default and classic dev port overrides available under the updated names.

* fix(web): inject app styles into isolated HTML (QuantumNous#5860)

- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.

* fix: keep page state when switching tabs within the same route (QuantumNous#5796)

AnimatedOutlet keyed its motion container by the full pathname, so
navigating between params of the same route (e.g. the dashboard tabs
under /dashboard/$section) changed the key and remounted the route
component, discarding its in-memory state. The most visible symptom:
the dashboard time range resets to the default every time you switch
sub-tabs (Model Analytics / Flow / User Analytics).

Key the transition by the matched route id instead, so param-only
navigation re-renders in place while real page-to-page navigation
still plays the enter animation. This also preserves state across the
other $section tab pages (usage logs, models, system settings).

* 支持服务优雅关闭,避免重启回复中断和面板缓存数据丢失 (QuantumNous#4258)

* feat: add graceful shutdown with configurable timeout

* fix: flush quota dashboard cache on graceful shutdown

Persist the in-memory CacheQuotaData aggregation to the quota_data table
before process exit, so a restart no longer drops up to one DataExportInterval
window of dashboard data (issue QuantumNous#5679).

* docs: update AGENTS.md

* Make quota logging synchronous and delay startup log

---------

Co-authored-by: CaIon <i@caion.me>
Co-authored-by: feitianbubu <feitianbubu@qq.com>
Co-authored-by: t0ng7u <dev@aiass.cc>
Co-authored-by: olwater <52482488+olwater@users.noreply.github.com>
Co-authored-by: Scott <sc908181134@gmail.com>
Co-authored-by: QuentinHsu <xuquentinyang@gmail.com>
Co-authored-by: henrydontbbai <268972047+henrydontbbai@users.noreply.github.com>
@Calcium-Ion
Calcium-Ion deleted the fix/isolated-html-app-styles branch July 3, 2026 08:57
liulixin-lex pushed a commit to liulixin-lex/xy-api that referenced this pull request Jul 7, 2026
- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.
xiaomingchen pushed a commit to xiaomingchen/new-api that referenced this pull request Jul 10, 2026
- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.
Jacobinwwey pushed a commit to Jacobinwwey/new-api that referenced this pull request Jul 11, 2026
- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.
ruanhangjian pushed a commit to ruanhangjian/new-api that referenced this pull request Jul 11, 2026
- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.
noah-wung pushed a commit to noah-wung/new-api that referenced this pull request Jul 17, 2026
- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.
zhaodechao2008 pushed a commit to zhaodechao2008/new-api that referenced this pull request Jul 27, 2026
- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
- clone loaded application style nodes into the Shadow DOM for custom HTML rendering.
- keep HTML rendering isolated while restoring layout and typography that depend on app CSS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants