Didier B. Posted March 11 Share Posted March 11 I want to use the TinyMCE Media plugin to place html video and youtube/vimeo embeds within text. I also want to leave the purifier option activated. I added "extended_valid_elements": "video, source, iframe" to my custom TinyMCE default settings JSON file: { "extended_valid_elements": "video,source,iframe", "browser_spellcheck": false, "height": 500, ... } After saving the page the video and iframe elements are still removed. Sometimes the elements remain after the first save, but after a subsequent save they are still removed. How to solve this? Link to comment Share on other sites More sharing options...
elabx Posted March 11 Share Posted March 11 I struggled with this too, I didn't give it a shot but I thought of hooking the MarkupHTMLPurifier but I didn't find a reasonable point to hook into, maybe here? But would love to scope it to InputfieldTinyMCE. Link to comment Share on other sites More sharing options...
Didier B. Posted March 12 Author Share Posted March 12 Based on information I found here I placed the code below in site/ready.php but this doesn't work either... Does it only work for CKEditor? $wire->addHookAfter('MarkupHTMLPurifier::initConfig', function(HookEvent $event) { $def = $event->arguments(1); $def->addElement('video', 'Flow', 'Flow', 'Common'); $def->addElement('source', 'Flow', 'Flow', 'Common'); $def->addElement('iframe', 'Flow', 'Flow', 'Common'); }); Link to comment Share on other sites More sharing options...
BrendonKoz Posted March 12 Share Posted March 12 I was curious so just tested the default configuration of using the TinyMCE field with the media plugin enabled, and I was able to get it to save a YouTube and/or Vimeo video within the editor (and view it successfully on the frontend) without adjusting HTMLPurifier. However, if I re-save the exact same page, after saving it once, the content then disappears. Something must be changing just enough that's causing it to get wiped, though I haven't dug down to see what. I think most have taken advantage of either hannacodes, Ryan's Textformatter Video Embed, or one of the two Oembed modules for this. It's not quite as convenient as simply using something that exists natively within the TinyMCE editor, but it may be a viable workaround if a better solution can't immediately be found. 😞 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now