Reputation: 638
Is there a way to completely strip the selected elements of their styles AND HTML tags?
So <p>Text</p>
would become Text
.
Either using a custom button (function), or a 'Plain Text' style in the formats dropdown?
Upvotes: 2
Views: 2453
Reputation: 638
Thanks to Anub for direction, I managed to do this myself.
// Store the current selections string/value in a variable and strip it's tags
var node = tinymce.activeEditor.selection.getContent({ format : 'text' });
// Replace the selected content with the stripped out content
tinymce.activeEditor.selection.setContent(node);
Upvotes: 3
Reputation: 97
try
selection.getContent({format : 'text'});
or
selection.getContent({format : 'html'});
Upvotes: 4