[kupu-dev] Avoid filtering of specific attribute

Max M maxm at mxm.dk
Thu Oct 4 14:01:21 CEST 2007


Wouter Vanden Hove skrev:

> what is the best way get disable the filtering for this?
> edit kupucontentfilters.js or kupuinit.js?

Ok. The only solution I can think of is this:

this.initialize = function(editor) {
     // The initialize method is called automaticaly by Kupu
     // This is where we add the event handler.
     this.editor = editor;
     var allowedAttrs = ['class', 'dynafield:uid','dynafield:view']
     var validator = editor.xhtmlvalid;
     validator.setTagAttributes(['span'],allowedAttrs);
     validator.setAttrFilter(allowedAttrs);
     addEventHandler(this.button, 'change', this.execCommand, this);
     // make the dynafield tags valid.
};


This way a span will keep the attributes in 'allowedAttrs'. I could not 
find another way to set it.

includeTagAttributes will not work, as span and div does not have any 
attributes set to begin with.

But on the other hand it is pretty simple to add additional attributes 
in that list.

If this is a hack, so be it. I cannot use more time on the problem now 
:-s If anybody figures out a more correct approach, please let me know ...

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science



More information about the kupu-dev mailing list