feat:add Shadow Root support for the editor#224
feat:add Shadow Root support for the editor#224xxMudCloudxx wants to merge 3 commits intoantvis:mainfrom
Conversation
|
最近有点忙,我先hold一下 |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the editor's compatibility with Shadow DOM, allowing it to be seamlessly integrated into web components and other encapsulated environments. It ensures that all editor functionalities, including user interactions, UI overlays, and style management, operate correctly when the editor is hosted within a ShadowRoot, thereby improving modularity and preventing conflicts with the surrounding page's styles and DOM structure. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive support for Shadow DOM across various editor components and utilities. Key changes include updating InteractionManager to correctly handle click events within shadow roots using event.composedPath() and a new eventPathContains utility. The Popover component, EditBar plugin, and ResetViewBox plugin have been refactored to properly inject styles and append overlay elements into either a specified custom container or the SVG's shadow root, leveraging new OverlayRoot types and getOverlayContainer utility. Style injection functions (injectStyleOnce, ensureEditorStyles, ensureIconButtonStyle, ensureColorPickerStyles, ensurePopoverStyle, ensureFontColorStyles, ensureFontFamilyListStyle, ensureButtonStyle) now accept an optional target node to determine the correct root for style insertion. Additionally, parseOptions and related types have been updated to accept ShadowRoot instances as valid containers, and setSVGPadding now correctly computes viewBox for SVGs within shadow roots. New test cases have been added to validate these Shadow DOM behaviors for InteractionManager, Popover, EditBar, ResetViewBox, parseOptions, and setSVGPadding.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #224 +/- ##
==========================================
+ Coverage 46.62% 49.26% +2.63%
==========================================
Files 342 343 +1
Lines 28261 28376 +115
Branches 2368 2544 +176
==========================================
+ Hits 13177 13979 +802
+ Misses 15072 14386 -686
+ Partials 12 11 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
b7002dd to
3954ed3
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive support for Shadow DOM, which is a significant enhancement for the editor's flexibility and encapsulation. The changes correctly address several key aspects of Shadow DOM integration, including event handling, style injection, and overlay placement. The new getOverlayContainer and eventPathContains utilities provide robust solutions for navigating and interacting with elements across shadow boundaries. Furthermore, the refactoring of injectStyleOnce to support targeted style injection into ShadowRoot instances ensures proper style encapsulation. The updated components and their associated tests demonstrate a thorough approach to implementing this feature. Overall, the changes are well-implemented and contribute positively to the editor's architecture.
📝 Change List (Shadow-root Support)📂 文件级工具 (Core Utils)
🖱️ 交互层 (Interaction Layer)
🧩 基础组件 (Base Components)
🏗️ Edit Bar 主体 (Edit Bar Core)
🎨 Edit Bar 子项 (Edit Bar Items)
⚙️ 其他插件 (Other Plugins)
✅ 测试用例 (Testing)
|
为编辑器增加对shadow root的支持。
前置pr:#223