Reputation: 336
If someone pastes content from an HTML page, the IDs of that page's elements are pasted with it. This messes up a lot if it later causes duplicate IDs when the content is displayed.
How can I strip all the IDs (and classes for that matter) from any pasted content but still retain the tags?
Here's an excerpt of my instantiation:
menubar : false,
statusbar : false,
content_css : "css/mce.css",
contextmenu : "link image jbimage paste inserttable | cell row column deletetable",
plugins : [
"advlist autolink lists link image charmap anchor",
"code fullscreen media table contextmenu paste jbimages paste"
],
paste_auto_cleanup_on_paste : true,
paste_strip_class_attributes:"all",
menubar : false,
toolbar : "fontselect | fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify | link image jbimages media | fullscreen | setSection code",
toolbar_items_size : 'small',
force_br_newlines : true,
force_p_newlines : false,
forced_root_block : '',
title : "",
mode : "textareas",
Upvotes: 2
Views: 388
Reputation: 50832
Use the paste_preprocess setting of tinymce and define something like the following
ed.settings.paste_preprocess = function(pl, o)
{
o.content = o.content.replace(/ id="(.*?)"/ig, "");
});
Upvotes: 2