• Hello,
    Thanks for your plugin. I added two options:

    paste_preprocess | function(plugin, args){
        // Strip all HTML tags except those we have whitelisted
        var whitelist = 'p,strong,em,i,b,h2,h3,h4,h5,h6,ul,li,ol';
        var stripped = jQuery('<div>' + args.content + '</div>');
        var els = stripped.find('*').not(whitelist);
        for (var i = els.length - 1; i >= 0; i--) {
          var e = els[i];
          jQuery(e).replaceWith(e.innerHTML);
        }
        // Strip all class and id attributes
        stripped.find('*').removeAttr('id').removeAttr('class').removeAttr('align');
        // Return the clean HTML
        args.content = stripped.html();
      }

    and extended_valid_elements | strong/b,em/i

    These are to clean HTML code when pasting from Word. The first one seems to work (it removes not whitelisted tags, etc.) but the second one does not: I still have b and i tags in my editor, while I’d like them to be replaced by strong and em ones.

    Thanks for your help.

    • This topic was modified 4 years, 9 months ago by mahrr.
  • The topic ‘extended_valid_elements’ is closed to new replies.