We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21872
    • 95 Posts
    I tried creating a setting, but it looks like the system doesn’t recognize this one and there’s no documentation form the tinymce plugin on rtfm. I need to do the following: add section, article, and aside as valid elements and as valid containers. Has anyone done this?

    edit: there is a file called xconfig.js that has a comment "This file is used by the MODx TinyMCE plugin to pass additional parameters to TinyMCE for processing." and includes "var tinymce_extended_valid_elements = ’’" but adding elements following the instructions here: http://tinymce.moxiecode.com/wiki.php/Configuration:extended_valid_elements has no effect.
      • 21872
      • 95 Posts
      I think editing that file *might* have had an effect on Tiny. maybe not. I created a template that inserts a section, and it has class mceTmpl, when the cursor is within the section, the status bar says "Path: section" but at some point it gets removed. This is extremely frustrating. What I am trying to do should have taken five minutes, it’s turning into two hours.
        • 3749
        • 24,544 Posts
        This is just a wild guess, but look on the properties tab of the plugin

        If there is no tinymce_extended_valid_elements property, I think you could add one and it would be set when the OnRichTextEditorInit event fires.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 21872
          • 95 Posts
          A good wild guess, but it didn’t work. As far as I can tell, there’s some sort of cleanup script running fairly regularly, at a minimum, it runs when updating via the html button, when toggling the RTE with the Toggle Editor check box, and on save. Despite adding what would appear to be the appropriate settings in the tinymce area of system settings, then editing one of what appears to be core to the plugin (and thus likely to be overwritten on the next update), and finally doing as you suggest and editing the default properties (which discourage being edited since they may easily be overwritten on update) I can only conclude that those values never get included in the configuration provided to the tinymce init() method. Indeed, I just took the obvious step of viewing the source of a page where the editor is present and found Ext.onReady(function () { Tiny.config = { .......... }); It does not contain [tt]valid_elements [/tt]or [tt]advanced_valid_elements[/tt], although it does contain [tt]"element_list":""[/tt], [tt]"entities":""[/tt], and [tt]"invalid_elements":""[/tt] so at a guess, there’s no place in the plugin where those values get included. I hope I’m wrong, though.
            • 21872
            • 95 Posts
            Out of sheer desperation, I’ve resorted to using a div until this is either fixed or I have time to fork the plugin. There’s not much point to having rich semantics if you can’t give WYSIWYG users a way to use them 1) easily and 2) correctly.
              • 3749
              • 24,544 Posts
              Quote from: nsfdev at Jan 09, 2011, 02:17 AM

              A good wild guess, but it didn’t work. As far as I can tell, there’s some sort of cleanup script running fairly regularly, at a minimum, it runs when updating via the html button, when toggling the RTE with the Toggle Editor check box, and on save. Despite adding what would appear to be the appropriate settings in the tinymce area of system settings, then editing one of what appears to be core to the plugin (and thus likely to be overwritten on the next update), and finally doing as you suggest and editing the default properties (which discourage being edited since they may easily be overwritten on update) I can only conclude that those values never get included in the configuration provided to the tinymce init() method. Indeed, I just took the obvious step of viewing the source of a page where the editor is present and found Ext.onReady(function () { Tiny.config = { .......... }); It does not contain [tt]valid_elements [/tt]or [tt]advanced_valid_elements[/tt], although it does contain [tt]"element_list":""[/tt], [tt]"entities":""[/tt], and [tt]"invalid_elements":""[/tt] so at a guess, there’s no place in the plugin where those values get included. I hope I’m wrong, though.

              I don’t actually know this, but I assumed that the $scriptProperties values would be passed in last so as to override anything else. That’s generally SOP in MODx and I know that in the NewsPublisher code, this works:

               $tinyproperties=$plugin->getProperties();
                                 require_once $tinyPath.'tinymce.class.php';
                                 $tiny = new TinyMCE($this->modx,$tinyproperties,$tinyUrl);
              
                                // irrelevant code omitted
              
                                 $tinyproperties['cleanup'] = true; /* prevents "bogus" bug */
                                 $tinyproperties['width'] = empty ($this->props['tinywidth'] )? '95%' : $this->props['tinywidth'];
                                 $tinyproperties['height'] = empty ($this->props['tinyheight'])? '400px' : $this->props['tinyheight'];
              
                                 $tiny->setProperties($tinyproperties);
              


              The settings for height and width definitely make it through to TinyMCE (and the ones in the plugin’s properties do too, if I don’t set them explicitly). I assumed that the back-end code would work the same way. Maybe there’s some other setting that’s making Tiny ignore tinymce_extended_valid_elements property (on reflection, maybe it should be just extended_valid_elements?). You could also try using a ’selector’ property. It might accept a comma-separated list: ’modx-richtext,alias,section’.

              As a last resort, I think you could write your own plugin that gets things before TinyMCE does and insert class="modx-richtext" in the appropriate places.

              BTW, I can’t imagine why you would want a richtext alias. wink
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 37763
                • 12 Posts
                I have same problem here, i have try to add the extend element in 'xconfig.js', but still not working. anyone know why, and how to fix it?