Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Tiny MCE (not) replacing characters

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

Page: 1
Go to End
Author Topic: 1546 Views
  • Alex S
    Community Member
    30 Posts

    Tiny MCE (not) replacing characters Link to this post


    I've just noticed that TinyMCE doesn't seem to be replacing double-quote characters with the correct HTML alternative. What I would expect to happen is, having typed this "Hello World" into the CMS Tiny MCE would convert accordingly to "Hello World" in the source code. However, the double quote character remains (and stops the page validating as XHTML).

    I had a further look and tested inserting the correct HTML directly into the source editor, it seems to have the opposite effect to what it should be doing? It converts my " back to the double quotation character in the source code.

    It correctly changes the "less than" and "greater than" characters to their respective HTML.

    I've tried adding the following to "_config.php": "HtmlEditorConfig::get('cms')->setOption('verify_html', 'true'); // turn on html validation" to attempt to force some validation, sadly, no joy.

    I found some code in the "/jsparty/tiny_mce2/tiny_mce_src.js" file (line 2206):

    encode : function(s) {
             return s ? ('' + s).replace(/[<>&\"]/g, function (c, b) {
                switch (c) {
                   case '&':
                      return '&amp;';

                   case '"':
                      return '&quot;';

                   case '<':
                      return '&lt;';

                   case '>':
                      return '&gt;';

                return c;
             }) : s;

    Which looks like it's going to do the right thing.

    Have I missed something? Is this disabled somewhere? I figure I've just not dug down far enough yet but I can't think where else to look, does anyone have any suggestions?



Page: 1
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.