Cobby
Cobby

Reputation: 5454

Strip HTML style attributes in dijit.Editor (onPaste)

Is there anyway to make the dijit.Editor strip HTML style="" attributes from pasted content?

If I copy text from another site, it copies it's font-size, color, etc and puts it into span tags. I would prefer to only strip styles when pasting.

I already have a tried-and-tested regex to replace the content, but I don't know how to hook it up with the dijit.Editor. I tried pushing a function to contentPreFilters but that doesn't get called when pasting text.

Upvotes: 1

Views: 1341

Answers (2)

todor.hr
todor.hr

Reputation: 56

htmlEditor.editNode.innerText

does the trick for me.

Upvotes: 0

achimbode
achimbode

Reputation: 35

Try the dojox.editor.plugins.NormalizeStyle Plugin by Jared Jurkiewicz. It allows for configuring either CSS style or normal attributes output.

Upvotes: 1

Related Questions