We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24865
    • 289 Posts
    Hi,

    I came across a small problem when trying to apply a class to an image. Seeing that MODx requires the formats to be split by a comma (’,’) in the backend and TinyMCE interpreting that on the RichText init, I found out why it doesn’t load it.

    File: /assets/components/tinymce/jscripts/tiny_mce/plugins/advimage/js/image.js
    	fillClassList : function(id) {
    		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
    		
    		if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
    			cl = [];
    			tinymce.each(v.split(';'), function(v) {
    				var p = v.split('=');
    
    				cl.push({'title' : p[0], 'class' : p[1]});
    			});
    		} else
    			cl = tinyMCEPopup.editor.dom.getClasses();
    
    		if (cl.length > 0) {
    			lst.options.length = 0;
    			lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
    
    			tinymce.each(cl, function(o) {
    				lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
    			});
    		} else
    			dom.remove(dom.getParent(id, 'tr'));
    	},


    The line starts as line #260; I corrected the error on line #265 like so:
    			cl = [];
    			
    			/*tinymce.each(v.split(';'), function(v) {
    				var p = v.split('=');
    
    				cl.push({'title' : p[0], 'class' : p[1]});
    			});*/
    			
    			tinymce.each(v.split(','), function(v) {
    				cl.push({'title' : v, 'class' : v});
    			});


    If this has already been fixed, you may ignore it. If not, please try to include this into your newest version.

    And if you are wondering, splitting them by ; in the backend system settings panel works perfectly, but then it doesn’t load the classes into TinyMCE because TinyMCE itself requires a class, class or class,class format. Perhaps here you should replace ; by , and you won’t need to change the advimage plugin.
      @MarkGHErnst

      Developer at Adwise Internetmarketing, the Netherlands.