[Solved]Text editor changing code

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

[Solved]Text editor changing code

Post by jasnick »

Using CMSMS 1.11.7 and latest modules

Setting up a Video Gallery page using VideoLightBox. Finally got it working only to find that after I exited from Admin then re-opened Admin later, it had stopped working at the stage where it should have started playing the video.

After much checking, I discovered (in Admin) that the code I had pasted into the page had changed a little.

Working code:

<!-- Start VideoLightBox.com BODY section -->

<__script__ type="text/javascript">

function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("video_overlay");
ytplayer.setVolume(100);
}

</__script>
<div id="videogallery">
<a rel="#voverlay" href="uploads/videos/engine/swf/player.swf?url=../../data/video/black_marlin_dampier_wa_2012_.flv&volume=100" title="Black Marlin Dampier WA 2012 "><img src="uploads/videos/data/thumbnails/black_marlin_dampier_wa_2012_.png" alt="Black Marlin Dampier WA 2012 " />Black Marlin Dampier WA 2012</a><a id="videolb" href="http://videolightbox.com">Video in Popup by VideoLightBox.com v1.11</a>
</div>
<!-- End VideoLightBox.com BODY section -->

Non-working code:
After Submit, the page plays correctly. However, if I go back into Admin and edit the page again, I find the code has changed to:

<!-- Start VideoLightBox.com BODY section -->
<__script__ type="text/javascript">// <![CDATA[
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("video_overlay");
ytplayer.setVolume(100);
}
// ]]></__script>
<div id="videogallery"><a title="Black Marlin Dampier WA 2012 " href="uploads/videos/engine/swf/data/video/black_marlin_dampier_wa_2012_.flv&volume=100" rel="#voverlay"><img src="uploads/videos/data/thumbnails/black_marlin_dampier_wa_2012_.png" alt="Black Marlin Dampier WA 2012 " />Black Marlin Dampier WA 2012 </a><a id="videolb" href="http://videolightbox.com">Video in Popup by VideoLightBox.com v1.11</a>
</div>
<!-- End VideoLightBox.com BODY section -->

In the page metadata is:<!-- Start VideoLightBox.com HEAD section -->
{literal}
<link rel="stylesheet" href="uploads/videos/engine/css/videolightbox.css" type="text/css" />
<style type="text/css">#videogallery a#videolb{display:none}</style>
<link rel="stylesheet" type="text/css" href="uploads/videos/engine/css/overlay-minimal.css"/>
<__script__ src="uploads/videos/engine/js/jquery.tools.min.js"></__script>
<__script__ src="uploads/videos/engine/js/swfobject.js"></__script>
<!-- make all links with the 'rel' attribute open overlays -->
<__script__ src="uploads/videos/engine/js/videolightbox.js"></__script>
{/literal}
<!-- End VideoLightBox.com HEAD section -->

The change in the order of the code has stopped the video playing. The overlay opens but no black box with video. In other words, the first mentioned code works, the second doesn't. Is there anything that can be done to stop TinyMCE changing the code? I was using MicroTiny initially but changed to TinyMCE in case it made a difference.

Thanks
Last edited by jasnick on Mon Aug 05, 2013 7:57 am, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Text editor changing code

Post by Jo Morg »

WYSIWYG editors are known to change code: normally it's by design. They are not meant to input HTML, except for a few tags needed for basic formating. AFAIK TinyMCE may have a setting to allow some extra tags whereas MicroTiny doesn't.
The best solution (and there are several already posted on the forum that a search may reveal) would be to use an UDT or a GCB with the code and to call either with a parameter that would be the filename of the source video.
HTH
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

Re: Text editor changing code

Post by jasnick »

Thanks Jo Morg - I am obviously not using the correct search terms as I have not found much to help me. I will research your suggestions as I really want to achieve this layout if I can.

Thanks again!
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Text editor changing code

Post by Jo Morg »

"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

Re: Text editor changing code

Post by jasnick »

Can it be that easy? I just added the working code into GCB and it works!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Text editor changing code

Post by velden »

Please add '[solved]' to topic title.

If you only need to paste the video code in that page you could also choose to disable wysiwyg editor for that page only.

In the options tab check: 'Disable WYSIWYG editor on this page (regardless of template or user settings)'
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

Re: Text editor changing code

Post by jasnick »

Sorry, velden - I was waiting to make sure it WAS solved. Yes, I did go in and disable WYSIWYG in the settings!

Thanks
Post Reply

Return to “Modules/Add-Ons”