I have used @Thariama solutions but I got one issue.
In paste_preprocess function:
paste_preprocess : function(pl, o) {
o.content = StripTags( o.content,'' );
console.log(o.content);
},
Tinymce returns string as:
Original String:
"<h1>History.js Test Suite</h1>
<p>HTML5 Browsers must pass the HTML4+HTML5 tests, HTML4 Browsers must pass the HTML4 tests and should fail the HTML5 tests.</p>"
Returned string:
<h1>History.js Test Suite</h1><br /> <br /><p>HTML5 Browsers must pass the HTML4+HTML5 tests, HTML4 Browsers must pass the HTML4 tests and should fail the HTML5 tests.</p>
The best I found that will for both string.
var $str1 = '<h1>History.js Test Suite</h1><br /> <br /><p>HTML5 Browsers must pass the HTML4+HTML5 tests, HTML4 Browsers must pass the HTML4 tests and should fail the HTML5 tests.</p>';
function StripTags(string) {
var decoded_string = $("<div/>").html(string).text();
return $("<div/>").html(decoded_string).text();
}
console.log(StripTags($str1));
Output:
History.js Test Suite HTML5 Browsers must pass the HTML4+HTML5 tests, HTML4 Browsers must pass the HTML4 tests and should fail the HTML5 tests.
Reference link