Skip to content

NOW MANAGED ON CODEBERG

Fixed custom code theme not showing in WYSIWYG

Dan Brownaf434d021663
diff --git a/resources/js/wysiwyg/plugin-codeeditor.js b/resources/js/wysiwyg/plugin-codeeditor.js
index b9fc355e1..5377f564e 100644
--- a/resources/js/wysiwyg/plugin-codeeditor.js
+++ b/resources/js/wysiwyg/plugin-codeeditor.js
@@ -39,16 +39,16 @@ function defineCodeBlockCustomElement(editor) {
constructor() {
super();
this.attachShadow({mode: 'open'});
- const linkElem = document.createElement('link');
- linkElem.setAttribute('rel', 'stylesheet');
- linkElem.setAttribute('href', window.baseUrl('/dist/styles.css'));
+
+ const stylesToCopy = document.querySelectorAll('link[rel="stylesheet"]:not([media="print"])');
+ const copiedStyles = Array.from(stylesToCopy).map(styleEl => styleEl.cloneNode(false));
const cmContainer = document.createElement('div');
cmContainer.style.pointerEvents = 'none';
cmContainer.contentEditable = 'false';
cmContainer.classList.add('CodeMirrorContainer');
- this.shadowRoot.append(linkElem, cmContainer);
+ this.shadowRoot.append(...copiedStyles, cmContainer);
}
getLanguage() {