Last active
June 23, 2025 21:43
-
-
Save towfiqpiash/d6b51e97120adbea5a4581edc6094219 to your computer and use it in GitHub Desktop.
Revisions
-
towfiqpiash revised this gist
Oct 8, 2017 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,9 +6,15 @@ function html2text(html) { return tag.innerText; } // Convert Any copied text to plain text in TinyMCE (strip all tags) paste_preprocess: function(plugin, args) { var tag = document.createElement('div'); tag.innerHTML = args.content; args.content = tag.innerText; } // Convert Any copied text to plain text in TinyMCE (Keep <P> tag only) paste_preprocess: function(plugin, args) { var pWithStyle = args.content.replace(/<[^p](?:.|\n)*?>/gm, ''); args.content = pWithStyle.replace(/\sstyle=\"(.*?)\"/gm, ''); } -
towfiqpiash created this gist
Oct 8, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // converts HTML to text using Javascript function html2text(html) { var tag = document.createElement('div'); tag.innerHTML = html; return tag.innerText; } // Convert Any copied text to plain text in TinyMCE paste_preprocess: function(plugin, args) { var tag = document.createElement('div'); tag.innerHTML = args.content; args.content = tag.innerText; },