Removing wrapping html elements like div or others of tinyMCE editor
Author:
Omar Shamali
Last Modification:
Writing Date:
we usually initiate tinyMCE like this:
tinyMCE.init({
});
we also have toolbar list like this:
tinyMCE.init({
toolbar2: 'forecolor backcolor emoticons fontselect fontsizeselect | ltr rtl | visualchars visualblocks loremipsum loremipsumar| searchreplace | fullscreen code preview help',
});
we need to first add the button of removeformat, in which generally removes some formatting html tags, so it become like this:
tinyMCE.init({
toolbar2: 'forecolor backcolor emoticons fontselect fontsizeselect | ltr rtl | visualchars visualblocks loremipsum loremipsumar| searchreplace | fullscreen code preview help removeformat',
});
now to specific which elements the removeformat will remove upon clicking, we add removeformat_selector config parameter as follows:
tinyMCE.init({
toolbar2: 'forecolor backcolor emoticons fontselect fontsizeselect | ltr rtl | visualchars visualblocks loremipsum loremipsumar| searchreplace | fullscreen code preview help removeformat',
removeformat_selector : 'b,strong,em,i,span,ins,div',
});