{% extends '@FOSCKEditor/Form/ckeditor_widget.html.twig' %}
{% block ckeditor_widget_extra %}
CKEDITOR.on('instanceReady', function(e) {
// First time
if (document.body.classList.contains('oka-darkMode')){
e.editor.document.getBody().setStyle('color', 'white');
e.editor.document.getBody().setStyle('background-color', 'transparent');
}
else {
e.editor.document.getBody().setStyle('color', 'black');
e.editor.document.getBody().setStyle('background-color', 'transparent');
}
// in case the user switches to source and back
e.editor.on('contentDom', function() {
if (document.body.classList.contains('oka-darkMode')){
e.editor.document.getBody().setStyle('color', 'white');
e.editor.document.getBody().setStyle('background-color', 'transparent');
}
else {
e.editor.document.getBody().setStyle('color', 'black');
e.editor.document.getBody().setStyle('background-color', 'transparent');
}
});
e.editor.on('change', (event) => {
console.log("in there");
e.editor.updateElement()
})
});
{% endblock %}