Open cyberpau opened 1 year ago
I ran into this problem myself where I wanted to enable people to embed videos into the content but merely adding a customHTMLSanitizer was insufficient as loading the content in wysiwyg mode causes the embed code to be lost. No solutions from me yet. I may look into how to create a toast plugin and see if I can add support that way.
Summary
I have a code that checks the initialValue of the Editor
And I'm passing the
defaultEditor
value to<Editor>
props:This is working fine as if the contents I'm editing contains any iframe / html element, it will switch to markdown mode, and if it contains plain text, it will use WYSIWYG.
But what I would like to achieve is to lock the user on markdown mode (prevent them from switching to wysiwyg). What I tried is to use CSS to disable the WYSIWYG button, something like this:
But it only works one time, WYSIWYG users that switched to markdown mode will not be able to go back to WYSIWYG mode even if their contents do not contain any iframes. It seems that the styled is only loaded once. I trieed to put it on handleDocChange() but still does not work.
Screenshots
Version
Additional Context
Switching between WYSIWYG and Markdown mode removes or corrupts HTML elements such as
iframes
,classes
, etc.