Page 1 of 1

WYSIWYG editor strips embed code

Posted: Fri Oct 23, 2015 4:20 am
by Christine
Hi, I'm having a problem where if I use one of the WYSIWYG editors (any version, including CKEditor), it removes any embed code I have. For example, it removes the <object> tags and everything between them for a music player I'm using, and the <video> tags and everything between them for VideoJS. It happens both when I switch from using the plain editor to WYSIWYG (if I save the post without even editing it, it will be saved with those tags ^ missing) and when I enter the code in Source mode in the editor - it just immediately deletes it when I switch back from/to Source. It even happens when I use the embed button and enter the code there.

I just upgraded to the latest Serendipity from 1.7, I'm not sure if that has anything to do with it. I also disabled all my markup plugins to test it and it still removes everything.

Am I missing something obvious, like a plugin I need, or is this a bug?

Re: WYSIWYG editor strips embed code

Posted: Fri Oct 23, 2015 10:24 am
by Timbalu
Since Serendipity 2.0 the internal, "built-in" editor is CKEDITOR. There is also a plugin called CKEDITOR. They can differ in version and the Plugin may have additional wysiwyg-plugins enabled. They both come by default with an extra button for media objects. It looks like a vertical filmstrip and is called "Embed video media". This opens a popup window where to place your code.
If you have some special kind of code to place which isn't taken by this approach, you can use the CKEDITOR plugin and disable the Plugin option for ACF. Then everything is allowed. (IMO, not recommended!)

Re: WYSIWYG editor strips embed code

Posted: Fri Oct 23, 2015 11:45 pm
by Christine
Thanks, Timbalu. I ended up using the CKEditor Plugin with ACF disabled, and that's working for me. Is there any particular reason you don't recommend it, e.g. any problems I may have down the line?

Regarding the built-in editor, I just thought I'd mention I was trying the film strip button and it would just delete my code immediately. Should it be that that aggressive?

Re: WYSIWYG editor strips embed code

Posted: Sat Oct 24, 2015 10:11 am
by Timbalu
I am not much experienced in embedding videos to posts, but this was meant to use a youtube embed link as such:

Code: Select all

<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/9HvpIgHBSdo" width="560"></iframe>
Which shows up as

Code: Select all

<div><iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/9HvpIgHBSdo" width="560"></iframe></div>

<p>&nbsp;</p>
This can be done either by the mediaembed or by the sourcecode button with a direct insert. So it may depend on how you normally insert video markup to your entries.

About the ACF, it is designed to only allow secured and well known html. This helps users not to do and not to use "dirty" markup, which might blow up your page some day. So you might use the ACF shutoff for single entries until save and then enable it again, or use it totally off and know what you do.

Re: WYSIWYG editor strips embed code

Posted: Sat Oct 24, 2015 11:57 am
by Christine
Thanks again, Ian. I thought that might be the case with ACF disabled, but I believe I know what I'm doing enough for it not to be a problem.

For video, I'm using VideoJS, which uses html5 <video> tags. Looking around, I've found CKEditor doesn't support this by default and I need a plugin or to configure CKEditor for it. Same with the flash objects. I'll consider doing this if the disabled ACF doesn't work out for me.

It might be nice if the editor came with some options like this, especially for html5 video and audio.

Re: WYSIWYG editor strips embed code

Posted: Sat Oct 24, 2015 12:34 pm
by Timbalu
If you add

Code: Select all

video[*];source[*];
to

Code: Select all

config.extraAllowedContent
in cke_config.js or using the cores editor in https://github.com/s9y/Serendipity/blob ... fig.js#L68 this should work right out of the box (with some hard reloads to avoid caching issues, though).

HTML5 audio is already supported.
Flash is dead! Do not support this crap! :) Please!

Re: WYSIWYG editor strips embed code

Posted: Sun Oct 25, 2015 2:07 am
by Christine
Don't worry, it's just a fallback :D. My HTML5 music player is a little buggy, so I want to ease into using it alone.

Thanks once again for your help, I'll try those CKEditor configurations.