I wanna have a button to wrap content with all tags.
My Code:
editor.addButton('MobileToggleArea', {
text: '<M>',
icon: false,
onclick: function (){
editor.selection.setContent('<div class="mobile-hide">' + editor.selection.getContent({format: 'raw'}) + '</div><div class="mobil-mehr">mehr</div>');
}
});
Example:
<p>test</p>
<p>test</p>
Result:
<p> </p>
<div class="mobile-hide">
<p>test</p>
<p>test</p>
<div class="mobil-mehr">mehr</div>
<p> </p>
Problem:
It is adding additional p tags, why? how to prevent?
Other Problem (but not so bad) is when selected only one p Tag:
<div class="mobile-hide">test</div>
<div class="mobil-mehr">mehr</div>
The p Tag has gone away.
Plugins: char word count autosave charmap code fullscreen image importcss link lists paste searchreplace tabfocus table template visualblocks anchor hr nonbreaking textcolor colorpicker
Thanks for helping out.