We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3072
    • 20 Posts
    When I go to Resources/Plugins/TinyMCE/Configuration I want to define valid_elements in "Custom Parameters"

    This line says to TinyMCE that only "p" and "a" elements are allowed.
    valid_elements : "p,a",

    MODx has problem to parse this code -> TinyMCE doesn´t load. I found out that the comma makes problems, but its the regular syntax.
    http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

    Using this code, TinyMCE has no problems.
    valid_elements : "p",


    To clean up the HTML I would use this expression.
    valid_elements : "@[id|class|title],a[href|type],abbr,acronym,address,big,blockquote[cite],br,caption,cite,code,col[span],col[colgroup],dd,del[cite|datetime],dfn,dl,dt,em/i,h2,h3,h4,h5,h6,hr,img[alt|name|src|width|height],ins[cite|datetime],li,object[height|archive|classid|codebase|codetype|data|declare|name|standby|tabindex|type|usemap|width],ol,p,param[id|name|type|value|valuetype<DATA?OBJECT?REF],q[cite],samp,small,strong/b,sub,sup,table[summary|caption],tbody,td[abbr|colspan],tfoot,th[abbr|colspan],thead,title,tr[abbr|colspan],tt,ul,var",

    Worked for me good, but not in MODx.
      • 3072
      • 20 Posts
      I found this in /assets/plugins/tinymce3201/tinymce.functions.php @ line 235-243
      if(!empty($customparams)){
      			    $params = split(",",$customparams);
      			    $paramsCount = count($params);
              		for ($i=0;$i<$paramsCount;$i++) {
              			if(!empty($params[$i])){
              				$tinymceInit .= "		  ".trim($params[$i]).",\n";
              			}
              		}			    
      			}

      I´m not sure how to fix it.
        • 10957
        • 32 Posts
        Does anyone have a clue about this problem ?
          • 34162
          • 1 Posts
          Hi there,

          i can admit this problem.

          No idea how to fix it.

          Changing the comma seperated list does not apply to tinymce.

          That’s a pity

          greetz
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I would think that explode() would be better than split(). For one thing, it’s faster:
            preg_split(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to split(). If you don’t require the power of regular expressions, it is faster to use explode(), which doesn’t incur the overhead of the regular expression engine.
            and for another split() will generate a notice with PHP 5.3
            Note: As of PHP 5.3.0 the regex extension is deprecated, calling this function will issue an E_DEPRECATED notice.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Digging into this a bit, it appears that quite a number of characters causes the configuration to break. I tried pasting in one of the samples from the moxiecode site
              valid_elements : "a[href|target=_blank],strong/b,div[align],br"
              

              The entire configuration string gets stored into the database just fine...
              &customparams=Custom Parameters;textarea;valid_elements : "a[href|target=_blank],strong/b,div[align],br" &tinyFormats...
              But on reloading into the plugin editing page, the Custom Parameters part gets trucated at the = (for the a[href|target=_blank] part):
              &customparams=Custom Parameters;textarea;valid_elements : "a[href|target &tinyFormats...
              However, that still doesn’t explain why a , in that particular configuration field causes TinyMCE to fail; there are certainly plenty of commas in the rest of the fields.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 3072
                • 20 Posts
                Bug is not fixed in Version 1.0.0
                  • 30107
                  • 44 Posts
                  Still broken in Evolution 1.0.2 sad
                    • 25663 MODX Staff
                    • 12,272 Posts
                    Please file a bug report in JIRA. Thank you!
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me