Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » TinyMCE strips my code

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4
Go to End
Author Topic: 12037 Views
  • Lukef
    Avatar
    Community Member
    32 Posts

    Re: TinyMCE strips my code Link to this post

    Sorry to dredge this thread up... but I am having the same issue (not being able to add JS) and the advice given does not seem to be working in my case...

    The problem looks a little like this...
    Correct, working code

    <ul class="hoverbox">
    <li><img src="assets/specimages/_resampled/ResizedImage10067-3.jpg" alt="description" onmouseover=show_200("assets/specimages/3.jpg","image_3",418,280) onmouseout=hide_div() onerror=gag(this,100) ></li>
    </ul>

    The Code after SS/TinyMCE is finished with it.

    <ul class="hoverbox">
    <li><img onmouseover="show_200("assets/specimages/3.jpg","image_3",418,280)" onmouseout="hide_div()" src="assets/specimages/_resampled/ResizedImage10067-3.jpg" alt="description" ></li>
    </ul>

    What you see there, is still the result after commenting out the lines recommended by Banal.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: TinyMCE strips my code Link to this post

    Hi

    Your code is actually not correct... although it's working (not in all browsers I presume).
    The event attributes should look like this:

    onmouseover="show_200('assets/specimages/3.jpg', 'image_3', 418, 280)"

    Use double quotes to wrap the whole event argument, then use single quotes for the parameters.
    AFAIK, the onerror event attribute is not part of the current html standard (4.0). What's the purpose of this "gag" function you call there?

  • Lukef
    Avatar
    Community Member
    32 Posts

    Re: TinyMCE strips my code Link to this post

    Thanks for your speedy reply Banal, here is the truth of it. i don't know anything useful about JS, however, i know a guy who does, and i asked him to create some simple image rollover pop-ups for me he did so but when he discovered SS "cleaned" the code, rather than fix it, he disabled TinyMCE altogether and input the code.

    This works in FF3 ie7 and ie6 in a nearly uniform way, but it is of course now no use to the guy i am building it for as he cannot edit any of his site without knowledge of HTML (which he does not possess) SO i am trying to un-break the editor without breaking the code that is already there... so as you could imagine... all help gratefully received... i am a Designer, not a Developer.

    so as to the "Why's" of the code, i have no idea. :-/

    |G|

  • banal
    Avatar
    Community Member
    901 Posts

    Re: TinyMCE strips my code Link to this post

    I see. I really doubt, that the onerror event will even be fired.. so there's not much sense in including this.
    You should be able to enter your code in TinyMCE if you stick to the quotation rules I posted (http://www.w3schools.com/HTML/html_attributes.asp). Attributes without quotes.. that's coming straight from the nineties

    If you're using these scripts for a lot of images, it would be a lot easier if you (your programmer) wrote some jQuery functions that add the event handlers to the elements automatically (on page load).

  • Lukef
    Avatar
    Community Member
    32 Posts

    Re: TinyMCE strips my code Link to this post

    Thanks for he advice Banal
    but it still seems to be butchering the code... though to a lesser extent (or should that be ok?)

    code i entered:

    <ul class="hoverbox">
    <li><img src="assets/specimages/_resampled/ResizedImage10067-3.jpg" alt="description" onmouseover="show_200('assets/specimages/3.jpg', 'image_3', 418, 280)" onmouseout="hide_div()" /></li>
    </ul>

    Code it is churning out:

    <ul class="hoverbox">
    <li><img onmouseover="show_200('assets/specimages/3.jpg', 'image_3', 418, 280)" onmouseout="hide_div()" src="assets/specimages/_resampled/ResizedImage10067-3.jpg" alt="description" /></li>
    </ul>

    thanks again.

    |G|

  • banal
    Avatar
    Community Member
    901 Posts

    Re: TinyMCE strips my code Link to this post

    That looks ok to me. Seems like the attributes got shuffled a bit, but that doesn't matter.
    Doesn't it work like you expected?

  • Lukef
    Avatar
    Community Member
    32 Posts

    Re: TinyMCE strips my code Link to this post

    I was testing it locally before testing it on the live site thats all, which is why i wanted to check. but i just applied it to the live site and GUESS WHAT!

    IT WORKS!

    God is Good to me, he sends able people like yourself to help me out. I hope you have a legendary weekend.

    |G|

  • CriaturaCreativaStudio
    Avatar
    Community Member
    73 Posts

    Re: TinyMCE strips my code Link to this post

    Hi!

    Is there a way to prevent the editor making changes into the code?
    It's very annoying, all my code is well formed, but all the time inserts some tags that mess up my design!

    any help would be much apreciated

    Regards

    Eduardo

    12037 Views
Page: 1 2 3 4
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.