Fix for existing umls on CKEditor

0 votes
asked Feb 3, 2015 in Bug by fuksman (120 points)

In case when you want to edit existing plantuml you have an empty src-attribute. I fixed this problem in CKEDITOR.on('instanceReady') function. Here is my code:

 

htmlFilter.addRules( {
                    elements : {
                        $ : function( element ) {
                            if ( element.name == 'img' ) {
                                // var imgsrc = element.attributes.src;
        
                                // element.attributes.src = imgsrc;
 
                                var imgalt = element.attributes.alt;
                                var u = compress(imgalt);
                                u = "http://www.plantuml.com/plantuml/img/"+u;
                                element.attributes.src = u;
                                element.attributes['data-cke-saved-src'] = u;
                            }
                        }
                    }
                });

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...