Hi there,
since it is not possible to paste images, if stripping all formatting is configured, i have created a small workaround, which i want to share. Target was, to get pretty clean HTML - without annoying markup - but to allow images to be inserted via clipboard.
First of all, use the options of the editor, to "pre-clean" the HTML:
StripFormattingOptions="Css,Font,Span,MSWordRemoveAll"
Then attach to the OnClientPasteHtml event and perform special cleaning, if HTML is pasted:
function Editor_PasteHtml(sender, args) { var sInitialValue = args.get_value(); if ((args.get_commandName() == 'Paste') && (sInitialValue != null)) { // Only allow basic tags var sStrippedValue = sInitialValue.replace(new RegExp("<(?!\/?(strong|b|em|img|(i(?!nput))|u|ol|ul|li|p|br)(?=>|\s?.*>))\/?.*?>", "ig"), ""); args.set_value(sStrippedValue); } }
The solution is not perfect and the RegEx could be extended, but for our case, it works good enought. The RegEx itself was taken from a sample by Rumen and modified, to allow less tags.
Kind regards, Carsten