I have a scheme system, so I have a button that change the colors of my website. But I want to do that without having to reset the editor or reload the page. So I would like to know how to change skin
and content_css
properties in a simple js function, when I click the toggle scheme btn, and I need that it applies immediately.
I have implemented the editor like this:
<Editor
id='content'
apiKey='XXXXXXXXXXXXXXXXXXXXX'
onInit={(_evt, editor) => editorRef.current = editor}
init={{
height: 300,
width: '100%',
menubar: false,
content_css: isDark ? 'dark' : 'light',
skin: isDark ? 'oxide-dark' : 'oxide',
plugins: ['advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview',
'anchor', 'searchreplace', 'visualblocks', 'codesample', 'fullscreen',
'insertdatetime', 'media', 'table', 'help', 'wordcount'],
toolbar: 'undo redo | blocks | ' +
'bold italic forecolor | image link anchor codesample anchor' +
'alignleft aligncenter | alignright alignjustify | bullist numlist outdent indent | ' +
'removeformat | help',
content_style: 'body { font-family:Arial; font-size:14px }'
}}
/>
I tried to change directly these propoerties with editorRef.current.contentCSS
but nothing happened, and I don’t if it’s rlly the right property bc “skin” doesn’t appear here so ??
I also tried to change directly the background, which worked, now I don’t know how to change the toolbar ? => editorRef.current.getBody().style.backgroundColor = 'red'
enter image description here