I've got a plugin using an htmlFilter.
When I add the image tag using editor.document.getBody().appendHtml("<img src='mysrc'>"), when switching to source mode the filter gets applied and replaces the src attribute of the image element. I can see this change in the source view.
However, if I use editor.insertHtml("<img src='mysrc'>"), when switching to source mode, I still hit the breakpoint and overwrite the element.attributes.src value but the source view does not show the src attribute as changed.
How is it that an element added with editor.insertHtml will not apply a change made to element.attributes.src when switching to Source mode?
When I add the image tag using editor.document.getBody().appendHtml("<img src='mysrc'>"), when switching to source mode the filter gets applied and replaces the src attribute of the image element. I can see this change in the source view.
However, if I use editor.insertHtml("<img src='mysrc'>"), when switching to source mode, I still hit the breakpoint and overwrite the element.attributes.src value but the source view does not show the src attribute as changed.
How is it that an element added with editor.insertHtml will not apply a change made to element.attributes.src when switching to Source mode?
afterInit: function(editor) var htmlFilter = dataProcessor && dataProcessor.htmlFilter; if ( htmlFilter ) { htmlFilter.addRules( { elements: { img : function(element) { var pattern = new RegExp("mysrc", "i"); if ( pattern.test(element.attributes.src) ) { element.attributes.src = replaceSrc(pattern, element.attributes.src); } } } }); }
Re: htmlFilter executes but doesn't get applied for insertHt
Re: htmlFilter executes but doesn't get applied for insertHt