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.