Sha256: c55ed4665d7f68bb5450ec084752934503a546910230a7a0dc5153396375f058

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

!function(e){"use strict";function t(e){var t=e;return t=t.replace(/<[^> ]*/g,function(e){return e.toLowerCase()}),t=t.replace(/<[^>]*>/g,function(e){return e=e.replace(/ [^=]+=/g,function(e){return e.toLowerCase()})}),t=t.replace(/<[^>]*>/g,function(e){return e=e.replace(/( [^=]+=)([^"][^ >]*)/g,'$1"$2"')})}function r(e){return e=t(e),e=e.replace(/<b(\s+|>)/g,"<strong$1"),e=e.replace(/<\/b(\s+|>)/g,"</strong$1"),e=e.replace(/<i(\s+|>)/g,"<em$1"),e=e.replace(/<\/i(\s+|>)/g,"</em$1"),e=e.replace(/<!(?:--[\s\S]*?--\s*)?>\s*/g,""),e=e.replace(/&nbsp;/gi," "),e=e.replace(/ <\//gi,"</"),e.replace(/\s+/g," "),e=e.replace(/^\s*|\s*$/g,""),e=e.replace(/<[^>]*>/g,function(e){return e=e.replace(/ ([^=]+)="[^"]*"/g,function(e,t){return["alt","href","src","title"].indexOf(t)!==-1?e:""})}),e=e.replace(/<\?xml[^>]*>/g,""),e=e.replace(/<[^ >]+:[^>]*>/g,""),e=e.replace(/<\/[^ >]+:[^>]*>/g,""),e=e.replace(/<(div|span|style|meta|link).*?>/gi,"")}e.extend(!0,e.trumbowyg,{plugins:{cleanPaste:{init:function(t){t.pasteHandlers.push(function(n){setTimeout(function(){try{t.saveRange();var a=(n.originalEvent||n).clipboardData,c=a.getData("Text"),o=t.doc.getSelection().focusNode,g=t.doc.createRange(),l=r(c.trim()),i=e(l)[0]||t.doc.createTextNode(l);""===t.$ed.html()?t.$ed[0].appendChild(i):(g.setStartAfter(o),g.setEndAfter(o),t.doc.getSelection().removeAllRanges(),t.doc.getSelection().addRange(g),t.range.insertNode(i)),g=t.doc.createRange(),g.setStartAfter(i),g.setEndAfter(i),t.doc.getSelection().removeAllRanges(),t.doc.getSelection().addRange(g),n.stopPropagation(),n.preventDefault(),t.saveRange(),t.syncCode(),t.$c.trigger("tbwchange")}catch(s){}},0)})}}}})}(jQuery);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin_trumbowyg-0.2.12 app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js