From 4457fd9e9c4d116c4272cfdecb0349d3f3152699 Mon Sep 17 00:00:00 2001 From: Froala Bot Date: Mon, 8 Apr 2019 09:52:00 +0000 Subject: [PATCH] Review froala-labs/froala-editor-js-2#668. --- js/froala_editor.pkgd.min.js | 2 +- js/plugins/word_paste.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/froala_editor.pkgd.min.js b/js/froala_editor.pkgd.min.js index eb9515708..cd5d4d8e6 100644 --- a/js/froala_editor.pkgd.min.js +++ b/js/froala_editor.pkgd.min.js @@ -4,4 +4,4 @@ * Copyright 2014-2019 Froala Labs */ -!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(Ee){var s=function(e,t){this.id=++Ee.FE.ID;var n={};t&&t.documentReady&&(n.toolbarButtons=["fullscreen","undo","redo","getPDF","print","|","bold","italic","underline","color","clearFormatting","|","alignLeft","alignCenter","alignRight","alignJustify","|","formatOL","formatUL","indent","outdent","-","paragraphFormat","|","fontFamily","|","fontSize","|","insertLink","insertImage","quote"],n.paragraphFormatSelection=!0,n.fontFamilySelection=!0,n.fontSizeSelection=!0,n.placeholderText="",n.quickInsertEnabled=!1,n.charCounterCount=!1),this.opts=Ee.extend(!0,{},Ee.extend({},s.DEFAULTS,n,"object"==typeof t&&t));var r=JSON.stringify(this.opts);Ee.FE.OPTS_MAPPING[r]=Ee.FE.OPTS_MAPPING[r]||this.id,this.sid=Ee.FE.OPTS_MAPPING[r],Ee.FE.SHARED[this.sid]=Ee.FE.SHARED[this.sid]||{},this.shared=Ee.FE.SHARED[this.sid],this.shared.count=(this.shared.count||0)+1,this.$oel=Ee(e),this.$oel.data("froala.editor",this),this.o_doc=e.ownerDocument,this.o_win="defaultView"in this.o_doc?this.o_doc.defaultView:this.o_doc.parentWindow;var i=Ee(this.o_win).scrollTop();this.$oel.on("froala.doInit",Ee.proxy(function(){this.$oel.off("froala.doInit"),this.doc=this.$el.get(0).ownerDocument,this.win="defaultView"in this.doc?this.doc.defaultView:this.doc.parentWindow,this.$doc=Ee(this.doc),this.$win=Ee(this.win),this.opts.pluginsEnabled||(this.opts.pluginsEnabled=Object.keys(Ee.FE.PLUGINS)),this.opts.initOnClick?(this.load(Ee.FE.MODULES),this.$el.on("touchstart.init",function(){Ee(this).data("touched",!0)}),this.$el.on("touchmove.init",function(){Ee(this).removeData("touched")}),this.$el.on("mousedown.init touchend.init dragenter.init focus.init",Ee.proxy(function(e){if("touchend"==e.type&&!this.$el.data("touched"))return!0;if(1===e.which||!e.which){this.$el.off("mousedown.init touchstart.init touchmove.init touchend.init dragenter.init focus.init"),this.load(Ee.FE.MODULES),this.load(Ee.FE.PLUGINS);var t=e.originalEvent&&e.originalEvent.originalTarget;t&&"IMG"==t.tagName&&Ee(t).trigger("mousedown"),"undefined"==typeof this.ul&&this.destroy(),"touchend"==e.type&&this.image&&e.originalEvent&&e.originalEvent.target&&Ee(e.originalEvent.target).is("img")&&setTimeout(Ee.proxy(function(){this.image.edit(Ee(e.originalEvent.target))},this),100),this.ready=!0,this.events.trigger("initialized")}},this)),this.events.trigger("initializationDelayed")):(this.load(Ee.FE.MODULES),this.load(Ee.FE.PLUGINS),Ee(this.o_win).scrollTop(i),"undefined"==typeof this.ul&&this.destroy(),this.ready=!0,this.events.trigger("initialized"))},this)),this._init()};s.DEFAULTS={initOnClick:!1,pluginsEnabled:null},s.MODULES={},s.PLUGINS={},s.VERSION="2.9.4",s.INSTANCES=[],s.OPTS_MAPPING={},s.SHARED={},s.ID=0,s.prototype._init=function(){var e=this.$oel.prop("tagName");this.$oel.closest("label").length;var t=Ee.proxy(function(){"TEXTAREA"!=e&&(this._original_html=this._original_html||this.$oel.html()),this.$box=this.$box||this.$oel,this.opts.fullPage&&(this.opts.iframe=!0),this.opts.iframe?(this.$iframe=Ee('',provider:"youtube"},{test_regex:/^.*(?:vimeo.com)\/(?:channels(\/\w+\/)?|groups\/*\/videos\/\u200b\d+\/|video\/|)(\d+)(?:$|\/|\?)/,url_regex:/(?:https?:\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?(\/[a-zA-Z0-9_\-]+)?/i,url_text:"https://player.vimeo.com/video/$1",html:'',provider:"vimeo"},{test_regex:/^.+(dailymotion.com|dai.ly)\/(video|hub)?\/?([^_]+)[^#]*(#video=([^_&]+))?/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:dailymotion\.com|dai\.ly)\/(?:video|hub)?\/?(.+)/g,url_text:"https://www.dailymotion.com/embed/video/$1",html:'',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"https://rutube.ru/play/embed/$1",html:'',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/g,url_text:"https://play.vidyard.com/$1",html:'',provider:"vidyard"}],Ee.FE.VIDEO_EMBED_REGEX=/^\W*(((\s|\n)*<\/iframe>)|())\W*$/i,Ee.FE.PLUGINS.video=function(p){var s,c,f,u,r,n,l="https://i.froala.com/upload",d=2,h=3,g=4,m=5,v=6,i={};function E(){var e=p.popups.get("video.insert");e.find(".fr-video-by-url-layer input").val("").trigger("change");var t=e.find(".fr-video-embed-layer textarea");t.val("").trigger("change"),(t=e.find(".fr-video-upload-layer input")).val("").trigger("change")}function a(){var e=p.popups.get("video.edit");if(e||(e=function(){var e="";if(0',e+=p.button.buildList(p.opts.videoEditButtons);var t={buttons:e+=""},n=p.popups.create("video.edit",t);return p.events.$on(p.$wp,"scroll.video-edit",function(){u&&p.popups.isVisible("video.edit")&&(p.events.disableBlur(),L(u))}),n}return!1}()),e){p.popups.setContainer("video.edit",p.$sc),p.popups.refresh("video.edit");var t=u.find("iframe, embed, video"),n=t.offset().left+t.outerWidth()/2,r=t.offset().top+t.outerHeight();p.popups.show("video.edit",n,r,t.outerHeight())}}function o(e){if(e)return p.popups.onRefresh("video.insert",E),p.popups.onHide("image.insert",X),!0;var t="";p.opts.videoUpload||-1===p.opts.videoInsertButtons.indexOf("videoUpload")||p.opts.videoInsertButtons.splice(p.opts.videoInsertButtons.indexOf("videoUpload"),1);var n=p.button.buildList(p.opts.videoInsertButtons);""!==n&&(t='
'+n+"
");var r,i="",a=p.opts.videoInsertButtons.indexOf("videoUpload"),o=p.opts.videoInsertButtons.indexOf("videoByURL"),s=p.opts.videoInsertButtons.indexOf("videoEmbed");0<=o&&(r=" fr-active",(a
");var l="";0<=s&&(r=" fr-active",(a
");var d="";0<=a&&(r=" fr-active",(s'+p.language.translate("Drop video")+"
("+p.language.translate("or click")+')
');var c={buttons:t,by_url_layer:i,embed_layer:l,upload_layer:d,progress_bar:'

Uploading

'},f=p.popups.create("video.insert",c);return function(r){p.events.$on(r,"dragover dragenter",".fr-video-upload-layer",function(){return Ee(this).addClass("fr-drop"),!1},!0),p.events.$on(r,"dragleave dragend",".fr-video-upload-layer",function(){return Ee(this).removeClass("fr-drop"),!1},!0),p.events.$on(r,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),Ee(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var n=r.data("instance")||p;n.events.disableBlur(),n.video.upload(t.files),n.events.enableBlur()}},!0),p.helpers.isIOS()&&p.events.$on(r,"touchstart",'.fr-video-upload-layer input[type="file"]',function(){Ee(this).trigger("click")},!0);p.events.$on(r,"change",'.fr-video-upload-layer input[type="file"]',function(){if(this.files){var e=r.data("instance")||p;e.events.disableBlur(),r.find("input:focus").blur(),e.events.enableBlur(),e.video.upload(this.files)}Ee(this).val("")},!0)}(f),f}function b(e){p.events.focus(!0),p.selection.restore();var t=!1;u&&(V(),t=!0),p.html.insert(''+e+"",!1,p.opts.videoSplitHTML),p.popups.hide("video.insert");var n=p.$el.find(".fr-jiv");n.removeClass("fr-jiv"),n.toggleClass("fr-rv",p.opts.videoResponsive),q(n,p.opts.videoDefaultDisplay,p.opts.videoDefaultAlign),n.toggleClass("fr-draggable",p.opts.videoMove),p.events.trigger(t?"video.replaced":"video.inserted",[n])}function T(){var e=Ee(this);p.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),L(e.parent()),p.events.trigger("video.loaded",[e.parent()])}function A(s,e,l,d,c){p.edit.off(),R("Loading video"),e&&(s=p.helpers.sanitizeURL(s));C("Loading video"),function(){var e,t;if(d){p.undo.canDo()||d.find("video").hasClass("fr-uploading")||p.undo.saveStep();var n=d.find("video").data("fr-old-src"),r=d.data("fr-replaced");d.data("fr-replaced",!1),p.$wp?((e=d.clone()).find("video").removeData("fr-old-src").removeClass("fr-uploading"),e.find("video").off("canplay"),n&&d.find("video").attr("src",n),d.replaceWith(e)):e=d;for(var i=e.find("video").get(0).attributes,a=0;a");o.toggleClass("fr-draggable",p.opts.videoMove),p.edit.on(),p.events.focus(!0),p.selection.restore(),p.undo.saveStep(),p.opts.videoSplitHTML?p.markers.split():p.markers.insert(),p.html.wrap();var s=p.$el.find(".fr-marker");return p.node.isLastSibling(s)&&s.parent().hasClass("fr-deletable")&&s.insertAfter(s.parent()),s.replaceWith(o),p.selection.clear(),o.find("video").get(0).readyState>o.find("video").get(0).HAVE_FUTURE_DATA||p.helpers.isIOS()?n.call(o.find("video").get(0)):o.find("video").on("canplaythrough load",n),o}(s,l,T),F(),p.undo.saveStep(),p.events.trigger("video.inserted",[e,c])}()}function C(e){var t=p.popups.get("video.insert");if(t||(t=o()),t.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").addClass("fr-active"),t.find(".fr-buttons").hide(),u){var n=u.find("video");p.popups.setContainer("video.insert",p.$sc);var r=n.offset().left+n.width()/2,i=n.offset().top+n.height();p.popups.show("video.insert",r,i,n.outerHeight())}void 0===e&&R(p.language.translate("Uploading"),0)}function S(e){var t=p.popups.get("video.insert");if(t&&(t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").removeClass("fr-active"),t.find(".fr-buttons").show(),e||p.$el.find("video.fr-error").length)){if(p.events.focus(),p.$el.find("video.fr-error").length&&(p.$el.find("video.fr-error").parent().remove(),p.undo.saveStep(),p.undo.run(),p.undo.dropRedo()),!p.$wp&&u){var n=u;B(!0),p.selection.setAfter(n.find("video").get(0)),p.selection.restore()}p.popups.hide("video.insert")}}function R(e,t){var n=p.popups.get("video.insert");if(n){var r=n.find(".fr-video-progress-bar-layer");r.find("h3").text(e+(t?" "+t+"%":"")),r.removeClass("fr-error"),t?(r.find("div").removeClass("fr-indeterminate"),r.find("div > span").css("width",t+"%")):r.find("div").addClass("fr-indeterminate")}}function y(e){C();var t=p.popups.get("video.insert").find(".fr-video-progress-bar-layer");t.addClass("fr-error");var n=t.find("h3");n.text(e),p.events.disableBlur(),n.focus()}function L(e){$.call(e.get(0))}function _(e){R("Loading video");var t=this.status,n=this.response,r=this.responseXML,i=this.responseText;try{if(p.opts.videoUploadToS3)if(201==t){var a=function(e){try{var t=Ee(e).find("Location").text(),n=Ee(e).find("Key").text();return!1===p.events.trigger("video.uploadedToS3",[t,n,e],!0)?(p.edit.on(),!1):t}catch(r){return H(g,e),!1}}(r);a&&A(a,!1,[],e,n||r)}else H(g,n||r);else if(200<=t&&t<300){var o=function(e){try{if(!1===p.events.trigger("video.uploaded",[e],!0))return p.edit.on(),!1;var t=JSON.parse(e);return t.link?t:(H(d,e),!1)}catch(n){return H(g,e),!1}}(i);o&&A(o.link,!1,o,e,n||i)}else H(h,n||i)}catch(s){H(g,n||i)}}function x(){H(g,this.response||this.responseText||this.responseXML)}function N(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;R(p.language.translate("Uploading"),t)}}function w(){p.edit.on(),S(!0)}function O(e){if(!p.core.sameInstance(f))return!0;e.preventDefault(),e.stopPropagation();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),n=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!n)return!1;if("mousedown"==e.type){var r=p.$oel.get(0).ownerDocument,i=r.defaultView||r.parentWindow,a=!1;try{a=i.location!=i.parent.location&&!(i.$&&i.$.FE)}catch(o){}a&&i.frameElement&&(t+=p.helpers.getPX(Ee(i.frameElement).offset().left)+i.frameElement.clientLeft,n=e.clientY+p.helpers.getPX(Ee(i.frameElement).offset().top)+i.frameElement.clientTop)}p.undo.canDo()||p.undo.saveStep(),(c=Ee(this)).data("start-x",t),c.data("start-y",n),s.show(),p.popups.hideAll(),P()}function I(e){if(!p.core.sameInstance(f))return!0;if(c){e.preventDefault();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),n=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!n)return!1;var r=c.data("start-x"),i=c.data("start-y");c.data("start-x",t),c.data("start-y",n);var a=t-r,o=n-i,s=u.find("iframe, embed, video"),l=s.width(),d=s.height();(c.hasClass("fr-hnw")||c.hasClass("fr-hsw"))&&(a=0-a),(c.hasClass("fr-hnw")||c.hasClass("fr-hne"))&&(o=0-o),s.css("width",l+a),s.css("height",d+o),s.removeAttr("width"),s.removeAttr("height"),M()}}function k(e){if(!p.core.sameInstance(f))return!0;c&&u&&(e&&e.stopPropagation(),c=null,s.hide(),M(),a(),p.undo.saveStep())}function t(e){return'
'}function D(e,t,n,r){return e.pageX=t,e.pageY=t,O.call(this,e),e.pageX=e.pageX+n*Math.floor(Math.pow(1.1,r)),e.pageY=e.pageY+n*Math.floor(Math.pow(1.1,r)),I.call(this,e),k.call(this,e),++r}function F(){var e,t=Array.prototype.slice.call(p.el.querySelectorAll("video, .fr-video > *")),n=[];for(e=0;e'),f=p.shared.$video_resizer,p.events.$on(f,"mousedown",function(e){e.stopPropagation()},!0),p.opts.videoResize&&(f.append(t("nw")+t("ne")+t("sw")+t("se")),p.shared.$vid_overlay=Ee('
'),s=p.shared.$vid_overlay,e=f.get(0).ownerDocument,Ee(e).find("body:first").append(s))),p.events.on("shared.destroy",function(){f.html("").removeData().remove(),f=null,p.opts.videoResize&&(s.remove(),s=null)},!0),p.helpers.isMobile()||p.events.$on(Ee(p.o_win),"resize.video",function(){B(!0)}),p.opts.videoResize){e=f.get(0).ownerDocument,p.events.$on(f,p._mousedown,".fr-handler",O),p.events.$on(Ee(e),p._mousemove,I),p.events.$on(Ee(e.defaultView||e.parentWindow),p._mouseup,k),p.events.$on(s,"mouseleave",k);var r=1,i=null,a=0;p.events.on("keydown",function(e){if(u){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,n=e.which;(n!==i||200p.opts.videoMaxSize)return H(m),!1;if(p.opts.videoAllowedTypes.indexOf(n.type.replace(/video\//g,""))<0)return H(v),!1;if(p.drag_support.formdata&&(t=p.drag_support.formdata?new FormData:null),t){var r;if(!1!==p.opts.videoUploadToS3)for(r in t.append("key",p.opts.videoUploadToS3.keyStart+(new Date).getTime()+"-"+(n.name||"untitled")),t.append("success_action_status","201"),t.append("X-Requested-With","xhr"),t.append("Content-Type",n.type),p.opts.videoUploadToS3.params)p.opts.videoUploadToS3.params.hasOwnProperty(r)&&t.append(r,p.opts.videoUploadToS3.params[r]);for(r in p.opts.videoUploadParams)p.opts.videoUploadParams.hasOwnProperty(r)&&t.append(r,p.opts.videoUploadParams[r]);t.append(p.opts.videoUploadParam,n);var i=p.opts.videoUploadURL;p.opts.videoUploadToS3&&(i=p.opts.videoUploadToS3.uploadURL?p.opts.videoUploadToS3.uploadURL:"https://"+p.opts.videoUploadToS3.region+".amazonaws.com/"+p.opts.videoUploadToS3.bucket);var a=p.core.getXHR(i,p.opts.videoUploadMethod);a.onload=function(){_.call(a,u)},a.onerror=x,a.upload.onprogress=N,a.onabort=w,C(),p.events.disableBlur(),p.edit.off(),p.events.enableBlur();var o=p.popups.get("video.insert");o&&o.off("abortUpload").on("abortUpload",function(){4!=a.readyState&&a.abort()}),a.send(t)}}}function H(e,t){p.edit.on(),u&&u.find("video").addClass("fr-error"),y(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.error",[{code:e,message:i[e]},t])}function W(){if(u){var e=p.popups.get("video.size"),t=u.find("iframe, embed, video");e.find('input[name="width"]').val(t.get(0).style.width||t.attr("width")).trigger("change"),e.find('input[name="height"]').val(t.get(0).style.height||t.attr("height")).trigger("change")}}function z(e){if(e)return p.popups.onRefresh("video.size",W),!0;var t={buttons:'
'+p.button.buildList(p.opts.videoSizeButtons)+"
",size_layer:'
"},n=p.popups.create("video.size",t);return p.events.$on(p.$wp,"scroll",function(){u&&p.popups.isVisible("video.size")&&(p.events.disableBlur(),L(u))}),n}function Y(e){if(void 0===e&&(e=u),e){if(e.hasClass("fr-fvl"))return"left";if(e.hasClass("fr-fvr"))return"right";if(e.hasClass("fr-dvb")||e.hasClass("fr-dvi"))return"center";if("block"==e.css("display")){if("left"==e.css("text-algin"))return"left";if("right"==e.css("text-align"))return"right"}else{if("left"==e.css("float"))return"left";if("right"==e.css("float"))return"right"}}return"center"}function G(e){void 0===e&&(e=u);var t=e.css("float");return e.css("float","none"),"block"==e.css("display")?(e.css("float",""),e.css("float")!=t&&e.css("float",t),"block"):(e.css("float",""),e.css("float")!=t&&e.css("float",t),"inline")}function V(){if(u&&!1!==p.events.trigger("video.beforeRemove",[u])){var e=u;p.popups.hideAll(),B(!0),p.selection.setBefore(e.get(0))||p.selection.setAfter(e.get(0)),e.remove(),p.selection.restore(),p.html.fillEmptyBlocks()}}function X(){S()}function q(e,t,n){!p.opts.htmlUntouched&&p.opts.useClasses?(e.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),e.addClass("fr-fv"+n[0]+" fr-dv"+t[0])):"inline"==t?(e.css({display:"inline-block"}),"center"==n?e.css({"float":"none"}):"left"==n?e.css({"float":"left"}):e.css({"float":"right"})):(e.css({display:"block",clear:"both"}),"left"==n?e.css({textAlign:"left"}):"right"==n?e.css({textAlign:"right"}):e.css({textAlign:"center"}))}function j(){p.$el.find("video").filter(function(){return 0===Ee(this).parents("span.fr-video").length}).wrap(''),p.$el.find("embed, iframe").filter(function(){if(p.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0');for(var e,t,n=p.$el.find("span.fr-video, video"),r=0;r *:first").replaceWith(p.icon.create("video-align-"+Y()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+Y()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){u.removeClass("fr-dvi fr-dvb"),!p.opts.htmlUntouched&&p.opts.useClasses?"inline"==e?u.addClass("fr-dvi"):"block"==e&&u.addClass("fr-dvb"):q(u,e,Y()),Q(),M(),a(),p.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+G()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:V,hideProgressBar:S,showSizePopup:function(){var e=p.popups.get("video.size");e||(e=z()),S(),p.popups.refresh("video.size"),p.popups.setContainer("video.size",p.$sc);var t=u.find("iframe, embed, video"),n=t.offset().left+t.width()/2,r=t.offset().top+t.height();p.popups.show("video.size",n,r,t.height())},replace:function(){var e=p.popups.get("video.insert");e||(e=o()),p.popups.isVisible("video.insert")||(S(),p.popups.refresh("video.insert"),p.popups.setContainer("video.insert",p.$sc));var t=u.offset().left+u.width()/2,n=u.offset().top+u.height();p.popups.show("video.insert",t,n,u.outerHeight())},back:function(){u?(p.events.disableBlur(),u.trigger("click")):(p.events.disableBlur(),p.selection.restore(),p.events.enableBlur(),p.popups.hide("video.insert"),p.toolbar.showInline())},setSize:function(e,t){if(u){var n=p.popups.get("video.size"),r=u.find("iframe, embed, video");r.css("width",e||n.find('input[name="width"]').val()),r.css("height",t||n.find('input[name="height"]').val()),r.get(0).style.width&&r.removeAttr("width"),r.get(0).style.height&&r.removeAttr("height"),n.find("input:focus").blur(),setTimeout(function(){u.trigger("click")},p.helpers.isAndroid()?50:0)}},get:function(){return u},showProgressBar:C}},Ee.FE.RegisterCommand("insertVideo",{title:"Insert Video",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("video.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("video.insert")):this.video.showInsertPopup()},plugin:"video"}),Ee.FE.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera"}),Ee.FE.DefineIcon("videoByURL",{NAME:"link"}),Ee.FE.RegisterCommand("videoByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-by-url")},refresh:function(e){this.video.refreshByURLButton(e)}}),Ee.FE.DefineIcon("videoEmbed",{NAME:"code"}),Ee.FE.RegisterCommand("videoEmbed",{title:"Embedded Code",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-embed")},refresh:function(e){this.video.refreshEmbedButton(e)}}),Ee.FE.DefineIcon("videoUpload",{NAME:"upload"}),Ee.FE.RegisterCommand("videoUpload",{title:"Upload Video",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-upload")},refresh:function(e){this.video.refreshUploadButton(e)}}),Ee.FE.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),Ee.FE.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),Ee.FE.DefineIcon("videoDisplay",{NAME:"star"}),Ee.FE.RegisterCommand("videoDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.video.display(t)},refresh:function(e){this.opts.videoTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.video.refreshDisplayOnShow(e,t)}}),Ee.FE.DefineIcon("video-align",{NAME:"align-left"}),Ee.FE.DefineIcon("video-align-left",{NAME:"align-left"}),Ee.FE.DefineIcon("video-align-right",{NAME:"align-right"}),Ee.FE.DefineIcon("video-align-center",{NAME:"align-justify"}),Ee.FE.DefineIcon("videoAlign",{NAME:"align-center"}),Ee.FE.RegisterCommand("videoAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='"},callback:function(e,t){this.video.align(t)},refresh:function(e){this.video.refreshAlign(e)},refreshOnShow:function(e,t){this.video.refreshAlignOnShow(e,t)}}),Ee.FE.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),Ee.FE.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),Ee.FE.DefineIcon("videoRemove",{NAME:"trash"}),Ee.FE.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),Ee.FE.DefineIcon("videoSize",{NAME:"arrows-alt"}),Ee.FE.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),Ee.FE.DefineIcon("videoBack",{NAME:"arrow-left"}),Ee.FE.RegisterCommand("videoBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.video.back()},refresh:function(e){this.video.get()||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),Ee.FE.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),Ee.FE.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}}),Ee.extend(Ee.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent","border","border-.*","line-height"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),Ee.FE.PLUGINS.wordPaste=function(T){var a,r,o="word_paste";function t(e){var t=T.opts.wordAllowedStyleProps;e||(T.opts.wordAllowedStyleProps=[]),0===r.indexOf("")&&(r=""+r+"
"),r=function(e,t){0<=e.indexOf("]*(]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),n=1;n').remove()}}(e,t),!0});for(var a=i.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),o=a.length-1;0<=o;o--)a[o].previousElementSibling&&"LI"===a[o].previousElementSibling.tagName&&a[o].previousElementSibling.appendChild(a[o]);c(i,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/
(\n|\r)/gi,"
"),!1;if(t.nodeType==Node.ELEMENT_NODE){if(C(t)){var n=t.parentNode,r=t.previousSibling,i=function e(t,n,r){var i=/[0-9a-zA-Z]./gi;var a=!1;var o=t.querySelector('span[style="mso-list:Ignore"]');var s;var l;var d;var c;var f;o&&(a=a||i.test(o.textContent));var p=a?"ol":"ul";var u="<"+p+">";for(;t;){if(!C(t)){if(t.outerHTML&&0"+c+""):(f=e(t,n,h),u+=f.el.outerHTML,t=f.currentNode);var g=t&&t.nextElementSibling;g&&(s=g.previousElementSibling),t&&t.parentNode&&t.parentNode.removeChild(t),t=g}}u+="";var m=document.createElement("div");m.innerHTML=u;var v=m.firstElementChild;return{el:v,currentNode:t}}(t,s).el,a=null;return(a=r?r.nextSibling:n.firstChild)?n.insertBefore(i,a):n.appendChild(i),!1}return"FONT"===t.tagName&&s["."+t.getAttribute("class")]&&(t=v(t,"span")),p(t,s)}if(t.nodeType==Node.COMMENT_NODE){if(-1([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var n="",r=0;r++/gi,"")}function v(e,t){for(var n=document.createElement(t),r=0;r");for(var o=n.firstElementChild,s=1==n.children.length;o;)"P"!=o.tagName||C(o)||s&&S(o),o=o.nextElementSibling;if(t){var l=n.getAttribute("class");if(l){var d=(l=R(l)).match(/xl[0-9]+/gi);if(d){var c="."+d[0];t[c]&&y(n,t[c])}}t.td&&y(n,t.td)}var f=n.getAttribute("style");f&&(f=R(f))&&";"!=f.slice(-1)&&(f+=";");var p=n.getAttribute("valign");if(!p&&f){var u=f.match(/vertical-align:.+?[; "]{1,1}/gi);u&&(p=u[u.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var h=null;if(f){var g=f.match(/text-align:.+?[; "]{1,1}/gi);g&&(h=g[g.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==h&&(h=null)}var m=null;if(f){var v=f.match(/background:.+?[; "]{1,1}/gi);v&&(m=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var E=n.getAttribute("colspan"),b=n.getAttribute("rowspan");E&&n.setAttribute("colspan",E),b&&n.setAttribute("rowspan",b),p&&(n.style["vertical-align"]=p),h&&(n.style["text-align"]=h),m&&(n.style["background-color"]=m),a&&n.setAttribute("width",a),n=n.nextElementSibling}for(n=e.firstElementChild;n;)a=n.getAttribute("width"),i?n.removeAttribute("width"):n.setAttribute("width",100*parseInt(a,10)/r+"%"),n=n.nextElementSibling}(e,t),"A"!=n||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"A"==n&&e.getAttribute("href")&&e.querySelector("img")){var g=e.querySelectorAll("span");for(i=0;i"),"TABLE"==n&&(e.style.width=e.style.width||"100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var m=R(e.getAttribute("style"));(m=m.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",m):e.removeAttribute("style")}return!0}var h={};return{_init:function(){T.events.on("paste.wordPaste",function(e){return r=e,T.opts.wordPasteModal?function(){if(!a){var e='

'+T.language.translate("Word Paste Detected")+"

",t=(i='
',i+='

'+T.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"

",i+='
",i+="
"),n=T.modals.create(o,e,t),r=n.$body;a=n.$modal,n.$modal.addClass("fr-middle"),T.events.bindClick(r,"button.fr-remove-word",function(){var e=a.data("instance")||T;e.wordPaste.clean()}),T.events.bindClick(r,"button.fr-keep-word",function(){var e=a.data("instance")||T;e.wordPaste.clean(!0)}),T.events.$on(Ee(T.o_win),"resize",function(){T.modals.resize(o)})}var i;T.modals.show(o),T.modals.resize(o)}():t(T.opts.wordPasteKeepFormatting),!1})},clean:t}}}); \ No newline at end of file +!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(Ee){var s=function(e,t){this.id=++Ee.FE.ID;var n={};t&&t.documentReady&&(n.toolbarButtons=["fullscreen","undo","redo","getPDF","print","|","bold","italic","underline","color","clearFormatting","|","alignLeft","alignCenter","alignRight","alignJustify","|","formatOL","formatUL","indent","outdent","-","paragraphFormat","|","fontFamily","|","fontSize","|","insertLink","insertImage","quote"],n.paragraphFormatSelection=!0,n.fontFamilySelection=!0,n.fontSizeSelection=!0,n.placeholderText="",n.quickInsertEnabled=!1,n.charCounterCount=!1),this.opts=Ee.extend(!0,{},Ee.extend({},s.DEFAULTS,n,"object"==typeof t&&t));var r=JSON.stringify(this.opts);Ee.FE.OPTS_MAPPING[r]=Ee.FE.OPTS_MAPPING[r]||this.id,this.sid=Ee.FE.OPTS_MAPPING[r],Ee.FE.SHARED[this.sid]=Ee.FE.SHARED[this.sid]||{},this.shared=Ee.FE.SHARED[this.sid],this.shared.count=(this.shared.count||0)+1,this.$oel=Ee(e),this.$oel.data("froala.editor",this),this.o_doc=e.ownerDocument,this.o_win="defaultView"in this.o_doc?this.o_doc.defaultView:this.o_doc.parentWindow;var i=Ee(this.o_win).scrollTop();this.$oel.on("froala.doInit",Ee.proxy(function(){this.$oel.off("froala.doInit"),this.doc=this.$el.get(0).ownerDocument,this.win="defaultView"in this.doc?this.doc.defaultView:this.doc.parentWindow,this.$doc=Ee(this.doc),this.$win=Ee(this.win),this.opts.pluginsEnabled||(this.opts.pluginsEnabled=Object.keys(Ee.FE.PLUGINS)),this.opts.initOnClick?(this.load(Ee.FE.MODULES),this.$el.on("touchstart.init",function(){Ee(this).data("touched",!0)}),this.$el.on("touchmove.init",function(){Ee(this).removeData("touched")}),this.$el.on("mousedown.init touchend.init dragenter.init focus.init",Ee.proxy(function(e){if("touchend"==e.type&&!this.$el.data("touched"))return!0;if(1===e.which||!e.which){this.$el.off("mousedown.init touchstart.init touchmove.init touchend.init dragenter.init focus.init"),this.load(Ee.FE.MODULES),this.load(Ee.FE.PLUGINS);var t=e.originalEvent&&e.originalEvent.originalTarget;t&&"IMG"==t.tagName&&Ee(t).trigger("mousedown"),"undefined"==typeof this.ul&&this.destroy(),"touchend"==e.type&&this.image&&e.originalEvent&&e.originalEvent.target&&Ee(e.originalEvent.target).is("img")&&setTimeout(Ee.proxy(function(){this.image.edit(Ee(e.originalEvent.target))},this),100),this.ready=!0,this.events.trigger("initialized")}},this)),this.events.trigger("initializationDelayed")):(this.load(Ee.FE.MODULES),this.load(Ee.FE.PLUGINS),Ee(this.o_win).scrollTop(i),"undefined"==typeof this.ul&&this.destroy(),this.ready=!0,this.events.trigger("initialized"))},this)),this._init()};s.DEFAULTS={initOnClick:!1,pluginsEnabled:null},s.MODULES={},s.PLUGINS={},s.VERSION="2.9.4",s.INSTANCES=[],s.OPTS_MAPPING={},s.SHARED={},s.ID=0,s.prototype._init=function(){var e=this.$oel.prop("tagName");this.$oel.closest("label").length;var t=Ee.proxy(function(){"TEXTAREA"!=e&&(this._original_html=this._original_html||this.$oel.html()),this.$box=this.$box||this.$oel,this.opts.fullPage&&(this.opts.iframe=!0),this.opts.iframe?(this.$iframe=Ee('',provider:"youtube"},{test_regex:/^.*(?:vimeo.com)\/(?:channels(\/\w+\/)?|groups\/*\/videos\/\u200b\d+\/|video\/|)(\d+)(?:$|\/|\?)/,url_regex:/(?:https?:\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?(\/[a-zA-Z0-9_\-]+)?/i,url_text:"https://player.vimeo.com/video/$1",html:'',provider:"vimeo"},{test_regex:/^.+(dailymotion.com|dai.ly)\/(video|hub)?\/?([^_]+)[^#]*(#video=([^_&]+))?/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:dailymotion\.com|dai\.ly)\/(?:video|hub)?\/?(.+)/g,url_text:"https://www.dailymotion.com/embed/video/$1",html:'',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"https://rutube.ru/play/embed/$1",html:'',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/g,url_text:"https://play.vidyard.com/$1",html:'',provider:"vidyard"}],Ee.FE.VIDEO_EMBED_REGEX=/^\W*(((\s|\n)*<\/iframe>)|())\W*$/i,Ee.FE.PLUGINS.video=function(p){var s,c,f,u,r,n,l="https://i.froala.com/upload",d=2,h=3,g=4,m=5,v=6,i={};function E(){var e=p.popups.get("video.insert");e.find(".fr-video-by-url-layer input").val("").trigger("change");var t=e.find(".fr-video-embed-layer textarea");t.val("").trigger("change"),(t=e.find(".fr-video-upload-layer input")).val("").trigger("change")}function a(){var e=p.popups.get("video.edit");if(e||(e=function(){var e="";if(0',e+=p.button.buildList(p.opts.videoEditButtons);var t={buttons:e+=""},n=p.popups.create("video.edit",t);return p.events.$on(p.$wp,"scroll.video-edit",function(){u&&p.popups.isVisible("video.edit")&&(p.events.disableBlur(),L(u))}),n}return!1}()),e){p.popups.setContainer("video.edit",p.$sc),p.popups.refresh("video.edit");var t=u.find("iframe, embed, video"),n=t.offset().left+t.outerWidth()/2,r=t.offset().top+t.outerHeight();p.popups.show("video.edit",n,r,t.outerHeight())}}function o(e){if(e)return p.popups.onRefresh("video.insert",E),p.popups.onHide("image.insert",X),!0;var t="";p.opts.videoUpload||-1===p.opts.videoInsertButtons.indexOf("videoUpload")||p.opts.videoInsertButtons.splice(p.opts.videoInsertButtons.indexOf("videoUpload"),1);var n=p.button.buildList(p.opts.videoInsertButtons);""!==n&&(t='
'+n+"
");var r,i="",a=p.opts.videoInsertButtons.indexOf("videoUpload"),o=p.opts.videoInsertButtons.indexOf("videoByURL"),s=p.opts.videoInsertButtons.indexOf("videoEmbed");0<=o&&(r=" fr-active",(a
");var l="";0<=s&&(r=" fr-active",(a
");var d="";0<=a&&(r=" fr-active",(s'+p.language.translate("Drop video")+"
("+p.language.translate("or click")+')
');var c={buttons:t,by_url_layer:i,embed_layer:l,upload_layer:d,progress_bar:'

Uploading

'},f=p.popups.create("video.insert",c);return function(r){p.events.$on(r,"dragover dragenter",".fr-video-upload-layer",function(){return Ee(this).addClass("fr-drop"),!1},!0),p.events.$on(r,"dragleave dragend",".fr-video-upload-layer",function(){return Ee(this).removeClass("fr-drop"),!1},!0),p.events.$on(r,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),Ee(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var n=r.data("instance")||p;n.events.disableBlur(),n.video.upload(t.files),n.events.enableBlur()}},!0),p.helpers.isIOS()&&p.events.$on(r,"touchstart",'.fr-video-upload-layer input[type="file"]',function(){Ee(this).trigger("click")},!0);p.events.$on(r,"change",'.fr-video-upload-layer input[type="file"]',function(){if(this.files){var e=r.data("instance")||p;e.events.disableBlur(),r.find("input:focus").blur(),e.events.enableBlur(),e.video.upload(this.files)}Ee(this).val("")},!0)}(f),f}function b(e){p.events.focus(!0),p.selection.restore();var t=!1;u&&(V(),t=!0),p.html.insert(''+e+"",!1,p.opts.videoSplitHTML),p.popups.hide("video.insert");var n=p.$el.find(".fr-jiv");n.removeClass("fr-jiv"),n.toggleClass("fr-rv",p.opts.videoResponsive),q(n,p.opts.videoDefaultDisplay,p.opts.videoDefaultAlign),n.toggleClass("fr-draggable",p.opts.videoMove),p.events.trigger(t?"video.replaced":"video.inserted",[n])}function T(){var e=Ee(this);p.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),L(e.parent()),p.events.trigger("video.loaded",[e.parent()])}function A(s,e,l,d,c){p.edit.off(),R("Loading video"),e&&(s=p.helpers.sanitizeURL(s));C("Loading video"),function(){var e,t;if(d){p.undo.canDo()||d.find("video").hasClass("fr-uploading")||p.undo.saveStep();var n=d.find("video").data("fr-old-src"),r=d.data("fr-replaced");d.data("fr-replaced",!1),p.$wp?((e=d.clone()).find("video").removeData("fr-old-src").removeClass("fr-uploading"),e.find("video").off("canplay"),n&&d.find("video").attr("src",n),d.replaceWith(e)):e=d;for(var i=e.find("video").get(0).attributes,a=0;a");o.toggleClass("fr-draggable",p.opts.videoMove),p.edit.on(),p.events.focus(!0),p.selection.restore(),p.undo.saveStep(),p.opts.videoSplitHTML?p.markers.split():p.markers.insert(),p.html.wrap();var s=p.$el.find(".fr-marker");return p.node.isLastSibling(s)&&s.parent().hasClass("fr-deletable")&&s.insertAfter(s.parent()),s.replaceWith(o),p.selection.clear(),o.find("video").get(0).readyState>o.find("video").get(0).HAVE_FUTURE_DATA||p.helpers.isIOS()?n.call(o.find("video").get(0)):o.find("video").on("canplaythrough load",n),o}(s,l,T),F(),p.undo.saveStep(),p.events.trigger("video.inserted",[e,c])}()}function C(e){var t=p.popups.get("video.insert");if(t||(t=o()),t.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").addClass("fr-active"),t.find(".fr-buttons").hide(),u){var n=u.find("video");p.popups.setContainer("video.insert",p.$sc);var r=n.offset().left+n.width()/2,i=n.offset().top+n.height();p.popups.show("video.insert",r,i,n.outerHeight())}void 0===e&&R(p.language.translate("Uploading"),0)}function S(e){var t=p.popups.get("video.insert");if(t&&(t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").removeClass("fr-active"),t.find(".fr-buttons").show(),e||p.$el.find("video.fr-error").length)){if(p.events.focus(),p.$el.find("video.fr-error").length&&(p.$el.find("video.fr-error").parent().remove(),p.undo.saveStep(),p.undo.run(),p.undo.dropRedo()),!p.$wp&&u){var n=u;B(!0),p.selection.setAfter(n.find("video").get(0)),p.selection.restore()}p.popups.hide("video.insert")}}function R(e,t){var n=p.popups.get("video.insert");if(n){var r=n.find(".fr-video-progress-bar-layer");r.find("h3").text(e+(t?" "+t+"%":"")),r.removeClass("fr-error"),t?(r.find("div").removeClass("fr-indeterminate"),r.find("div > span").css("width",t+"%")):r.find("div").addClass("fr-indeterminate")}}function y(e){C();var t=p.popups.get("video.insert").find(".fr-video-progress-bar-layer");t.addClass("fr-error");var n=t.find("h3");n.text(e),p.events.disableBlur(),n.focus()}function L(e){$.call(e.get(0))}function _(e){R("Loading video");var t=this.status,n=this.response,r=this.responseXML,i=this.responseText;try{if(p.opts.videoUploadToS3)if(201==t){var a=function(e){try{var t=Ee(e).find("Location").text(),n=Ee(e).find("Key").text();return!1===p.events.trigger("video.uploadedToS3",[t,n,e],!0)?(p.edit.on(),!1):t}catch(r){return H(g,e),!1}}(r);a&&A(a,!1,[],e,n||r)}else H(g,n||r);else if(200<=t&&t<300){var o=function(e){try{if(!1===p.events.trigger("video.uploaded",[e],!0))return p.edit.on(),!1;var t=JSON.parse(e);return t.link?t:(H(d,e),!1)}catch(n){return H(g,e),!1}}(i);o&&A(o.link,!1,o,e,n||i)}else H(h,n||i)}catch(s){H(g,n||i)}}function x(){H(g,this.response||this.responseText||this.responseXML)}function N(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;R(p.language.translate("Uploading"),t)}}function w(){p.edit.on(),S(!0)}function O(e){if(!p.core.sameInstance(f))return!0;e.preventDefault(),e.stopPropagation();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),n=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!n)return!1;if("mousedown"==e.type){var r=p.$oel.get(0).ownerDocument,i=r.defaultView||r.parentWindow,a=!1;try{a=i.location!=i.parent.location&&!(i.$&&i.$.FE)}catch(o){}a&&i.frameElement&&(t+=p.helpers.getPX(Ee(i.frameElement).offset().left)+i.frameElement.clientLeft,n=e.clientY+p.helpers.getPX(Ee(i.frameElement).offset().top)+i.frameElement.clientTop)}p.undo.canDo()||p.undo.saveStep(),(c=Ee(this)).data("start-x",t),c.data("start-y",n),s.show(),p.popups.hideAll(),P()}function I(e){if(!p.core.sameInstance(f))return!0;if(c){e.preventDefault();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),n=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!n)return!1;var r=c.data("start-x"),i=c.data("start-y");c.data("start-x",t),c.data("start-y",n);var a=t-r,o=n-i,s=u.find("iframe, embed, video"),l=s.width(),d=s.height();(c.hasClass("fr-hnw")||c.hasClass("fr-hsw"))&&(a=0-a),(c.hasClass("fr-hnw")||c.hasClass("fr-hne"))&&(o=0-o),s.css("width",l+a),s.css("height",d+o),s.removeAttr("width"),s.removeAttr("height"),M()}}function k(e){if(!p.core.sameInstance(f))return!0;c&&u&&(e&&e.stopPropagation(),c=null,s.hide(),M(),a(),p.undo.saveStep())}function t(e){return'
'}function D(e,t,n,r){return e.pageX=t,e.pageY=t,O.call(this,e),e.pageX=e.pageX+n*Math.floor(Math.pow(1.1,r)),e.pageY=e.pageY+n*Math.floor(Math.pow(1.1,r)),I.call(this,e),k.call(this,e),++r}function F(){var e,t=Array.prototype.slice.call(p.el.querySelectorAll("video, .fr-video > *")),n=[];for(e=0;e'),f=p.shared.$video_resizer,p.events.$on(f,"mousedown",function(e){e.stopPropagation()},!0),p.opts.videoResize&&(f.append(t("nw")+t("ne")+t("sw")+t("se")),p.shared.$vid_overlay=Ee('
'),s=p.shared.$vid_overlay,e=f.get(0).ownerDocument,Ee(e).find("body:first").append(s))),p.events.on("shared.destroy",function(){f.html("").removeData().remove(),f=null,p.opts.videoResize&&(s.remove(),s=null)},!0),p.helpers.isMobile()||p.events.$on(Ee(p.o_win),"resize.video",function(){B(!0)}),p.opts.videoResize){e=f.get(0).ownerDocument,p.events.$on(f,p._mousedown,".fr-handler",O),p.events.$on(Ee(e),p._mousemove,I),p.events.$on(Ee(e.defaultView||e.parentWindow),p._mouseup,k),p.events.$on(s,"mouseleave",k);var r=1,i=null,a=0;p.events.on("keydown",function(e){if(u){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,n=e.which;(n!==i||200p.opts.videoMaxSize)return H(m),!1;if(p.opts.videoAllowedTypes.indexOf(n.type.replace(/video\//g,""))<0)return H(v),!1;if(p.drag_support.formdata&&(t=p.drag_support.formdata?new FormData:null),t){var r;if(!1!==p.opts.videoUploadToS3)for(r in t.append("key",p.opts.videoUploadToS3.keyStart+(new Date).getTime()+"-"+(n.name||"untitled")),t.append("success_action_status","201"),t.append("X-Requested-With","xhr"),t.append("Content-Type",n.type),p.opts.videoUploadToS3.params)p.opts.videoUploadToS3.params.hasOwnProperty(r)&&t.append(r,p.opts.videoUploadToS3.params[r]);for(r in p.opts.videoUploadParams)p.opts.videoUploadParams.hasOwnProperty(r)&&t.append(r,p.opts.videoUploadParams[r]);t.append(p.opts.videoUploadParam,n);var i=p.opts.videoUploadURL;p.opts.videoUploadToS3&&(i=p.opts.videoUploadToS3.uploadURL?p.opts.videoUploadToS3.uploadURL:"https://"+p.opts.videoUploadToS3.region+".amazonaws.com/"+p.opts.videoUploadToS3.bucket);var a=p.core.getXHR(i,p.opts.videoUploadMethod);a.onload=function(){_.call(a,u)},a.onerror=x,a.upload.onprogress=N,a.onabort=w,C(),p.events.disableBlur(),p.edit.off(),p.events.enableBlur();var o=p.popups.get("video.insert");o&&o.off("abortUpload").on("abortUpload",function(){4!=a.readyState&&a.abort()}),a.send(t)}}}function H(e,t){p.edit.on(),u&&u.find("video").addClass("fr-error"),y(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.error",[{code:e,message:i[e]},t])}function W(){if(u){var e=p.popups.get("video.size"),t=u.find("iframe, embed, video");e.find('input[name="width"]').val(t.get(0).style.width||t.attr("width")).trigger("change"),e.find('input[name="height"]').val(t.get(0).style.height||t.attr("height")).trigger("change")}}function z(e){if(e)return p.popups.onRefresh("video.size",W),!0;var t={buttons:'
'+p.button.buildList(p.opts.videoSizeButtons)+"
",size_layer:'
"},n=p.popups.create("video.size",t);return p.events.$on(p.$wp,"scroll",function(){u&&p.popups.isVisible("video.size")&&(p.events.disableBlur(),L(u))}),n}function Y(e){if(void 0===e&&(e=u),e){if(e.hasClass("fr-fvl"))return"left";if(e.hasClass("fr-fvr"))return"right";if(e.hasClass("fr-dvb")||e.hasClass("fr-dvi"))return"center";if("block"==e.css("display")){if("left"==e.css("text-algin"))return"left";if("right"==e.css("text-align"))return"right"}else{if("left"==e.css("float"))return"left";if("right"==e.css("float"))return"right"}}return"center"}function G(e){void 0===e&&(e=u);var t=e.css("float");return e.css("float","none"),"block"==e.css("display")?(e.css("float",""),e.css("float")!=t&&e.css("float",t),"block"):(e.css("float",""),e.css("float")!=t&&e.css("float",t),"inline")}function V(){if(u&&!1!==p.events.trigger("video.beforeRemove",[u])){var e=u;p.popups.hideAll(),B(!0),p.selection.setBefore(e.get(0))||p.selection.setAfter(e.get(0)),e.remove(),p.selection.restore(),p.html.fillEmptyBlocks()}}function X(){S()}function q(e,t,n){!p.opts.htmlUntouched&&p.opts.useClasses?(e.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),e.addClass("fr-fv"+n[0]+" fr-dv"+t[0])):"inline"==t?(e.css({display:"inline-block"}),"center"==n?e.css({"float":"none"}):"left"==n?e.css({"float":"left"}):e.css({"float":"right"})):(e.css({display:"block",clear:"both"}),"left"==n?e.css({textAlign:"left"}):"right"==n?e.css({textAlign:"right"}):e.css({textAlign:"center"}))}function j(){p.$el.find("video").filter(function(){return 0===Ee(this).parents("span.fr-video").length}).wrap(''),p.$el.find("embed, iframe").filter(function(){if(p.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0');for(var e,t,n=p.$el.find("span.fr-video, video"),r=0;r *:first").replaceWith(p.icon.create("video-align-"+Y()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+Y()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){u.removeClass("fr-dvi fr-dvb"),!p.opts.htmlUntouched&&p.opts.useClasses?"inline"==e?u.addClass("fr-dvi"):"block"==e&&u.addClass("fr-dvb"):q(u,e,Y()),Q(),M(),a(),p.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+G()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:V,hideProgressBar:S,showSizePopup:function(){var e=p.popups.get("video.size");e||(e=z()),S(),p.popups.refresh("video.size"),p.popups.setContainer("video.size",p.$sc);var t=u.find("iframe, embed, video"),n=t.offset().left+t.width()/2,r=t.offset().top+t.height();p.popups.show("video.size",n,r,t.height())},replace:function(){var e=p.popups.get("video.insert");e||(e=o()),p.popups.isVisible("video.insert")||(S(),p.popups.refresh("video.insert"),p.popups.setContainer("video.insert",p.$sc));var t=u.offset().left+u.width()/2,n=u.offset().top+u.height();p.popups.show("video.insert",t,n,u.outerHeight())},back:function(){u?(p.events.disableBlur(),u.trigger("click")):(p.events.disableBlur(),p.selection.restore(),p.events.enableBlur(),p.popups.hide("video.insert"),p.toolbar.showInline())},setSize:function(e,t){if(u){var n=p.popups.get("video.size"),r=u.find("iframe, embed, video");r.css("width",e||n.find('input[name="width"]').val()),r.css("height",t||n.find('input[name="height"]').val()),r.get(0).style.width&&r.removeAttr("width"),r.get(0).style.height&&r.removeAttr("height"),n.find("input:focus").blur(),setTimeout(function(){u.trigger("click")},p.helpers.isAndroid()?50:0)}},get:function(){return u},showProgressBar:C}},Ee.FE.RegisterCommand("insertVideo",{title:"Insert Video",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("video.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("video.insert")):this.video.showInsertPopup()},plugin:"video"}),Ee.FE.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera"}),Ee.FE.DefineIcon("videoByURL",{NAME:"link"}),Ee.FE.RegisterCommand("videoByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-by-url")},refresh:function(e){this.video.refreshByURLButton(e)}}),Ee.FE.DefineIcon("videoEmbed",{NAME:"code"}),Ee.FE.RegisterCommand("videoEmbed",{title:"Embedded Code",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-embed")},refresh:function(e){this.video.refreshEmbedButton(e)}}),Ee.FE.DefineIcon("videoUpload",{NAME:"upload"}),Ee.FE.RegisterCommand("videoUpload",{title:"Upload Video",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-upload")},refresh:function(e){this.video.refreshUploadButton(e)}}),Ee.FE.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),Ee.FE.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),Ee.FE.DefineIcon("videoDisplay",{NAME:"star"}),Ee.FE.RegisterCommand("videoDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.video.display(t)},refresh:function(e){this.opts.videoTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.video.refreshDisplayOnShow(e,t)}}),Ee.FE.DefineIcon("video-align",{NAME:"align-left"}),Ee.FE.DefineIcon("video-align-left",{NAME:"align-left"}),Ee.FE.DefineIcon("video-align-right",{NAME:"align-right"}),Ee.FE.DefineIcon("video-align-center",{NAME:"align-justify"}),Ee.FE.DefineIcon("videoAlign",{NAME:"align-center"}),Ee.FE.RegisterCommand("videoAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='"},callback:function(e,t){this.video.align(t)},refresh:function(e){this.video.refreshAlign(e)},refreshOnShow:function(e,t){this.video.refreshAlignOnShow(e,t)}}),Ee.FE.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),Ee.FE.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),Ee.FE.DefineIcon("videoRemove",{NAME:"trash"}),Ee.FE.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),Ee.FE.DefineIcon("videoSize",{NAME:"arrows-alt"}),Ee.FE.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),Ee.FE.DefineIcon("videoBack",{NAME:"arrow-left"}),Ee.FE.RegisterCommand("videoBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.video.back()},refresh:function(e){this.video.get()||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),Ee.FE.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),Ee.FE.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}}),Ee.extend(Ee.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent","border","border-.*","line-height"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),Ee.FE.PLUGINS.wordPaste=function(T){var a,r,o="word_paste";function t(e){var t=T.opts.wordAllowedStyleProps;e||(T.opts.wordAllowedStyleProps=[]),0===r.indexOf("")&&(r=""+r+"
"),r=function(e,t){0<=e.indexOf("]*(]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),n=1;n').remove()}}(e,t),!0});for(var a=i.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),o=a.length-1;0<=o;o--)a[o].previousElementSibling&&"LI"===a[o].previousElementSibling.tagName&&a[o].previousElementSibling.appendChild(a[o]);c(i,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/
(\n|\r)/gi,"
"),!1;if(t.nodeType==Node.ELEMENT_NODE){if(C(t)){var n=t.parentNode,r=t.previousSibling,i=function e(t,n,r){var i=/[0-9a-zA-Z]./gi;var a=!1;var o=t.querySelector('span[style="mso-list:Ignore"]');var s;var l;var d;var c;var f;o&&(a=a||i.test(o.textContent));var p=a?"ol":"ul";var u="<"+p+">";for(;t;){if(!C(t)){if(t.outerHTML&&0"+c+""):(f=e(t,n,h),u+=f.el.outerHTML,t=f.currentNode);var g=t&&t.nextElementSibling;g&&(s=g.previousElementSibling),t&&t.parentNode&&t.parentNode.removeChild(t),t=g}}u+="";var m=document.createElement("div");m.innerHTML=u;var v=m.firstElementChild;return{el:v,currentNode:t}}(t,s).el,a=null;return(a=r?r.nextSibling:n.firstChild)?n.insertBefore(i,a):n.appendChild(i),!1}return"FONT"===t.tagName&&s["."+t.getAttribute("class")]&&(t=v(t,"span")),p(t,s)}if(t.nodeType==Node.COMMENT_NODE){if(-1([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var n="",r=0;r++/gi,"")}function v(e,t){for(var n=document.createElement(t),r=0;r");for(var o=n.firstElementChild,s=1==n.children.length;o;)"P"!=o.tagName||C(o)||s&&S(o),o=o.nextElementSibling;if(t){var l=n.getAttribute("class");if(l){var d=(l=R(l)).match(/xl[0-9]+/gi);if(d){var c="."+d[0];t[c]&&y(n,t[c])}}t.td&&y(n,t.td)}var f=n.getAttribute("style");f&&(f=R(f))&&";"!=f.slice(-1)&&(f+=";");var p=n.getAttribute("valign");if(!p&&f){var u=f.match(/vertical-align:.+?[; "]{1,1}/gi);u&&(p=u[u.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var h=null;if(f){var g=f.match(/text-align:.+?[; "]{1,1}/gi);g&&(h=g[g.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==h&&(h=null)}var m=null;if(f){var v=f.match(/background:.+?[; "]{1,1}/gi);v&&(m=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var E=n.getAttribute("colspan"),b=n.getAttribute("rowspan");E&&n.setAttribute("colspan",E),b&&n.setAttribute("rowspan",b),p&&(n.style["vertical-align"]=p),h&&(n.style["text-align"]=h),m&&(n.style["background-color"]=m),a&&n.setAttribute("width",a),n=n.nextElementSibling}for(n=e.firstElementChild;n;)a=n.getAttribute("width"),i?n.removeAttribute("width"):n.setAttribute("width",100*parseInt(a,10)/r+"%"),n=n.nextElementSibling}(e,t),"A"!=n||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"A"==n&&e.getAttribute("href")&&e.querySelector("img")){var g=e.querySelectorAll("span");for(i=0;i"),"TABLE"==n&&(e.style.width=e.style.width||"100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var m=R(e.getAttribute("style"));(m=m.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",m):e.removeAttribute("style")}return!0}var h={};return{_init:function(){T.events.on("paste.wordPaste",function(e){return r=e,T.opts.wordPasteModal?function(){if(!a){var e='

'+T.language.translate("Word Paste Detected")+"

",t=(i='
',i+='

'+T.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"

",i+='
",i+="
"),n=T.modals.create(o,e,t),r=n.$body;a=n.$modal,n.$modal.addClass("fr-middle"),T.events.bindClick(r,"button.fr-remove-word",function(){var e=a.data("instance")||T;e.wordPaste.clean()}),T.events.bindClick(r,"button.fr-keep-word",function(){var e=a.data("instance")||T;e.wordPaste.clean(!0)}),T.events.$on(Ee(T.o_win),"resize",function(){T.modals.resize(o)})}var i;T.modals.show(o),T.modals.resize(o)}():t(T.opts.wordPasteKeepFormatting),!1})},clean:t}}}); \ No newline at end of file diff --git a/js/plugins/word_paste.min.js b/js/plugins/word_paste.min.js index ebd92cf20..319cf6a2b 100644 --- a/js/plugins/word_paste.min.js +++ b/js/plugins/word_paste.min.js @@ -4,4 +4,4 @@ * Copyright 2014-2019 Froala Labs */ -!function(r){"function"==typeof define&&define.amd?define(["jquery"],r):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),r(t)}:r(window.jQuery)}(function(w){w.extend(w.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent","border","border-.*","line-height"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),w.FE.PLUGINS.wordPaste=function(y){var a,i,l="word_paste";function t(e){var t=y.opts.wordAllowedStyleProps;e||(y.opts.wordAllowedStyleProps=[]),0===i.indexOf("")&&(i=""+i+"
"),i=function(e,t){0<=e.indexOf("]*(]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),r=1;r').remove()}}(e,t),!0});for(var a=n.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),l=a.length-1;0<=l;l--)a[l].previousElementSibling&&"LI"===a[l].previousElementSibling.tagName&&a[l].previousElementSibling.appendChild(a[l]);f(n,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/
(\n|\r)/gi,"
"),!1;if(t.nodeType==Node.ELEMENT_NODE){if(A(t)){var r=t.parentNode,i=t.previousSibling,n=function e(t,r,i){var n=/[0-9a-zA-Z]./gi;var a=!1;var l=t.querySelector('span[style="mso-list:Ignore"]');var o;var s;var d;var f;var u;l&&(a=a||n.test(l.textContent));var g=a?"ol":"ul";var p="<"+g+">";for(;t;){if(!A(t)){if(t.outerHTML&&0"+f+""):(u=e(t,r,c),p+=u.el.outerHTML,t=u.currentNode);var m=t&&t.nextElementSibling;m&&(o=m.previousElementSibling),t&&t.parentNode&&t.parentNode.removeChild(t),t=m}}p+="";var h=document.createElement("div");h.innerHTML=p;var v=h.firstElementChild;return{el:v,currentNode:t}}(t,o).el,a=null;return(a=i?i.nextSibling:r.firstChild)?r.insertBefore(n,a):r.appendChild(n),!1}return"FONT"===t.tagName&&o["."+t.getAttribute("class")]&&(t=v(t,"span")),g(t,o)}if(t.nodeType==Node.COMMENT_NODE){if(-1([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var r="",i=0;i++/gi,"")}function v(e,t){for(var r=document.createElement(t),i=0;i");for(var l=r.firstElementChild,o=1==r.children.length;l;)"P"!=l.tagName||A(l)||o&&x(l),l=l.nextElementSibling;if(t){var s=r.getAttribute("class");if(s){var d=(s=C(s)).match(/xl[0-9]+/gi);if(d){var f="."+d[0];t[f]&&T(r,t[f])}}t.td&&T(r,t.td)}var u=r.getAttribute("style");u&&(u=C(u))&&";"!=u.slice(-1)&&(u+=";");var g=r.getAttribute("valign");if(!g&&u){var p=u.match(/vertical-align:.+?[; "]{1,1}/gi);p&&(g=p[p.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var c=null;if(u){var m=u.match(/text-align:.+?[; "]{1,1}/gi);m&&(c=m[m.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==c&&(c=null)}var h=null;if(u){var v=u.match(/background:.+?[; "]{1,1}/gi);v&&(h=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var b=r.getAttribute("colspan"),E=r.getAttribute("rowspan");b&&r.setAttribute("colspan",b),E&&r.setAttribute("rowspan",E),g&&(r.style["vertical-align"]=g),c&&(r.style["text-align"]=c),h&&(r.style["background-color"]=h),a&&r.setAttribute("width",a),r=r.nextElementSibling}for(r=e.firstElementChild;r;)a=r.getAttribute("width"),n?r.removeAttribute("width"):r.setAttribute("width",100*parseInt(a,10)/i+"%"),r=r.nextElementSibling}(e,t),"A"!=r||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"A"==r&&e.getAttribute("href")&&e.querySelector("img")){var m=e.querySelectorAll("span");for(n=0;n"),"TABLE"==r&&(e.style.width=e.style.width||"100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var h=C(e.getAttribute("style"));(h=h.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",h):e.removeAttribute("style")}return!0}var c={};return{_init:function(){y.events.on("paste.wordPaste",function(e){return i=e,y.opts.wordPasteModal?function(){if(!a){var e='

'+y.language.translate("Word Paste Detected")+"

",t=(n='
',n+='

'+y.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"

",n+='
",n+="
"),r=y.modals.create(l,e,t),i=r.$body;a=r.$modal,r.$modal.addClass("fr-middle"),y.events.bindClick(i,"button.fr-remove-word",function(){var e=a.data("instance")||y;e.wordPaste.clean()}),y.events.bindClick(i,"button.fr-keep-word",function(){var e=a.data("instance")||y;e.wordPaste.clean(!0)}),y.events.$on(w(y.o_win),"resize",function(){y.modals.resize(l)})}var n;y.modals.show(l),y.modals.resize(l)}():t(y.opts.wordPasteKeepFormatting),!1})},clean:t}}}); \ No newline at end of file +!function(r){"function"==typeof define&&define.amd?define(["jquery"],r):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),r(t)}:r(window.jQuery)}(function(w){w.extend(w.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent","border","border-.*","line-height"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),w.FE.PLUGINS.wordPaste=function(E){var a,i,l="word_paste";function t(e){var t=E.opts.wordAllowedStyleProps;e||(E.opts.wordAllowedStyleProps=[]),0===i.indexOf("")&&(i=""+i+"
"),i=function(e,t){0<=e.indexOf("]*(]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),r=1;r').remove()}}(e,t),!0});for(var a=n.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),l=a.length-1;0<=l;l--)a[l].previousElementSibling&&"LI"===a[l].previousElementSibling.tagName&&a[l].previousElementSibling.appendChild(a[l]);f(n,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/
(\n|\r)/gi,"
"),!1;if(t.nodeType==Node.ELEMENT_NODE){if(A(t)){var r=t.parentNode,i=t.previousSibling,n=function e(t,r,i){var n=/[0-9a-zA-Z]./gi;var a=!1;var l=t.querySelector('span[style="mso-list:Ignore"]');var o;var s;var d;var f;var u;l&&(a=a||n.test(l.textContent));var g=a?"ol":"ul";var p="<"+g+">";for(;t;){if(!A(t)){if(t.outerHTML&&0"+f+""):(u=e(t,r,c),p+=u.el.outerHTML,t=u.currentNode);var m=t&&t.nextElementSibling;m&&(o=m.previousElementSibling),t&&t.parentNode&&t.parentNode.removeChild(t),t=m}}p+="";var h=document.createElement("div");h.innerHTML=p;var v=h.firstElementChild;return{el:v,currentNode:t}}(t,o).el,a=null;return(a=i?i.nextSibling:r.firstChild)?r.insertBefore(n,a):r.appendChild(n),!1}return"FONT"===t.tagName&&o["."+t.getAttribute("class")]&&(t=v(t,"span")),g(t,o)}if(t.nodeType==Node.COMMENT_NODE){if(-1([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var r="",i=0;i++/gi,"")}function v(e,t){for(var r=document.createElement(t),i=0;i");for(var l=r.firstElementChild,o=1==r.children.length;l;)"P"!=l.tagName||A(l)||o&&x(l),l=l.nextElementSibling;if(t){var s=r.getAttribute("class");if(s){var d=(s=C(s)).match(/xl[0-9]+/gi);if(d){var f="."+d[0];t[f]&&T(r,t[f])}}t.td&&T(r,t.td)}var u=r.getAttribute("style");u&&(u=C(u))&&";"!=u.slice(-1)&&(u+=";");var g=r.getAttribute("valign");if(!g&&u){var p=u.match(/vertical-align:.+?[; "]{1,1}/gi);p&&(g=p[p.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var c=null;if(u){var m=u.match(/text-align:.+?[; "]{1,1}/gi);m&&(c=m[m.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==c&&(c=null)}var h=null;if(u){var v=u.match(/background:.+?[; "]{1,1}/gi);v&&(h=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var b=r.getAttribute("colspan"),N=r.getAttribute("rowspan");b&&r.setAttribute("colspan",b),N&&r.setAttribute("rowspan",N),g&&(r.style["vertical-align"]=g),c&&(r.style["text-align"]=c),h&&(r.style["background-color"]=h),a&&r.setAttribute("width",a),r=r.nextElementSibling}for(r=e.firstElementChild;r;)a=r.getAttribute("width"),n?r.removeAttribute("width"):r.setAttribute("width",100*parseInt(a,10)/i+"%"),r=r.nextElementSibling}(e,t),"A"!=r||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"A"==r&&e.getAttribute("href")&&e.querySelector("img")){var m=e.querySelectorAll("span");for(n=0;n"),"TABLE"==r&&(e.style.width=e.style.width||"100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var h=C(e.getAttribute("style"));(h=h.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",h):e.removeAttribute("style")}return!0}var c={};return{_init:function(){E.events.on("paste.wordPaste",function(e){return i=e,E.opts.wordPasteModal?function(){if(!a){var e='

'+E.language.translate("Word Paste Detected")+"

",t=(n='
',n+='

'+E.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"

",n+='
",n+="
"),r=E.modals.create(l,e,t),i=r.$body;a=r.$modal,r.$modal.addClass("fr-middle"),E.events.bindClick(i,"button.fr-remove-word",function(){var e=a.data("instance")||E;e.wordPaste.clean()}),E.events.bindClick(i,"button.fr-keep-word",function(){var e=a.data("instance")||E;e.wordPaste.clean(!0)}),E.events.$on(w(E.o_win),"resize",function(){E.modals.resize(l)})}var n;E.modals.show(l),E.modals.resize(l)}():t(E.opts.wordPasteKeepFormatting),!1})},clean:t}}}); \ No newline at end of file