mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-30 07:32:39 +01:00
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:
parent
b5cc0a8e38
commit
2523cee0e2
@ -53,8 +53,8 @@ function defineCodeBlockCustomElement(editor) {
|
|||||||
super();
|
super();
|
||||||
this.attachShadow({mode: 'open'});
|
this.attachShadow({mode: 'open'});
|
||||||
|
|
||||||
const stylesToCopy = document.querySelectorAll('link[rel="stylesheet"]:not([media="print"])');
|
const stylesToCopy = document.head.querySelectorAll('link[rel="stylesheet"]:not([media="print"]),style');
|
||||||
const copiedStyles = Array.from(stylesToCopy).map(styleEl => styleEl.cloneNode(false));
|
const copiedStyles = Array.from(stylesToCopy).map(styleEl => styleEl.cloneNode(true));
|
||||||
|
|
||||||
const cmContainer = document.createElement('div');
|
const cmContainer = document.createElement('div');
|
||||||
cmContainer.style.pointerEvents = 'none';
|
cmContainer.style.pointerEvents = 'none';
|
||||||
|
Loading…
Reference in New Issue
Block a user