1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 23:29:42 +02:00
documize/gui/public/tinymce/plugins/paste/plugin.min.js

1 line
21 KiB
JavaScript
Raw Normal View History

2018-01-19 11:36:38 +00:00
!function(){"use strict";function e(e,t){return P.each(t,function(t){e=t.constructor===RegExp?e.replace(t,""):e.replace(t[0],t[1])}),e}function t(e){var t,n;return n=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],e=e.replace(/^[\u00a0 ]+/,""),P.each(n,function(n){if(n.test(e))return t=!0,!1}),t}function n(e){return/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(e)}function r(e,t,n,r){var i,o={},a=e.dom.parseStyle(r);return P.each(a,function(a,s){switch(s){case"mso-list":(i=/\w+ \w+([0-9]+)/i.exec(r))&&(n._listLevel=parseInt(i[1],10)),/Ignore/i.test(a)&&n.firstChild&&(n._listIgnore=!0,n.firstChild._listIgnore=!0);break;case"horiz-align":s="text-align";break;case"vert-align":s="vertical-align";break;case"font-color":case"mso-foreground":s="color";break;case"mso-background":case"mso-highlight":s="background";break;case"font-weight":case"font-style":return void("normal"!==a&&(o[s]=a));case"mso-element":if(/^(comment|comment-list)$/i.test(a))return void n.remove()}0!==s.indexOf("mso-comment")?0!==s.indexOf("mso-")&&("all"===m.getRetainStyleProps(e)||t&&t[s])&&(o[s]=a):n.remove()}),/(bold)/i.test(o["font-weight"])&&(delete o["font-weight"],n.wrap(new k("b",1))),/(italic)/i.test(o["font-style"])&&(delete o["font-style"],n.wrap(new k("i",1))),(o=e.dom.serializeStyle(o,n.name))||null}function i(e,t){e.on("PastePreProcess",function(n){n.content=t(e,n.content,n.internal,n.wordContent)})}function o(e,t){if(!F.isWordContent(t))return t;var n=[];P.each(e.schema.getBlockElements(),function(e,t){n.push(t)});var r=new RegExp("(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?("+n.join("|")+")[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*","g");return t=M.filter(t,[[r,"$1"]]),t=M.filter(t,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}function a(e,t,n,r){if(r||n)return t;var i=m.getWebkitStyles(e);if(!1===m.shouldRemoveWebKitStyles(e)||"all"===i)return t;if(i&&(i=i.split(/[, ]/)),i){var o=e.dom,a=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(e,t,n,r){var s=o.parseStyle(o.decode(n),"span"),l={};if("none"===i)return t+r;for(var u=0;u<i.length;u++){var c=s[i[u]],f=o.getStyle(a,i[u],!0);/color/.test(i[u])&&(c=o.toHex(c),f=o.toHex(f)),f!==c&&(l[i[u]]=c)}return(l=o.serializeStyle(l,"span"))?t+' style="'+l+'"'+r:t+r})}else t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(e,t,n,r){return t+' style="'+n+'"'+r})}function s(e,t){e.$("a",t).find("font,u").each(function(t,n){e.dom.remove(n,!0)})}var l=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return l(n())}}},u=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=function(e){return!(!/(^|[ ,])powerpaste([, ]|$)/.test(e.settings.plugins)||!u.get("powerpaste")||("undefined"!=typeof window.console&&window.console.log&&window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option."),0))},f=function(e,t){return{clipboard:e,quirks:t}},d={firePastePreProcess:function(e,t,n,r){return e.fire("PastePreProcess",{content:t,internal:n,wordContent:r})},firePastePostProcess:function(e,t,n,r){return e.fire("PastePostProcess",{node:t,internal:n,wordContent:r})},firePastePlainTextToggle:function(e,t){return e.fire("PastePlainTextToggle",{state:t})},firePaste:function(e,t){return e.fire("paste",{ieFake:t})}},m={shouldPlainTextInform:function(e){return e.getParam("paste_plaintext_inform",!0)},shouldBlockDrop:function(e){return e.getParam("paste_block_drop",!1)},shouldPasteDataImages:function(e){return e.getParam("paste_data_images",!1)},shouldFilterDrop:function(e){return e.getParam("paste_filter_drop",!0)},getPreProcess:function(e){return e.getParam("paste_preprocess")},getPostProcess:function(e){return e.getParam("paste_postprocess")},getWebkitStyles:function(e){retu