开发者

Strip HTML style attributes in dijit.Editor (onPaste)

开发者 https://www.devze.com 2023-01-09 00:54 出处:网络
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 f开发者_如何学Goont-size, color, etc and puts it into

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 f开发者_如何学Goont-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.


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


htmlEditor.editNode.innerText

does the trick for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号