WYSWIYG code blocks: copied head styles into shadow root

Currently only link-based styles are made available in the shadow root
code editor environment, this adds normal styles to apply any user-added
via custom head content.

Fixes #4228
This commit is contained in:
Dan Brown
2023-05-08 12:21:53 +01:00
parent b5cc0a8e38
commit 2523cee0e2

View File

@ -53,8 +53,8 @@ function defineCodeBlockCustomElement(editor) {
super();
this.attachShadow({mode: 'open'});
const stylesToCopy = document.querySelectorAll('link[rel="stylesheet"]:not([media="print"])');
const copiedStyles = Array.from(stylesToCopy).map(styleEl => styleEl.cloneNode(false));
const stylesToCopy = document.head.querySelectorAll('link[rel="stylesheet"]:not([media="print"]),style');
const copiedStyles = Array.from(stylesToCopy).map(styleEl => styleEl.cloneNode(true));
const cmContainer = document.createElement('div');
cmContainer.style.pointerEvents = 'none';