Skip to content

Ensure style element is added to shadowDOM components on colorizeElement#190505

Merged
hediet merged 3 commits intomicrosoft:mainfrom
lucasMarioza:colorize-element-shadowdom
Aug 24, 2023
Merged

Ensure style element is added to shadowDOM components on colorizeElement#190505
hediet merged 3 commits intomicrosoft:mainfrom
lucasMarioza:colorize-element-shadowdom

Conversation

@lucasMarioza
Copy link
Contributor

@lucasMarioza lucasMarioza commented Aug 15, 2023

Fixes microsoft/monaco-editor#4092

When registerEditorContainer is called on shadow dom element, the <style> is attached to the element itself rather than to document.body. Since colorize element replace the innerHTML with the new formatted code, it loses the <style> element that was just added.

This PR moves the registerEditorContainer to after the colorizeElement to ensure the style will be there.

The changes was tested in this monaco playground following this guide

image

@Tyriar Tyriar assigned hediet and unassigned Tyriar Aug 16, 2023
@hediet hediet added this to the August 2023 milestone Aug 16, 2023
@hediet hediet enabled auto-merge August 24, 2023 21:08
@hediet hediet merged commit b8c413b into microsoft:main Aug 24, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] colorizeElement doesn't work in shadow DOM

4 participants