froala-editor
Advanced tools
Comparing version 3.0.0-beta.2-1 to 3.0.0-rc.1
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e["default"]:e,Object.assign(e.DEFAULTS,{codeMirror:window.CodeMirror,codeMirrorOptions:{lineNumbers:!0,tabMode:"indent",indentWithTabs:!0,lineWrapping:!0,mode:"text/html",tabSize:2},codeBeautifierOptions:{end_with_newline:!0,indent_inner_html:!0,extra_liners:["p","h1","h2","h3","h4","h5","h6","blockquote","pre","ul","ol","table","dl"],brace_style:"expand",indent_char:"\t",indent_size:1,wrap_line_length:0},codeViewKeepActiveButtons:["fullscreen"]}),e.PLUGINS.codeView=function(l){var d,c,f=l.$;function h(){return l.$box.hasClass("fr-code-view")}function p(){return c?c.getValue():d.val()}function u(){h()&&(c&&c.setSize(null,l.opts.height?l.opts.height:"auto"),l.opts.heightMin||l.opts.height?l.$box.find(".CodeMirror-scroll, .CodeMirror-gutters").css("min-height",l.opts.heightMin||l.opts.height):l.$box.find(".CodeMirror-scroll, .CodeMirror-gutters").css("min-height",""))}var g,m=!1;function b(){h()&&l.events.trigger("blur")}function v(){h()&&m&&l.events.trigger("focus")}function n(e){d||(!function(){d=f('<textarea class="fr-code" tabIndex="-1">'),l.$wp.append(d),d.attr("dir",l.opts.direction),l.$box.hasClass("fr-basic")||(g=f('<a data-cmd="html" title="Code View" class="fr-command fr-btn html-switch'+(l.helpers.isMobile()?"":" fr-desktop")+'" role="button" tabIndex="-1"><i class="fa fa-code"></i></button>'),l.$box.append(g),l.events.bindClick(l.$box,"a.html-switch",function(){l.events.trigger("commands.before",["html"]),M(!1),l.events.trigger("commands.after",["html"])}));var e=function(){return!h()};l.events.on("buttons.refresh",e),l.events.on("copy",e,!0),l.events.on("cut",e,!0),l.events.on("paste",e,!0),l.events.on("destroy",A,!0),l.events.on("html.set",function(){h()&&M(!0)}),l.events.on("codeView.update",u),l.events.on("form.submit",function(){h()&&(l.html.set(p()),l.events.trigger("contentChanged",[],!0))},!0)}(),!c&&l.opts.codeMirror?((c=l.opts.codeMirror.fromTextArea(d.get(0),l.opts.codeMirrorOptions)).on("blur",b),c.on("focus",v)):(l.events.$on(d,"keydown keyup change input",function(){l.opts.height?this.removeAttribute("rows"):(this.rows=1,0===this.value.length?this.style.height="auto":this.style.height=this.scrollHeight+"px")}),l.events.$on(d,"blur",b),l.events.$on(d,"focus",v))),l.undo.saveStep(),l.html.cleanEmptyTags(),l.html.cleanWhiteTags(!0),l.core.hasFocus()&&(l.core.isEmpty()||(l.selection.save(),l.$el.find('.fr-marker[data-type="true"]').first().replaceWith('<span class="fr-tmp fr-sm">F</span>'),l.$el.find('.fr-marker[data-type="false"]').last().replaceWith('<span class="fr-tmp fr-em">F</span>')));var t=l.html.get(!1,!0);l.$el.find("span.fr-tmp").remove(),l.$box.toggleClass("fr-code-view",!0);var r,o,n=!1;if(l.core.hasFocus()&&(n=!0,l.events.disableBlur(),l.$el.blur()),t=(t=t.replace(/<span class="fr-tmp fr-sm">F<\/span>/,"FROALA-SM")).replace(/<span class="fr-tmp fr-em">F<\/span>/,"FROALA-EM"),l.codeBeautifier&&(t=l.codeBeautifier.run(t,l.opts.codeBeautifierOptions)),c){r=t.indexOf("FROALA-SM"),(o=t.indexOf("FROALA-EM"))<r?r=o:o-=9;var s=(t=t.replace(/FROALA-SM/g,"").replace(/FROALA-EM/g,"")).substring(0,r).length-t.substring(0,r).replace(/\n/g,"").length,i=t.substring(0,o).length-t.substring(0,o).replace(/\n/g,"").length;r=t.substring(0,r).length-t.substring(0,t.substring(0,r).lastIndexOf("\n")+1).length,o=t.substring(0,o).length-t.substring(0,t.substring(0,o).lastIndexOf("\n")+1).length,c.setSize(null,l.opts.height?l.opts.height:"auto"),l.opts.heightMin&&l.$box.find(".CodeMirror-scroll").css("min-height",l.opts.heightMin),c.setValue(t),m=!n,c.focus(),m=!0,c.setSelection({line:s,ch:r},{line:i,ch:o}),c.refresh(),c.clearHistory()}else{r=t.indexOf("FROALA-SM"),o=t.indexOf("FROALA-EM")-9,l.opts.heightMin&&d.css("min-height",l.opts.heightMin),l.opts.height&&d.css("height",l.opts.height),l.opts.heightMax&&d.css("max-height",l.opts.height||l.opts.heightMax),d.val(t.replace(/FROALA-SM/g,"").replace(/FROALA-EM/g,"")).trigger("change");var a=f(l.o_doc).scrollTop();m=!n,d.focus(),m=!0,d.get(0).setSelectionRange(r,o),f(l.o_doc).scrollTop(a)}l.$tb.find(".fr-btn-grp > .fr-command, .fr-more-toolbar > .fr-command, .fr-btn-grp > .fr-btn-wrap > .fr-command, .fr-more-toolbar > .fr-btn-wrap > .fr-command").not(e).filter(function(){return l.opts.codeViewKeepActiveButtons.indexOf(f(this).data("cmd"))<0}).addClass("fr-disabled").attr("aria-disabled",!0),e.addClass("fr-active").attr("aria-pressed",!0),!l.helpers.isMobile()&&l.opts.toolbarInline&&l.toolbar.hide()}function M(e){void 0===e&&(e=!h());var t,r,o=l.$tb.find('.fr-command[data-cmd="html"]');e?(l.popups.hideAll(),n(o)):(l.$box.toggleClass("fr-code-view",!1),t=o,r=p(),l.html.set(r),l.$el.blur(),l.$tb.find(".fr-btn-grp > .fr-command, .fr-more-toolbar > .fr-command, .fr-btn-grp > .fr-btn-wrap > .fr-command, .fr-more-toolbar > .fr-btn-wrap > .fr-command").not(t).removeClass("fr-disabled").attr("aria-disabled",!1),t.removeClass("fr-active").attr("aria-pressed",!1),l.selection.setAtStart(l.el),l.selection.restore(),l.placeholder.refresh(),l.undo.saveStep())}function A(){h()&&M(!1),c&&c.toTextArea(),d.val("").removeData().remove(),d=null,g&&(g.remove(),g=null)}return{_init:function(){if(l.events.on("focus",function(){var e;l.opts.toolbarContainer&&(e=l.$tb.find('.fr-command[data-cmd="html"]'),h()?(l.$tb.find(".fr-btn-grp > .fr-command, .fr-more-toolbar > .fr-command").not(e).filter(function(){return l.opts.codeViewKeepActiveButtons.indexOf(f(this).data("cmd"))<0}).addClass("fr-disabled").attr("aria-disabled",!1),e.addClass("fr-active").attr("aria-pressed",!1)):(l.$tb.find(".fr-btn-grp > .fr-command, .fr-more-toolbar > .fr-command").not(e).removeClass("fr-disabled").attr("aria-disabled",!1),e.removeClass("fr-active").attr("aria-pressed",!1)))}),!l.$wp)return!1},toggle:M,isActive:h,get:p}},e.RegisterCommand("html",{title:"Code View",undo:!1,focus:!1,forcedRefresh:!0,toggle:!0,callback:function(){this.codeView.toggle()},plugin:"codeView"}),e.DefineIcon("html",{NAME:"code",SVG_KEY:"codeView"})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e["default"]:e,Object.assign(e.DEFAULTS,{codeMirror:window.CodeMirror,codeMirrorOptions:{lineNumbers:!0,tabMode:"indent",indentWithTabs:!0,lineWrapping:!0,mode:"text/html",tabSize:2},codeBeautifierOptions:{end_with_newline:!0,indent_inner_html:!0,extra_liners:["p","h1","h2","h3","h4","h5","h6","blockquote","pre","ul","ol","table","dl"],brace_style:"expand",indent_char:"\t",indent_size:1,wrap_line_length:0},codeViewKeepActiveButtons:["fullscreen"]}),e.PLUGINS.codeView=function(l){var d,c,f=l.$;function h(){return l.$box.hasClass("fr-code-view")}function p(){return c?c.getValue():d.val()}function u(){h()&&(c&&c.setSize(null,l.opts.height?l.opts.height:"auto"),l.opts.heightMin||l.opts.height?l.$box.find(".CodeMirror-scroll, .CodeMirror-gutters").css("min-height",l.opts.heightMin||l.opts.height):l.$box.find(".CodeMirror-scroll, .CodeMirror-gutters").css("min-height",""))}var g,m=!1;function b(){h()&&l.events.trigger("blur")}function v(){h()&&m&&l.events.trigger("focus")}function n(e){d||(!function(){d=f('<textarea class="fr-code" tabIndex="-1">'),l.$wp.append(d),d.attr("dir",l.opts.direction),l.$box.hasClass("fr-basic")||(g=f('<a data-cmd="html" title="Code View" class="fr-command fr-btn html-switch'+(l.helpers.isMobile()?"":" fr-desktop")+'" role="button" tabIndex="-1"><i class="fa fa-code"></i></button>'),l.$box.append(g),l.events.bindClick(l.$box,"a.html-switch",function(){l.events.trigger("commands.before",["html"]),M(!1),l.events.trigger("commands.after",["html"])}));var e=function(){return!h()};l.events.on("buttons.refresh",e),l.events.on("copy",e,!0),l.events.on("cut",e,!0),l.events.on("paste",e,!0),l.events.on("destroy",w,!0),l.events.on("html.set",function(){h()&&M(!0)}),l.events.on("codeView.update",u),l.events.on("codeView.toggle",function(){l.$box.hasClass("fr-code-view")&&M()}),l.events.on("form.submit",function(){h()&&(l.html.set(p()),l.events.trigger("contentChanged",[],!0))},!0)}(),!c&&l.opts.codeMirror?((c=l.opts.codeMirror.fromTextArea(d.get(0),l.opts.codeMirrorOptions)).on("blur",b),c.on("focus",v)):(l.events.$on(d,"keydown keyup change input",function(){l.opts.height?this.removeAttribute("rows"):(this.rows=1,0===this.value.length?this.style.height="auto":this.style.height=this.scrollHeight+"px")}),l.events.$on(d,"blur",b),l.events.$on(d,"focus",v))),l.undo.saveStep(),l.html.cleanEmptyTags(),l.html.cleanWhiteTags(!0),l.core.hasFocus()&&(l.core.isEmpty()||(l.selection.save(),l.$el.find('.fr-marker[data-type="true"]').first().replaceWith('<span class="fr-tmp fr-sm">F</span>'),l.$el.find('.fr-marker[data-type="false"]').last().replaceWith('<span class="fr-tmp fr-em">F</span>')));var t=l.html.get(!1,!0);l.$el.find("span.fr-tmp").remove(),l.$box.toggleClass("fr-code-view",!0);var r,o,n=!1;if(l.core.hasFocus()&&(n=!0,l.events.disableBlur(),l.$el.blur()),t=(t=t.replace(/<span class="fr-tmp fr-sm">F<\/span>/,"FROALA-SM")).replace(/<span class="fr-tmp fr-em">F<\/span>/,"FROALA-EM"),l.codeBeautifier&&(t=l.codeBeautifier.run(t,l.opts.codeBeautifierOptions)),c){r=t.indexOf("FROALA-SM"),(o=t.indexOf("FROALA-EM"))<r?r=o:o-=9;var s=(t=t.replace(/FROALA-SM/g,"").replace(/FROALA-EM/g,"")).substring(0,r).length-t.substring(0,r).replace(/\n/g,"").length,i=t.substring(0,o).length-t.substring(0,o).replace(/\n/g,"").length;r=t.substring(0,r).length-t.substring(0,t.substring(0,r).lastIndexOf("\n")+1).length,o=t.substring(0,o).length-t.substring(0,t.substring(0,o).lastIndexOf("\n")+1).length,c.setSize(null,l.opts.height?l.opts.height:"auto"),l.opts.heightMin&&l.$box.find(".CodeMirror-scroll").css("min-height",l.opts.heightMin),c.setValue(t),m=!n,c.focus(),m=!0,c.setSelection({line:s,ch:r},{line:i,ch:o}),c.refresh(),c.clearHistory()}else{r=t.indexOf("FROALA-SM"),o=t.indexOf("FROALA-EM")-9,l.opts.heightMin&&d.css("min-height",l.opts.heightMin),l.opts.height&&d.css("height",l.opts.height),l.opts.heightMax&&d.css("max-height",l.opts.height||l.opts.heightMax),d.val(t.replace(/FROALA-SM/g,"").replace(/FROALA-EM/g,"")).trigger("change");var a=f(l.o_doc).scrollTop();m=!n,d.focus(),m=!0,d.get(0).setSelectionRange(r,o),f(l.o_doc).scrollTop(a)}l.$tb.find(".fr-btn-grp > .fr-command, .fr-more-toolbar > .fr-command, .fr-btn-grp > .fr-btn-wrap > .fr-command, .fr-more-toolbar > .fr-btn-wrap > .fr-command").not(e).filter(function(){return l.opts.codeViewKeepActiveButtons.indexOf(f(this).data("cmd"))<0}).addClass("fr-disabled").attr("aria-disabled",!0),e.addClass("fr-active").attr("aria-pressed",!0),!l.helpers.isMobile()&&l.opts.toolbarInline&&l.toolbar.hide()}function M(e){void 0===e&&(e=!h());var t,r,o=l.$tb.find('.fr-command[data-cmd="html"]');e?(l.popups.hideAll(),n(o)):(l.$box.toggleClass("fr-code-view",!1),t=o,r=p(),l.html.set(r),l.$el.blur(),l.$tb.find(".fr-btn-grp > .fr-command, .fr-more-toolbar > .fr-command, .fr-btn-grp > .fr-btn-wrap > .fr-command, .fr-more-toolbar > .fr-btn-wrap > .fr-command").not(t).removeClass("fr-disabled").attr("aria-disabled",!1),t.removeClass("fr-active").attr("aria-pressed",!1),l.selection.setAtStart(l.el),l.selection.restore(),l.placeholder.refresh(),l.undo.saveStep())}function w(){h()&&M(!1),c&&c.toTextArea(),d.val("").removeData().remove(),d=null,g&&(g.remove(),g=null)}return{_init:function(){if(l.events.on("focus",function(){var e;l.opts.toolbarContainer&&(e=l.$tb.find('.fr-command[data-cmd="html"]'),h()?(l.$tb.find(".fr-btn-grp > .fr-command, .fr-more-toolbar > .fr-command").not(e).filter(function(){return l.opts.codeViewKeepActiveButtons.indexOf(f(this).data("cmd"))<0}).addClass("fr-disabled").attr("aria-disabled",!1),e.addClass("fr-active").attr("aria-pressed",!1)):(l.$tb.find(".fr-btn-grp > .fr-command, .fr-more-toolbar > .fr-command").not(e).removeClass("fr-disabled").attr("aria-disabled",!1),e.removeClass("fr-active").attr("aria-pressed",!1)))}),!l.$wp)return!1},toggle:M,isActive:h,get:p}},e.RegisterCommand("html",{title:"Code View",undo:!1,focus:!1,forcedRefresh:!0,toggle:!0,callback:function(){this.codeView.toggle()},plugin:"codeView"}),e.DefineIcon("html",{NAME:"code",SVG_KEY:"codeView"})}); |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(ye){"use strict";function we(e){return(we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}ye=ye&&ye.hasOwnProperty("default")?ye["default"]:ye,Object.assign(ye.POPUP_TEMPLATES,{"image.insert":"[_BUTTONS_][_UPLOAD_LAYER_][_BY_URL_LAYER_][_PROGRESS_BAR_]","image.edit":"[_BUTTONS_]","image.alt":"[_BUTTONS_][_ALT_LAYER_]","image.size":"[_BUTTONS_][_SIZE_LAYER_]"}),Object.assign(ye.DEFAULTS,{imageInsertButtons:["imageBack","|","imageUpload","imageByURL"],imageEditButtons:["imageReplace","imageAlign","imageCaption","imageRemove","imageLink","linkOpen","linkEdit","linkRemove","-","imageDisplay","imageStyle","imageAlt","imageSize"],imageAltButtons:["imageBack","|"],imageSizeButtons:["imageBack","|"],imageUpload:!0,imageUploadURL:null,imageCORSProxy:"https://cors-anywhere.froala.com",imageUploadRemoteUrls:!0,imageUploadParam:"file",imageUploadParams:{},imageUploadToS3:!1,imageUploadMethod:"POST",imageMaxSize:10485760,imageAllowedTypes:["jpeg","jpg","png","gif","webp"],imageResize:!0,imageResizeWithPercent:!1,imageRoundPercent:!1,imageDefaultWidth:300,imageDefaultAlign:"center",imageDefaultDisplay:"block",imageSplitHTML:!1,imageStyles:{"fr-rounded":"Rounded","fr-bordered":"Bordered","fr-shadow":"Shadow"},imageMove:!0,imageMultipleStyles:!0,imageTextNear:!0,imagePaste:!0,imagePasteProcess:!1,imageMinWidth:16,imageOutputSize:!1,imageDefaultMargin:5}),ye.PLUGINS.image=function(g){var d,l,f,p,o,a,c=g.$,m="https://i.froala.com/upload",t=!1,i=1,u=2,h=3,v=4,b=5,y=6,r={};function w(){var e=g.popups.get("image.insert").find(".fr-image-by-url-layer input");e.val(""),d&&e.val(d.attr("src")),e.trigger("change")}function n(){var e=g.popups.get("image.edit");if(e||(e=$()),e){var t=ve();be()&&(t=t.find(".fr-img-wrap")),g.popups.setContainer("image.edit",g.$sc),g.popups.refresh("image.edit");var a=t.offset().left+t.outerWidth()/2,i=t.offset().top+t.outerHeight();d.hasClass("fr-uploading")?I():g.popups.show("image.edit",a,i,t.outerHeight(),!0)}}function C(){k()}function e(){for(var e,t,a="IMG"==g.el.tagName?[g.el]:g.el.querySelectorAll("img"),i=0;i<a.length;i++){var r=c(a[i]);!g.opts.htmlUntouched&&g.opts.useClasses?((g.opts.imageDefaultAlign||g.opts.imageDefaultDisplay)&&(0<(t=r).parents(".fr-img-caption").length&&(t=t.parents(".fr-img-caption").first()),t.hasClass("fr-dii")||t.hasClass("fr-dib")||(t.addClass("fr-fi"+de(t)[0]),t.addClass("fr-di"+ce(t)[0]),t.css("margin",""),t.css("float",""),t.css("display",""),t.css("z-index",""),t.css("position",""),t.css("overflow",""),t.css("vertical-align",""))),g.opts.imageTextNear||(0<r.parents(".fr-img-caption").length?r.parents(".fr-img-caption").first().removeClass("fr-dii").addClass("fr-dib"):r.removeClass("fr-dii").addClass("fr-dib"))):g.opts.htmlUntouched||g.opts.useClasses||(g.opts.imageDefaultAlign||g.opts.imageDefaultDisplay)&&(0<(e=r).parents(".fr-img-caption").length&&(e=e.parents(".fr-img-caption").first()),ge(e,e.hasClass("fr-dib")?"block":e.hasClass("fr-dii")?"inline":null,e.hasClass("fr-fil")?"left":e.hasClass("fr-fir")?"right":de(e)),e.removeClass("fr-dib fr-dii fr-fir fr-fil")),g.opts.iframe&&r.on("load",g.size.syncIframe)}}function A(e){void 0===e&&(e=!0);var t,a=Array.prototype.slice.call(g.el.querySelectorAll("img")),i=[];for(t=0;t<a.length;t++)if(i.push(a[t].getAttribute("src")),c(a[t]).toggleClass("fr-draggable",g.opts.imageMove),""===a[t].getAttribute("class")&&a[t].removeAttribute("class"),""===a[t].getAttribute("style")&&a[t].removeAttribute("style"),a[t].parentNode&&a[t].parentNode.parentNode&&g.node.hasClass(a[t].parentNode.parentNode,"fr-img-caption")){var r=a[t].parentNode.parentNode;g.browser.mozilla||r.setAttribute("contenteditable",!1),r.setAttribute("draggable",!1),r.classList.add("fr-draggable");var n=a[t].nextSibling;n&&!g.browser.mozilla&&n.setAttribute("contenteditable",!0)}if(o)for(t=0;t<o.length;t++)i.indexOf(o[t].getAttribute("src"))<0&&g.events.trigger("image.removed",[c(o[t])]);if(o&&e){var s=[];for(t=0;t<o.length;t++)s.push(o[t].getAttribute("src"));for(t=0;t<a.length;t++)s.indexOf(a[t].getAttribute("src"))<0&&g.events.trigger("image.loaded",[c(a[t])])}o=a}function E(){if(l||function(){var e;g.shared.$image_resizer?(l=g.shared.$image_resizer,p=g.shared.$img_overlay,g.events.on("destroy",function(){c("body").first().append(l.removeClass("fr-active"))},!0)):(g.shared.$image_resizer=c(document.createElement("div")).attr("class","fr-image-resizer"),l=g.shared.$image_resizer,g.events.$on(l,"mousedown",function(e){e.stopPropagation()},!0),g.opts.imageResize&&(l.append(s("nw")+s("ne")+s("sw")+s("se")),g.shared.$img_overlay=c(document.createElement("div")).attr("class","fr-image-overlay"),p=g.shared.$img_overlay,e=l.get(0).ownerDocument,c(e).find("body").first().append(p)));g.events.on("shared.destroy",function(){l.html("").removeData().remove(),l=null,g.opts.imageResize&&(p.remove(),p=null)},!0),g.helpers.isMobile()||g.events.$on(c(g.o_win),"resize",function(){d&&!d.hasClass("fr-uploading")?oe(!0):d&&(E(),me(),I(!1))});if(g.opts.imageResize){e=l.get(0).ownerDocument,g.events.$on(l,g._mousedown,".fr-handler",R),g.events.$on(c(e),g._mousemove,D),g.events.$on(c(e.defaultView||e.parentWindow),g._mouseup,x),g.events.$on(p,"mouseleave",x);var i=1,r=null,n=0;g.events.on("keydown",function(e){if(d){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,a=e.which;(a!==r||200<e.timeStamp-n)&&(i=1),(a==ye.KEYCODE.EQUALS||g.browser.mozilla&&a==ye.KEYCODE.FF_EQUALS)&&t&&!e.altKey?i=Q.call(this,e,1,1,i):(a==ye.KEYCODE.HYPHEN||g.browser.mozilla&&a==ye.KEYCODE.FF_HYPHEN)&&t&&!e.altKey?i=Q.call(this,e,2,-1,i):g.keys.ctrlKey(e)||a!=ye.KEYCODE.ENTER||(d.before("<br>"),P(d)),r=a,n=e.timeStamp}},!0),g.events.on("keyup",function(){i=1})}}(),!d)return!1;var e=g.$wp||g.$sc;e.append(l),l.data("instance",g);var t=e.scrollTop()-("static"!=e.css("position")?e.offset().top:0),a=e.scrollLeft()-("static"!=e.css("position")?e.offset().left:0);a-=g.helpers.getPX(e.css("border-left-width")),t-=g.helpers.getPX(e.css("border-top-width")),g.$el.is("img")&&g.$sc.is("body")&&(a=t=0);var i=ve();be()&&(i=i.find(".fr-img-wrap"));var r=0,n=0;g.opts.iframe&&(r=g.helpers.getPX(g.$wp.find(".fr-iframe").css("padding-top")),n=g.helpers.getPX(g.$wp.find(".fr-iframe").css("padding-left"))),l.css("top",(g.opts.iframe?i.offset().top+r:i.offset().top+t)-1).css("left",(g.opts.iframe?i.offset().left+n:i.offset().left+a)-1).css("width",i.get(0).getBoundingClientRect().width).css("height",i.get(0).getBoundingClientRect().height).addClass("fr-active")}function s(e){return'<div class="fr-handler fr-h'+e+'"></div>'}function S(e){be()?d.parents(".fr-img-caption").css("width",e):d.css("width",e)}function R(e){if(!g.core.sameInstance(l))return!0;if(e.preventDefault(),e.stopPropagation(),g.$el.find("img.fr-error").left)return!1;g.undo.canDo()||g.undo.saveStep();var t=e.pageX||e.originalEvent.touches[0].pageX;if("mousedown"==e.type){var a=g.$oel.get(0).ownerDocument,i=a.defaultView||a.parentWindow,r=!1;try{r=i.location!=i.parent.location&&!(i.$&&i.$.FE)}catch(o){}r&&i.frameElement&&(t+=g.helpers.getPX(c(i.frameElement).offset().left)+i.frameElement.clientLeft)}(f=c(this)).data("start-x",t),f.data("start-width",d.width()),f.data("start-height",d.height());var n=d.width();if(g.opts.imageResizeWithPercent){var s=d.parentsUntil(g.$el,g.html.blockTagsQuery()).get(0)||g.el;n=(n/c(s).outerWidth()*100).toFixed(2)+"%"}S(n),p.show(),g.popups.hideAll(),pe()}function D(e){if(!g.core.sameInstance(l))return!0;var t;if(f&&d){if(e.preventDefault(),g.$el.find("img.fr-error").left)return!1;var a=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null);if(!a)return!1;var i=a-f.data("start-x"),r=f.data("start-width");if((f.hasClass("fr-hnw")||f.hasClass("fr-hsw"))&&(i=0-i),g.opts.imageResizeWithPercent){var n=d.parentsUntil(g.$el,g.html.blockTagsQuery()).get(0)||g.el;r=((r+i)/c(n).outerWidth()*100).toFixed(2),g.opts.imageRoundPercent&&(r=Math.round(r)),S(r+"%"),(t=be()?(g.helpers.getPX(d.parents(".fr-img-caption").css("width"))/c(n).outerWidth()*100).toFixed(2):(g.helpers.getPX(d.css("width"))/c(n).outerWidth()*100).toFixed(2))===r||g.opts.imageRoundPercent||S(t+"%"),d.css("height","").removeAttr("height")}else r+i>=g.opts.imageMinWidth&&(S(r+i),t=be()?g.helpers.getPX(d.parents(".fr-img-caption").css("width")):g.helpers.getPX(d.css("width"))),t!==r+i&&S(t),((d.attr("style")||"").match(/(^height:)|(; *height:)/)||d.attr("height"))&&(d.css("height",f.data("start-height")*d.width()/f.data("start-width")),d.removeAttr("height"));E(),g.events.trigger("image.resize",[he()])}}function x(e){if(!g.core.sameInstance(l))return!0;if(f&&d){if(e&&e.stopPropagation(),g.$el.find("img.fr-error").left)return!1;f=null,p.hide(),E(),n(),g.undo.saveStep(),g.events.trigger("image.resizeEnd",[he()])}}function U(e,t,a){g.edit.on(),d&&d.addClass("fr-error"),function(e){I();var t=g.popups.get("image.insert").find(".fr-image-progress-bar-layer");t.addClass("fr-error");var a=t.find("h3");a.text(e),g.events.disableBlur(),a.focus()}(g.language.translate("Something went wrong. Please try again.")),!d&&a&&J(a),g.events.trigger("image.error",[{code:e,message:r[e]},t,a])}function $(e){if(e)return g.$wp&&g.events.$on(g.$wp,"scroll.image-edit",function(){d&&g.popups.isVisible("image.edit")&&(g.events.disableBlur(),n())}),!0;var t="";if(0<g.opts.imageEditButtons.length){var a={buttons:t+='<div class="fr-buttons"> \n '.concat(g.button.buildList(g.opts.imageEditButtons),"\n </div>")};return g.popups.create("image.edit",a)}return!1}function I(e){var t=g.popups.get("image.insert");if(t||(t=G()),t.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),t.find(".fr-image-progress-bar-layer").addClass("fr-active"),t.find(".fr-buttons").hide(),d){var a=ve();g.popups.setContainer("image.insert",g.$sc);var i=a.offset().left,r=a.offset().top+a.height();g.popups.show("image.insert",i,r,a.outerHeight())}void 0===e&&O(g.language.translate("Uploading"),0)}function k(e){var t=g.popups.get("image.insert");if(t&&(t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),t.find(".fr-image-progress-bar-layer").removeClass("fr-active"),t.find(".fr-buttons").show(),e||g.$el.find("img.fr-error").length)){if(g.events.focus(),g.$el.find("img.fr-error").length&&(g.$el.find("img.fr-error").remove(),g.undo.saveStep(),g.undo.run(),g.undo.dropRedo()),!g.$wp&&d){var a=d;oe(!0),g.selection.setAfter(a.get(0)),g.selection.restore()}g.popups.hide("image.insert")}}function O(e,t){var a=g.popups.get("image.insert");if(a){var i=a.find(".fr-image-progress-bar-layer");i.find("h3").text(e+(t?" "+t+"%":"")),i.removeClass("fr-error"),t?(i.find("div").removeClass("fr-indeterminate"),i.find("div > span").css("width",t+"%")):i.find("div").addClass("fr-indeterminate")}}function P(e){se.call(e.get(0))}function B(){var e=c(this);g.popups.hide("image.insert"),e.removeClass("fr-uploading"),e.next().is("br")&&e.next().remove(),P(e),g.events.trigger("image.loaded",[e])}function N(s,e,o,l,f){g.edit.off(),O(g.language.translate("Loading image")),e&&(s=g.helpers.sanitizeURL(s));var t=new Image;t.onload=function(){var e,t;if(l){g.undo.canDo()||l.hasClass("fr-uploading")||g.undo.saveStep();var a=l.data("fr-old-src");l.data("fr-image-pasted")&&(a=null),g.$wp?((e=l.clone().removeData("fr-old-src").removeClass("fr-uploading").removeAttr("data-fr-image-pasted")).off("load"),a&&l.attr("src",a),l.replaceWith(e)):e=l;for(var i=e.get(0).attributes,r=0;r<i.length;r++){var n=i[r];0===n.nodeName.indexOf("data-")&&e.removeAttr(n.nodeName)}if(void 0!==o)for(t in o)o.hasOwnProperty(t)&&"link"!=t&&e.attr("data-"+t,o[t]);e.on("load",B),e.attr("src",s),g.edit.on(),A(!1),g.undo.saveStep(),g.events.disableBlur(),g.$el.blur(),g.events.trigger(a?"image.replaced":"image.inserted",[e,f])}else e=M(s,o,B),A(!1),g.undo.saveStep(),g.events.disableBlur(),g.$el.blur(),g.events.trigger("image.inserted",[e,f])},t.onerror=function(){U(i)},I(g.language.translate("Loading image")),t.src=s}function T(e){O(g.language.translate("Loading image"));var t=this.status,a=this.response,i=this.responseXML,r=this.responseText;try{if(g.opts.imageUploadToS3)if(201==t){var n=function(e){try{var t=c(e).find("Location").text(),a=c(e).find("Key").text();return!1===g.events.trigger("image.uploadedToS3",[t,a,e],!0)?(g.edit.on(),!1):t}catch(i){return U(v,e),!1}}(i);n&&N(n,!1,[],e,a||i)}else U(v,a||i,e);else if(200<=t&&t<300){var s=function(e){try{if(!1===g.events.trigger("image.uploaded",[e],!0))return g.edit.on(),!1;var t=JSON.parse(e);return t.link?t:(U(u,e),!1)}catch(a){return U(v,e),!1}}(r);s&&N(s.link,!1,s,e,a||r)}else U(h,a||r,e)}catch(o){U(v,a||r,e)}}function _(){U(v,this.response||this.responseText||this.responseXML)}function L(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;O(g.language.translate("Uploading"),t)}}function M(e,t,a){var i,r=c(document.createElement("img")).attr("src",e);if(t&&void 0!==t)for(i in t)t.hasOwnProperty(i)&&"link"!=i&&(" data-"+i+'="'+t[i]+'"',r.attr("data-str"+i,t[i]));var n=g.opts.imageDefaultWidth;n&&"auto"!=n&&(n+=g.opts.imageResizeWithPercent?"%":"px"),r.attr("style",n?"width: "+n+";":""),ge(r,g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign),r.on("load",a),r.on("error",a),g.edit.on(),g.events.focus(!0),g.selection.restore(),g.undo.saveStep(),g.opts.imageSplitHTML?g.markers.split():g.markers.insert(),g.html.wrap();var s=g.$el.find(".fr-marker");return s.length?(s.parent().is("hr")&&s.parent().after(s),g.node.isLastSibling(s)&&s.parent().hasClass("fr-deletable")&&s.insertAfter(s.parent()),s.replaceWith(r)):g.$el.append(r),g.selection.clear(),r}function z(){g.edit.on(),k(!0)}function K(e,t){if(void 0!==e&&0<e.length){if(!1===g.events.trigger("image.beforeUpload",[e,t]))return!1;var a,i=e[0];if((null===g.opts.imageUploadURL||g.opts.imageUploadURL==m)&&!g.opts.imageUploadToS3)return s=i,o=t||d,(l=new FileReader).onload=function(){var e=l.result;if(l.result.indexOf("svg+xml")<0){for(var t=atob(l.result.split(",")[1]),a=[],i=0;i<t.length;i++)a.push(t.charCodeAt(i));e=window.URL.createObjectURL(new Blob([new Uint8Array(a)],{type:s.type})),g.image.insert(e,!1,null,o)}},I(),l.readAsDataURL(s),!1;if(i.name||(i.name=(new Date).getTime()+"."+(i.type||"image/jpeg").replace(/image\//g,"")),i.size>g.opts.imageMaxSize)return U(b),!1;if(g.opts.imageAllowedTypes.indexOf(i.type.replace(/image\//g,""))<0)return U(y),!1;if(g.drag_support.formdata&&(a=g.drag_support.formdata?new FormData:null),a){var r;if(!1!==g.opts.imageUploadToS3)for(r in a.append("key",g.opts.imageUploadToS3.keyStart+(new Date).getTime()+"-"+(i.name||"untitled")),a.append("success_action_status","201"),a.append("X-Requested-With","xhr"),a.append("Content-Type",i.type),g.opts.imageUploadToS3.params)g.opts.imageUploadToS3.params.hasOwnProperty(r)&&a.append(r,g.opts.imageUploadToS3.params[r]);for(r in g.opts.imageUploadParams)g.opts.imageUploadParams.hasOwnProperty(r)&&a.append(r,g.opts.imageUploadParams[r]);a.append(g.opts.imageUploadParam,i,i.name);var n=g.opts.imageUploadURL;g.opts.imageUploadToS3&&(n=g.opts.imageUploadToS3.uploadURL?g.opts.imageUploadToS3.uploadURL:"https://"+g.opts.imageUploadToS3.region+".amazonaws.com/"+g.opts.imageUploadToS3.bucket),function(t,a,e,r){function n(){var e=c(this);e.off("load"),e.addClass("fr-uploading"),e.next().is("br")&&e.next().remove(),g.placeholder.refresh(),P(e),E(),I(),g.edit.off(),t.onload=function(){T.call(t,e)},t.onerror=_,t.upload.onprogress=L,t.onabort=z,c(e.off("abortUpload")).on("abortUpload",function(){4!=t.readyState&&t.abort()}),t.send(a)}var s=new FileReader;s.onload=function(){var e=s.result;if(s.result.indexOf("svg+xml")<0){for(var t=atob(s.result.split(",")[1]),a=[],i=0;i<t.length;i++)a.push(t.charCodeAt(i));e=window.URL.createObjectURL(new Blob([new Uint8Array(a)],{type:"image/jpeg"}))}r?(r.on("load",n),r.on("error",function(){n(),c(this).off("error")}),g.edit.on(),g.undo.saveStep(),r.data("fr-old-src",r.attr("src")),r.attr("src",e)):M(e,null,n)},s.readAsDataURL(e)}(g.core.getXHR(n,g.opts.imageUploadMethod),a,i,t||d)}}var s,o,l}function Y(e){if(e.is("img")&&0<e.parents(".fr-img-caption").length)return e.parents(".fr-img-caption")}function W(e){var t=e.originalEvent.dataTransfer;if(t&&t.files&&t.files.length){var a=t.files[0];if(a&&a.type&&-1!==a.type.indexOf("image")&&0<=g.opts.imageAllowedTypes.indexOf(a.type.replace(/image\//g,""))){if(!g.opts.imageUpload)return e.preventDefault(),e.stopPropagation(),!1;g.markers.remove(),g.markers.insertAtPoint(e.originalEvent),g.$el.find(".fr-marker").replaceWith(ye.MARKERS),0===g.$el.find(".fr-marker").length&&g.selection.setAtEnd(g.el),g.popups.hideAll();var i=g.popups.get("image.insert");i||(i=G()),g.popups.setContainer("image.insert",g.$sc);var r=e.originalEvent.pageX,n=e.originalEvent.pageY;if(g.opts.iframe){var s=g.helpers.getPX(g.$wp.find(".fr-iframe").css("padding-top")),o=g.helpers.getPX(g.$wp.find(".fr-iframe").css("padding-left"));n+=g.$iframe.offset().top+s,r+=g.$iframe.offset().left+o}return g.popups.show("image.insert",r,n),I(),0<=g.opts.imageAllowedTypes.indexOf(a.type.replace(/image\//g,""))?(oe(!0),K(t.files)):U(y),e.preventDefault(),e.stopPropagation(),!1}}}function G(e){if(e)return g.popups.onRefresh("image.insert",w),g.popups.onHide("image.insert",C),!0;var t,a,i="";g.opts.imageUpload||-1===g.opts.imageInsertButtons.indexOf("imageUpload")||g.opts.imageInsertButtons.splice(g.opts.imageInsertButtons.indexOf("imageUpload"),1);var r=g.button.buildList(g.opts.imageInsertButtons);""!==r&&(i='<div class="fr-buttons fr-tabs">'+r+"</div>");var n=g.opts.imageInsertButtons.indexOf("imageUpload"),s=g.opts.imageInsertButtons.indexOf("imageByURL"),o="";0<=n&&(t=" fr-active",0<=s&&s<n&&(t=""),o='<div class="fr-image-upload-layer'+t+' fr-layer" id="fr-image-upload-layer-'+g.id+'"><strong>'+g.language.translate("Drop image")+"</strong><br>("+g.language.translate("or click")+')<div class="fr-form"><input type="file" accept="image/'+g.opts.imageAllowedTypes.join(", image/").toLowerCase()+'" tabIndex="-1" aria-labelledby="fr-image-upload-layer-'+g.id+'" role="button"></div></div>');var l="";0<=s&&(t=" fr-active",0<=n&&n<s&&(t=""),l='<div class="fr-image-by-url-layer'+t+' fr-layer" id="fr-image-by-url-layer-'+g.id+'"><div class="fr-input-line"><input id="fr-image-by-url-layer-text-'+g.id+'" type="text" placeholder="http://" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="imageInsertByURL" tabIndex="2" role="button">'+g.language.translate("Insert")+"</button></div></div>");var f,p={buttons:i,upload_layer:o,by_url_layer:l,progress_bar:'<div class="fr-image-progress-bar-layer fr-layer"><h3 tabIndex="-1" class="fr-message">Uploading</h3><div class="fr-loader"><span class="fr-progress"></span></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-dismiss" data-cmd="imageDismissError" tabIndex="2" role="button">OK</button></div></div>'};return 1<=g.opts.imageInsertButtons.length&&(a=g.popups.create("image.insert",p)),g.$wp&&g.events.$on(g.$wp,"scroll",function(){d&&g.popups.isVisible("image.insert")&&me()}),f=a,g.events.$on(f,"dragover dragenter",".fr-image-upload-layer",function(){return c(this).addClass("fr-drop"),!1},!0),g.events.$on(f,"dragleave dragend",".fr-image-upload-layer",function(){return c(this).removeClass("fr-drop"),!1},!0),g.events.$on(f,"drop",".fr-image-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),c(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var a=f.data("instance")||g;a.events.disableBlur(),a.image.upload(t.files),a.events.enableBlur()}},!0),g.helpers.isIOS()&&g.events.$on(f,"touchstart",'.fr-image-upload-layer input[type="file"]',function(){c(this).trigger("click")},!0),g.events.$on(f,"change",'.fr-image-upload-layer input[type="file"]',function(){if(this.files){var e=f.data("instance")||g;e.events.disableBlur(),f.find("input:focus").blur(),e.events.enableBlur(),e.image.upload(this.files,d)}c(this).val("")},!0),a}function V(){d&&g.popups.get("image.alt").find("input").val(d.attr("alt")||"").trigger("change")}function H(){var e=g.popups.get("image.alt");e||(e=X()),k(),g.popups.refresh("image.alt"),g.popups.setContainer("image.alt",g.$sc);var t=ve();be()&&(t=t.find(".fr-img-wrap"));var a=t.offset().left+t.outerWidth()/2,i=t.offset().top+t.outerHeight();g.popups.show("image.alt",a,i,t.outerHeight(),!0)}function X(e){if(e)return g.popups.onRefresh("image.alt",V),!0;var t={buttons:'<div class="fr-buttons fr-tabs">'+g.button.buildList(g.opts.imageAltButtons)+"</div>",alt_layer:'<div class="fr-image-alt-layer fr-layer fr-active" id="fr-image-alt-layer-'+g.id+'"><div class="fr-input-line"><input id="fr-image-alt-layer-text-'+g.id+'" type="text" placeholder="'+g.language.translate("Alternative Text")+'" tabIndex="1"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="imageSetAlt" tabIndex="2" role="button">'+g.language.translate("Update")+"</button></div></div>"},a=g.popups.create("image.alt",t);return g.$wp&&g.events.$on(g.$wp,"scroll.image-alt",function(){d&&g.popups.isVisible("image.alt")&&H()}),a}function F(){var e=g.popups.get("image.size");if(d)if(be()){var t=d.parent();t.get(0).style.width||(t=d.parent().parent()),e.find('input[name="width"]').val(t.get(0).style.width).trigger("change"),e.find('input[name="height"]').val(t.get(0).style.height).trigger("change")}else e.find('input[name="width"]').val(d.get(0).style.width).trigger("change"),e.find('input[name="height"]').val(d.get(0).style.height).trigger("change")}function j(){var e=g.popups.get("image.size");e||(e=q()),k(),g.popups.refresh("image.size"),g.popups.setContainer("image.size",g.$sc);var t=ve();be()&&(t=t.find(".fr-img-wrap"));var a=t.offset().left+t.outerWidth()/2,i=t.offset().top+t.outerHeight();g.popups.show("image.size",a,i,t.outerHeight(),!0)}function q(e){if(e)return g.popups.onRefresh("image.size",F),!0;var t={buttons:'<div class="fr-buttons fr-tabs">'+g.button.buildList(g.opts.imageSizeButtons)+"</div>",size_layer:'<div class="fr-image-size-layer fr-layer fr-active" id="fr-image-size-layer-'+g.id+'"><div class="fr-image-group"><div class="fr-input-line"><input id="fr-image-size-layer-width-'+g.id+'" type="text" name="width" placeholder="'+g.language.translate("Width")+'" tabIndex="1"></div><div class="fr-input-line"><input id="fr-image-size-layer-height'+g.id+'" type="text" name="height" placeholder="'+g.language.translate("Height")+'" tabIndex="1"></div></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="imageSetSize" tabIndex="2" role="button">'+g.language.translate("Update")+"</button></div></div>"},a=g.popups.create("image.size",t);return g.$wp&&g.events.$on(g.$wp,"scroll.image-size",function(){d&&g.popups.isVisible("image.size")&&j()}),a}function Q(e,t,a,i){return e.pageX=t,R.call(this,e),e.pageX=e.pageX+a*Math.floor(Math.pow(1.1,i)),D.call(this,e),x.call(this,e),++i}function J(e){(e=e||ve())&&!1!==g.events.trigger("image.beforeRemove",[e])&&(g.popups.hideAll(),ue(),oe(!0),g.undo.canDo()||g.undo.saveStep(),e.get(0)==g.el?e.removeAttr("src"):(e.get(0).parentNode&&"A"==e.get(0).parentNode.tagName?(g.selection.setBefore(e.get(0).parentNode)||g.selection.setAfter(e.get(0).parentNode)||e.parent().after(ye.MARKERS),c(e.get(0).parentNode).remove()):(g.selection.setBefore(e.get(0))||g.selection.setAfter(e.get(0))||e.after(ye.MARKERS),e.remove()),g.html.fillEmptyBlocks(),g.selection.restore()),g.undo.saveStep())}function Z(e){var t=e.which;if(d&&(t==ye.KEYCODE.BACKSPACE||t==ye.KEYCODE.DELETE))return e.preventDefault(),e.stopPropagation(),J(),!1;if(d&&t==ye.KEYCODE.ESC){var a=d;return oe(!0),g.selection.setAfter(a.get(0)),g.selection.restore(),e.preventDefault(),!1}if(d&&(t==ye.KEYCODE.ARROW_LEFT||t==ye.KEYCODE.ARROW_RIGHT)){var i=d.get(0);return oe(!0),t==ye.KEYCODE.ARROW_LEFT?g.selection.setBefore(i):g.selection.setAfter(i),g.selection.restore(),e.preventDefault(),!1}return d&&t!=ye.KEYCODE.F10&&!g.keys.isBrowserAction(e)?(e.preventDefault(),e.stopPropagation(),!1):void 0}function ee(e){if(e&&"IMG"==e.tagName){if(g.node.hasClass(e,"fr-uploading")||g.node.hasClass(e,"fr-error")?e.parentNode.removeChild(e):g.node.hasClass(e,"fr-draggable")&&e.classList.remove("fr-draggable"),e.parentNode&&e.parentNode.parentNode&&g.node.hasClass(e.parentNode.parentNode,"fr-img-caption")){var t=e.parentNode.parentNode;t.removeAttribute("contenteditable"),t.removeAttribute("draggable"),t.classList.remove("fr-draggable");var a=e.nextSibling;a&&a.removeAttribute("contenteditable")}}else if(e&&e.nodeType==Node.ELEMENT_NODE)for(var i=e.querySelectorAll("img.fr-uploading, img.fr-error, img.fr-draggable"),r=0;r<i.length;r++)ee(i[r])}function te(e){if(!1===g.events.trigger("image.beforePasteUpload",[e]))return!1;d=c(e),E(),n(),me(),I(),d.on("load",function(){E(),I(),c(this).off("load")});for(var t=c(e).attr("src").split(","),a=atob(t[1]),i=[],r=0;r<a.length;r++)i.push(a.charCodeAt(r));K([new Blob([new Uint8Array(i)],{type:t[0].replace(/data\:/g,"").replace(/;base64/g,"")})],d)}function ae(){g.opts.imagePaste?g.$el.find("img[data-fr-image-pasted]").each(function(e,a){if(g.opts.imagePasteProcess){var t=g.opts.imageDefaultWidth;t&&"auto"!=t&&(t+=g.opts.imageResizeWithPercent?"%":"px"),c(a).css("width",t).removeClass("fr-dii fr-dib fr-fir fr-fil"),ge(c(a),g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign)}if(0===a.src.indexOf("data:"))te(a);else if(0===a.src.indexOf("blob:")||0===a.src.indexOf("http")&&g.opts.imageUploadRemoteUrls&&g.opts.imageCORSProxy){var i=new Image;i.crossOrigin="Anonymous",i.onload=function(){var e=g.o_doc.createElement("CANVAS"),t=e.getContext("2d");e.height=this.naturalHeight,e.width=this.naturalWidth,t.drawImage(this,0,0),setTimeout(function(){te(a)},0),a.src=e.toDataURL("image/jpeg")},i.src=(0===a.src.indexOf("blob:")?"":g.opts.imageCORSProxy+"/")+a.src}else 0!==a.src.indexOf("http")||0===a.src.indexOf("https://mail.google.com/mail")?(g.selection.save(),c(a).remove(),g.selection.restore()):c(a).removeAttr("data-fr-image-pasted")}):g.$el.find("img[data-fr-image-pasted]").remove()}function ie(e){var t=e.target.result,a=g.opts.imageDefaultWidth;a&&"auto"!=a&&(a+=g.opts.imageResizeWithPercent?"%":"px"),g.undo.saveStep(),g.html.insert('<img data-fr-image-pasted="true" src="'+t+'"'+(a?' style="width: '+a+';"':"")+">");var i=g.$el.find('img[data-fr-image-pasted="true"]');i&&ge(i,g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign),g.events.trigger("paste.after")}function re(e){if(e&&e.clipboardData&&e.clipboardData.items){var t=null;if(e.clipboardData.types&&-1!=e.clipboardData.types.indexOf("text/rtf")||e.clipboardData.getData("text/rtf"))t=e.clipboardData.items[0].getAsFile();else for(var a=0;a<e.clipboardData.items.length&&!(t=e.clipboardData.items[a].getAsFile());a++);if(t)return i=t,(r=new FileReader).onload=ie,r.readAsDataURL(i),!1}var i,r}function ne(e){return e=e.replace(/<img /gi,'<img data-fr-image-pasted="true" ')}function se(e){if("false"==c(this).parents("[contenteditable]").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;if(e&&"touchend"==e.type&&a)return!0;if(e&&g.edit.isDisabled())return e.stopPropagation(),e.preventDefault(),!1;for(var t=0;t<ye.INSTANCES.length;t++)ye.INSTANCES[t]!=g&&ye.INSTANCES[t].events.trigger("image.hideResizer");g.toolbar.disable(),e&&(e.stopPropagation(),e.preventDefault()),g.helpers.isMobile()&&(g.events.disableBlur(),g.$el.blur(),g.events.enableBlur()),g.opts.iframe&&g.size.syncIframe(),d=c(this),ue(),E(),n(),g.browser.msie?(g.popups.areVisible()&&g.events.disableBlur(),g.win.getSelection&&(g.win.getSelection().removeAllRanges(),g.win.getSelection().addRange(g.doc.createRange()))):g.selection.clear(),g.helpers.isIOS()&&(g.events.disableBlur(),g.$el.blur()),g.button.bulkRefresh(),g.events.trigger("video.hideResizer")}function oe(e){d&&(le||!0===e)&&(g.toolbar.enable(),l.removeClass("fr-active"),g.popups.hide("image.edit"),d=null,pe(),f=null,p&&p.hide())}r[i]="Image cannot be loaded from the passed link.",r[u]="No link in upload response.",r[h]="Error during file upload.",r[v]="Parsing response failed.",r[b]="File is too large.",r[y]="Image file type is invalid.",r[7]="Files can be uploaded only to same domain in IE 8 and IE 9.";var le=!(r[8]="Image file is corrupted.");function fe(){le=!0}function pe(){le=!1}function ge(e,t,a){!g.opts.htmlUntouched&&g.opts.useClasses?(e.removeClass("fr-fil fr-fir fr-dib fr-dii"),a&&e.addClass("fr-fi"+a[0]),t&&e.addClass("fr-di"+t[0])):"inline"==t?(e.css({display:"inline-block",verticalAlign:"bottom",margin:g.opts.imageDefaultMargin}),"center"==a?e.css({"float":"none",marginBottom:"",marginTop:"",maxWidth:"calc(100% - "+2*g.opts.imageDefaultMargin+"px)",textAlign:"center"}):"left"==a?e.css({"float":"left",marginLeft:0,maxWidth:"calc(100% - "+g.opts.imageDefaultMargin+"px)",textAlign:"left"}):e.css({"float":"right",marginRight:0,maxWidth:"calc(100% - "+g.opts.imageDefaultMargin+"px)",textAlign:"right"})):"block"==t&&(e.css({display:"block","float":"none",verticalAlign:"top",margin:g.opts.imageDefaultMargin+"px auto",textAlign:"center"}),"left"==a?e.css({marginLeft:0,textAlign:"left"}):"right"==a&&e.css({marginRight:0,textAlign:"right"}))}function de(e){if(void 0===e&&(e=ve()),e){if(e.hasClass("fr-fil"))return"left";if(e.hasClass("fr-fir"))return"right";if(e.hasClass("fr-dib")||e.hasClass("fr-dii"))return"center";var t=e.css("float");if(e.css("float","none"),"block"==e.css("display")){if(e.css("float",""),e.css("float")!=t&&e.css("float",t),0===parseInt(e.css("margin-left"),10))return"left";if(0===parseInt(e.css("margin-right"),10))return"right"}else{if(e.css("float",""),e.css("float")!=t&&e.css("float",t),"left"==e.css("float"))return"left";if("right"==e.css("float"))return"right"}}return"center"}function ce(e){void 0===e&&(e=ve());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 me(){var e=g.popups.get("image.insert");e||(e=G()),g.popups.isVisible("image.insert")||(k(),g.popups.refresh("image.insert"),g.popups.setContainer("image.insert",g.$sc));var t=ve();be()&&(t=t.find(".fr-img-wrap"));var a=t.offset().left+t.outerWidth()/2,i=t.offset().top+t.outerHeight();g.popups.show("image.insert",a,i,t.outerHeight(!0),!0)}function ue(){if(d){g.events.disableBlur(),g.selection.clear();var e=g.doc.createRange();e.selectNode(d.get(0)),g.browser.msie&&e.collapse(!0),g.selection.get().addRange(e),g.events.enableBlur()}}function he(){return d}function ve(){return be()?d.parents(".fr-img-caption").first():d}function be(){return!!d&&0<d.parents(".fr-img-caption").length}return{_init:function(){var i;g.events.$on(g.$el,g._mousedown,"IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',function(e){if("false"==c(this).parents("contenteditable").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;g.helpers.isMobile()||g.selection.clear(),t=!0,g.popups.areVisible()&&g.events.disableBlur(),g.browser.msie&&(g.events.disableBlur(),g.$el.attr("contenteditable",!1)),g.draggable||"touchstart"==e.type||e.preventDefault(),e.stopPropagation()}),g.events.$on(g.$el,g._mouseup,"IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',function(e){if("false"==c(this).parents("contenteditable").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;t&&(t=!1,e.stopPropagation(),g.browser.msie&&(g.$el.attr("contenteditable",!0),g.events.enableBlur()))}),g.events.on("keyup",function(e){if(e.shiftKey&&""===g.selection.text().replace(/\n/g,"")&&g.keys.isArrow(e.which)){var t=g.selection.element(),a=g.selection.endElement();t&&"IMG"==t.tagName?P(c(t)):a&&"IMG"==a.tagName&&P(c(a))}},!0),g.events.on("drop",W),g.events.on("element.beforeDrop",Y),g.events.on("mousedown window.mousedown",fe),g.events.on("window.touchmove",pe),g.events.on("mouseup window.mouseup",function(){if(d)return oe(),!1;pe()}),g.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&oe()}),g.events.on("image.resizeEnd",function(){g.opts.iframe&&g.size.syncIframe()}),g.events.on("blur image.hideResizer commands.undo commands.redo element.dropped",function(){oe(!(t=!1))}),g.events.on("modals.hide",function(){d&&(ue(),g.selection.clear())}),g.events.on("image.resizeEnd",function(){g.win.getSelection&&P(d)}),"IMG"==g.el.tagName&&g.$el.addClass("fr-view"),g.events.$on(g.$el,g.helpers.isMobile()&&!g.helpers.isWindowsPhone()?"touchend":"click","IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',se),g.helpers.isMobile()&&(g.events.$on(g.$el,"touchstart","IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',function(){a=!1}),g.events.$on(g.$el,"touchmove",function(){a=!0})),g.$wp?(g.events.on("window.keydown keydown",Z,!0),g.events.on("keyup",function(e){if(d&&e.which==ye.KEYCODE.ENTER)return!1},!0),g.events.$on(g.$el,"keydown",function(){var e=g.selection.element();e.nodeType===Node.TEXT_NODE&&(e=e.parentNode),g.node.hasClass(e,"fr-inner")||(g.node.hasClass(e,"fr-img-caption")||(e=c(e).parents(".fr-img-caption").get(0)),g.node.hasClass(e,"fr-img-caption")&&(c(e).after(c.FE.INVISIBLE_SPACE+c.FE.MARKERS),g.selection.restore()))})):g.events.$on(g.$win,"keydown",Z),g.events.on("toolbar.esc",function(){if(d){if(g.$wp)g.events.disableBlur(),g.events.focus();else{var e=d;oe(!0),g.selection.setAfter(e.get(0)),g.selection.restore()}return!1}},!0),g.events.on("toolbar.focusEditor",function(){if(d)return!1},!0),g.events.on("window.cut window.copy",function(e){if(d&&g.popups.isVisible("image.edit")&&!g.popups.get("image.edit").find(":focus").length){var t=ve();be()?(t.before(ye.START_MARKER),t.after(ye.END_MARKER),g.selection.restore(),g.paste.saveCopiedText(t.get(0).outerHTML,t.text())):(ue(),g.paste.saveCopiedText(d.get(0).outerHTML,d.attr("alt"))),"copy"==e.type?setTimeout(function(){P(d)}):(oe(!0),g.undo.saveStep(),setTimeout(function(){g.undo.saveStep()},0))}},!0),g.browser.msie&&g.events.on("keydown",function(e){if(!g.selection.isCollapsed()||!d)return!0;var t=e.which;t==ye.KEYCODE.C&&g.keys.ctrlKey(e)?g.events.trigger("window.copy"):t==ye.KEYCODE.X&&g.keys.ctrlKey(e)&&g.events.trigger("window.cut")}),g.events.$on(c(g.o_win),"keydown",function(e){var t=e.which;if(d&&t==ye.KEYCODE.BACKSPACE)return e.preventDefault(),!1}),g.events.$on(g.$win,"keydown",function(e){var t=e.which;d&&d.hasClass("fr-uploading")&&t==ye.KEYCODE.ESC&&d.trigger("abortUpload")}),g.events.on("destroy",function(){d&&d.hasClass("fr-uploading")&&d.trigger("abortUpload")}),g.events.on("paste.before",re),g.events.on("paste.beforeCleanup",ne),g.events.on("paste.after",ae),g.events.on("html.set",e),g.events.on("html.inserted",e),e(),g.events.on("destroy",function(){o=[]}),g.events.on("html.processGet",ee),g.opts.imageOutputSize&&g.events.on("html.beforeGet",function(){i=g.el.querySelectorAll("img");for(var e=0;e<i.length;e++){var t=i[e].style.width||c(i[e]).width(),a=i[e].style.height||c(i[e]).height();t&&i[e].setAttribute("width",(""+t).replace(/px/,"")),a&&i[e].setAttribute("height",(""+a).replace(/px/,""))}}),g.opts.iframe&&g.events.on("image.loaded",g.size.syncIframe),g.$wp&&(A(),g.events.on("contentChanged",A)),g.events.$on(c(g.o_win),"orientationchange.image",function(){setTimeout(function(){d&&P(d)},100)}),$(!0),G(!0),q(!0),X(!0),g.events.on("node.remove",function(e){if("IMG"==e.get(0).tagName)return J(e),!1})},showInsertPopup:function(){var e=g.$tb.find('.fr-command[data-cmd="insertImage"]'),t=g.popups.get("image.insert");if(t||(t=G()),k(),!t.hasClass("fr-active"))if(g.popups.refresh("image.insert"),g.popups.setContainer("image.insert",g.$tb),e.isVisible()){var a=g.button.getPosition(e),i=a.left,r=a.top;g.popups.show("image.insert",i,r,e.outerHeight())}else g.position.forSelection(t),g.popups.show("image.insert")},showLayer:function(e){var t,a,i=g.popups.get("image.insert");if(d||g.opts.toolbarInline){if(d){var r=ve();be()&&(r=r.find(".fr-img-wrap")),a=r.offset().top+r.outerHeight(),t=r.offset().left}}else{var n=g.$tb.find('.fr-command[data-cmd="insertImage"]');t=n.offset().left,a=n.offset().top+(g.opts.toolbarBottom?10:n.outerHeight()-10)}!d&&g.opts.toolbarInline&&(a=i.offset().top-g.helpers.getPX(i.css("margin-top")),i.hasClass("fr-above")&&(a+=i.outerHeight())),i.find(".fr-layer").removeClass("fr-active"),i.find(".fr-"+e+"-layer").addClass("fr-active"),g.popups.show("image.insert",t,a,d?d.outerHeight():0),g.accessibility.focusPopup(i)},refreshUploadButton:function(e){var t=g.popups.get("image.insert");t&&t.find(".fr-image-upload-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshByURLButton:function(e){var t=g.popups.get("image.insert");t&&t.find(".fr-image-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},upload:K,insertByURL:function(){var e=g.popups.get("image.insert").find(".fr-image-by-url-layer input");if(0<e.val().length){I(),O(g.language.translate("Loading image"));var t=e.val().trim();if(g.opts.imageUploadRemoteUrls&&g.opts.imageCORSProxy&&g.opts.imageUpload){var a=new XMLHttpRequest;a.onload=function(){200==this.status?K([new Blob([this.response],{type:this.response.type||"image/png"})],d):U(i)},a.onerror=function(){N(t,!0,[],d)},a.open("GET",g.opts.imageCORSProxy+"/"+t,!0),a.responseType="blob",a.send()}else N(t,!0,[],d);e.val(""),e.blur()}},align:function(e){var t=ve();t.removeClass("fr-fir fr-fil"),!g.opts.htmlUntouched&&g.opts.useClasses?"left"==e?t.addClass("fr-fil"):"right"==e&&t.addClass("fr-fir"):ge(t,ce(),e),ue(),E(),n(),g.selection.clear()},refreshAlign:function(e){d&&e.find("> *").first().replaceWith(g.icon.create("image-align-"+de()))},refreshAlignOnShow:function(e,t){d&&t.find('.fr-command[data-param1="'+de()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){var t=ve();t.removeClass("fr-dii fr-dib"),!g.opts.htmlUntouched&&g.opts.useClasses?"inline"==e?t.addClass("fr-dii"):"block"==e&&t.addClass("fr-dib"):ge(t,e,de()),ue(),E(),n(),g.selection.clear()},refreshDisplayOnShow:function(e,t){d&&t.find('.fr-command[data-param1="'+ce()+'"]').addClass("fr-active").attr("aria-selected",!0)},replace:me,back:function(){d?(g.events.disableBlur(),c(".fr-popup input:focus").blur(),P(d)):(g.events.disableBlur(),g.selection.restore(),g.events.enableBlur(),g.popups.hide("image.insert"),g.toolbar.showInline())},get:he,getEl:ve,insert:N,showProgressBar:I,remove:J,hideProgressBar:k,applyStyle:function(e,t,a){if(void 0===t&&(t=g.opts.imageStyles),void 0===a&&(a=g.opts.imageMultipleStyles),!d)return!1;var i=ve();if(!a){var r=Object.keys(t);r.splice(r.indexOf(e),1),i.removeClass(r.join(" "))}"object"==we(t[e])?(i.removeAttr("style"),i.css(t[e].style)):i.toggleClass(e),P(d)},showAltPopup:H,showSizePopup:j,setAlt:function(e){if(d){var t=g.popups.get("image.alt");d.attr("alt",e||t.find("input").val()||""),t.find("input:focus").blur(),P(d)}},setSize:function(e,t){if(d){var a=g.popups.get("image.size");e=e||a.find('input[name="width"]').val()||"",t=t||a.find('input[name="height"]').val()||"";var i=/^[\d]+((px)|%)*$/g;d.removeAttr("width").removeAttr("height"),e.match(i)?d.css("width",e):d.css("width",""),t.match(i)?d.css("height",t):d.css("height",""),be()&&(d.parent().removeAttr("width").removeAttr("height"),e.match(i)?d.parent().css("width",e):d.parent().css("width",""),t.match(i)?d.parent().css("height",t):d.parent().css("height","")),a&&a.find("input:focus").blur(),P(d)}},toggleCaption:function(){var e;if(d&&!be()){(e=d).parent().is("a")&&(e=d.parent());var t=e.width();e.wrap("<span "+(g.browser.mozilla?"":'contenteditable="false"')+'class="fr-img-caption '+d.attr("class")+'" draggable="false"></span>'),e.wrap('<span class="fr-img-wrap"></span>'),e.after('<span class="fr-inner"'+(g.browser.mozilla?"":' contenteditable="true"')+">"+ye.START_MARKER+"Image caption"+ye.END_MARKER+"</span>"),d.removeAttr("class").removeAttr("style").removeAttr("width"),d.parents(".fr-img-caption").css("width",t+"px"),oe(!0),g.selection.restore()}else e=ve(),d.insertAfter(e),d.attr("class",e.attr("class").replace("fr-img-caption","")).attr("style",e.attr("style")),e.remove(),P(d)},hasCaption:be,exitEdit:oe,edit:P}},ye.DefineIcon("insertImage",{NAME:"image",SVG_KEY:"insertImage"}),ye.RegisterShortcut(ye.KEYCODE.P,"insertImage",null,"P"),ye.RegisterCommand("insertImage",{title:"Insert Image",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("image.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("image.insert")):this.image.showInsertPopup()},plugin:"image"}),ye.DefineIcon("imageUpload",{NAME:"upload",SVG_KEY:"upload"}),ye.RegisterCommand("imageUpload",{title:"Upload Image",undo:!1,focus:!1,toggle:!0,callback:function(){this.image.showLayer("image-upload")},refresh:function(e){this.image.refreshUploadButton(e)}}),ye.DefineIcon("imageByURL",{NAME:"link",SVG_KEY:"insertLink"}),ye.RegisterCommand("imageByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.image.showLayer("image-by-url")},refresh:function(e){this.image.refreshByURLButton(e)}}),ye.RegisterCommand("imageInsertByURL",{title:"Insert Image",undo:!0,refreshAfterCallback:!1,callback:function(){this.image.insertByURL()},refresh:function(e){this.image.get()?e.text(this.language.translate("Replace")):e.text(this.language.translate("Insert"))}}),ye.DefineIcon("imageDisplay",{NAME:"star",SVG_KEY:"imageDisplay"}),ye.RegisterCommand("imageDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.image.display(t)},refresh:function(e){this.opts.imageTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.image.refreshDisplayOnShow(e,t)}}),ye.DefineIcon("image-align",{NAME:"align-left",SVG_KEY:"alignLeft"}),ye.DefineIcon("image-align-left",{NAME:"align-left",SVG_KEY:"alignLeft"}),ye.DefineIcon("image-align-right",{NAME:"align-right",SVG_KEY:"alignRight"}),ye.DefineIcon("image-align-center",{NAME:"align-justify",SVG_KEY:"alignCenter"}),ye.DefineIcon("imageAlign",{NAME:"align-justify",SVG_KEY:"alignJustify"}),ye.RegisterCommand("imageAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ye.COMMANDS.imageAlign.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="imageAlign" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.icon.create("image-align-"+a)+'<span class="fr-sr-only">'+this.language.translate(t[a])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.image.align(t)},refresh:function(e){this.image.refreshAlign(e)},refreshOnShow:function(e,t){this.image.refreshAlignOnShow(e,t)}}),ye.DefineIcon("imageReplace",{NAME:"exchange",FA5NAME:"exchange-alt",SVG_KEY:"replaceImage"}),ye.RegisterCommand("imageReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.image.replace()}}),ye.DefineIcon("imageRemove",{NAME:"trash",SVG_KEY:"remove"}),ye.RegisterCommand("imageRemove",{title:"Remove",callback:function(){this.image.remove()}}),ye.DefineIcon("imageBack",{NAME:"arrow-left",SVG_KEY:"back"}),ye.RegisterCommand("imageBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.image.back()},refresh:function(e){this.$;this.image.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"))}}),ye.RegisterCommand("imageDismissError",{title:"OK",undo:!1,callback:function(){this.image.hideProgressBar(!0)}}),ye.DefineIcon("imageStyle",{NAME:"magic",SVG_KEY:"imageClass"}),ye.RegisterCommand("imageStyle",{title:"Style",type:"dropdown",html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.imageStyles;for(var a in t)if(t.hasOwnProperty(a)){var i=t[a];"object"==we(i)&&(i=i.title),e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="imageStyle" data-param1="'+a+'">'+this.language.translate(i)+"</a></li>"}return e+="</ul>"},callback:function(e,t){this.image.applyStyle(t)},refreshOnShow:function(e,t){var a=this.$,i=this.image.getEl();i&&t.find(".fr-command").each(function(){var e=a(this).data("param1"),t=i.hasClass(e);a(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),ye.DefineIcon("imageAlt",{NAME:"info",SVG_KEY:"imageAltText"}),ye.RegisterCommand("imageAlt",{undo:!1,focus:!1,popup:!0,title:"Alternative Text",callback:function(){this.image.showAltPopup()}}),ye.RegisterCommand("imageSetAlt",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.image.setAlt()}}),ye.DefineIcon("imageSize",{NAME:"arrows-alt",SVG_KEY:"imageSize"}),ye.RegisterCommand("imageSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.image.showSizePopup()}}),ye.RegisterCommand("imageSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.image.setSize()}}),ye.DefineIcon("imageCaption",{NAME:"commenting",FA5NAME:"comment-alt",SVG_KEY:"imageCaption"}),ye.RegisterCommand("imageCaption",{undo:!0,focus:!1,title:"Image Caption",refreshAfterCallback:!0,callback:function(){this.image.toggleCaption()},refresh:function(e){this.image.get()&&e.toggleClass("fr-active",this.image.hasCaption())}})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(ye){"use strict";function we(e){return(we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}ye=ye&&ye.hasOwnProperty("default")?ye["default"]:ye,Object.assign(ye.POPUP_TEMPLATES,{"image.insert":"[_BUTTONS_][_UPLOAD_LAYER_][_BY_URL_LAYER_][_PROGRESS_BAR_]","image.edit":"[_BUTTONS_]","image.alt":"[_BUTTONS_][_ALT_LAYER_]","image.size":"[_BUTTONS_][_SIZE_LAYER_]"}),Object.assign(ye.DEFAULTS,{imageInsertButtons:["imageBack","|","imageUpload","imageByURL"],imageEditButtons:["imageReplace","imageAlign","imageCaption","imageRemove","imageLink","linkOpen","linkEdit","linkRemove","-","imageDisplay","imageStyle","imageAlt","imageSize"],imageAltButtons:["imageBack","|"],imageSizeButtons:["imageBack","|"],imageUpload:!0,imageUploadURL:null,imageCORSProxy:"https://cors-anywhere.froala.com",imageUploadRemoteUrls:!0,imageUploadParam:"file",imageUploadParams:{},imageUploadToS3:!1,imageUploadMethod:"POST",imageMaxSize:10485760,imageAllowedTypes:["jpeg","jpg","png","gif","webp"],imageResize:!0,imageResizeWithPercent:!1,imageRoundPercent:!1,imageDefaultWidth:300,imageDefaultAlign:"center",imageDefaultDisplay:"block",imageSplitHTML:!1,imageStyles:{"fr-rounded":"Rounded","fr-bordered":"Bordered","fr-shadow":"Shadow"},imageMove:!0,imageMultipleStyles:!0,imageTextNear:!0,imagePaste:!0,imagePasteProcess:!1,imageMinWidth:16,imageOutputSize:!1,imageDefaultMargin:5,imageAddNewLine:!1}),ye.PLUGINS.image=function(g){var d,l,f,p,o,a,c=g.$,m="https://i.froala.com/upload",t=!1,i=1,u=2,h=3,v=4,b=5,y=6,r={};function w(){var e=g.popups.get("image.insert").find(".fr-image-by-url-layer input");e.val(""),d&&e.val(d.attr("src")),e.trigger("change")}function n(){var e=g.popups.get("image.edit");if(e||(e=$()),e){var t=ve();be()&&(t=t.find(".fr-img-wrap")),g.popups.setContainer("image.edit",g.$sc),g.popups.refresh("image.edit");var a=t.offset().left+t.outerWidth()/2,i=t.offset().top+t.outerHeight();d.hasClass("fr-uploading")?I():g.popups.show("image.edit",a,i,t.outerHeight(),!0)}}function C(){k()}function e(){for(var e,t,a="IMG"==g.el.tagName?[g.el]:g.el.querySelectorAll("img"),i=0;i<a.length;i++){var r=c(a[i]);!g.opts.htmlUntouched&&g.opts.useClasses?((g.opts.imageDefaultAlign||g.opts.imageDefaultDisplay)&&(0<(t=r).parents(".fr-img-caption").length&&(t=t.parents(".fr-img-caption").first()),t.hasClass("fr-dii")||t.hasClass("fr-dib")||(t.addClass("fr-fi"+de(t)[0]),t.addClass("fr-di"+ce(t)[0]),t.css("margin",""),t.css("float",""),t.css("display",""),t.css("z-index",""),t.css("position",""),t.css("overflow",""),t.css("vertical-align",""))),g.opts.imageTextNear||(0<r.parents(".fr-img-caption").length?r.parents(".fr-img-caption").first().removeClass("fr-dii").addClass("fr-dib"):r.removeClass("fr-dii").addClass("fr-dib"))):g.opts.htmlUntouched||g.opts.useClasses||(g.opts.imageDefaultAlign||g.opts.imageDefaultDisplay)&&(0<(e=r).parents(".fr-img-caption").length&&(e=e.parents(".fr-img-caption").first()),ge(e,e.hasClass("fr-dib")?"block":e.hasClass("fr-dii")?"inline":null,e.hasClass("fr-fil")?"left":e.hasClass("fr-fir")?"right":de(e)),e.removeClass("fr-dib fr-dii fr-fir fr-fil")),g.opts.iframe&&r.on("load",g.size.syncIframe)}}function A(e){void 0===e&&(e=!0);var t,a=Array.prototype.slice.call(g.el.querySelectorAll("img")),i=[];for(t=0;t<a.length;t++)if(i.push(a[t].getAttribute("src")),c(a[t]).toggleClass("fr-draggable",g.opts.imageMove),""===a[t].getAttribute("class")&&a[t].removeAttribute("class"),""===a[t].getAttribute("style")&&a[t].removeAttribute("style"),a[t].parentNode&&a[t].parentNode.parentNode&&g.node.hasClass(a[t].parentNode.parentNode,"fr-img-caption")){var r=a[t].parentNode.parentNode;g.browser.mozilla||r.setAttribute("contenteditable",!1),r.setAttribute("draggable",!1),r.classList.add("fr-draggable");var n=a[t].nextSibling;n&&!g.browser.mozilla&&n.setAttribute("contenteditable",!0)}if(o)for(t=0;t<o.length;t++)i.indexOf(o[t].getAttribute("src"))<0&&g.events.trigger("image.removed",[c(o[t])]);if(o&&e){var s=[];for(t=0;t<o.length;t++)s.push(o[t].getAttribute("src"));for(t=0;t<a.length;t++)s.indexOf(a[t].getAttribute("src"))<0&&g.events.trigger("image.loaded",[c(a[t])])}o=a}function E(){if(l||function(){var e;g.shared.$image_resizer?(l=g.shared.$image_resizer,p=g.shared.$img_overlay,g.events.on("destroy",function(){c("body").first().append(l.removeClass("fr-active"))},!0)):(g.shared.$image_resizer=c(document.createElement("div")).attr("class","fr-image-resizer"),l=g.shared.$image_resizer,g.events.$on(l,"mousedown",function(e){e.stopPropagation()},!0),g.opts.imageResize&&(l.append(s("nw")+s("ne")+s("sw")+s("se")),g.shared.$img_overlay=c(document.createElement("div")).attr("class","fr-image-overlay"),p=g.shared.$img_overlay,e=l.get(0).ownerDocument,c(e).find("body").first().append(p)));g.events.on("shared.destroy",function(){l.html("").removeData().remove(),l=null,g.opts.imageResize&&(p.remove(),p=null)},!0),g.helpers.isMobile()||g.events.$on(c(g.o_win),"resize",function(){d&&!d.hasClass("fr-uploading")?oe(!0):d&&(E(),me(),I(!1))});if(g.opts.imageResize){e=l.get(0).ownerDocument,g.events.$on(l,g._mousedown,".fr-handler",R),g.events.$on(c(e),g._mousemove,D),g.events.$on(c(e.defaultView||e.parentWindow),g._mouseup,x),g.events.$on(p,"mouseleave",x);var i=1,r=null,n=0;g.events.on("keydown",function(e){if(d){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,a=e.which;(a!==r||200<e.timeStamp-n)&&(i=1),(a==ye.KEYCODE.EQUALS||g.browser.mozilla&&a==ye.KEYCODE.FF_EQUALS)&&t&&!e.altKey?i=Q.call(this,e,1,1,i):(a==ye.KEYCODE.HYPHEN||g.browser.mozilla&&a==ye.KEYCODE.FF_HYPHEN)&&t&&!e.altKey?i=Q.call(this,e,2,-1,i):g.keys.ctrlKey(e)||a!=ye.KEYCODE.ENTER||(d.before("<br>"),P(d)),r=a,n=e.timeStamp}},!0),g.events.on("keyup",function(){i=1})}}(),!d)return!1;var e=g.$wp||g.$sc;e.append(l),l.data("instance",g);var t=e.scrollTop()-("static"!=e.css("position")?e.offset().top:0),a=e.scrollLeft()-("static"!=e.css("position")?e.offset().left:0);a-=g.helpers.getPX(e.css("border-left-width")),t-=g.helpers.getPX(e.css("border-top-width")),g.$el.is("img")&&g.$sc.is("body")&&(a=t=0);var i=ve();be()&&(i=i.find(".fr-img-wrap"));var r=0,n=0;g.opts.iframe&&(r=g.helpers.getPX(g.$wp.find(".fr-iframe").css("padding-top")),n=g.helpers.getPX(g.$wp.find(".fr-iframe").css("padding-left"))),l.css("top",(g.opts.iframe?i.offset().top+r:i.offset().top+t)-1).css("left",(g.opts.iframe?i.offset().left+n:i.offset().left+a)-1).css("width",i.get(0).getBoundingClientRect().width).css("height",i.get(0).getBoundingClientRect().height).addClass("fr-active")}function s(e){return'<div class="fr-handler fr-h'+e+'"></div>'}function S(e){be()?d.parents(".fr-img-caption").css("width",e):d.css("width",e)}function R(e){if(!g.core.sameInstance(l))return!0;if(e.preventDefault(),e.stopPropagation(),g.$el.find("img.fr-error").left)return!1;g.undo.canDo()||g.undo.saveStep();var t=e.pageX||e.originalEvent.touches[0].pageX;if("mousedown"==e.type){var a=g.$oel.get(0).ownerDocument,i=a.defaultView||a.parentWindow,r=!1;try{r=i.location!=i.parent.location&&!(i.$&&i.$.FE)}catch(o){}r&&i.frameElement&&(t+=g.helpers.getPX(c(i.frameElement).offset().left)+i.frameElement.clientLeft)}(f=c(this)).data("start-x",t),f.data("start-width",d.width()),f.data("start-height",d.height());var n=d.width();if(g.opts.imageResizeWithPercent){var s=d.parentsUntil(g.$el,g.html.blockTagsQuery()).get(0)||g.el;n=(n/c(s).outerWidth()*100).toFixed(2)+"%"}S(n),p.show(),g.popups.hideAll(),pe()}function D(e){if(!g.core.sameInstance(l))return!0;var t;if(f&&d){if(e.preventDefault(),g.$el.find("img.fr-error").left)return!1;var a=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null);if(!a)return!1;var i=a-f.data("start-x"),r=f.data("start-width");if((f.hasClass("fr-hnw")||f.hasClass("fr-hsw"))&&(i=0-i),g.opts.imageResizeWithPercent){var n=d.parentsUntil(g.$el,g.html.blockTagsQuery()).get(0)||g.el;r=((r+i)/c(n).outerWidth()*100).toFixed(2),g.opts.imageRoundPercent&&(r=Math.round(r)),S(r+"%"),(t=be()?(g.helpers.getPX(d.parents(".fr-img-caption").css("width"))/c(n).outerWidth()*100).toFixed(2):(g.helpers.getPX(d.css("width"))/c(n).outerWidth()*100).toFixed(2))===r||g.opts.imageRoundPercent||S(t+"%"),d.css("height","").removeAttr("height")}else r+i>=g.opts.imageMinWidth&&(S(r+i),t=be()?g.helpers.getPX(d.parents(".fr-img-caption").css("width")):g.helpers.getPX(d.css("width"))),t!==r+i&&S(t),((d.attr("style")||"").match(/(^height:)|(; *height:)/)||d.attr("height"))&&(d.css("height",f.data("start-height")*d.width()/f.data("start-width")),d.removeAttr("height"));E(),g.events.trigger("image.resize",[he()])}}function x(e){if(!g.core.sameInstance(l))return!0;if(f&&d){if(e&&e.stopPropagation(),g.$el.find("img.fr-error").left)return!1;f=null,p.hide(),E(),n(),g.undo.saveStep(),g.events.trigger("image.resizeEnd",[he()])}}function U(e,t,a){g.edit.on(),d&&d.addClass("fr-error"),function(e){I();var t=g.popups.get("image.insert").find(".fr-image-progress-bar-layer");t.addClass("fr-error");var a=t.find("h3");a.text(e),g.events.disableBlur(),a.focus()}(g.language.translate("Something went wrong. Please try again.")),!d&&a&&J(a),g.events.trigger("image.error",[{code:e,message:r[e]},t,a])}function $(e){if(e)return g.$wp&&g.events.$on(g.$wp,"scroll.image-edit",function(){d&&g.popups.isVisible("image.edit")&&(g.events.disableBlur(),n())}),!0;var t="";if(0<g.opts.imageEditButtons.length){var a={buttons:t+='<div class="fr-buttons"> \n '.concat(g.button.buildList(g.opts.imageEditButtons),"\n </div>")};return g.popups.create("image.edit",a)}return!1}function I(e){var t=g.popups.get("image.insert");if(t||(t=G()),t.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),t.find(".fr-image-progress-bar-layer").addClass("fr-active"),t.find(".fr-buttons").hide(),d){var a=ve();g.popups.setContainer("image.insert",g.$sc);var i=a.offset().left,r=a.offset().top+a.height();g.popups.show("image.insert",i,r,a.outerHeight())}void 0===e&&N(g.language.translate("Uploading"),0)}function k(e){var t=g.popups.get("image.insert");if(t&&(t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),t.find(".fr-image-progress-bar-layer").removeClass("fr-active"),t.find(".fr-buttons").show(),e||g.$el.find("img.fr-error").length)){if(g.events.focus(),g.$el.find("img.fr-error").length&&(g.$el.find("img.fr-error").remove(),g.undo.saveStep(),g.undo.run(),g.undo.dropRedo()),!g.$wp&&d){var a=d;oe(!0),g.selection.setAfter(a.get(0)),g.selection.restore()}g.popups.hide("image.insert")}}function N(e,t){var a=g.popups.get("image.insert");if(a){var i=a.find(".fr-image-progress-bar-layer");i.find("h3").text(e+(t?" "+t+"%":"")),i.removeClass("fr-error"),t?(i.find("div").removeClass("fr-indeterminate"),i.find("div > span").css("width",t+"%")):i.find("div").addClass("fr-indeterminate")}}function P(e){se.call(e.get(0))}function O(){var e=c(this);g.popups.hide("image.insert"),e.removeClass("fr-uploading"),e.next().is("br")&&e.next().remove(),P(e),g.events.trigger("image.loaded",[e])}function B(s,e,o,l,f){g.edit.off(),N(g.language.translate("Loading image")),e&&(s=g.helpers.sanitizeURL(s));var t=new Image;t.onload=function(){var e,t;if(l){g.undo.canDo()||l.hasClass("fr-uploading")||g.undo.saveStep();var a=l.data("fr-old-src");l.data("fr-image-pasted")&&(a=null),g.$wp?((e=l.clone().removeData("fr-old-src").removeClass("fr-uploading").removeAttr("data-fr-image-pasted")).off("load"),a&&l.attr("src",a),l.replaceWith(e)):e=l;for(var i=e.get(0).attributes,r=0;r<i.length;r++){var n=i[r];0===n.nodeName.indexOf("data-")&&e.removeAttr(n.nodeName)}if(void 0!==o)for(t in o)o.hasOwnProperty(t)&&"link"!=t&&e.attr("data-"+t,o[t]);e.on("load",O),e.attr("src",s),g.edit.on(),A(!1),g.undo.saveStep(),g.events.disableBlur(),g.$el.blur(),g.events.trigger(a?"image.replaced":"image.inserted",[e,f])}else e=M(s,o,O),A(!1),g.undo.saveStep(),g.events.disableBlur(),g.$el.blur(),g.events.trigger("image.inserted",[e,f])},t.onerror=function(){U(i)},I(g.language.translate("Loading image")),t.src=s}function T(e){N(g.language.translate("Loading image"));var t=this.status,a=this.response,i=this.responseXML,r=this.responseText;try{if(g.opts.imageUploadToS3)if(201==t){var n=function(e){try{var t=c(e).find("Location").text(),a=c(e).find("Key").text();return!1===g.events.trigger("image.uploadedToS3",[t,a,e],!0)?(g.edit.on(),!1):t}catch(i){return U(v,e),!1}}(i);n&&B(n,!1,[],e,a||i)}else U(v,a||i,e);else if(200<=t&&t<300){var s=function(e){try{if(!1===g.events.trigger("image.uploaded",[e],!0))return g.edit.on(),!1;var t=JSON.parse(e);return t.link?t:(U(u,e),!1)}catch(a){return U(v,e),!1}}(r);s&&B(s.link,!1,s,e,a||r)}else U(h,a||r,e)}catch(o){U(v,a||r,e)}}function _(){U(v,this.response||this.responseText||this.responseXML)}function L(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;N(g.language.translate("Uploading"),t)}}function M(e,t,a){var i,r=c(document.createElement("img")).attr("src",e);if(t&&void 0!==t)for(i in t)t.hasOwnProperty(i)&&"link"!=i&&(" data-"+i+'="'+t[i]+'"',r.attr("data-str"+i,t[i]));var n=g.opts.imageDefaultWidth;n&&"auto"!=n&&(n+=g.opts.imageResizeWithPercent?"%":"px"),r.attr("style",n?"width: "+n+";":""),ge(r,g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign),r.on("load",a),r.on("error",a),g.edit.on(),g.events.focus(!0),g.selection.restore(),g.undo.saveStep(),g.opts.imageSplitHTML?g.markers.split():g.markers.insert(),g.html.wrap();var s=g.$el.find(".fr-marker");return s.length?(s.parent().is("hr")&&s.parent().after(s),g.node.isLastSibling(s)&&s.parent().hasClass("fr-deletable")&&s.insertAfter(s.parent()),s.replaceWith(r)):g.$el.append(r),g.selection.clear(),r}function z(){g.edit.on(),k(!0)}function K(e,t){if(void 0!==e&&0<e.length){if(!1===g.events.trigger("image.beforeUpload",[e,t]))return!1;var a,i=e[0];if((null===g.opts.imageUploadURL||g.opts.imageUploadURL==m)&&!g.opts.imageUploadToS3)return s=i,o=t||d,(l=new FileReader).onload=function(){var e=l.result;if(l.result.indexOf("svg+xml")<0){for(var t=atob(l.result.split(",")[1]),a=[],i=0;i<t.length;i++)a.push(t.charCodeAt(i));e=window.URL.createObjectURL(new Blob([new Uint8Array(a)],{type:s.type})),g.image.insert(e,!1,null,o)}},I(),l.readAsDataURL(s),!1;if(i.name||(i.name=(new Date).getTime()+"."+(i.type||"image/jpeg").replace(/image\//g,"")),i.size>g.opts.imageMaxSize)return U(b),!1;if(g.opts.imageAllowedTypes.indexOf(i.type.replace(/image\//g,""))<0)return U(y),!1;if(g.drag_support.formdata&&(a=g.drag_support.formdata?new FormData:null),a){var r;if(!1!==g.opts.imageUploadToS3)for(r in a.append("key",g.opts.imageUploadToS3.keyStart+(new Date).getTime()+"-"+(i.name||"untitled")),a.append("success_action_status","201"),a.append("X-Requested-With","xhr"),a.append("Content-Type",i.type),g.opts.imageUploadToS3.params)g.opts.imageUploadToS3.params.hasOwnProperty(r)&&a.append(r,g.opts.imageUploadToS3.params[r]);for(r in g.opts.imageUploadParams)g.opts.imageUploadParams.hasOwnProperty(r)&&a.append(r,g.opts.imageUploadParams[r]);a.append(g.opts.imageUploadParam,i,i.name);var n=g.opts.imageUploadURL;g.opts.imageUploadToS3&&(n=g.opts.imageUploadToS3.uploadURL?g.opts.imageUploadToS3.uploadURL:"https://"+g.opts.imageUploadToS3.region+".amazonaws.com/"+g.opts.imageUploadToS3.bucket),function(t,a,e,r){function n(){var e=c(this);e.off("load"),e.addClass("fr-uploading"),e.next().is("br")&&e.next().remove(),g.placeholder.refresh(),P(e),E(),I(),g.edit.off(),t.onload=function(){T.call(t,e)},t.onerror=_,t.upload.onprogress=L,t.onabort=z,c(e.off("abortUpload")).on("abortUpload",function(){4!=t.readyState&&t.abort()}),t.send(a)}var s=new FileReader;s.onload=function(){var e=s.result;if(s.result.indexOf("svg+xml")<0){for(var t=atob(s.result.split(",")[1]),a=[],i=0;i<t.length;i++)a.push(t.charCodeAt(i));e=window.URL.createObjectURL(new Blob([new Uint8Array(a)],{type:"image/jpeg"}))}r?(r.on("load",n),r.on("error",function(){n(),c(this).off("error")}),g.edit.on(),g.undo.saveStep(),r.data("fr-old-src",r.attr("src")),r.attr("src",e)):M(e,null,n)},s.readAsDataURL(e)}(g.core.getXHR(n,g.opts.imageUploadMethod),a,i,t||d)}}var s,o,l}function Y(e){if(e.is("img")&&0<e.parents(".fr-img-caption").length)return e.parents(".fr-img-caption")}function W(e){var t=e.originalEvent.dataTransfer;if(t&&t.files&&t.files.length){var a=t.files[0];if(a&&a.type&&-1!==a.type.indexOf("image")&&0<=g.opts.imageAllowedTypes.indexOf(a.type.replace(/image\//g,""))){if(!g.opts.imageUpload)return e.preventDefault(),e.stopPropagation(),!1;g.markers.remove(),g.markers.insertAtPoint(e.originalEvent),g.$el.find(".fr-marker").replaceWith(ye.MARKERS),0===g.$el.find(".fr-marker").length&&g.selection.setAtEnd(g.el),g.popups.hideAll();var i=g.popups.get("image.insert");i||(i=G()),g.popups.setContainer("image.insert",g.$sc);var r=e.originalEvent.pageX,n=e.originalEvent.pageY;if(g.opts.iframe){var s=g.helpers.getPX(g.$wp.find(".fr-iframe").css("padding-top")),o=g.helpers.getPX(g.$wp.find(".fr-iframe").css("padding-left"));n+=g.$iframe.offset().top+s,r+=g.$iframe.offset().left+o}return g.popups.show("image.insert",r,n),I(),0<=g.opts.imageAllowedTypes.indexOf(a.type.replace(/image\//g,""))?(oe(!0),K(t.files)):U(y),e.preventDefault(),e.stopPropagation(),!1}}}function G(e){if(e)return g.popups.onRefresh("image.insert",w),g.popups.onHide("image.insert",C),!0;var t,a,i="";g.opts.imageUpload||-1===g.opts.imageInsertButtons.indexOf("imageUpload")||g.opts.imageInsertButtons.splice(g.opts.imageInsertButtons.indexOf("imageUpload"),1);var r=g.button.buildList(g.opts.imageInsertButtons);""!==r&&(i='<div class="fr-buttons fr-tabs">'+r+"</div>");var n=g.opts.imageInsertButtons.indexOf("imageUpload"),s=g.opts.imageInsertButtons.indexOf("imageByURL"),o="";0<=n&&(t=" fr-active",0<=s&&s<n&&(t=""),o='<div class="fr-image-upload-layer'+t+' fr-layer" id="fr-image-upload-layer-'+g.id+'"><strong>'+g.language.translate("Drop image")+"</strong><br>("+g.language.translate("or click")+')<div class="fr-form"><input type="file" accept="image/'+g.opts.imageAllowedTypes.join(", image/").toLowerCase()+'" tabIndex="-1" aria-labelledby="fr-image-upload-layer-'+g.id+'" role="button"></div></div>');var l="";0<=s&&(t=" fr-active",0<=n&&n<s&&(t=""),l='<div class="fr-image-by-url-layer'+t+' fr-layer" id="fr-image-by-url-layer-'+g.id+'"><div class="fr-input-line"><input id="fr-image-by-url-layer-text-'+g.id+'" type="text" placeholder="http://" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="imageInsertByURL" tabIndex="2" role="button">'+g.language.translate("Insert")+"</button></div></div>");var f,p={buttons:i,upload_layer:o,by_url_layer:l,progress_bar:'<div class="fr-image-progress-bar-layer fr-layer"><h3 tabIndex="-1" class="fr-message">Uploading</h3><div class="fr-loader"><span class="fr-progress"></span></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-dismiss" data-cmd="imageDismissError" tabIndex="2" role="button">OK</button></div></div>'};return 1<=g.opts.imageInsertButtons.length&&(a=g.popups.create("image.insert",p)),g.$wp&&g.events.$on(g.$wp,"scroll",function(){d&&g.popups.isVisible("image.insert")&&me()}),f=a,g.events.$on(f,"dragover dragenter",".fr-image-upload-layer",function(){return c(this).addClass("fr-drop"),!1},!0),g.events.$on(f,"dragleave dragend",".fr-image-upload-layer",function(){return c(this).removeClass("fr-drop"),!1},!0),g.events.$on(f,"drop",".fr-image-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),c(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var a=f.data("instance")||g;a.events.disableBlur(),a.image.upload(t.files),a.events.enableBlur()}},!0),g.helpers.isIOS()&&g.events.$on(f,"touchstart",'.fr-image-upload-layer input[type="file"]',function(){c(this).trigger("click")},!0),g.events.$on(f,"change",'.fr-image-upload-layer input[type="file"]',function(){if(this.files){var e=f.data("instance")||g;e.events.disableBlur(),f.find("input:focus").blur(),e.events.enableBlur(),e.image.upload(this.files,d)}c(this).val("")},!0),a}function V(){d&&g.popups.get("image.alt").find("input").val(d.attr("alt")||"").trigger("change")}function H(){var e=g.popups.get("image.alt");e||(e=X()),k(),g.popups.refresh("image.alt"),g.popups.setContainer("image.alt",g.$sc);var t=ve();be()&&(t=t.find(".fr-img-wrap"));var a=t.offset().left+t.outerWidth()/2,i=t.offset().top+t.outerHeight();g.popups.show("image.alt",a,i,t.outerHeight(),!0)}function X(e){if(e)return g.popups.onRefresh("image.alt",V),!0;var t={buttons:'<div class="fr-buttons fr-tabs">'+g.button.buildList(g.opts.imageAltButtons)+"</div>",alt_layer:'<div class="fr-image-alt-layer fr-layer fr-active" id="fr-image-alt-layer-'+g.id+'"><div class="fr-input-line"><input id="fr-image-alt-layer-text-'+g.id+'" type="text" placeholder="'+g.language.translate("Alternative Text")+'" tabIndex="1"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="imageSetAlt" tabIndex="2" role="button">'+g.language.translate("Update")+"</button></div></div>"},a=g.popups.create("image.alt",t);return g.$wp&&g.events.$on(g.$wp,"scroll.image-alt",function(){d&&g.popups.isVisible("image.alt")&&H()}),a}function F(){var e=g.popups.get("image.size");if(d)if(be()){var t=d.parent();t.get(0).style.width||(t=d.parent().parent()),e.find('input[name="width"]').val(t.get(0).style.width).trigger("change"),e.find('input[name="height"]').val(t.get(0).style.height).trigger("change")}else e.find('input[name="width"]').val(d.get(0).style.width).trigger("change"),e.find('input[name="height"]').val(d.get(0).style.height).trigger("change")}function j(){var e=g.popups.get("image.size");e||(e=q()),k(),g.popups.refresh("image.size"),g.popups.setContainer("image.size",g.$sc);var t=ve();be()&&(t=t.find(".fr-img-wrap"));var a=t.offset().left+t.outerWidth()/2,i=t.offset().top+t.outerHeight();g.popups.show("image.size",a,i,t.outerHeight(),!0)}function q(e){if(e)return g.popups.onRefresh("image.size",F),!0;var t={buttons:'<div class="fr-buttons fr-tabs">'+g.button.buildList(g.opts.imageSizeButtons)+"</div>",size_layer:'<div class="fr-image-size-layer fr-layer fr-active" id="fr-image-size-layer-'+g.id+'"><div class="fr-image-group"><div class="fr-input-line"><input id="fr-image-size-layer-width-'+g.id+'" type="text" name="width" placeholder="'+g.language.translate("Width")+'" tabIndex="1"></div><div class="fr-input-line"><input id="fr-image-size-layer-height'+g.id+'" type="text" name="height" placeholder="'+g.language.translate("Height")+'" tabIndex="1"></div></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="imageSetSize" tabIndex="2" role="button">'+g.language.translate("Update")+"</button></div></div>"},a=g.popups.create("image.size",t);return g.$wp&&g.events.$on(g.$wp,"scroll.image-size",function(){d&&g.popups.isVisible("image.size")&&j()}),a}function Q(e,t,a,i){return e.pageX=t,R.call(this,e),e.pageX=e.pageX+a*Math.floor(Math.pow(1.1,i)),D.call(this,e),x.call(this,e),++i}function J(e){(e=e||ve())&&!1!==g.events.trigger("image.beforeRemove",[e])&&(g.popups.hideAll(),ue(),oe(!0),g.undo.canDo()||g.undo.saveStep(),e.get(0)==g.el?e.removeAttr("src"):(e.get(0).parentNode&&"A"==e.get(0).parentNode.tagName?(g.selection.setBefore(e.get(0).parentNode)||g.selection.setAfter(e.get(0).parentNode)||e.parent().after(ye.MARKERS),c(e.get(0).parentNode).remove()):(g.selection.setBefore(e.get(0))||g.selection.setAfter(e.get(0))||e.after(ye.MARKERS),e.remove()),g.html.fillEmptyBlocks(),g.selection.restore()),g.undo.saveStep())}function Z(e){var t=e.which;if(d&&(t==ye.KEYCODE.BACKSPACE||t==ye.KEYCODE.DELETE))return e.preventDefault(),e.stopPropagation(),J(),!1;if(d&&t==ye.KEYCODE.ESC){var a=d;return oe(!0),g.selection.setAfter(a.get(0)),g.selection.restore(),e.preventDefault(),!1}if(d&&(t==ye.KEYCODE.ARROW_LEFT||t==ye.KEYCODE.ARROW_RIGHT)){var i=d.get(0);return oe(!0),t==ye.KEYCODE.ARROW_LEFT?g.selection.setBefore(i):g.selection.setAfter(i),g.selection.restore(),e.preventDefault(),!1}return d&&t!=ye.KEYCODE.F10&&!g.keys.isBrowserAction(e)?(e.preventDefault(),e.stopPropagation(),!1):void 0}function ee(e){if(e&&"IMG"==e.tagName){if(g.node.hasClass(e,"fr-uploading")||g.node.hasClass(e,"fr-error")?e.parentNode.removeChild(e):g.node.hasClass(e,"fr-draggable")&&e.classList.remove("fr-draggable"),e.parentNode&&e.parentNode.parentNode&&g.node.hasClass(e.parentNode.parentNode,"fr-img-caption")){var t=e.parentNode.parentNode;t.removeAttribute("contenteditable"),t.removeAttribute("draggable"),t.classList.remove("fr-draggable");var a=e.nextSibling;a&&a.removeAttribute("contenteditable")}}else if(e&&e.nodeType==Node.ELEMENT_NODE)for(var i=e.querySelectorAll("img.fr-uploading, img.fr-error, img.fr-draggable"),r=0;r<i.length;r++)ee(i[r])}function te(e){if(!1===g.events.trigger("image.beforePasteUpload",[e]))return!1;d=c(e),E(),n(),me(),I(),d.on("load",function(){E(),I(),c(this).off("load")});for(var t=c(e).attr("src").split(","),a=atob(t[1]),i=[],r=0;r<a.length;r++)i.push(a.charCodeAt(r));K([new Blob([new Uint8Array(i)],{type:t[0].replace(/data\:/g,"").replace(/;base64/g,"")})],d)}function ae(){g.opts.imagePaste?g.$el.find("img[data-fr-image-pasted]").each(function(e,a){if(g.opts.imagePasteProcess){var t=g.opts.imageDefaultWidth;t&&"auto"!=t&&(t+=g.opts.imageResizeWithPercent?"%":"px"),c(a).css("width",t).removeClass("fr-dii fr-dib fr-fir fr-fil"),ge(c(a),g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign)}if(0===a.src.indexOf("data:"))te(a);else if(0===a.src.indexOf("blob:")||0===a.src.indexOf("http")&&g.opts.imageUploadRemoteUrls&&g.opts.imageCORSProxy){var i=new Image;i.crossOrigin="Anonymous",i.onload=function(){var e=g.o_doc.createElement("CANVAS"),t=e.getContext("2d");e.height=this.naturalHeight,e.width=this.naturalWidth,t.drawImage(this,0,0),setTimeout(function(){te(a)},0),a.src=e.toDataURL("image/jpeg")},i.src=(0===a.src.indexOf("blob:")?"":g.opts.imageCORSProxy+"/")+a.src}else 0!==a.src.indexOf("http")||0===a.src.indexOf("https://mail.google.com/mail")?(g.selection.save(),c(a).remove(),g.selection.restore()):c(a).removeAttr("data-fr-image-pasted")}):g.$el.find("img[data-fr-image-pasted]").remove()}function ie(e){var t=e.target.result,a=g.opts.imageDefaultWidth;a&&"auto"!=a&&(a+=g.opts.imageResizeWithPercent?"%":"px"),g.undo.saveStep(),g.html.insert('<img data-fr-image-pasted="true" src="'+t+'"'+(a?' style="width: '+a+';"':"")+">");var i=g.$el.find('img[data-fr-image-pasted="true"]');i&&ge(i,g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign),g.events.trigger("paste.after")}function re(e){if(e&&e.clipboardData&&e.clipboardData.items){var t=null;if(e.clipboardData.types&&-1!=e.clipboardData.types.indexOf("text/rtf")||e.clipboardData.getData("text/rtf"))t=e.clipboardData.items[0].getAsFile();else for(var a=0;a<e.clipboardData.items.length&&!(t=e.clipboardData.items[a].getAsFile());a++);if(t)return i=t,(r=new FileReader).onload=ie,r.readAsDataURL(i),!1}var i,r}function ne(e){return e=e.replace(/<img /gi,'<img data-fr-image-pasted="true" ')}function se(e){if("false"==c(this).parents("[contenteditable]").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;if(e&&"touchend"==e.type&&a)return!0;if(e&&g.edit.isDisabled())return e.stopPropagation(),e.preventDefault(),!1;for(var t=0;t<ye.INSTANCES.length;t++)ye.INSTANCES[t]!=g&&ye.INSTANCES[t].events.trigger("image.hideResizer");g.toolbar.disable(),e&&(e.stopPropagation(),e.preventDefault()),g.helpers.isMobile()&&(g.events.disableBlur(),g.$el.blur(),g.events.enableBlur()),g.opts.iframe&&g.size.syncIframe(),d=c(this),ue(),E(),n(),g.browser.msie?(g.popups.areVisible()&&g.events.disableBlur(),g.win.getSelection&&(g.win.getSelection().removeAllRanges(),g.win.getSelection().addRange(g.doc.createRange()))):g.selection.clear(),g.helpers.isIOS()&&(g.events.disableBlur(),g.$el.blur()),g.button.bulkRefresh(),g.events.trigger("video.hideResizer")}function oe(e){d&&(le||!0===e)&&(g.toolbar.enable(),l.removeClass("fr-active"),g.popups.hide("image.edit"),d=null,pe(),f=null,p&&p.hide())}r[i]="Image cannot be loaded from the passed link.",r[u]="No link in upload response.",r[h]="Error during file upload.",r[v]="Parsing response failed.",r[b]="File is too large.",r[y]="Image file type is invalid.",r[7]="Files can be uploaded only to same domain in IE 8 and IE 9.";var le=!(r[8]="Image file is corrupted.");function fe(){le=!0}function pe(){le=!1}function ge(e,t,a){!g.opts.htmlUntouched&&g.opts.useClasses?(e.removeClass("fr-fil fr-fir fr-dib fr-dii"),a&&e.addClass("fr-fi"+a[0]),t&&e.addClass("fr-di"+t[0])):"inline"==t?(e.css({display:"inline-block",verticalAlign:"bottom",margin:g.opts.imageDefaultMargin}),"center"==a?e.css({"float":"none",marginBottom:"",marginTop:"",maxWidth:"calc(100% - "+2*g.opts.imageDefaultMargin+"px)",textAlign:"center"}):"left"==a?e.css({"float":"left",marginLeft:0,maxWidth:"calc(100% - "+g.opts.imageDefaultMargin+"px)",textAlign:"left"}):e.css({"float":"right",marginRight:0,maxWidth:"calc(100% - "+g.opts.imageDefaultMargin+"px)",textAlign:"right"})):"block"==t&&(e.css({display:"block","float":"none",verticalAlign:"top",margin:g.opts.imageDefaultMargin+"px auto",textAlign:"center"}),"left"==a?e.css({marginLeft:0,textAlign:"left"}):"right"==a&&e.css({marginRight:0,textAlign:"right"}))}function de(e){if(void 0===e&&(e=ve()),e){if(e.hasClass("fr-fil"))return"left";if(e.hasClass("fr-fir"))return"right";if(e.hasClass("fr-dib")||e.hasClass("fr-dii"))return"center";var t=e.css("float");if(e.css("float","none"),"block"==e.css("display")){if(e.css("float",""),e.css("float")!=t&&e.css("float",t),0===parseInt(e.css("margin-left"),10))return"left";if(0===parseInt(e.css("margin-right"),10))return"right"}else{if(e.css("float",""),e.css("float")!=t&&e.css("float",t),"left"==e.css("float"))return"left";if("right"==e.css("float"))return"right"}}return"center"}function ce(e){void 0===e&&(e=ve());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 me(){var e=g.popups.get("image.insert");e||(e=G()),g.popups.isVisible("image.insert")||(k(),g.popups.refresh("image.insert"),g.popups.setContainer("image.insert",g.$sc));var t=ve();be()&&(t=t.find(".fr-img-wrap"));var a=t.offset().left+t.outerWidth()/2,i=t.offset().top+t.outerHeight();g.popups.show("image.insert",a,i,t.outerHeight(!0),!0)}function ue(){if(d){g.events.disableBlur(),g.selection.clear();var e=g.doc.createRange();e.selectNode(d.get(0)),g.browser.msie&&e.collapse(!0),g.selection.get().addRange(e),g.events.enableBlur()}}function he(){return d}function ve(){return be()?d.parents(".fr-img-caption").first():d}function be(){return!!d&&0<d.parents(".fr-img-caption").length}return{_init:function(){var i;g.events.$on(g.$el,g._mousedown,"IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',function(e){if("false"==c(this).parents("contenteditable").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;g.helpers.isMobile()||g.selection.clear(),t=!0,g.popups.areVisible()&&g.events.disableBlur(),g.browser.msie&&(g.events.disableBlur(),g.$el.attr("contenteditable",!1)),g.draggable||"touchstart"==e.type||e.preventDefault(),e.stopPropagation()}),g.events.$on(g.$el,g._mouseup,"IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',function(e){if("false"==c(this).parents("contenteditable").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;t&&(t=!1,e.stopPropagation(),g.browser.msie&&(g.$el.attr("contenteditable",!0),g.events.enableBlur()))}),g.events.on("keyup",function(e){if(e.shiftKey&&""===g.selection.text().replace(/\n/g,"")&&g.keys.isArrow(e.which)){var t=g.selection.element(),a=g.selection.endElement();t&&"IMG"==t.tagName?P(c(t)):a&&"IMG"==a.tagName&&P(c(a))}},!0),g.events.on("drop",W),g.events.on("element.beforeDrop",Y),g.events.on("mousedown window.mousedown",fe),g.events.on("window.touchmove",pe),g.events.on("mouseup window.mouseup",function(){if(d)return oe(),!1;pe()}),g.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&oe()}),g.events.on("image.resizeEnd",function(){g.opts.iframe&&g.size.syncIframe()}),g.events.on("blur image.hideResizer commands.undo commands.redo element.dropped",function(){oe(!(t=!1))}),g.events.on("modals.hide",function(){d&&(ue(),g.selection.clear())}),g.events.on("image.resizeEnd",function(){g.win.getSelection&&P(d)}),g.opts.imageAddNewLine&&g.events.on("image.inserted",function(e){var t=e.get(0);for(t.nextSibling&&"BR"===t.nextSibling.tagName&&(t=t.nextSibling);t&&!g.node.isElement(t);)t=g.node.isLastSibling(t)?t.parentNode:null;g.node.isElement(t)&&(g.opts.enter===ye.ENTER_BR?e.after("<br>"):c(g.node.blockParent(e.get(0))).after("<"+g.html.defaultTag()+"><br></"+g.html.defaultTag()+">"))}),"IMG"==g.el.tagName&&g.$el.addClass("fr-view"),g.events.$on(g.$el,g.helpers.isMobile()&&!g.helpers.isWindowsPhone()?"touchend":"click","IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',se),g.helpers.isMobile()&&(g.events.$on(g.$el,"touchstart","IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',function(){a=!1}),g.events.$on(g.$el,"touchmove",function(){a=!0})),g.$wp?(g.events.on("window.keydown keydown",Z,!0),g.events.on("keyup",function(e){if(d&&e.which==ye.KEYCODE.ENTER)return!1},!0),g.events.$on(g.$el,"keydown",function(){var e=g.selection.element();e.nodeType===Node.TEXT_NODE&&(e=e.parentNode),g.node.hasClass(e,"fr-inner")||(g.node.hasClass(e,"fr-img-caption")||(e=c(e).parents(".fr-img-caption").get(0)),g.node.hasClass(e,"fr-img-caption")&&(c(e).after(c.FE.INVISIBLE_SPACE+c.FE.MARKERS),g.selection.restore()))})):g.events.$on(g.$win,"keydown",Z),g.events.on("toolbar.esc",function(){if(d){if(g.$wp)g.events.disableBlur(),g.events.focus();else{var e=d;oe(!0),g.selection.setAfter(e.get(0)),g.selection.restore()}return!1}},!0),g.events.on("toolbar.focusEditor",function(){if(d)return!1},!0),g.events.on("window.cut window.copy",function(e){if(d&&g.popups.isVisible("image.edit")&&!g.popups.get("image.edit").find(":focus").length){var t=ve();be()?(t.before(ye.START_MARKER),t.after(ye.END_MARKER),g.selection.restore(),g.paste.saveCopiedText(t.get(0).outerHTML,t.text())):(ue(),g.paste.saveCopiedText(d.get(0).outerHTML,d.attr("alt"))),"copy"==e.type?setTimeout(function(){P(d)}):(oe(!0),g.undo.saveStep(),setTimeout(function(){g.undo.saveStep()},0))}},!0),g.browser.msie&&g.events.on("keydown",function(e){if(!g.selection.isCollapsed()||!d)return!0;var t=e.which;t==ye.KEYCODE.C&&g.keys.ctrlKey(e)?g.events.trigger("window.copy"):t==ye.KEYCODE.X&&g.keys.ctrlKey(e)&&g.events.trigger("window.cut")}),g.events.$on(c(g.o_win),"keydown",function(e){var t=e.which;if(d&&t==ye.KEYCODE.BACKSPACE)return e.preventDefault(),!1}),g.events.$on(g.$win,"keydown",function(e){var t=e.which;d&&d.hasClass("fr-uploading")&&t==ye.KEYCODE.ESC&&d.trigger("abortUpload")}),g.events.on("destroy",function(){d&&d.hasClass("fr-uploading")&&d.trigger("abortUpload")}),g.events.on("paste.before",re),g.events.on("paste.beforeCleanup",ne),g.events.on("paste.after",ae),g.events.on("html.set",e),g.events.on("html.inserted",e),e(),g.events.on("destroy",function(){o=[]}),g.events.on("html.processGet",ee),g.opts.imageOutputSize&&g.events.on("html.beforeGet",function(){i=g.el.querySelectorAll("img");for(var e=0;e<i.length;e++){var t=i[e].style.width||c(i[e]).width(),a=i[e].style.height||c(i[e]).height();t&&i[e].setAttribute("width",(""+t).replace(/px/,"")),a&&i[e].setAttribute("height",(""+a).replace(/px/,""))}}),g.opts.iframe&&g.events.on("image.loaded",g.size.syncIframe),g.$wp&&(A(),g.events.on("contentChanged",A)),g.events.$on(c(g.o_win),"orientationchange.image",function(){setTimeout(function(){d&&P(d)},100)}),$(!0),G(!0),q(!0),X(!0),g.events.on("node.remove",function(e){if("IMG"==e.get(0).tagName)return J(e),!1})},showInsertPopup:function(){var e=g.$tb.find('.fr-command[data-cmd="insertImage"]'),t=g.popups.get("image.insert");if(t||(t=G()),k(),!t.hasClass("fr-active"))if(g.popups.refresh("image.insert"),g.popups.setContainer("image.insert",g.$tb),e.isVisible()){var a=g.button.getPosition(e),i=a.left,r=a.top;g.popups.show("image.insert",i,r,e.outerHeight())}else g.position.forSelection(t),g.popups.show("image.insert")},showLayer:function(e){var t,a,i=g.popups.get("image.insert");if(d||g.opts.toolbarInline){if(d){var r=ve();be()&&(r=r.find(".fr-img-wrap")),a=r.offset().top+r.outerHeight(),t=r.offset().left}}else{var n=g.$tb.find('.fr-command[data-cmd="insertImage"]');t=n.offset().left,a=n.offset().top+(g.opts.toolbarBottom?10:n.outerHeight()-10)}!d&&g.opts.toolbarInline&&(a=i.offset().top-g.helpers.getPX(i.css("margin-top")),i.hasClass("fr-above")&&(a+=i.outerHeight())),i.find(".fr-layer").removeClass("fr-active"),i.find(".fr-"+e+"-layer").addClass("fr-active"),g.popups.show("image.insert",t,a,d?d.outerHeight():0),g.accessibility.focusPopup(i)},refreshUploadButton:function(e){var t=g.popups.get("image.insert");t&&t.find(".fr-image-upload-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshByURLButton:function(e){var t=g.popups.get("image.insert");t&&t.find(".fr-image-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},upload:K,insertByURL:function(){var e=g.popups.get("image.insert").find(".fr-image-by-url-layer input");if(0<e.val().length){I(),N(g.language.translate("Loading image"));var t=e.val().trim();if(g.opts.imageUploadRemoteUrls&&g.opts.imageCORSProxy&&g.opts.imageUpload){var a=new XMLHttpRequest;a.onload=function(){200==this.status?K([new Blob([this.response],{type:this.response.type||"image/png"})],d):U(i)},a.onerror=function(){B(t,!0,[],d)},a.open("GET",g.opts.imageCORSProxy+"/"+t,!0),a.responseType="blob",a.send()}else B(t,!0,[],d);e.val(""),e.blur()}},align:function(e){var t=ve();t.removeClass("fr-fir fr-fil"),!g.opts.htmlUntouched&&g.opts.useClasses?"left"==e?t.addClass("fr-fil"):"right"==e&&t.addClass("fr-fir"):ge(t,ce(),e),ue(),E(),n(),g.selection.clear()},refreshAlign:function(e){d&&e.find("> *").first().replaceWith(g.icon.create("image-align-"+de()))},refreshAlignOnShow:function(e,t){d&&t.find('.fr-command[data-param1="'+de()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){var t=ve();t.removeClass("fr-dii fr-dib"),!g.opts.htmlUntouched&&g.opts.useClasses?"inline"==e?t.addClass("fr-dii"):"block"==e&&t.addClass("fr-dib"):ge(t,e,de()),ue(),E(),n(),g.selection.clear()},refreshDisplayOnShow:function(e,t){d&&t.find('.fr-command[data-param1="'+ce()+'"]').addClass("fr-active").attr("aria-selected",!0)},replace:me,back:function(){d?(g.events.disableBlur(),c(".fr-popup input:focus").blur(),P(d)):(g.events.disableBlur(),g.selection.restore(),g.events.enableBlur(),g.popups.hide("image.insert"),g.toolbar.showInline())},get:he,getEl:ve,insert:B,showProgressBar:I,remove:J,hideProgressBar:k,applyStyle:function(e,t,a){if(void 0===t&&(t=g.opts.imageStyles),void 0===a&&(a=g.opts.imageMultipleStyles),!d)return!1;var i=ve();if(!a){var r=Object.keys(t);r.splice(r.indexOf(e),1),i.removeClass(r.join(" "))}"object"==we(t[e])?(i.removeAttr("style"),i.css(t[e].style)):i.toggleClass(e),P(d)},showAltPopup:H,showSizePopup:j,setAlt:function(e){if(d){var t=g.popups.get("image.alt");d.attr("alt",e||t.find("input").val()||""),t.find("input:focus").blur(),P(d)}},setSize:function(e,t){if(d){var a=g.popups.get("image.size");e=e||a.find('input[name="width"]').val()||"",t=t||a.find('input[name="height"]').val()||"";var i=/^[\d]+((px)|%)*$/g;d.removeAttr("width").removeAttr("height"),e.match(i)?d.css("width",e):d.css("width",""),t.match(i)?d.css("height",t):d.css("height",""),be()&&(d.parents(".fr-img-caption").removeAttr("width").removeAttr("height"),e.match(i)?d.parents(".fr-img-caption").css("width",e):d.parents(".fr-img-caption").css("width",""),t.match(i)?d.parents(".fr-img-caption").css("height",t):d.parents(".fr-img-caption").css("height","")),a&&a.find("input:focus").blur(),P(d)}},toggleCaption:function(){var e;if(d&&!be()){(e=d).parent().is("a")&&(e=d.parent());var t=e.width();e.wrap("<span "+(g.browser.mozilla?"":'contenteditable="false"')+'class="fr-img-caption '+d.attr("class")+'" draggable="false"></span>'),e.wrap('<span class="fr-img-wrap"></span>'),e.after('<span class="fr-inner"'+(g.browser.mozilla?"":' contenteditable="true"')+">"+ye.START_MARKER+"Image caption"+ye.END_MARKER+"</span>"),d.removeAttr("class").removeAttr("style").removeAttr("width"),d.parents(".fr-img-caption").css("width",t+"px"),oe(!0),g.selection.restore()}else e=ve(),d.insertAfter(e),d.attr("class",e.attr("class").replace("fr-img-caption","")).attr("style",e.attr("style")),e.remove(),P(d)},hasCaption:be,exitEdit:oe,edit:P}},ye.DefineIcon("insertImage",{NAME:"image",SVG_KEY:"insertImage"}),ye.RegisterShortcut(ye.KEYCODE.P,"insertImage",null,"P"),ye.RegisterCommand("insertImage",{title:"Insert Image",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("image.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("image.insert")):this.image.showInsertPopup()},plugin:"image"}),ye.DefineIcon("imageUpload",{NAME:"upload",SVG_KEY:"upload"}),ye.RegisterCommand("imageUpload",{title:"Upload Image",undo:!1,focus:!1,toggle:!0,callback:function(){this.image.showLayer("image-upload")},refresh:function(e){this.image.refreshUploadButton(e)}}),ye.DefineIcon("imageByURL",{NAME:"link",SVG_KEY:"insertLink"}),ye.RegisterCommand("imageByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.image.showLayer("image-by-url")},refresh:function(e){this.image.refreshByURLButton(e)}}),ye.RegisterCommand("imageInsertByURL",{title:"Insert Image",undo:!0,refreshAfterCallback:!1,callback:function(){this.image.insertByURL()},refresh:function(e){this.image.get()?e.text(this.language.translate("Replace")):e.text(this.language.translate("Insert"))}}),ye.DefineIcon("imageDisplay",{NAME:"star",SVG_KEY:"imageDisplay"}),ye.RegisterCommand("imageDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.image.display(t)},refresh:function(e){this.opts.imageTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.image.refreshDisplayOnShow(e,t)}}),ye.DefineIcon("image-align",{NAME:"align-left",SVG_KEY:"alignLeft"}),ye.DefineIcon("image-align-left",{NAME:"align-left",SVG_KEY:"alignLeft"}),ye.DefineIcon("image-align-right",{NAME:"align-right",SVG_KEY:"alignRight"}),ye.DefineIcon("image-align-center",{NAME:"align-justify",SVG_KEY:"alignCenter"}),ye.DefineIcon("imageAlign",{NAME:"align-justify",SVG_KEY:"alignJustify"}),ye.RegisterCommand("imageAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ye.COMMANDS.imageAlign.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="imageAlign" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.icon.create("image-align-"+a)+'<span class="fr-sr-only">'+this.language.translate(t[a])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.image.align(t)},refresh:function(e){this.image.refreshAlign(e)},refreshOnShow:function(e,t){this.image.refreshAlignOnShow(e,t)}}),ye.DefineIcon("imageReplace",{NAME:"exchange",FA5NAME:"exchange-alt",SVG_KEY:"replaceImage"}),ye.RegisterCommand("imageReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.image.replace()}}),ye.DefineIcon("imageRemove",{NAME:"trash",SVG_KEY:"remove"}),ye.RegisterCommand("imageRemove",{title:"Remove",callback:function(){this.image.remove()}}),ye.DefineIcon("imageBack",{NAME:"arrow-left",SVG_KEY:"back"}),ye.RegisterCommand("imageBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.image.back()},refresh:function(e){this.$;this.image.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"))}}),ye.RegisterCommand("imageDismissError",{title:"OK",undo:!1,callback:function(){this.image.hideProgressBar(!0)}}),ye.DefineIcon("imageStyle",{NAME:"magic",SVG_KEY:"imageClass"}),ye.RegisterCommand("imageStyle",{title:"Style",type:"dropdown",html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.imageStyles;for(var a in t)if(t.hasOwnProperty(a)){var i=t[a];"object"==we(i)&&(i=i.title),e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="imageStyle" data-param1="'+a+'">'+this.language.translate(i)+"</a></li>"}return e+="</ul>"},callback:function(e,t){this.image.applyStyle(t)},refreshOnShow:function(e,t){var a=this.$,i=this.image.getEl();i&&t.find(".fr-command").each(function(){var e=a(this).data("param1"),t=i.hasClass(e);a(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),ye.DefineIcon("imageAlt",{NAME:"info",SVG_KEY:"imageAltText"}),ye.RegisterCommand("imageAlt",{undo:!1,focus:!1,popup:!0,title:"Alternative Text",callback:function(){this.image.showAltPopup()}}),ye.RegisterCommand("imageSetAlt",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.image.setAlt()}}),ye.DefineIcon("imageSize",{NAME:"arrows-alt",SVG_KEY:"imageSize"}),ye.RegisterCommand("imageSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.image.showSizePopup()}}),ye.RegisterCommand("imageSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.image.setSize()}}),ye.DefineIcon("imageCaption",{NAME:"commenting",FA5NAME:"comment-alt",SVG_KEY:"imageCaption"}),ye.RegisterCommand("imageCaption",{undo:!0,focus:!1,title:"Image Caption",refreshAfterCallback:!0,callback:function(){this.image.toggleCaption()},refresh:function(e){this.image.get()&&e.toggleClass("fr-active",this.image.hasCaption())}})}); |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(m){"use strict";m=m&&m.hasOwnProperty("default")?m["default"]:m,Object.assign(m.POPUP_TEMPLATES,{"link.edit":"[_BUTTONS_]","link.insert":"[_BUTTONS_][_INPUT_LAYER_]"}),Object.assign(m.DEFAULTS,{linkEditButtons:["linkOpen","linkStyle","linkEdit","linkRemove"],linkInsertButtons:["linkBack","|","linkList"],linkAttributes:{},linkAutoPrefix:"http://",linkStyles:{"fr-green":"Green","fr-strong":"Thick"},linkMultipleStyles:!0,linkConvertEmailAddress:!0,linkAlwaysBlank:!1,linkAlwaysNoFollow:!1,linkNoOpener:!0,linkNoReferrer:!0,linkList:[{text:"Froala",href:"https://froala.com",target:"_blank"},{text:"Google",href:"https://google.com",target:"_blank"},{displayText:"Facebook",href:"https://facebook.com"}],linkText:!0}),m.PLUGINS.link=function(c){var d=c.$;function u(){var e=c.image?c.image.get():null;if(!e&&c.$wp){var t=c.selection.ranges(0).commonAncestorContainer;try{t&&(t.contains&&t.contains(c.el)||!c.el.contains(t)||c.el==t)&&(t=null)}catch(r){t=null}if(t&&"A"===t.tagName)return t;var n=c.selection.element(),i=c.selection.endElement();"A"==n.tagName||c.node.isElement(n)||(n=d(n).parentsUntil(c.$el,"a").first().get(0)),"A"==i.tagName||c.node.isElement(i)||(i=d(i).parentsUntil(c.$el,"a").first().get(0));try{i&&(i.contains&&i.contains(c.el)||!c.el.contains(i)||c.el==i)&&(i=null)}catch(r){i=null}try{n&&(n.contains&&n.contains(c.el)||!c.el.contains(n)||c.el==n)&&(n=null)}catch(r){n=null}return i&&i==n&&"A"==i.tagName?(c.browser.msie||c.helpers.isMobile())&&(c.selection.info(n).atEnd||c.selection.info(n).atStart)?null:n:null}return"A"==c.el.tagName?c.el:e&&e.get(0).parentNode&&"A"==e.get(0).parentNode.tagName?e.get(0).parentNode:void 0}function k(){var e,t,n,i,r=c.image?c.image.get():null,l=[];if(r)"A"==r.get(0).parentNode.tagName&&l.push(r.get(0).parentNode);else if(c.win.getSelection){var a=c.win.getSelection();if(a.getRangeAt&&a.rangeCount){i=c.doc.createRange();for(var s=0;s<a.rangeCount;++s)if((t=(e=a.getRangeAt(s)).commonAncestorContainer)&&1!=t.nodeType&&(t=t.parentNode),t&&"a"==t.nodeName.toLowerCase())l.push(t);else{n=t.getElementsByTagName("a");for(var o=0;o<n.length;++o)i.selectNodeContents(n[o]),i.compareBoundaryPoints(e.END_TO_START,e)<1&&-1<i.compareBoundaryPoints(e.START_TO_END,e)&&l.push(n[o])}}}else if(c.doc.selection&&"Control"!=c.doc.selection.type)if("a"==(t=(e=c.doc.selection.createRange()).parentElement()).nodeName.toLowerCase())l.push(t);else{n=t.getElementsByTagName("a"),i=c.doc.body.createTextRange();for(var p=0;p<n.length;++p)i.moveToElementText(n[p]),-1<i.compareEndPoints("StartToEnd",e)&&i.compareEndPoints("EndToStart",e)<1&&l.push(n[p])}return l}function g(r){if(c.core.hasFocus()){if(a(),r&&"keyup"===r.type&&(r.altKey||r.which==m.KEYCODE.ALT))return!0;setTimeout(function(){if(!r||r&&(1==r.which||"mouseup"!=r.type)){var e=u(),t=c.image?c.image.get():null;if(e&&!t){if(c.image){var n=c.node.contents(e);if(1==n.length&&"IMG"==n[0].tagName){var i=c.selection.ranges(0);return 0===i.startOffset&&0===i.endOffset?d(e).before(m.MARKERS):d(e).after(m.MARKERS),c.selection.restore(),!1}}r&&r.stopPropagation(),l(e)}}},c.helpers.isIOS()?100:0)}}function l(e){var t=c.popups.get("link.edit");t||(t=function(){var e="";1<=c.opts.linkEditButtons.length&&("A"==c.el.tagName&&0<=c.opts.linkEditButtons.indexOf("linkRemove")&&c.opts.linkEditButtons.splice(c.opts.linkEditButtons.indexOf("linkRemove"),1),e='<div class="fr-buttons">'.concat(c.button.buildList(c.opts.linkEditButtons),"</div>"));var t={buttons:e},n=c.popups.create("link.edit",t);c.$wp&&c.events.$on(c.$wp,"scroll.link-edit",function(){u()&&c.popups.isVisible("link.edit")&&l(u())});return n}());var n=d(e);c.popups.isVisible("link.edit")||c.popups.refresh("link.edit"),c.popups.setContainer("link.edit",c.$sc);var i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();c.popups.show("link.edit",i,r,n.outerHeight(),!0)}function a(){c.popups.hide("link.edit")}function o(){var e=c.popups.get("link.insert"),t=u();if(t){var n,i,r=d(t),l=e.find('input.fr-link-attr[type="text"]'),a=e.find('input.fr-link-attr[type="checkbox"]');for(n=0;n<l.length;n++)(i=d(l[n])).val(r.attr(i.attr("name")||""));for(a.attr("checked",!1),n=0;n<a.length;n++)i=d(a[n]),r.attr(i.attr("name"))==i.data("checked")&&i.attr("checked",!0);e.find('input.fr-link-attr[type="text"][name="text"]').val(r.text())}else e.find('input.fr-link-attr[type="text"]').val(""),e.find('input.fr-link-attr[type="checkbox"]').attr("checked",!1),e.find('input.fr-link-attr[type="text"][name="text"]').val(c.selection.text());e.find("input.fr-link-attr").trigger("change"),(c.image?c.image.get():null)?e.find('.fr-link-attr[name="text"]').parent().hide():e.find('.fr-link-attr[name="text"]').parent().show()}function s(e){if(e)return c.popups.onRefresh("link.insert",o),!0;var t="";1<=c.opts.linkInsertButtons.length&&(t='<div class="fr-buttons fr-tabs">'+c.button.buildList(c.opts.linkInsertButtons)+"</div>");var n="",i=0;for(var r in n='<div class="fr-link-insert-layer fr-layer fr-active" id="fr-link-insert-layer-'+c.id+'">',n+='<div class="fr-input-line"><input id="fr-link-insert-layer-url-'+c.id+'" name="href" type="text" class="fr-link-attr" placeholder="'+c.language.translate("URL")+'" tabIndex="'+ ++i+'"></div>',c.opts.linkText&&(n+='<div class="fr-input-line"><input id="fr-link-insert-layer-text-'+c.id+'" name="text" type="text" class="fr-link-attr" placeholder="'+c.language.translate("Text")+'" tabIndex="'+ ++i+'"></div>'),c.opts.linkAttributes)if(c.opts.linkAttributes.hasOwnProperty(r)){var l=c.opts.linkAttributes[r];n+='<div class="fr-input-line"><input name="'+r+'" type="text" class="fr-link-attr" placeholder="'+c.language.translate(l)+'" tabIndex="'+ ++i+'"></div>'}c.opts.linkAlwaysBlank||(n+='<div class="fr-checkbox-line"><span class="fr-checkbox"><input name="target" class="fr-link-attr" data-checked="_blank" type="checkbox" id="fr-link-target-'.concat(c.id,'" tabIndex="').concat(++i,'"><span>').concat('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10" viewBox="0 0 32 32"><path d="M27 4l-15 15-7-7-5 5 12 12 20-20z" fill="#FFF"></path></svg>','</span></span><label id="fr-label-target-').concat(c.id,'">').concat(c.language.translate("Open in new tab"),"</label></div>"));var a={buttons:t,input_layer:n+='<div class="fr-action-buttons"><button class="fr-command fr-submit" role="button" data-cmd="linkInsert" href="#" tabIndex="'+ ++i+'" type="button">'+c.language.translate("Insert")+"</button></div></div>"},s=c.popups.create("link.insert",a);return c.$wp&&c.events.$on(c.$wp,"scroll.link-insert",function(){(c.image?c.image.get():null)&&c.popups.isVisible("link.insert")&&h(),c.popups.isVisible("link.insert")&&f()}),s}function p(e,t,n){if(void 0===n&&(n={}),!1===c.events.trigger("link.beforeInsert",[e,t,n]))return!1;var i=c.image?c.image.get():null;i||"A"==c.el.tagName?"A"==c.el.tagName&&c.$el.focus():(c.selection.restore(),c.popups.hide("link.insert"));var r=e;c.opts.linkConvertEmailAddress&&c.helpers.isEmail(e)&&!/^mailto:.*/i.test(e)&&(e="mailto:"+e);if(""===c.opts.linkAutoPrefix||new RegExp("^("+m.LinkProtocols.join("|")+"):.","i").test(e)||/^data:image.*/i.test(e)||/^(https?:|ftps?:|file:|)\/\//i.test(e)||/^([A-Za-z]:(\\){1,2}|[A-Za-z]:((\\){1,2}[^\\]+)+)(\\)?$/i.test(e)||["/","{","[","#","(","."].indexOf((e||"")[0])<0&&(e=c.opts.linkAutoPrefix+c.helpers.sanitizeURL(e)),e=c.helpers.sanitizeURL(e),c.opts.linkAlwaysBlank&&(n.target="_blank"),c.opts.linkAlwaysNoFollow&&(n.rel="nofollow"),c.helpers.isEmail(r)&&(n.target=null,n.rel=null),"_blank"==n.target?(c.opts.linkNoOpener&&(n.rel?n.rel+=" noopener":n.rel="noopener"),c.opts.linkNoReferrer&&(n.rel?n.rel+=" noreferrer":n.rel="noreferrer")):null==n.target&&(n.rel?n.rel=n.rel.replace(/noopener/,"").replace(/noreferrer/,""):n.rel=null),t=t||"",e===c.opts.linkAutoPrefix)return c.popups.get("link.insert").find('input[name="href"]').addClass("fr-error"),c.events.trigger("link.bad",[r]),!1;var l,a=u();if(a){if((l=d(a)).attr("href",e),0<t.length&&l.text()!=t&&!i){for(var s=l.get(0);1===s.childNodes.length&&s.childNodes[0].nodeType==Node.ELEMENT_NODE;)s=s.childNodes[0];d(s).text(t)}i||l.prepend(m.START_MARKER).append(m.END_MARKER),l.attr(n),i||c.selection.restore()}else{i?i.wrap('<a href="'+e+'"></a>'):(c.format.remove("a"),c.selection.isCollapsed()?(t=0===t.length?r:t,c.html.insert('<a href="'+e+'">'+m.START_MARKER+t.replace(/&/g,"&")+m.END_MARKER+"</a>"),c.selection.restore()):0<t.length&&t!=c.selection.text().replace(/\n/g,"")?(c.selection.remove(),c.html.insert('<a href="'+e+'">'+m.START_MARKER+t.replace(/&/g,"&")+m.END_MARKER+"</a>"),c.selection.restore()):(!function(){if(!c.selection.isCollapsed()){c.selection.save();for(var e=c.$el.find(".fr-marker").addClass("fr-unprocessed").toArray();e.length;){var t=d(e.pop());t.removeClass("fr-unprocessed");var n=c.node.deepestParent(t.get(0));if(n){for(var i=t.get(0),r="",l="";i=i.parentNode,c.node.isBlock(i)||(r+=c.node.closeTagString(i),l=c.node.openTagString(i)+l),i!=n;);var a=c.node.openTagString(t.get(0))+t.html()+c.node.closeTagString(t.get(0));t.replaceWith('<span id="fr-break"></span>');var s=n.outerHTML;s=(s=s.replace(/<span id="fr-break"><\/span>/g,r+a+l)).replace(l+r,""),n.outerHTML=s}e=c.$el.find(".fr-marker.fr-unprocessed").toArray()}c.html.cleanEmptyTags(),c.selection.restore()}}(),c.format.apply("a",{href:e})));for(var o=k(),p=0;p<o.length;p++)(l=d(o[p])).attr(n),l.removeAttr("_moz_dirty");1==o.length&&c.$wp&&!i&&(d(o[0]).prepend(m.START_MARKER).append(m.END_MARKER),c.selection.restore())}if(i){var f=c.popups.get("link.insert");f&&f.find("input:focus").blur(),c.image.edit(i)}else g()}function f(){a();var e=u();if(e){var t=c.popups.get("link.insert");t||(t=s()),c.popups.isVisible("link.insert")||(c.popups.refresh("link.insert"),c.selection.save(),c.helpers.isMobile()&&(c.events.disableBlur(),c.$el.blur(),c.events.enableBlur())),c.popups.setContainer("link.insert",c.$sc);var n=(c.image?c.image.get():null)||d(e),i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();c.popups.show("link.insert",i,r,n.outerHeight(),!0)}}function h(){var e=c.image?c.image.getEl():null;if(e){var t=c.popups.get("link.insert");c.image.hasCaption()&&(e=e.find(".fr-img-wrap")),t||(t=s()),o(),c.popups.setContainer("link.insert",c.$sc);var n=e.offset().left+e.outerWidth()/2,i=e.offset().top+e.outerHeight();c.popups.show("link.insert",n,i,e.outerHeight(),!0)}}return{_init:function(){c.events.on("keyup",function(e){e.which!=m.KEYCODE.ESC&&g(e)}),c.events.on("window.mouseup",g),c.events.$on(c.$el,"click","a",function(e){c.edit.isDisabled()&&e.preventDefault()}),c.helpers.isMobile()&&c.events.$on(c.$doc,"selectionchange",g),s(!0),"A"==c.el.tagName&&c.$el.addClass("fr-view"),c.events.on("toolbar.esc",function(){if(c.popups.isVisible("link.edit"))return c.events.disableBlur(),c.events.focus(),!1},!0)},remove:function(){var e=u(),t=c.image?c.image.get():null;if(!1===c.events.trigger("link.beforeRemove",[e]))return!1;t&&e?(t.unwrap(),c.image.edit(t)):e&&(c.selection.save(),d(e).replaceWith(d(e).html()),c.selection.restore(),a())},showInsertPopup:function(){var e=c.$tb.find('.fr-command[data-cmd="insertLink"]'),t=c.popups.get("link.insert");if(t||(t=s()),!t.hasClass("fr-active"))if(c.popups.refresh("link.insert"),c.popups.setContainer("link.insert",c.$tb||c.$sc),e.isVisible()){var n=c.button.getPosition(e),i=n.left,r=n.top;c.popups.show("link.insert",i,r,e.outerHeight())}else c.position.forSelection(t),c.popups.show("link.insert")},usePredefined:function(e){var t,n,i=c.opts.linkList[e],r=c.popups.get("link.insert"),l=r.find('input.fr-link-attr[type="text"]'),a=r.find('input.fr-link-attr[type="checkbox"]');for(n=0;n<l.length;n++)i[(t=d(l[n])).attr("name")]?(t.val(i[t.attr("name")]),t.toggleClass("fr-not-empty",!0)):"text"!=t.attr("name")&&t.val("");for(n=0;n<a.length;n++)(t=d(a[n])).attr("checked",t.data("checked")==i[t.attr("name")]);c.accessibility.focusPopup(r)},insertCallback:function(){var e,t,n=c.popups.get("link.insert"),i=n.find('input.fr-link-attr[type="text"]'),r=n.find('input.fr-link-attr[type="checkbox"]'),l=(i.filter('[name="href"]').val()||"").trim(),a=i.filter('[name="text"]').val(),s={};for(t=0;t<i.length;t++)e=d(i[t]),["href","text"].indexOf(e.attr("name"))<0&&(s[e.attr("name")]=e.val());for(t=0;t<r.length;t++)(e=d(r[t])).is(":checked")?s[e.attr("name")]=e.data("checked"):s[e.attr("name")]=e.data("unchecked")||null;var o=c.helpers.scrollTop();p(l,a,s),d(c.o_win).scrollTop(o)},insert:p,update:f,get:u,allSelected:k,back:function(){c.image&&c.image.get()?c.image.back():(c.events.disableBlur(),c.selection.restore(),c.events.enableBlur(),u()&&c.$wp?(c.selection.restore(),a(),g()):"A"==c.el.tagName?(c.$el.focus(),g()):(c.popups.hide("link.insert"),c.toolbar.showInline()))},imageLink:h,applyStyle:function(e,t,n){void 0===n&&(n=c.opts.linkMultipleStyles),void 0===t&&(t=c.opts.linkStyles);var i=u();if(!i)return!1;if(!n){var r=Object.keys(t);r.splice(r.indexOf(e),1),d(i).removeClass(r.join(" "))}d(i).toggleClass(e),g()}}},m.DefineIcon("insertLink",{NAME:"link",SVG_KEY:"insertLink"}),m.RegisterShortcut(m.KEYCODE.K,"insertLink",null,"K"),m.RegisterCommand("insertLink",{title:"Insert Link",undo:!1,focus:!0,refreshOnCallback:!1,popup:!0,callback:function(){this.popups.isVisible("link.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("link.insert")):this.link.showInsertPopup()},plugin:"link"}),m.DefineIcon("linkOpen",{NAME:"external-link",FA5NAME:"external-link-alt",SVG_KEY:"openLink"}),m.RegisterCommand("linkOpen",{title:"Open Link",undo:!1,refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},callback:function(){var e=this.link.get();e&&(-1!==e.href.indexOf("mailto:")?this.o_win.open(e.href).close():this.o_win.open(e.href,"_blank","noopener"),this.popups.hide("link.edit"))},plugin:"link"}),m.DefineIcon("linkEdit",{NAME:"edit",SVG_KEY:"editLink"}),m.RegisterCommand("linkEdit",{title:"Edit Link",undo:!1,refreshAfterCallback:!1,popup:!0,callback:function(){this.link.update()},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"}),m.DefineIcon("linkRemove",{NAME:"unlink",SVG_KEY:"unlink"}),m.RegisterCommand("linkRemove",{title:"Unlink",callback:function(){this.link.remove()},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"}),m.DefineIcon("linkBack",{NAME:"arrow-left",SVG_KEY:"back"}),m.RegisterCommand("linkBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.link.back()},refresh:function(e){var t=this.link.get()&&this.doc.hasFocus();(this.image?this.image.get():null)||t||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"))},plugin:"link"}),m.DefineIcon("linkList",{NAME:"search",SVG_KEY:"search"}),m.RegisterCommand("linkList",{title:"Choose Link",type:"dropdown",focus:!1,undo:!1,refreshAfterCallback:!1,html:function(){for(var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.linkList,n=0;n<t.length;n++)e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="linkList" data-param1="'+n+'">'+(t[n].displayText||t[n].text)+"</a></li>";return e+="</ul>"},callback:function(e,t){this.link.usePredefined(t)},plugin:"link"}),m.RegisterCommand("linkInsert",{focus:!1,refreshAfterCallback:!1,callback:function(){this.link.insertCallback()},refresh:function(e){this.link.get()?e.text(this.language.translate("Update")):e.text(this.language.translate("Insert"))},plugin:"link"}),m.DefineIcon("imageLink",{NAME:"link",SVG_KEY:"insertLink"}),m.RegisterCommand("imageLink",{title:"Insert Link",undo:!1,focus:!1,popup:!0,callback:function(){this.link.imageLink()},refresh:function(e){var t;this.link.get()?((t=e.prev()).hasClass("fr-separator")&&t.removeClass("fr-hidden"),e.addClass("fr-hidden")):((t=e.prev()).hasClass("fr-separator")&&t.addClass("fr-hidden"),e.removeClass("fr-hidden"))},plugin:"link"}),m.DefineIcon("linkStyle",{NAME:"magic",SVG_KEY:"linkStyles"}),m.RegisterCommand("linkStyle",{title:"Style",type:"dropdown",html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.linkStyles;for(var n in t)t.hasOwnProperty(n)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="linkStyle" data-param1="'+n+'">'+this.language.translate(t[n])+"</a></li>");return e+="</ul>"},callback:function(e,t){this.link.applyStyle(t)},refreshOnShow:function(e,t){var n=this.$,i=this.link.get();if(i){var r=n(i);t.find(".fr-command").each(function(){var e=n(this).data("param1"),t=r.hasClass(e);n(this).toggleClass("fr-active",t).attr("aria-selected",t)})}},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(m){"use strict";m=m&&m.hasOwnProperty("default")?m["default"]:m,Object.assign(m.POPUP_TEMPLATES,{"link.edit":"[_BUTTONS_]","link.insert":"[_BUTTONS_][_INPUT_LAYER_]"}),Object.assign(m.DEFAULTS,{linkEditButtons:["linkOpen","linkStyle","linkEdit","linkRemove"],linkInsertButtons:["linkBack","|","linkList"],linkAttributes:{},linkAutoPrefix:"http://",linkStyles:{"fr-green":"Green","fr-strong":"Thick"},linkMultipleStyles:!0,linkConvertEmailAddress:!0,linkAlwaysBlank:!1,linkAlwaysNoFollow:!1,linkNoOpener:!0,linkNoReferrer:!0,linkList:[{text:"Froala",href:"https://froala.com",target:"_blank"},{text:"Google",href:"https://google.com",target:"_blank"},{displayText:"Facebook",href:"https://facebook.com"}],linkText:!0}),m.PLUGINS.link=function(c){var d=c.$;function u(){var e=c.image?c.image.get():null;if(!e&&c.$wp){var t=c.selection.ranges(0).commonAncestorContainer;try{t&&(t.contains&&t.contains(c.el)||!c.el.contains(t)||c.el==t)&&(t=null)}catch(r){t=null}if(t&&"A"===t.tagName)return t;var n=c.selection.element(),i=c.selection.endElement();"A"==n.tagName||c.node.isElement(n)||(n=d(n).parentsUntil(c.$el,"a").first().get(0)),"A"==i.tagName||c.node.isElement(i)||(i=d(i).parentsUntil(c.$el,"a").first().get(0));try{i&&(i.contains&&i.contains(c.el)||!c.el.contains(i)||c.el==i)&&(i=null)}catch(r){i=null}try{n&&(n.contains&&n.contains(c.el)||!c.el.contains(n)||c.el==n)&&(n=null)}catch(r){n=null}return i&&i==n&&"A"==i.tagName?(c.browser.msie||c.helpers.isMobile())&&(c.selection.info(n).atEnd||c.selection.info(n).atStart)?null:n:null}return"A"==c.el.tagName?c.el:e&&e.get(0).parentNode&&"A"==e.get(0).parentNode.tagName?e.get(0).parentNode:void 0}function k(){var e,t,n,i,r=c.image?c.image.get():null,l=[];if(r)"A"==r.get(0).parentNode.tagName&&l.push(r.get(0).parentNode);else if(c.win.getSelection){var a=c.win.getSelection();if(a.getRangeAt&&a.rangeCount){i=c.doc.createRange();for(var s=0;s<a.rangeCount;++s)if((t=(e=a.getRangeAt(s)).commonAncestorContainer)&&1!=t.nodeType&&(t=t.parentNode),t&&"a"==t.nodeName.toLowerCase())l.push(t);else{n=t.getElementsByTagName("a");for(var o=0;o<n.length;++o)i.selectNodeContents(n[o]),i.compareBoundaryPoints(e.END_TO_START,e)<1&&-1<i.compareBoundaryPoints(e.START_TO_END,e)&&l.push(n[o])}}}else if(c.doc.selection&&"Control"!=c.doc.selection.type)if("a"==(t=(e=c.doc.selection.createRange()).parentElement()).nodeName.toLowerCase())l.push(t);else{n=t.getElementsByTagName("a"),i=c.doc.body.createTextRange();for(var p=0;p<n.length;++p)i.moveToElementText(n[p]),-1<i.compareEndPoints("StartToEnd",e)&&i.compareEndPoints("EndToStart",e)<1&&l.push(n[p])}return l}function g(r){if(c.core.hasFocus()){if(a(),r&&"keyup"===r.type&&(r.altKey||r.which==m.KEYCODE.ALT))return!0;setTimeout(function(){if(!r||r&&(1==r.which||"mouseup"!=r.type)){var e=u(),t=c.image?c.image.get():null;if(e&&!t){if(c.image){var n=c.node.contents(e);if(1==n.length&&"IMG"==n[0].tagName){var i=c.selection.ranges(0);return 0===i.startOffset&&0===i.endOffset?d(e).before(m.MARKERS):d(e).after(m.MARKERS),c.selection.restore(),!1}}r&&r.stopPropagation(),l(e)}}},c.helpers.isIOS()?100:0)}}function l(e){var t=c.popups.get("link.edit");t||(t=function(){var e="";1<=c.opts.linkEditButtons.length&&("A"==c.el.tagName&&0<=c.opts.linkEditButtons.indexOf("linkRemove")&&c.opts.linkEditButtons.splice(c.opts.linkEditButtons.indexOf("linkRemove"),1),e='<div class="fr-buttons">'.concat(c.button.buildList(c.opts.linkEditButtons),"</div>"));var t={buttons:e},n=c.popups.create("link.edit",t);c.$wp&&c.events.$on(c.$wp,"scroll.link-edit",function(){u()&&c.popups.isVisible("link.edit")&&l(u())});return n}());var n=d(e);c.popups.isVisible("link.edit")||c.popups.refresh("link.edit"),c.popups.setContainer("link.edit",c.$sc);var i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();c.popups.show("link.edit",i,r,n.outerHeight(),!0)}function a(){c.popups.hide("link.edit")}function o(){var e=c.popups.get("link.insert"),t=u();if(t){var n,i,r=d(t),l=e.find('input.fr-link-attr[type="text"]'),a=e.find('input.fr-link-attr[type="checkbox"]');for(n=0;n<l.length;n++)(i=d(l[n])).val(r.attr(i.attr("name")||""));for(a.attr("checked",!1),n=0;n<a.length;n++)i=d(a[n]),r.attr(i.attr("name"))==i.data("checked")&&i.attr("checked",!0);e.find('input.fr-link-attr[type="text"][name="text"]').val(r.text())}else e.find('input.fr-link-attr[type="text"]').val(""),e.find('input.fr-link-attr[type="checkbox"]').attr("checked",!1),e.find('input.fr-link-attr[type="text"][name="text"]').val(c.selection.text());e.find("input.fr-link-attr").trigger("change"),(c.image?c.image.get():null)?e.find('.fr-link-attr[name="text"]').parent().hide():e.find('.fr-link-attr[name="text"]').parent().show()}function s(e){if(e)return c.popups.onRefresh("link.insert",o),!0;var t="";1<=c.opts.linkInsertButtons.length&&(t='<div class="fr-buttons fr-tabs">'+c.button.buildList(c.opts.linkInsertButtons)+"</div>");var n="",i=0;for(var r in n='<div class="fr-link-insert-layer fr-layer fr-active" id="fr-link-insert-layer-'+c.id+'">',n+='<div class="fr-input-line"><input id="fr-link-insert-layer-url-'+c.id+'" name="href" type="text" class="fr-link-attr" placeholder="'+c.language.translate("URL")+'" tabIndex="'+ ++i+'"></div>',c.opts.linkText&&(n+='<div class="fr-input-line"><input id="fr-link-insert-layer-text-'+c.id+'" name="text" type="text" class="fr-link-attr" placeholder="'+c.language.translate("Text")+'" tabIndex="'+ ++i+'"></div>'),c.opts.linkAttributes)if(c.opts.linkAttributes.hasOwnProperty(r)){var l=c.opts.linkAttributes[r];n+='<div class="fr-input-line"><input name="'+r+'" type="text" class="fr-link-attr" placeholder="'+c.language.translate(l)+'" tabIndex="'+ ++i+'"></div>'}c.opts.linkAlwaysBlank||(n+='<div class="fr-checkbox-line"><span class="fr-checkbox"><input name="target" class="fr-link-attr" data-checked="_blank" type="checkbox" id="fr-link-target-'.concat(c.id,'" tabIndex="').concat(++i,'"><span>').concat('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10" viewBox="0 0 32 32"><path d="M27 4l-15 15-7-7-5 5 12 12 20-20z" fill="#FFF"></path></svg>','</span></span><label id="fr-label-target-').concat(c.id,'">').concat(c.language.translate("Open in new tab"),"</label></div>"));var a={buttons:t,input_layer:n+='<div class="fr-action-buttons"><button class="fr-command fr-submit" role="button" data-cmd="linkInsert" href="#" tabIndex="'+ ++i+'" type="button">'+c.language.translate("Insert")+"</button></div></div>"},s=c.popups.create("link.insert",a);return c.$wp&&c.events.$on(c.$wp,"scroll.link-insert",function(){(c.image?c.image.get():null)&&c.popups.isVisible("link.insert")&&h(),c.popups.isVisible("link.insert")&&f()}),s}function p(e,t,n){if(void 0===n&&(n={}),!1===c.events.trigger("link.beforeInsert",[e,t,n]))return!1;var i=c.image?c.image.get():null;i||"A"==c.el.tagName?"A"==c.el.tagName&&c.$el.focus():(c.selection.restore(),c.popups.hide("link.insert"));var r=e;c.opts.linkConvertEmailAddress&&c.helpers.isEmail(e)&&!/^mailto:.*/i.test(e)&&(e="mailto:"+e);if(""===c.opts.linkAutoPrefix||new RegExp("^("+m.LinkProtocols.join("|")+"):.","i").test(e)||/^data:image.*/i.test(e)||/^(https?:|ftps?:|file:|)\/\//i.test(e)||/^([A-Za-z]:(\\){1,2}|[A-Za-z]:((\\){1,2}[^\\]+)+)(\\)?$/i.test(e)||["/","{","[","#","(","."].indexOf((e||"")[0])<0&&(e=c.opts.linkAutoPrefix+c.helpers.sanitizeURL(e)),e=c.helpers.sanitizeURL(e),c.opts.linkAlwaysBlank&&(n.target="_blank"),c.opts.linkAlwaysNoFollow&&(n.rel="nofollow"),c.helpers.isEmail(r)&&(n.target=null,n.rel=null),"_blank"==n.target?(c.opts.linkNoOpener&&(n.rel?n.rel+=" noopener":n.rel="noopener"),c.opts.linkNoReferrer&&(n.rel?n.rel+=" noreferrer":n.rel="noreferrer")):null==n.target&&(n.rel?n.rel=n.rel.replace(/noopener/,"").replace(/noreferrer/,""):n.rel=null),t=t||"",e===c.opts.linkAutoPrefix)return c.popups.get("link.insert").find('input[name="href"]').addClass("fr-error"),c.events.trigger("link.bad",[r]),!1;var l,a=u();if(a){if((l=d(a)).attr("href",e),0<t.length&&l.text()!=t&&!i){for(var s=l.get(0);1===s.childNodes.length&&s.childNodes[0].nodeType==Node.ELEMENT_NODE;)s=s.childNodes[0];d(s).text(t)}i||l.prepend(m.START_MARKER).append(m.END_MARKER),l.attr(n),i||c.selection.restore()}else{i?i.wrap('<a href="'+e+'"></a>'):(c.format.remove("a"),c.selection.isCollapsed()?(t=0===t.length?r:t,c.html.insert('<a href="'+e+'">'+m.START_MARKER+t.replace(/&/g,"&").replace(/</,"<",">",">")+m.END_MARKER+"</a>"),c.selection.restore()):0<t.length&&t!=c.selection.text().replace(/\n/g,"")?(c.selection.remove(),c.html.insert('<a href="'+e+'">'+m.START_MARKER+t.replace(/&/g,"&")+m.END_MARKER+"</a>"),c.selection.restore()):(!function(){if(!c.selection.isCollapsed()){c.selection.save();for(var e=c.$el.find(".fr-marker").addClass("fr-unprocessed").toArray();e.length;){var t=d(e.pop());t.removeClass("fr-unprocessed");var n=c.node.deepestParent(t.get(0));if(n){for(var i=t.get(0),r="",l="";i=i.parentNode,c.node.isBlock(i)||(r+=c.node.closeTagString(i),l=c.node.openTagString(i)+l),i!=n;);var a=c.node.openTagString(t.get(0))+t.html()+c.node.closeTagString(t.get(0));t.replaceWith('<span id="fr-break"></span>');var s=n.outerHTML;s=(s=s.replace(/<span id="fr-break"><\/span>/g,r+a+l)).replace(l+r,""),n.outerHTML=s}e=c.$el.find(".fr-marker.fr-unprocessed").toArray()}c.html.cleanEmptyTags(),c.selection.restore()}}(),c.format.apply("a",{href:e})));for(var o=k(),p=0;p<o.length;p++)(l=d(o[p])).attr(n),l.removeAttr("_moz_dirty");1==o.length&&c.$wp&&!i&&(d(o[0]).prepend(m.START_MARKER).append(m.END_MARKER),c.selection.restore())}if(i){var f=c.popups.get("link.insert");f&&f.find("input:focus").blur(),c.image.edit(i)}else g()}function f(){a();var e=u();if(e){var t=c.popups.get("link.insert");t||(t=s()),c.popups.isVisible("link.insert")||(c.popups.refresh("link.insert"),c.selection.save(),c.helpers.isMobile()&&(c.events.disableBlur(),c.$el.blur(),c.events.enableBlur())),c.popups.setContainer("link.insert",c.$sc);var n=(c.image?c.image.get():null)||d(e),i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();c.popups.show("link.insert",i,r,n.outerHeight(),!0)}}function h(){var e=c.image?c.image.getEl():null;if(e){var t=c.popups.get("link.insert");c.image.hasCaption()&&(e=e.find(".fr-img-wrap")),t||(t=s()),o(),c.popups.setContainer("link.insert",c.$sc);var n=e.offset().left+e.outerWidth()/2,i=e.offset().top+e.outerHeight();c.popups.show("link.insert",n,i,e.outerHeight(),!0)}}return{_init:function(){c.events.on("keyup",function(e){e.which!=m.KEYCODE.ESC&&g(e)}),c.events.on("window.mouseup",g),c.events.$on(c.$el,"click","a",function(e){c.edit.isDisabled()&&e.preventDefault()}),c.helpers.isMobile()&&c.events.$on(c.$doc,"selectionchange",g),s(!0),"A"==c.el.tagName&&c.$el.addClass("fr-view"),c.events.on("toolbar.esc",function(){if(c.popups.isVisible("link.edit"))return c.events.disableBlur(),c.events.focus(),!1},!0)},remove:function(){var e=u(),t=c.image?c.image.get():null;if(!1===c.events.trigger("link.beforeRemove",[e]))return!1;t&&e?(t.unwrap(),c.image.edit(t)):e&&(c.selection.save(),d(e).replaceWith(d(e).html()),c.selection.restore(),a())},showInsertPopup:function(){var e=c.$tb.find('.fr-command[data-cmd="insertLink"]'),t=c.popups.get("link.insert");if(t||(t=s()),!t.hasClass("fr-active"))if(c.popups.refresh("link.insert"),c.popups.setContainer("link.insert",c.$tb||c.$sc),e.isVisible()){var n=c.button.getPosition(e),i=n.left,r=n.top;c.popups.show("link.insert",i,r,e.outerHeight())}else c.position.forSelection(t),c.popups.show("link.insert")},usePredefined:function(e){var t,n,i=c.opts.linkList[e],r=c.popups.get("link.insert"),l=r.find('input.fr-link-attr[type="text"]'),a=r.find('input.fr-link-attr[type="checkbox"]');for(n=0;n<l.length;n++)i[(t=d(l[n])).attr("name")]?(t.val(i[t.attr("name")]),t.toggleClass("fr-not-empty",!0)):"text"!=t.attr("name")&&t.val("");for(n=0;n<a.length;n++)(t=d(a[n])).attr("checked",t.data("checked")==i[t.attr("name")]);c.accessibility.focusPopup(r)},insertCallback:function(){var e,t,n=c.popups.get("link.insert"),i=n.find('input.fr-link-attr[type="text"]'),r=n.find('input.fr-link-attr[type="checkbox"]'),l=(i.filter('[name="href"]').val()||"").trim(),a=i.filter('[name="text"]').val(),s={};for(t=0;t<i.length;t++)e=d(i[t]),["href","text"].indexOf(e.attr("name"))<0&&(s[e.attr("name")]=e.val());for(t=0;t<r.length;t++)(e=d(r[t])).is(":checked")?s[e.attr("name")]=e.data("checked"):s[e.attr("name")]=e.data("unchecked")||null;var o=c.helpers.scrollTop();p(l,a,s),d(c.o_win).scrollTop(o)},insert:p,update:f,get:u,allSelected:k,back:function(){c.image&&c.image.get()?c.image.back():(c.events.disableBlur(),c.selection.restore(),c.events.enableBlur(),u()&&c.$wp?(c.selection.restore(),a(),g()):"A"==c.el.tagName?(c.$el.focus(),g()):(c.popups.hide("link.insert"),c.toolbar.showInline()))},imageLink:h,applyStyle:function(e,t,n){void 0===n&&(n=c.opts.linkMultipleStyles),void 0===t&&(t=c.opts.linkStyles);var i=u();if(!i)return!1;if(!n){var r=Object.keys(t);r.splice(r.indexOf(e),1),d(i).removeClass(r.join(" "))}d(i).toggleClass(e),g()}}},m.DefineIcon("insertLink",{NAME:"link",SVG_KEY:"insertLink"}),m.RegisterShortcut(m.KEYCODE.K,"insertLink",null,"K"),m.RegisterCommand("insertLink",{title:"Insert Link",undo:!1,focus:!0,refreshOnCallback:!1,popup:!0,callback:function(){this.popups.isVisible("link.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("link.insert")):this.link.showInsertPopup()},plugin:"link"}),m.DefineIcon("linkOpen",{NAME:"external-link",FA5NAME:"external-link-alt",SVG_KEY:"openLink"}),m.RegisterCommand("linkOpen",{title:"Open Link",undo:!1,refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},callback:function(){var e=this.link.get();e&&(-1!==e.href.indexOf("mailto:")?this.o_win.open(e.href).close():this.o_win.open(e.href,"_blank","noopener"),this.popups.hide("link.edit"))},plugin:"link"}),m.DefineIcon("linkEdit",{NAME:"edit",SVG_KEY:"editLink"}),m.RegisterCommand("linkEdit",{title:"Edit Link",undo:!1,refreshAfterCallback:!1,popup:!0,callback:function(){this.link.update()},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"}),m.DefineIcon("linkRemove",{NAME:"unlink",SVG_KEY:"unlink"}),m.RegisterCommand("linkRemove",{title:"Unlink",callback:function(){this.link.remove()},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"}),m.DefineIcon("linkBack",{NAME:"arrow-left",SVG_KEY:"back"}),m.RegisterCommand("linkBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.link.back()},refresh:function(e){var t=this.link.get()&&this.doc.hasFocus();(this.image?this.image.get():null)||t||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"))},plugin:"link"}),m.DefineIcon("linkList",{NAME:"search",SVG_KEY:"search"}),m.RegisterCommand("linkList",{title:"Choose Link",type:"dropdown",focus:!1,undo:!1,refreshAfterCallback:!1,html:function(){for(var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.linkList,n=0;n<t.length;n++)e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="linkList" data-param1="'+n+'">'+(t[n].displayText||t[n].text)+"</a></li>";return e+="</ul>"},callback:function(e,t){this.link.usePredefined(t)},plugin:"link"}),m.RegisterCommand("linkInsert",{focus:!1,refreshAfterCallback:!1,callback:function(){this.link.insertCallback()},refresh:function(e){this.link.get()?e.text(this.language.translate("Update")):e.text(this.language.translate("Insert"))},plugin:"link"}),m.DefineIcon("imageLink",{NAME:"link",SVG_KEY:"insertLink"}),m.RegisterCommand("imageLink",{title:"Insert Link",undo:!1,focus:!1,popup:!0,callback:function(){this.link.imageLink()},refresh:function(e){var t;this.link.get()?((t=e.prev()).hasClass("fr-separator")&&t.removeClass("fr-hidden"),e.addClass("fr-hidden")):((t=e.prev()).hasClass("fr-separator")&&t.addClass("fr-hidden"),e.removeClass("fr-hidden"))},plugin:"link"}),m.DefineIcon("linkStyle",{NAME:"magic",SVG_KEY:"linkStyles"}),m.RegisterCommand("linkStyle",{title:"Style",type:"dropdown",html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.linkStyles;for(var n in t)t.hasOwnProperty(n)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="linkStyle" data-param1="'+n+'">'+this.language.translate(t[n])+"</a></li>");return e+="</ul>"},callback:function(e,t){this.link.applyStyle(t)},refreshOnShow:function(e,t){var n=this.$,i=this.link.get();if(i){var r=n(i);t.find(".fr-command").each(function(){var e=n(this).data("param1"),t=r.hasClass(e);n(this).toggleClass("fr-active",t).attr("aria-selected",t)})}},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"})}); |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(ee){"use strict";ee=ee&&ee.hasOwnProperty("default")?ee["default"]:ee,Object.assign(ee.POPUP_TEMPLATES,{"table.insert":"[_BUTTONS_][_ROWS_COLUMNS_]","table.edit":"[_BUTTONS_]","table.colors":"[_BUTTONS_][_COLORS_][_CUSTOM_COLOR_]"}),Object.assign(ee.DEFAULTS,{tableInsertMaxSize:10,tableEditButtons:["tableHeader","tableRemove","tableRows","tableColumns","tableStyle","-","tableCells","tableCellBackground","tableCellVerticalAlign","tableCellHorizontalAlign","tableCellStyle"],tableInsertButtons:["tableBack","|"],tableResizer:!0,tableDefaultWidth:"100%",tableResizerOffset:5,tableResizingLimit:30,tableColorsButtons:["tableBack","|"],tableColors:["#61BD6D","#1ABC9C","#54ACD2","#2C82C9","#9365B8","#475577","#CCCCCC","#41A85F","#00A885","#3D8EB9","#2969B0","#553982","#28324E","#000000","#F7DA64","#FBA026","#EB6B56","#E25041","#A38F84","#EFEFEF","#FFFFFF","#FAC51C","#F37934","#D14841","#B8312F","#7C706B","#D1D5D8","REMOVE"],tableColorsStep:7,tableCellStyles:{"fr-highlighted":"Highlighted","fr-thick":"Thick"},tableStyles:{"fr-dashed-borders":"Dashed Borders","fr-alternate-rows":"Alternate Rows"},tableCellMultipleStyles:!0,tableMultipleStyles:!0,tableInsertHelper:!0,tableInsertHelperOffset:15}),ee.PLUGINS.table=function(E){var R,f,r,n,l,s,A,O=E.$;function h(){var e=_();if(e){var t=E.popups.get("table.edit");if(t||(t=p()),t){E.popups.setContainer("table.edit",E.$sc);var a=I(e),l=a.left+(a.right-a.left)/2,r=a.bottom;E.popups.show("table.edit",l,r,a.bottom-a.top,!0),E.edit.isDisabled()&&(1<Z().length&&E.toolbar.disable(),E.$el.removeClass("fr-no-selection"),E.edit.on(),E.button.bulkRefresh(),E.selection.setAtEnd(E.$el.find(".fr-selected-cell").last().get(0)),E.selection.restore())}}}function d(){var e,t,a,l,r=_();if(r){var n=E.popups.get("table.colors");n||(n=function(){var e="";0<E.opts.tableColorsButtons.length&&(e='<div class="fr-buttons fr-tabs">'+E.button.buildList(E.opts.tableColorsButtons)+"</div>");var t="";E.opts.colorsHEXInput&&(t='<div class="fr-color-hex-layer fr-table-colors-hex-layer fr-active fr-layer" id="fr-table-colors-hex-layer-'+E.id+'"><div class="fr-input-line"><input maxlength="7" id="fr-table-colors-hex-layer-text-'+E.id+'" type="text" placeholder="'+E.language.translate("HEX Color")+'" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="tableCellBackgroundCustomColor" tabIndex="2" role="button">'+E.language.translate("OK")+"</button></div></div>");var a={buttons:e,colors:function(){for(var e='<div class="fr-color-set fr-table-colors">',t=0;t<E.opts.tableColors.length;t++)0!==t&&t%E.opts.tableColorsStep==0&&(e+="<br>"),"REMOVE"!=E.opts.tableColors[t]?e+='<span class="fr-command" style="background: '+E.opts.tableColors[t]+';" tabIndex="-1" role="button" data-cmd="tableCellBackgroundColor" data-param1="'+E.opts.tableColors[t]+'"><span class="fr-sr-only">'+E.language.translate("Color")+" "+E.opts.tableColors[t]+" </span></span>":e+='<span class="fr-command" data-cmd="tableCellBackgroundColor" tabIndex="-1" role="button" data-param1="REMOVE" title="'+E.language.translate("Clear Formatting")+'">'+E.icon.create("tableColorRemove")+'<span class="fr-sr-only">'+E.language.translate("Clear Formatting")+"</span></span>";return e+="</div>"}(),custom_color:t},l=E.popups.create("table.colors",a);return E.events.$on(E.$wp,"scroll.table-colors",function(){E.popups.isVisible("table.colors")&&d()}),u=l,E.events.on("popup.tab",function(e){var t=O(e.currentTarget);if(!E.popups.isVisible("table.colors")||!t.is("span"))return!0;var a=e.which,l=!0;if(ee.KEYCODE.TAB==a){var r=u.find(".fr-buttons");l=!E.accessibility.focusToolbar(r,!!e.shiftKey)}else if(ee.KEYCODE.ARROW_UP==a||ee.KEYCODE.ARROW_DOWN==a||ee.KEYCODE.ARROW_LEFT==a||ee.KEYCODE.ARROW_RIGHT==a){var n=t.parent().find("span.fr-command"),s=n.index(t),o=E.opts.colorsStep,i=Math.floor(n.length/o),f=s%o,d=Math.floor(s/o),c=d*o+f,p=i*o;ee.KEYCODE.ARROW_UP==a?c=((c-o)%p+p)%p:ee.KEYCODE.ARROW_DOWN==a?c=(c+o)%p:ee.KEYCODE.ARROW_LEFT==a?c=((c-1)%p+p)%p:ee.KEYCODE.ARROW_RIGHT==a&&(c=(c+1)%p);var h=O(n.get(c));E.events.disableBlur(),h.focus(),l=!1}else ee.KEYCODE.ENTER==a&&(E.button.exec(t),l=!1);return!1===l&&(e.preventDefault(),e.stopPropagation()),l},!0),l;var u}()),E.popups.setContainer("table.colors",E.$sc);var s=I(r),o=(s.left+s.right)/2,i=s.bottom;e=E.popups.get("table.colors"),t=E.$el.find(".fr-selected-cell").first(),a=E.helpers.RGBToHex(t.css("background-color")),l=e.find(".fr-table-colors-hex-layer input"),e.find(".fr-selected-color").removeClass("fr-selected-color fr-active-item"),e.find('span[data-param1="'+a+'"]').addClass("fr-selected-color fr-active-item"),l.val(a).trigger("change"),E.popups.show("table.colors",o,i,s.bottom-s.top,!0)}}function o(){0===Z().length&&E.toolbar.enable()}function i(e){if(e)return E.popups.onHide("table.insert",function(){E.popups.get("table.insert").find('.fr-table-size .fr-select-table-size > span[data-row="1"][data-col="1"]').trigger("mouseover")}),!0;var t="";0<E.opts.tableInsertButtons.length&&(t='<div class="fr-buttons fr-tabs">'+E.button.buildList(E.opts.tableInsertButtons)+"</div>");var a,l={buttons:t,rows_columns:function(){for(var e='<div class="fr-table-size"><div class="fr-table-size-info">1 × 1</div><div class="fr-select-table-size">',t=1;t<=E.opts.tableInsertMaxSize;t++){for(var a=1;a<=E.opts.tableInsertMaxSize;a++){var l="inline-block";2<t&&!E.helpers.isMobile()&&(l="none");var r="fr-table-cell ";1==t&&1==a&&(r+=" hover"),e+='<span class="fr-command '+r+'" tabIndex="-1" data-cmd="tableInsert" data-row="'+t+'" data-col="'+a+'" data-param1="'+t+'" data-param2="'+a+'" style="display: '+l+';" role="button"><span></span><span class="fr-sr-only">'+t+" × "+a+" </span></span>"}e+='<div class="new-line"></div>'}return e+="</div></div>"}()},r=E.popups.create("table.insert",l);return E.events.$on(r,"mouseover",".fr-table-size .fr-select-table-size .fr-table-cell",function(e){c(O(e.currentTarget))},!0),a=r,E.events.$on(a,"focus","[tabIndex]",function(e){var t=O(e.currentTarget);c(t)}),E.events.on("popup.tab",function(e){var t=O(e.currentTarget);if(!E.popups.isVisible("table.insert")||!t.is("span, a"))return!0;var a,l=e.which;if(ee.KEYCODE.ARROW_UP==l||ee.KEYCODE.ARROW_DOWN==l||ee.KEYCODE.ARROW_LEFT==l||ee.KEYCODE.ARROW_RIGHT==l){if(t.is("span.fr-table-cell")){var r=t.parent().find("span.fr-table-cell"),n=r.index(t),s=E.opts.tableInsertMaxSize,o=n%s,i=Math.floor(n/s);ee.KEYCODE.ARROW_UP==l?i=Math.max(0,i-1):ee.KEYCODE.ARROW_DOWN==l?i=Math.min(E.opts.tableInsertMaxSize-1,i+1):ee.KEYCODE.ARROW_LEFT==l?o=Math.max(0,o-1):ee.KEYCODE.ARROW_RIGHT==l&&(o=Math.min(E.opts.tableInsertMaxSize-1,o+1));var f=i*s+o,d=O(r.get(f));c(d),E.events.disableBlur(),d.focus(),a=!1}}else ee.KEYCODE.ENTER==l&&(E.button.exec(t),a=!1);return!1===a&&(e.preventDefault(),e.stopPropagation()),a},!0),r}function c(e){var t=e.data("row");null!==t&&(t=parseInt(t));var a=e.data("col");null!==a&&(a=parseInt(a));var l=e.parent();l.siblings(".fr-table-size-info").html(t+" × "+a),l.find("> span").removeClass("hover fr-active-item");for(var r=1;r<=E.opts.tableInsertMaxSize;r++)for(var n=0;n<=E.opts.tableInsertMaxSize;n++){var s=l.find('> span[data-row="'+r+'"][data-col="'+n+'"]');r<=t&&n<=a?s.addClass("hover"):r<=t+1||r<=2&&!E.helpers.isMobile()?s.css("display","inline-block"):2<r&&!E.helpers.isMobile()&&s.css("display","none")}e.addClass("fr-active-item")}function p(e){if(e)return E.popups.onHide("table.edit",o),!0;if(0<E.opts.tableEditButtons.length){var t={buttons:'<div class="fr-buttons">'.concat(E.button.buildList(E.opts.tableEditButtons),"</div>")},a=E.popups.create("table.edit",t);return E.events.$on(E.$wp,"scroll.table-edit",function(){E.popups.isVisible("table.edit")&&h()}),a}return!1}function u(){if(0<Z().length){var e=Q();E.selection.setBefore(e.get(0))||E.selection.setAfter(e.get(0)),E.selection.restore(),E.popups.hide("table.edit"),e.remove(),E.toolbar.enable()}}function b(e){var t=Q();if(0<t.length){if(0<E.$el.find("th.fr-selected-cell").length&&"above"==e)return;var a,l,r,n=_(),s=M(n);if(null==s)return;l="above"==e?s.min_i:s.max_i;var o="<tr>";for(a=0;a<n[l].length;a++)if("below"==e&&l<n.length-1&&n[l][a]==n[l+1][a]||"above"==e&&0<l&&n[l][a]==n[l-1][a]){if(0===a||0<a&&n[l][a]!=n[l][a-1]){var i=O(n[l][a]);i.attr("rowspan",parseInt(i.attr("rowspan"),10)+1)}}else o+="<td><br></td>";o+="</tr>",r=0<E.$el.find("th.fr-selected-cell").length&&"below"==e?O(t.find("tbody").not(t.find("> table tbody"))):O(t.find("tr").not(t.find("> table tr")).get(l)),"below"==e?"TBODY"==r.attr("tagName")?r.prepend(o):r[0].parentNode&&r[0].insertAdjacentHTML("afterend",o):"above"==e&&(r.before(o),E.popups.isVisible("table.edit")&&h())}}function g(e,t,a){var l,r,n,s,o,i=0,f=_(a);if(e<(t=Math.min(t,f[0].length-1)))for(r=e;r<=t;r++)if(!(e<r&&f[0][r]==f[0][r-1])&&1<(s=Math.min(parseInt(f[0][r].getAttribute("colspan"),10)||1,t-e+1))&&f[0][r]==f[0][r+1])for(i=s-1,l=1;l<f.length;l++)if(f[l][r]!=f[l-1][r]){for(n=r;n<r+s;n++)if(1<(o=parseInt(f[l][n].getAttribute("colspan"),10)||1)&&f[l][n]==f[l][n+1])n+=i=Math.min(i,o-1);else if(!(i=Math.max(0,i-1)))break;if(!i)break}i&&v(f,i,"colspan",0,f.length-1,e,t)}function m(e,t,a){var l,r,n,s,o,i=0,f=_(a);if(e<(t=Math.min(t,f.length-1)))for(l=e;l<=t;l++)if(!(e<l&&f[l][0]==f[l-1][0])&&1<(s=Math.min(parseInt(f[l][0].getAttribute("rowspan"),10)||1,t-e+1))&&f[l][0]==f[l+1][0])for(i=s-1,r=1;r<f[0].length;r++)if(f[l][r]!=f[l][r-1]){for(n=l;n<l+s;n++)if(1<(o=parseInt(f[n][r].getAttribute("rowspan"),10)||1)&&f[n][r]==f[n+1][r])n+=i=Math.min(i,o-1);else if(!(i=Math.max(0,i-1)))break;if(!i)break}i&&v(f,i,"rowspan",e,t,0,f[0].length-1)}function v(e,t,a,l,r,n,s){var o,i,f;for(o=l;o<=r;o++)for(i=n;i<=s;i++)l<o&&e[o][i]==e[o-1][i]||n<i&&e[o][i]==e[o][i-1]||1<(f=parseInt(e[o][i].getAttribute(a),10)||1)&&(1<f-t?e[o][i].setAttribute(a,f-t):e[o][i].removeAttribute(a))}function w(e,t,a,l,r){m(e,t,r),g(a,l,r)}function t(e){var t=E.$el.find(".fr-selected-cell");"REMOVE"!=e?t.css("background-color",E.helpers.HEXtoRGB(e)):t.css("background-color",""),h()}function _(e){var f=[];return null==(e=e||null)&&0<Z().length&&(e=Q()),e&&e.findVisible("tr").not(e.find("> table tr")).each(function(o,e){var t=O(e),i=0;t.find("> th, > td").each(function(e,t){for(var a=O(t),l=parseInt(a.attr("colspan"),10)||1,r=parseInt(a.attr("rowspan"),10)||1,n=o;n<o+r;n++)for(var s=i;s<i+l;s++)f[n]||(f[n]=[]),f[n][s]?i++:f[n][s]=t;i+=l})}),f}function x(e,t){for(var a=0;a<t.length;a++)for(var l=0;l<t[a].length;l++)if(t[a][l]==e)return{row:a,col:l}}function $(e,t,a){for(var l=e+1,r=t+1;l<a.length;){if(a[l][t]!=a[e][t]){l--;break}l++}for(l==a.length&&l--;r<a[e].length;){if(a[e][r]!=a[e][t]){r--;break}r++}return r==a[e].length&&r--,{row:l,col:r}}function C(){E.el.querySelector(".fr-cell-fixed")&&E.el.querySelector(".fr-cell-fixed").classList.remove("fr-cell-fixed"),E.el.querySelector(".fr-cell-handler")&&E.el.querySelector(".fr-cell-handler").classList.remove("fr-cell-handler")}function D(){var e=E.$el.find(".fr-selected-cell");0<e.length&&e.each(function(){var e=O(this);e.removeClass("fr-selected-cell"),""===e.attr("class")&&e.removeAttr("class")}),C()}function y(){E.events.disableBlur(),E.selection.clear(),E.$el.addClass("fr-no-selection"),E.$el.blur(),E.events.enableBlur()}function M(e){var t=E.$el.find(".fr-selected-cell");if(0<t.length){var a,l=e.length,r=0,n=e[0].length,s=0;for(a=0;a<t.length;a++){var o=x(t[a],e),i=$(o.row,o.col,e);l=Math.min(o.row,l),r=Math.max(i.row,r),n=Math.min(o.col,n),s=Math.max(i.col,s)}return{min_i:l,max_i:r,min_j:n,max_j:s}}return null}function I(e){var t=M(e);if(null!=t){var a=O(e[t.min_i][t.min_j]),l=O(e[t.min_i][t.max_j]),r=O(e[t.max_i][t.min_j]);return{left:a.offset().left,right:l.offset().left+l.outerWidth(),top:a.offset().top,bottom:r.offset().top+r.outerHeight()}}}function S(t,a){if(O(t).is(a))D(),O(t).addClass("fr-selected-cell");else{y(),E.edit.off();var l=_(),r=x(t,l),n=x(a,l),s=function e(t,a,l,r,n){var s,o,i,f,d=t,c=a,p=l,h=r;for(s=d;s<=c;s++)(1<(parseInt(O(n[s][p]).attr("rowspan"),10)||1)||1<(parseInt(O(n[s][p]).attr("colspan"),10)||1))&&(f=$((i=x(n[s][p],n)).row,i.col,n),d=Math.min(i.row,d),c=Math.max(f.row,c),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(O(n[s][h]).attr("rowspan"),10)||1)||1<(parseInt(O(n[s][h]).attr("colspan"),10)||1))&&(f=$((i=x(n[s][h],n)).row,i.col,n),d=Math.min(i.row,d),c=Math.max(f.row,c),p=Math.min(i.col,p),h=Math.max(f.col,h));for(o=p;o<=h;o++)(1<(parseInt(O(n[d][o]).attr("rowspan"),10)||1)||1<(parseInt(O(n[d][o]).attr("colspan"),10)||1))&&(f=$((i=x(n[d][o],n)).row,i.col,n),d=Math.min(i.row,d),c=Math.max(f.row,c),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(O(n[c][o]).attr("rowspan"),10)||1)||1<(parseInt(O(n[c][o]).attr("colspan"),10)||1))&&(f=$((i=x(n[c][o],n)).row,i.col,n),d=Math.min(i.row,d),c=Math.max(f.row,c),p=Math.min(i.col,p),h=Math.max(f.col,h));return d==t&&c==a&&p==l&&h==r?{min_i:t,max_i:a,min_j:l,max_j:r}:e(d,c,p,h,n)}(Math.min(r.row,n.row),Math.max(r.row,n.row),Math.min(r.col,n.col),Math.max(r.col,n.col),l);D(),t.classList.add("fr-cell-fixed"),a.classList.add("fr-cell-handler");for(var o=s.min_i;o<=s.max_i;o++)for(var i=s.min_j;i<=s.max_j;i++)O(l[o][i]).addClass("fr-selected-cell")}}function T(e){var t=null,a=O(e.target);return"TD"==e.target.tagName||"TH"==e.target.tagName?t=e.target:0<a.closest("td").length?t=a.closest("td").get(0):0<a.closest("th").length&&(t=a.closest("th").get(0)),-1===E.$el.html.toString().search(t)?null:t}function N(){D(),E.popups.hide("table.edit")}function e(e){var t=T(e);if("false"==O(t).parents("[contenteditable]").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;if(0<Z().length&&!t&&N(),!E.edit.isDisabled()||E.popups.isVisible("table.edit"))if(1!=e.which||1==e.which&&E.helpers.isMac()&&e.ctrlKey)(3==e.which||1==e.which&&E.helpers.isMac()&&e.ctrlKey)&&t&&N();else if(n=!0,t){0<Z().length&&!e.shiftKey&&N(),e.stopPropagation(),E.events.trigger("image.hideResizer"),E.events.trigger("video.hideResizer"),r=!0;var a=t.tagName.toLowerCase();e.shiftKey&&0<E.$el.find(a+".fr-selected-cell").length?O(E.$el.find(a+".fr-selected-cell").closest("table")).is(O(t).closest("table"))?S(l,t):y():((E.keys.ctrlKey(e)||e.shiftKey)&&(1<Z().length||0===O(t).find(E.selection.element()).length&&!O(t).is(E.selection.element()))&&y(),l=t,0<E.opts.tableEditButtons.length&&S(l,l))}}function a(e){if(r||E.$tb.is(e.target)||E.$tb.is(O(e.target).closest(".fr-toolbar"))||(0<Z().length&&E.toolbar.enable(),D()),!(1!=e.which||1==e.which&&E.helpers.isMac()&&e.ctrlKey)){if(n=!1,r)r=!1,T(e)||1!=Z().length?0<Z().length&&(E.selection.isCollapsed()?h():D()):D();if(A){A=!1,R.removeClass("fr-moving"),E.$el.removeClass("fr-no-selection"),E.edit.on();var t=parseFloat(R.css("left"))+E.opts.tableResizerOffset+E.$wp.offset().left;E.opts.iframe&&(t-=E.$iframe.offset().left),R.data("release-position",t),R.removeData("max-left"),R.removeData("max-right"),function(){var e=R.data("origin"),t=R.data("release-position");if(e!==t){var a=R.data("first"),l=R.data("second"),r=R.data("table"),n=r.outerWidth();if(E.undo.canDo()||E.undo.saveStep(),null!=a&&null!=l){var s,o,i,f=_(r),d=[],c=[],p=[],h=[];for(s=0;s<f.length;s++)o=O(f[s][a]),i=O(f[s][l]),d[s]=o.outerWidth(),p[s]=i.outerWidth(),c[s]=d[s]/n*100,h[s]=p[s]/n*100;for(s=0;s<f.length;s++)if(o=O(f[s][a]),i=O(f[s][l]),f[s][a]!=f[s][l]){var u=(c[s]*(d[s]+t-e)/d[s]).toFixed(4);o.css("width",u+"%"),i.css("width",(c[s]+h[s]-u).toFixed(4)+"%")}}else{var b,g=r.parent(),m=n/g.width()*100,v=(parseInt(r.css("margin-left"),10)||0)/g.width()*100,w=(parseInt(r.css("margin-right"),10)||0)/g.width()*100;"rtl"==E.opts.direction&&0===l||"rtl"!=E.opts.direction&&0!==l?(b=(n+t-e)/n*m,r.css("margin-right","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(v).toFixed(4)+"%)")):("rtl"==E.opts.direction&&0!==l||"rtl"!=E.opts.direction&&0===l)&&(b=(n-t+e)/n*m,r.css("margin-left","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(w).toFixed(4)+"%)")),r.css("width",Math.round(b).toFixed(4)+"%")}E.selection.restore(),E.undo.saveStep(),E.events.trigger("table.resized",[r.get(0)])}R.removeData("origin"),R.removeData("release-position"),R.removeData("first"),R.removeData("second"),R.removeData("table")}(),Y()}}}function K(e){if(!0===r&&0<E.opts.tableEditButtons.length){if(O(e.currentTarget).closest("table").is(Q())){if("TD"==e.currentTarget.tagName&&0===E.$el.find("th.fr-selected-cell").length)return void S(l,e.currentTarget);if("TH"==e.currentTarget.tagName&&0===E.$el.find("td.fr-selected-cell").length)return void S(l,e.currentTarget)}y()}}function z(e,t,a,l){for(var r,n=t;n!=E.el&&"TD"!=n.tagName&&"TH"!=n.tagName&&("up"==l?r=n.previousElementSibling:"down"==l&&(r=n.nextElementSibling),!r);)n=n.parentNode;"TD"==n.tagName||"TH"==n.tagName?function(e,t){for(var a=e;a&&"TABLE"!=a.tagName&&a.parentNode!=E.el;)a=a.parentNode;if(a&&"TABLE"==a.tagName){var l=_(O(a));"up"==t?B(x(e,l),a,l):"down"==t&&k(x(e,l),a,l)}}(n,l):r&&("up"==l&&E.selection.setAtEnd(r),"down"==l&&E.selection.setAtStart(r))}function B(e,t,a){0<e.row?E.selection.setAtEnd(a[e.row-1][e.col]):z(0,t,0,"up")}function k(e,t,a){var l=parseInt(a[e.row][e.col].getAttribute("rowspan"),10)||1;e.row<a.length-l?E.selection.setAtStart(a[e.row+l][e.col]):z(0,t,0,"down")}function Y(){R&&(R.find("div").css("opacity",0),R.css("top",0),R.css("left",0),R.css("height",0),R.find("div").css("height",0),R.hide())}function W(){f&&f.removeClass("fr-visible").css("left","-9999px")}function L(e,t){var a=O(t),l=a.closest("table"),r=l.parent();if(t&&"TD"!=t.tagName&&"TH"!=t.tagName&&(0<a.closest("td").length?t=a.closest("td"):0<a.closest("th").length&&(t=a.closest("th"))),!t||"TD"!=t.tagName&&"TH"!=t.tagName)R&&a.get(0)!=R.get(0)&&a.parent().get(0)!=R.get(0)&&E.core.sameInstance(R)&&Y();else{if(a=O(t),0===E.$el.find(a).length)return!1;var n=a.offset().left-1,s=n+a.outerWidth();if(Math.abs(e.pageX-n)<=E.opts.tableResizerOffset||Math.abs(s-e.pageX)<=E.opts.tableResizerOffset){var o,i,f,d,c,p=_(l),h=x(t,p),u=$(h.row,h.col,p),b=l.offset().top,g=l.outerHeight()-1;"rtl"!=E.opts.direction?e.pageX-n<=E.opts.tableResizerOffset?(f=n,0<h.col?(d=n-j(h.col-1,p)+E.opts.tableResizingLimit,c=n+j(h.col,p)-E.opts.tableResizingLimit,o=h.col-1,i=h.col):(o=null,i=0,d=l.offset().left-1-parseInt(l.css("margin-left"),10),c=l.offset().left-1+l.width()-p[0].length*E.opts.tableResizingLimit)):s-e.pageX<=E.opts.tableResizerOffset&&(f=s,u.col<p[u.row].length&&p[u.row][u.col+1]?(d=s-j(u.col,p)+E.opts.tableResizingLimit,c=s+j(u.col+1,p)-E.opts.tableResizingLimit,o=u.col,i=u.col+1):(o=u.col,i=null,d=l.offset().left-1+p[0].length*E.opts.tableResizingLimit,c=r.offset().left-1+r.width()+parseFloat(r.css("padding-left")))):s-e.pageX<=E.opts.tableResizerOffset?(f=s,0<h.col?(d=s-j(h.col,p)+E.opts.tableResizingLimit,c=s+j(h.col-1,p)-E.opts.tableResizingLimit,o=h.col,i=h.col-1):(o=null,i=0,d=l.offset().left+p[0].length*E.opts.tableResizingLimit,c=r.offset().left-1+r.width()+parseFloat(r.css("padding-left")))):e.pageX-n<=E.opts.tableResizerOffset&&(f=n,u.col<p[u.row].length&&p[u.row][u.col+1]?(d=n-j(u.col+1,p)+E.opts.tableResizingLimit,c=n+j(u.col,p)-E.opts.tableResizingLimit,o=u.col+1,i=u.col):(o=u.col,i=null,d=r.offset().left+parseFloat(r.css("padding-left")),c=l.offset().left-1+l.width()-p[0].length*E.opts.tableResizingLimit)),R||(E.shared.$table_resizer||(E.shared.$table_resizer=O(document.createElement("div")).attr("class","fr-table-resizer").html("<div></div>")),R=E.shared.$table_resizer,E.events.$on(R,"mousedown",function(e){return!E.core.sameInstance(R)||(0<Z().length&&N(),1==e.which?(E.selection.save(),A=!0,R.addClass("fr-moving"),y(),E.edit.off(),R.find("div").css("opacity",1),!1):void 0)}),E.events.$on(R,"mousemove",function(e){if(!E.core.sameInstance(R))return!0;A&&(E.opts.iframe&&(e.pageX-=E.$iframe.offset().left),G(e))}),E.events.on("shared.destroy",function(){R.html("").removeData().remove(),R=null},!0),E.events.on("destroy",function(){E.$el.find(".fr-selected-cell").removeClass("fr-selected-cell"),O("body").first().append(R.hide())},!0)),R.data("table",l),R.data("first",o),R.data("second",i),R.data("instance",E),E.$wp.append(R);var m=f-E.win.pageXOffset-E.opts.tableResizerOffset-E.$wp.offset().left,v=b-E.$wp.offset().top+E.$wp.scrollTop();if(E.opts.iframe){var w=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-top")),C=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-left"));m+=E.$iframe.offset().left+C,v+=E.$iframe.offset().top+w,d+=E.$iframe.offset().left,c+=E.$iframe.offset().left}R.data("max-left",d),R.data("max-right",c),R.data("origin",f-E.win.pageXOffset),R.css("top",v),R.css("left",m),R.css("height",g),R.find("div").css("height",g),R.css("padding-left",E.opts.tableResizerOffset),R.css("padding-right",E.opts.tableResizerOffset),R.show()}else E.core.sameInstance(R)&&Y()}}function F(e,t){if(E.$box.find(".fr-line-breaker").isVisible())return!1;f||q(),E.$box.append(f),f.data("instance",E);var a,l=O(t).find("tr").first(),r=e.pageX,n=0,s=0;if(E.opts.iframe){var o=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-top")),i=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-left"));n+=E.$iframe.offset().left-E.helpers.scrollLeft()+i,s+=E.$iframe.offset().top-E.helpers.scrollTop()+o}l.find("th, td").each(function(){var e=O(this);return e.offset().left<=r&&r<e.offset().left+e.outerWidth()/2?(a=parseInt(f.find("a").css("width"),10),f.css("top",s+e.offset().top-E.$box.offset().top-a-5),f.css("left",n+e.offset().left-E.$box.offset().left-a/2),f.data("selected-cell",e),f.data("position","before"),f.addClass("fr-visible"),!1):e.offset().left+e.outerWidth()/2<=r&&r<e.offset().left+e.outerWidth()?(a=parseInt(f.find("a").css("width"),10),f.css("top",s+e.offset().top-E.$box.offset().top-a-5),f.css("left",n+e.offset().left-E.$box.offset().left+e.outerWidth()-a/2),f.data("selected-cell",e),f.data("position","after"),f.addClass("fr-visible"),!1):void 0})}function H(e,t){if(E.$box.find(".fr-line-breaker").isVisible())return!1;f||q(),E.$box.append(f),f.data("instance",E);var a,l=O(t),r=e.pageY,n=0,s=0;if(E.opts.iframe){var o=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-top")),i=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-left"));n+=E.$iframe.offset().left-E.helpers.scrollLeft()+i,s+=E.$iframe.offset().top-E.helpers.scrollTop()+o}l.find("tr").each(function(){var e=O(this);return e.offset().top<=r&&r<e.offset().top+e.outerHeight()/2?(a=parseInt(f.find("a").css("width"),10),f.css("top",s+e.offset().top-E.$box.offset().top-a/2),f.css("left",n+e.offset().left-E.$box.offset().left-a-5),f.data("selected-cell",e.find("td").first()),f.data("position","above"),f.addClass("fr-visible"),!1):e.offset().top+e.outerHeight()/2<=r&&r<e.offset().top+e.outerHeight()?(a=parseInt(f.find("a").css("width"),10),f.css("top",s+e.offset().top-E.$box.offset().top+e.outerHeight()-a/2),f.css("left",n+e.offset().left-E.$box.offset().left-a-5),f.data("selected-cell",e.find("td").first()),f.data("position","below"),f.addClass("fr-visible"),!1):void 0})}function V(e){s=null;var t=E.doc.elementFromPoint(e.pageX-E.win.pageXOffset,e.pageY-E.win.pageYOffset);E.opts.tableResizer&&(!E.popups.areVisible()||E.popups.areVisible()&&E.popups.isVisible("table.edit"))&&L(e,t),!E.opts.tableInsertHelper||E.popups.areVisible()||E.$tb.hasClass("fr-inline")&&E.$tb.isVisible()||function(e,t){if(0===Z().length){var a,l,r;if(t&&("HTML"==t.tagName||"BODY"==t.tagName||E.node.isElement(t)))for(a=1;a<=E.opts.tableInsertHelperOffset;a++){if(l=E.doc.elementFromPoint(e.pageX-E.win.pageXOffset,e.pageY-E.win.pageYOffset+a),O(l).hasClass("fr-tooltip"))return;if(l&&("TH"==l.tagName||"TD"==l.tagName||"TABLE"==l.tagName)&&(O(l).parents(".fr-wrapper").length||E.opts.iframe))return F(e,O(l).closest("table"));if(r=E.doc.elementFromPoint(e.pageX-E.win.pageXOffset+a,e.pageY-E.win.pageYOffset),O(r).hasClass("fr-tooltip"))return;if(r&&("TH"==r.tagName||"TD"==r.tagName||"TABLE"==r.tagName)&&(O(r).parents(".fr-wrapper").length||E.opts.iframe))return H(e,O(r).closest("table"))}E.core.sameInstance(f)&&W()}}(e,t)}function P(){if(A){var e=R.data("table").offset().top-E.win.pageYOffset;if(E.opts.iframe){var t=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-top"));e+=E.$iframe.offset().top-E.helpers.scrollTop()+t}R.css("top",e)}}function j(e,t){var a,l=O(t[0][e]).outerWidth();for(a=1;a<t.length;a++)l=Math.min(l,O(t[a][e]).outerWidth());return l}function X(e,t,a){var l,r=0;for(l=e;l<=t;l++)r+=j(l,a);return r}function G(e){if(1<Z().length&&n&&y(),!1===n&&!1===r&&!1===A)s&&clearTimeout(s),E.edit.isDisabled()&&!E.popups.isVisible("table.edit")||(s=setTimeout(V,30,e));else if(A){var t=e.pageX-E.win.pageXOffset;E.opts.iframe&&(t+=E.$iframe.offset().left);var a=R.data("max-left"),l=R.data("max-right");a<=t&&t<=l?R.css("left",t-E.opts.tableResizerOffset-E.$wp.offset().left):t<a&&parseFloat(R.css("left"),10)>a-E.opts.tableResizerOffset?R.css("left",a-E.opts.tableResizerOffset-E.$wp.offset().left):l<t&&parseFloat(R.css("left"),10)<l-E.opts.tableResizerOffset&&R.css("left",l-E.opts.tableResizerOffset-E.$wp.offset().left)}else n&&W()}function U(e){E.node.isEmpty(e.get(0))?e.prepend(ee.MARKERS):e.prepend(ee.START_MARKER).append(ee.END_MARKER)}function q(){E.shared.$ti_helper||(E.shared.$ti_helper=O(document.createElement("div")).attr("class","fr-insert-helper").html('<a class="fr-floating-btn" role="button" tabIndex="-1" title="'+E.language.translate("Insert")+'"><svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M22,16.75 L16.75,16.75 L16.75,22 L15.25,22.000 L15.25,16.75 L10,16.75 L10,15.25 L15.25,15.25 L15.25,10 L16.75,10 L16.75,15.25 L22,15.25 L22,16.75 Z"/></svg></a>'),E.events.bindClick(E.shared.$ti_helper,"a",function(){var e=f.data("selected-cell"),t=f.data("position"),a=f.data("instance")||E;"before"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertColumn(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"after"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertColumn(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"above"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertRow(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"below"==t&&(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertRow(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()),W()}),E.events.on("shared.destroy",function(){E.shared.$ti_helper.html("").removeData().remove(),E.shared.$ti_helper=null},!0),E.events.$on(E.shared.$ti_helper,"mousemove",function(e){e.stopPropagation()},!0),E.events.$on(O(E.o_win),"scroll",function(){W()},!0),E.events.$on(E.$wp,"scroll",function(){W()},!0)),f=E.shared.$ti_helper,E.events.on("destroy",function(){f=null}),E.tooltip.bind(E.$box,".fr-insert-helper > a.fr-floating-btn")}function J(){l=null,clearTimeout(s)}function Z(){return E.el.querySelectorAll(".fr-selected-cell")}function Q(){var e=Z();if(e.length){for(var t=e[0];t&&"TABLE"!=t.tagName&&t.parentNode!=E.el;)t=t.parentNode;return t&&"TABLE"==t.tagName?O(t):O([])}return O([])}return{_init:function(){if(!E.$wp)return!1;if(!E.helpers.isMobile()){A=r=n=!1,E.events.$on(E.$el,"mousedown",e),E.popups.onShow("image.edit",function(){D(),r=n=!1}),E.popups.onShow("link.edit",function(){D(),r=n=!1}),E.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&D()}),E.events.$on(E.$el,"mouseover","th, td",K),E.events.$on(E.$win,"mouseup",a),E.opts.iframe&&E.events.$on(O(E.o_win),"mouseup",a),E.events.$on(E.$win,"mousemove",G),E.events.$on(O(E.o_win),"scroll",P),E.events.on("contentChanged",function(){0<Z().length&&(h(),E.$el.find("img").on("load.selected-cells",function(){O(this).off("load.selected-cells"),0<Z().length&&h()}))}),E.events.$on(O(E.o_win),"resize",function(){D()}),E.events.on("toolbar.esc",function(){if(0<Z().length)return E.events.disableBlur(),E.events.focus(),!1},!0),E.events.$on(O(E.o_win),"keydown",function(){n&&r&&(r=n=!1,E.$el.removeClass("fr-no-selection"),E.edit.on(),E.selection.setAtEnd(E.$el.find(".fr-selected-cell").last().get(0)),E.selection.restore(),D())}),E.events.$on(E.$el,"keydown",function(e){e.shiftKey?!1===function(e){var t=Z();if(null!=t&&0<t.length){var a,l,r=_(),n=e.which;1==t.length?l=a=t[0]:(a=E.el.querySelector(".fr-cell-fixed"),l=E.el.querySelector(".fr-cell-handler"));var s=x(l,r);if(ee.KEYCODE.ARROW_RIGHT==n){if(s.col<r[0].length-1)return S(a,r[s.row][s.col+1]),!1}else if(ee.KEYCODE.ARROW_DOWN==n){if(s.row<r.length-1)return S(a,r[s.row+1][s.col]),!1}else if(ee.KEYCODE.ARROW_LEFT==n){if(0<s.col)return S(a,r[s.row][s.col-1]),!1}else if(ee.KEYCODE.ARROW_UP==n&&0<s.row)return S(a,r[s.row-1][s.col]),!1}}(e)&&setTimeout(function(){h()},0):function(e){var t=e.which,a=E.selection.blocks();if(a.length&&("TD"==(a=a[0]).tagName||"TH"==a.tagName)){for(var l=a;l&&"TABLE"!=l.tagName&&l.parentNode!=E.el;)l=l.parentNode;if(l&&"TABLE"==l.tagName&&(ee.KEYCODE.ARROW_LEFT==t||ee.KEYCODE.ARROW_UP==t||ee.KEYCODE.ARROW_RIGHT==t||ee.KEYCODE.ARROW_DOWN==t)&&(0<Z().length&&N(),E.browser.webkit&&(ee.KEYCODE.ARROW_UP==t||ee.KEYCODE.ARROW_DOWN==t))){var r=E.selection.ranges(0).startContainer;if(r.nodeType==Node.TEXT_NODE&&(ee.KEYCODE.ARROW_UP==t&&r.previousSibling||ee.KEYCODE.ARROW_DOWN==t&&r.nextSibling))return;e.preventDefault(),e.stopPropagation();var n=_(O(l)),s=x(a,n);ee.KEYCODE.ARROW_UP==t?B(s,l,n):ee.KEYCODE.ARROW_DOWN==t&&k(s,l,n),E.selection.restore()}}}(e)}),E.events.on("keydown",function(e){if(!1===function(e){if(e.which==ee.KEYCODE.TAB){var t;if(0<Z().length)t=E.$el.find(".fr-selected-cell").last();else{var a=E.selection.element();"TD"==a.tagName||"TH"==a.tagName?t=O(a):a!=E.el&&(0<O(a).parentsUntil(E.$el,"td").length?t=O(a).parents("td").first():0<O(a).parentsUntil(E.$el,"th").length&&(t=O(a).parents("th").first()))}if(t)return e.preventDefault(),!!(0<O(E.selection.element()).parentsUntil(E.$el,"ol, ul").length&&(0<O(E.selection.element()).parents("li").prev().length||O(E.selection.element()).is("li")&&0<O(E.selection.element()).prev().length))||(N(),e.shiftKey?0<t.prev().length?U(t.prev()):0<t.closest("tr").length&&0<t.closest("tr").prev().length?U(t.closest("tr").prev().find("td").last()):0<t.closest("tbody").length&&0<t.closest("table").find("thead tr").length&&U(t.closest("table").find("thead tr th").last()):0<t.next().length?U(t.next()):0<t.closest("tr").length&&0<t.closest("tr").next().length?U(t.closest("tr").next().find("td").first()):0<t.closest("thead").length&&0<t.closest("table").find("tbody tr").length?U(t.closest("table").find("tbody tr td").first()):(t.addClass("fr-selected-cell"),b("below"),D(),U(t.closest("tr").next().find("td").first())),E.selection.restore(),!1)}}(e))return!1;var t=Z();if(0<t.length){if(0<t.length&&E.keys.ctrlKey(e)&&e.which==ee.KEYCODE.A)return D(),E.popups.isVisible("table.edit")&&E.popups.hide("table.edit"),t=[],!0;if(e.which==ee.KEYCODE.ESC&&E.popups.isVisible("table.edit"))return D(),E.popups.hide("table.edit"),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!(t=[]);if(1<t.length&&(e.which==ee.KEYCODE.BACKSPACE||e.which==ee.KEYCODE.DELETE)){E.undo.saveStep();for(var a=0;a<t.length;a++)O(t[a]).html("<br>"),a==t.length-1&&O(t[a]).prepend(ee.MARKERS);return E.selection.restore(),E.undo.saveStep(),!(t=[])}if(1<t.length&&e.which!=ee.KEYCODE.F10&&!E.keys.isBrowserAction(e))return e.preventDefault(),!(t=[])}else if(!(t=[])===function(e){if(e.altKey&&e.which==ee.KEYCODE.SPACE){var t,a=E.selection.element();if("TD"==a.tagName||"TH"==a.tagName?t=a:0<O(a).closest("td").length?t=O(a).closest("td").get(0):0<O(a).closest("th").length&&(t=O(a).closest("th").get(0)),t)return e.preventDefault(),S(t,t),h(),!1}}(e))return!1},!0);var t=[];E.events.on("html.beforeGet",function(){t=Z();for(var e=0;e<t.length;e++)t[e].className=(t[e].className||"").replace(/fr-selected-cell/g,"")}),E.events.on("html.afterGet",function(){for(var e=0;e<t.length;e++)t[e].className=(t[e].className?t[e].className.trim()+" ":"")+"fr-selected-cell";t=[]}),i(!0),p(!0)}E.events.on("destroy",J)},insert:function(e,t){var a,l,r="<table "+(E.opts.tableDefaultWidth?'style="width: '+E.opts.tableDefaultWidth+';" ':"")+'class="fr-inserted-table"><tbody>',n=100/t;for(a=0;a<e;a++){for(r+="<tr>",l=0;l<t;l++)r+="<td"+(E.opts.tableDefaultWidth?' style="width: '+n.toFixed(4)+'%;"':"")+">",0===a&&0===l&&(r+=ee.MARKERS),r+="<br></td>";r+="</tr>"}r+="</tbody></table>",E.html.insert(r),E.selection.restore();var s=E.$el.find(".fr-inserted-table");s.removeClass("fr-inserted-table"),E.events.trigger("table.inserted",[s.get(0)])},remove:u,insertRow:b,deleteRow:function(){var e=Q();if(0<e.length){var t,a,l,r=_(),n=M(r);if(null==n)return;if(0===n.min_i&&n.max_i==r.length-1)u();else{for(t=n.max_i;t>=n.min_i;t--){for(l=O(e.find("tr").not(e.find("> table tr")).get(t)),a=0;a<r[t].length;a++)if(0===a||r[t][a]!=r[t][a-1]){var s=O(r[t][a]);if(1<parseInt(s.attr("rowspan"),10)){var o=parseInt(s.attr("rowspan"),10)-1;1==o?s.removeAttr("rowspan"):s.attr("rowspan",o)}if(t<r.length-1&&r[t][a]==r[t+1][a]&&(0===t||r[t][a]!=r[t-1][a])){for(var i=r[t][a],f=a;0<f&&r[t][f]==r[t][f-1];)f--;0===f?O(e.find("tr").not(e.find("> table tr")).get(t+1)).prepend(i):O(r[t+1][f-1])[0].parentNode&&O(r[t+1][f-1])[0].insertAdjacentElement("afterend",i)}}var d=l.parent();l.remove(),0===d.find("tr").length&&d.remove(),r=_(e)}w(0,r.length-1,0,r[0].length-1,e),0<n.min_i?E.selection.setAtEnd(r[n.min_i-1][0]):E.selection.setAtEnd(r[0][0]),E.selection.restore(),E.popups.hide("table.edit")}}},insertColumn:function(i){var e=Q();if(0<e.length){var f,d=_(),t=M(d);f="before"==i?t.min_j:t.max_j;var a,c=100/d[0].length,p=100/(d[0].length+1);e.find("th, td").each(function(){(a=O(this)).data("old-width",a.outerWidth()/e.outerWidth()*100)}),e.find("tr").not(e.find("> table tr")).each(function(e){for(var t,a=O(this),l=0,r=0;l-1<f;){if(!(t=a.find("> th, > td").get(r))){t=null;break}t==d[e][l]?(l+=parseInt(O(t).attr("colspan"),10)||1,r++):(l+=parseInt(O(d[e][l]).attr("colspan"),10)||1,"after"==i&&(t=0===r?-1:a.find("> th, > td").get(r-1)))}var n,s=O(t);if("after"==i&&f<l-1||"before"==i&&0<f&&d[e][f]==d[e][f-1]){if(0===e||0<e&&d[e][f]!=d[e-1][f]){var o=parseInt(s.attr("colspan"),10)+1;s.attr("colspan",o),s.css("width",(s.data("old-width")*p/c+p).toFixed(4)+"%"),s.removeData("old-width")}}else n=0<a.find("th").length?'<th style="width: '+p.toFixed(4)+'%;"><br></th>':'<td style="width: '+p.toFixed(4)+'%;"><br></td>',-1==t?a.prepend(n):null==t?a.append(n):"before"==i?s.before(n):"after"==i&&s[0].parentNode&&s[0].insertAdjacentHTML("afterend",n)}),e.find("th, td").each(function(){(a=O(this)).data("old-width")&&(a.css("width",(a.data("old-width")*p/c).toFixed(4)+"%"),a.removeData("old-width"))}),E.popups.isVisible("table.edit")&&h()}},deleteColumn:function(){var e=Q();if(0<e.length){var t,a,l,r=_(),n=M(r);if(null==n)return;if(0===n.min_j&&n.max_j==r[0].length-1)u();else{var s=0;for(t=0;t<r.length;t++)for(a=0;a<r[0].length;a++)(l=O(r[t][a])).hasClass("fr-selected-cell")||(l.data("old-width",l.outerWidth()/e.outerWidth()*100),(a<n.min_j||a>n.max_j)&&(s+=l.outerWidth()/e.outerWidth()*100));for(s/=r.length,a=n.max_j;a>=n.min_j;a--)for(t=0;t<r.length;t++)if(0===t||r[t][a]!=r[t-1][a])if(l=O(r[t][a]),1<(parseInt(l.attr("colspan"),10)||1)){var o=parseInt(l.attr("colspan"),10)-1;1==o?l.removeAttr("colspan"):l.attr("colspan",o),l.css("width",(100*(l.data("old-width")-j(a,r))/s).toFixed(4)+"%"),l.removeData("old-width")}else{var i=O(l.parent().get(0));l.remove(),0===i.find("> th, > td").length&&(0===i.prev().length||0===i.next().length||i.prev().find("> th[rowspan], > td[rowspan]").length<i.prev().find("> th, > td").length)&&i.remove()}w(0,r.length-1,0,r[0].length-1,e),0<n.min_j?E.selection.setAtEnd(r[n.min_i][n.min_j-1]):E.selection.setAtEnd(r[n.min_i][0]),E.selection.restore(),E.popups.hide("table.edit"),e.find("th, td").each(function(){(l=O(this)).data("old-width")&&(l.css("width",(100*l.data("old-width")/s).toFixed(4)+"%"),l.removeData("old-width"))})}}},mergeCells:function(){if(1<Z().length&&(0===E.$el.find("th.fr-selected-cell").length||0===E.$el.find("td.fr-selected-cell").length)){C();var e,t,a=M(_());if(null==a)return;var l=E.$el.find(".fr-selected-cell"),r=O(l[0]),n=r.parent().find(".fr-selected-cell"),s=r.closest("table"),o=r.html(),i=0;for(e=0;e<n.length;e++)i+=O(n[e]).outerWidth();for(r.css("width",Math.min(100,i/s.outerWidth()*100).toFixed(4)+"%"),a.min_j<a.max_j&&r.attr("colspan",a.max_j-a.min_j+1),a.min_i<a.max_i&&r.attr("rowspan",a.max_i-a.min_i+1),e=1;e<l.length;e++)"<br>"!=(t=O(l[e])).html()&&""!==t.html()&&(o+="<br>"+t.html()),t.remove();r.html(o),E.selection.setAtEnd(r.get(0)),E.selection.restore(),E.toolbar.enable(),m(a.min_i,a.max_i,s);var f=s.find("tr:empty");for(e=f.length-1;0<=e;e--)O(f[e]).remove();g(a.min_j,a.max_j,s),h()}},splitCellVertically:function(){if(1==Z().length){var e=E.$el.find(".fr-selected-cell"),t=parseInt(e.attr("colspan"),10)||1,a=e.parent().outerWidth(),l=e.outerWidth(),r=e.clone().html("<br>"),n=_(),s=x(e.get(0),n);if(1<t){var o=Math.ceil(t/2);l=X(s.col,s.col+o-1,n)/a*100;var i=X(s.col+o,s.col+t-1,n)/a*100;1<o?e.attr("colspan",o):e.removeAttr("colspan"),1<t-o?r.attr("colspan",t-o):r.removeAttr("colspan"),e.css("width",l.toFixed(4)+"%"),r.css("width",i.toFixed(4)+"%")}else{var f;for(f=0;f<n.length;f++)if(0===f||n[f][s.col]!=n[f-1][s.col]){var d=O(n[f][s.col]);if(!d.is(e)){var c=(parseInt(d.attr("colspan"),10)||1)+1;d.attr("colspan",c)}}l=l/a*100/2,e.css("width",l.toFixed(4)+"%"),r.css("width",l.toFixed(4)+"%")}e[0].parentNode&&e[0].insertAdjacentElement("afterend",r[0]),D(),E.popups.hide("table.edit")}},splitCellHorizontally:function(){if(1==Z().length){var e=E.$el.find(".fr-selected-cell"),t=e.parent(),a=e.closest("table"),l=parseInt(e.attr("rowspan"),10),r=_(),n=x(e.get(0),r),s=e.clone().html("<br>");if(1<l){var o=Math.ceil(l/2);1<o?e.attr("rowspan",o):e.removeAttr("rowspan"),1<l-o?s.attr("rowspan",l-o):s.removeAttr("rowspan");for(var i=n.row+o,f=0===n.col?n.col:n.col-1;0<=f&&(r[i][f]==r[i][f-1]||0<i&&r[i][f]==r[i-1][f]);)f--;-1==f?O(a.find("tr").not(a.find("> table tr")).get(i)).prepend(s):O(r[i][f])[0].parentNode&&O(r[i][f])[0].insertAdjacentElement("afterend",s[0])}else{var d,c=O(document.createElement("tr")).append(s);for(d=0;d<r[0].length;d++)if(0===d||r[n.row][d]!=r[n.row][d-1]){var p=O(r[n.row][d]);p.is(e)||p.attr("rowspan",(parseInt(p.attr("rowspan"),10)||1)+1)}t[0].parentNode&&t[0].insertAdjacentElement("afterend",c[0])}D(),E.popups.hide("table.edit")}},addHeader:function(){var e=Q();if(0<e.length&&0===e.find("th").length){var t,a="<thead><tr>",l=0;for(e.find("tr").first().find("> td").each(function(){var e=O(this);l+=parseInt(e.attr("colspan"),10)||1}),t=0;t<l;t++)a+="<th><br></th>";a+="</tr></thead>",e.prepend(a),h()}},removeHeader:function(){var e=Q(),t=e.find("thead");if(0<t.length)if(0===e.find("tbody tr").length)u();else if(t.remove(),0<Z().length)h();else{E.popups.hide("table.edit");var a=e.find("tbody tr").first().find("td").first().get(0);a&&(E.selection.setAtEnd(a),E.selection.restore())}},setBackground:t,showInsertPopup:function(){var e=E.$tb.find('.fr-command[data-cmd="insertTable"]'),t=E.popups.get("table.insert");if(t||(t=i()),!t.hasClass("fr-active")){E.popups.refresh("table.insert"),E.popups.setContainer("table.insert",E.$tb);var a=E.button.getPosition(e),l=a.left,r=a.top;E.popups.show("table.insert",l,r,e.outerHeight())}},showEditPopup:h,showColorsPopup:d,back:function(){0<Z().length?h():(E.popups.hide("table.insert"),E.toolbar.showInline())},verticalAlign:function(e){E.$el.find(".fr-selected-cell").css("vertical-align",e)},horizontalAlign:function(e){E.$el.find(".fr-selected-cell").css("text-align",e)},applyStyle:function(e,t,a,l){if(0<t.length){if(!a){var r=Object.keys(l);r.splice(r.indexOf(e),1),t.removeClass(r.join(" "))}t.toggleClass(e)}},selectedTable:Q,selectedCells:Z,customColor:function(){var e=E.popups.get("table.colors").find(".fr-table-colors-hex-layer input");e.length&&t(e.val())},selectCells:S}},ee.DefineIcon("insertTable",{NAME:"table",SVG_KEY:"insertTable"}),ee.RegisterCommand("insertTable",{title:"Insert Table",undo:!1,focus:!0,refreshOnCallback:!1,popup:!0,callback:function(){this.popups.isVisible("table.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("table.insert")):this.table.showInsertPopup()},plugin:"table"}),ee.RegisterCommand("tableInsert",{callback:function(e,t,a){this.table.insert(t,a),this.popups.hide("table.insert")}}),ee.DefineIcon("tableHeader",{NAME:"header",FA5NAME:"heading",SVG_KEY:"tableHeader"}),ee.RegisterCommand("tableHeader",{title:"Table Header",focus:!1,toggle:!0,callback:function(){this.popups.get("table.edit").find('.fr-command[data-cmd="tableHeader"]').hasClass("fr-active")?this.table.removeHeader():this.table.addHeader()},refresh:function(e){var t=this.table.selectedTable();0<t.length&&(0===t.find("th").length?e.removeClass("fr-active").attr("aria-pressed",!1):e.addClass("fr-active").attr("aria-pressed",!0))}}),ee.DefineIcon("tableRows",{NAME:"bars",SVG_KEY:"row"}),ee.RegisterCommand("tableRows",{type:"dropdown",focus:!1,title:"Row",options:{above:"Insert row above",below:"Insert row below","delete":"Delete row"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableRows.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableRows" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){"above"==t||"below"==t?this.table.insertRow(t):this.table.deleteRow()}}),ee.DefineIcon("tableColumns",{NAME:"bars fa-rotate-90",SVG_KEY:"columns"}),ee.RegisterCommand("tableColumns",{type:"dropdown",focus:!1,title:"Column",options:{before:"Insert column before",after:"Insert column after","delete":"Delete column"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableColumns.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableColumns" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){"before"==t||"after"==t?this.table.insertColumn(t):this.table.deleteColumn()}}),ee.DefineIcon("tableCells",{NAME:"square-o",FA5NAME:"square",SVG_KEY:"cellOptions"}),ee.RegisterCommand("tableCells",{type:"dropdown",focus:!1,title:"Cell",options:{merge:"Merge cells","vertical-split":"Vertical split","horizontal-split":"Horizontal split"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableCells.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCells" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){"merge"==t?this.table.mergeCells():"vertical-split"==t?this.table.splitCellVertically():this.table.splitCellHorizontally()},refreshOnShow:function(e,t){1<this.$el.find(".fr-selected-cell").length?(t.find('a[data-param1="vertical-split"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="horizontal-split"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="merge"]').removeClass("fr-disabled").attr("aria-disabled",!1)):(t.find('a[data-param1="merge"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="vertical-split"]').removeClass("fr-disabled").attr("aria-disabled",!1),t.find('a[data-param1="horizontal-split"]').removeClass("fr-disabled").attr("aria-disabled",!1))}}),ee.DefineIcon("tableRemove",{NAME:"trash",SVG_KEY:"removeTable"}),ee.RegisterCommand("tableRemove",{title:"Remove Table",focus:!1,callback:function(){this.table.remove()}}),ee.DefineIcon("tableStyle",{NAME:"paint-brush",SVG_KEY:"tableStyle"}),ee.RegisterCommand("tableStyle",{title:"Table Style",type:"dropdown",focus:!1,html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.tableStyles;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableStyle" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.applyStyle(t,this.$el.find(".fr-selected-cell").closest("table"),this.opts.tableMultipleStyles,this.opts.tableStyles)},refreshOnShow:function(e,t){var a=this.$,l=this.$el.find(".fr-selected-cell").closest("table");l&&t.find(".fr-command").each(function(){var e=a(this).data("param1"),t=l.hasClass(e);a(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),ee.DefineIcon("tableCellBackground",{NAME:"tint",SVG_KEY:"cellBackground"}),ee.RegisterCommand("tableCellBackground",{title:"Cell Background",focus:!1,popup:!0,callback:function(){this.table.showColorsPopup()}}),ee.RegisterCommand("tableCellBackgroundColor",{undo:!0,focus:!1,callback:function(e,t){this.table.setBackground(t)}}),ee.DefineIcon("tableBack",{NAME:"arrow-left",SVG_KEY:"back"}),ee.RegisterCommand("tableBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.table.back()},refresh:function(e){0!==this.table.selectedCells().length||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.DefineIcon("tableCellVerticalAlign",{NAME:"arrows-v",FA5NAME:"arrows-alt-v",SVG_KEY:"verticalAlignMiddle"}),ee.RegisterCommand("tableCellVerticalAlign",{type:"dropdown",focus:!1,title:"Vertical Align",options:{Top:"Align Top",Middle:"Align Middle",Bottom:"Align Bottom"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableCellVerticalAlign.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellVerticalAlign" data-param1="'+a.toLowerCase()+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(a)+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.verticalAlign(t)},refreshOnShow:function(e,t){t.find('.fr-command[data-param1="'+this.$el.find(".fr-selected-cell").css("vertical-align")+'"]').addClass("fr-active").attr("aria-selected",!0)}}),ee.DefineIcon("tableCellHorizontalAlign",{NAME:"align-left",SVG_KEY:"alignLeft"}),ee.DefineIcon("align-left",{NAME:"align-left",SVG_KEY:"alignLeft"}),ee.DefineIcon("align-right",{NAME:"align-right",SVG_KEY:"alignRight"}),ee.DefineIcon("align-center",{NAME:"align-center",SVG_KEY:"alignCenter"}),ee.DefineIcon("align-justify",{NAME:"align-justify",SVG_KEY:"alignJustify"}),ee.RegisterCommand("tableCellHorizontalAlign",{type:"dropdown",focus:!1,title:"Horizontal Align",options:{left:"Align Left",center:"Align Center",right:"Align Right",justify:"Align Justify"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableCellHorizontalAlign.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="tableCellHorizontalAlign" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.icon.create("align-"+a)+'<span class="fr-sr-only">'+this.language.translate(t[a])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.table.horizontalAlign(t)},refresh:function(e){var t=this.table.selectedCells(),a=this.$;t.length&&e.find("> *").first().replaceWith(this.icon.create("align-"+this.helpers.getAlignment(a(t[0]))))},refreshOnShow:function(e,t){t.find('.fr-command[data-param1="'+this.helpers.getAlignment(this.$el.find(".fr-selected-cell").first())+'"]').addClass("fr-active").attr("aria-selected",!0)}}),ee.DefineIcon("tableCellStyle",{NAME:"magic",SVG_KEY:"cellStyle"}),ee.RegisterCommand("tableCellStyle",{title:"Cell Style",type:"dropdown",focus:!1,html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.tableCellStyles;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellStyle" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.applyStyle(t,this.$el.find(".fr-selected-cell"),this.opts.tableCellMultipleStyles,this.opts.tableCellStyles)},refreshOnShow:function(e,t){var a=this.$,l=this.$el.find(".fr-selected-cell").first();l&&t.find(".fr-command").each(function(){var e=a(this).data("param1"),t=l.hasClass(e);a(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),ee.RegisterCommand("tableCellBackgroundCustomColor",{title:"OK",undo:!0,callback:function(){this.table.customColor()}}),ee.DefineIcon("tableColorRemove",{NAME:"eraser",SVG_KEY:"remove"})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(ee){"use strict";ee=ee&&ee.hasOwnProperty("default")?ee["default"]:ee,Object.assign(ee.POPUP_TEMPLATES,{"table.insert":"[_BUTTONS_][_ROWS_COLUMNS_]","table.edit":"[_BUTTONS_]","table.colors":"[_BUTTONS_][_COLORS_][_CUSTOM_COLOR_]"}),Object.assign(ee.DEFAULTS,{tableInsertMaxSize:10,tableEditButtons:["tableHeader","tableRemove","tableRows","tableColumns","tableStyle","-","tableCells","tableCellBackground","tableCellVerticalAlign","tableCellHorizontalAlign","tableCellStyle"],tableInsertButtons:["tableBack","|"],tableResizer:!0,tableDefaultWidth:"100%",tableResizerOffset:5,tableResizingLimit:30,tableColorsButtons:["tableBack","|"],tableColors:["#61BD6D","#1ABC9C","#54ACD2","#2C82C9","#9365B8","#475577","#CCCCCC","#41A85F","#00A885","#3D8EB9","#2969B0","#553982","#28324E","#000000","#F7DA64","#FBA026","#EB6B56","#E25041","#A38F84","#EFEFEF","#FFFFFF","#FAC51C","#F37934","#D14841","#B8312F","#7C706B","#D1D5D8","REMOVE"],tableColorsStep:7,tableCellStyles:{"fr-highlighted":"Highlighted","fr-thick":"Thick"},tableStyles:{"fr-dashed-borders":"Dashed Borders","fr-alternate-rows":"Alternate Rows"},tableCellMultipleStyles:!0,tableMultipleStyles:!0,tableInsertHelper:!0,tableInsertHelperOffset:15}),ee.PLUGINS.table=function(E){var R,f,r,n,l,s,A,O=E.$;function h(){var e=_();if(e){var t=E.popups.get("table.edit");if(t||(t=p()),t){E.popups.setContainer("table.edit",E.$sc);var a=I(e),l=a.left+(a.right-a.left)/2,r=a.bottom;E.popups.show("table.edit",l,r,a.bottom-a.top,!0),E.edit.isDisabled()&&(1<Z().length&&E.toolbar.disable(),E.$el.removeClass("fr-no-selection"),E.edit.on(),E.button.bulkRefresh(),E.selection.setAtEnd(E.$el.find(".fr-selected-cell").last().get(0)),E.selection.restore())}}}function d(){var e,t,a,l,r=_();if(r){var n=E.popups.get("table.colors");n||(n=function(){var e="";0<E.opts.tableColorsButtons.length&&(e='<div class="fr-buttons fr-tabs">'+E.button.buildList(E.opts.tableColorsButtons)+"</div>");var t="";E.opts.colorsHEXInput&&(t='<div class="fr-color-hex-layer fr-table-colors-hex-layer fr-active fr-layer" id="fr-table-colors-hex-layer-'+E.id+'"><div class="fr-input-line"><input maxlength="7" id="fr-table-colors-hex-layer-text-'+E.id+'" type="text" placeholder="'+E.language.translate("HEX Color")+'" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="tableCellBackgroundCustomColor" tabIndex="2" role="button">'+E.language.translate("OK")+"</button></div></div>");var a={buttons:e,colors:function(){for(var e='<div class="fr-color-set fr-table-colors">',t=0;t<E.opts.tableColors.length;t++)0!==t&&t%E.opts.tableColorsStep==0&&(e+="<br>"),"REMOVE"!=E.opts.tableColors[t]?e+='<span class="fr-command" style="background: '+E.opts.tableColors[t]+';" tabIndex="-1" role="button" data-cmd="tableCellBackgroundColor" data-param1="'+E.opts.tableColors[t]+'"><span class="fr-sr-only">'+E.language.translate("Color")+" "+E.opts.tableColors[t]+" </span></span>":e+='<span class="fr-command" data-cmd="tableCellBackgroundColor" tabIndex="-1" role="button" data-param1="REMOVE" title="'+E.language.translate("Clear Formatting")+'">'+E.icon.create("tableColorRemove")+'<span class="fr-sr-only">'+E.language.translate("Clear Formatting")+"</span></span>";return e+="</div>"}(),custom_color:t},l=E.popups.create("table.colors",a);return E.events.$on(E.$wp,"scroll.table-colors",function(){E.popups.isVisible("table.colors")&&d()}),u=l,E.events.on("popup.tab",function(e){var t=O(e.currentTarget);if(!E.popups.isVisible("table.colors")||!t.is("span"))return!0;var a=e.which,l=!0;if(ee.KEYCODE.TAB==a){var r=u.find(".fr-buttons");l=!E.accessibility.focusToolbar(r,!!e.shiftKey)}else if(ee.KEYCODE.ARROW_UP==a||ee.KEYCODE.ARROW_DOWN==a||ee.KEYCODE.ARROW_LEFT==a||ee.KEYCODE.ARROW_RIGHT==a){var n=t.parent().find("span.fr-command"),s=n.index(t),o=E.opts.colorsStep,i=Math.floor(n.length/o),f=s%o,d=Math.floor(s/o),c=d*o+f,p=i*o;ee.KEYCODE.ARROW_UP==a?c=((c-o)%p+p)%p:ee.KEYCODE.ARROW_DOWN==a?c=(c+o)%p:ee.KEYCODE.ARROW_LEFT==a?c=((c-1)%p+p)%p:ee.KEYCODE.ARROW_RIGHT==a&&(c=(c+1)%p);var h=O(n.get(c));E.events.disableBlur(),h.focus(),l=!1}else ee.KEYCODE.ENTER==a&&(E.button.exec(t),l=!1);return!1===l&&(e.preventDefault(),e.stopPropagation()),l},!0),l;var u}()),E.popups.setContainer("table.colors",E.$sc);var s=I(r),o=(s.left+s.right)/2,i=s.bottom;e=E.popups.get("table.colors"),t=E.$el.find(".fr-selected-cell").first(),a=E.helpers.RGBToHex(t.css("background-color")),l=e.find(".fr-table-colors-hex-layer input"),e.find(".fr-selected-color").removeClass("fr-selected-color fr-active-item"),e.find('span[data-param1="'+a+'"]').addClass("fr-selected-color fr-active-item"),l.val(a).trigger("change"),E.popups.show("table.colors",o,i,s.bottom-s.top,!0)}}function o(){0===Z().length&&E.toolbar.enable()}function i(e){if(e)return E.popups.onHide("table.insert",function(){E.popups.get("table.insert").find('.fr-table-size .fr-select-table-size > span[data-row="1"][data-col="1"]').trigger("mouseover")}),!0;var t="";0<E.opts.tableInsertButtons.length&&(t='<div class="fr-buttons fr-tabs">'+E.button.buildList(E.opts.tableInsertButtons)+"</div>");var a,l={buttons:t,rows_columns:function(){for(var e='<div class="fr-table-size"><div class="fr-table-size-info">1 × 1</div><div class="fr-select-table-size">',t=1;t<=E.opts.tableInsertMaxSize;t++){for(var a=1;a<=E.opts.tableInsertMaxSize;a++){var l="inline-block";2<t&&!E.helpers.isMobile()&&(l="none");var r="fr-table-cell ";1==t&&1==a&&(r+=" hover"),e+='<span class="fr-command '+r+'" tabIndex="-1" data-cmd="tableInsert" data-row="'+t+'" data-col="'+a+'" data-param1="'+t+'" data-param2="'+a+'" style="display: '+l+';" role="button"><span></span><span class="fr-sr-only">'+t+" × "+a+" </span></span>"}e+='<div class="new-line"></div>'}return e+="</div></div>"}()},r=E.popups.create("table.insert",l);return E.events.$on(r,"mouseover",".fr-table-size .fr-select-table-size .fr-table-cell",function(e){c(O(e.currentTarget))},!0),a=r,E.events.$on(a,"focus","[tabIndex]",function(e){var t=O(e.currentTarget);c(t)}),E.events.on("popup.tab",function(e){var t=O(e.currentTarget);if(!E.popups.isVisible("table.insert")||!t.is("span, a"))return!0;var a,l=e.which;if(ee.KEYCODE.ARROW_UP==l||ee.KEYCODE.ARROW_DOWN==l||ee.KEYCODE.ARROW_LEFT==l||ee.KEYCODE.ARROW_RIGHT==l){if(t.is("span.fr-table-cell")){var r=t.parent().find("span.fr-table-cell"),n=r.index(t),s=E.opts.tableInsertMaxSize,o=n%s,i=Math.floor(n/s);ee.KEYCODE.ARROW_UP==l?i=Math.max(0,i-1):ee.KEYCODE.ARROW_DOWN==l?i=Math.min(E.opts.tableInsertMaxSize-1,i+1):ee.KEYCODE.ARROW_LEFT==l?o=Math.max(0,o-1):ee.KEYCODE.ARROW_RIGHT==l&&(o=Math.min(E.opts.tableInsertMaxSize-1,o+1));var f=i*s+o,d=O(r.get(f));c(d),E.events.disableBlur(),d.focus(),a=!1}}else ee.KEYCODE.ENTER==l&&(E.button.exec(t),a=!1);return!1===a&&(e.preventDefault(),e.stopPropagation()),a},!0),r}function c(e){var t=e.data("row");null!==t&&(t=parseInt(t));var a=e.data("col");null!==a&&(a=parseInt(a));var l=e.parent();l.siblings(".fr-table-size-info").html(t+" × "+a),l.find("> span").removeClass("hover fr-active-item");for(var r=1;r<=E.opts.tableInsertMaxSize;r++)for(var n=0;n<=E.opts.tableInsertMaxSize;n++){var s=l.find('> span[data-row="'+r+'"][data-col="'+n+'"]');r<=t&&n<=a?s.addClass("hover"):r<=t+1||r<=2&&!E.helpers.isMobile()?s.css("display","inline-block"):2<r&&!E.helpers.isMobile()&&s.css("display","none")}e.addClass("fr-active-item")}function p(e){if(e)return E.popups.onHide("table.edit",o),!0;if(0<E.opts.tableEditButtons.length){var t={buttons:'<div class="fr-buttons">'.concat(E.button.buildList(E.opts.tableEditButtons),"</div>")},a=E.popups.create("table.edit",t);return E.events.$on(E.$wp,"scroll.table-edit",function(){E.popups.isVisible("table.edit")&&h()}),a}return!1}function u(){if(0<Z().length){var e=Q();E.selection.setBefore(e.get(0))||E.selection.setAfter(e.get(0)),E.selection.restore(),E.popups.hide("table.edit"),e.remove(),E.toolbar.enable()}}function b(e){var t=Q();if(0<t.length){if(0<E.$el.find("th.fr-selected-cell").length&&"above"==e)return;var a,l,r,n=_(),s=M(n);if(null==s)return;l="above"==e?s.min_i:s.max_i;var o="<tr>";for(a=0;a<n[l].length;a++)if("below"==e&&l<n.length-1&&n[l][a]==n[l+1][a]||"above"==e&&0<l&&n[l][a]==n[l-1][a]){if(0===a||0<a&&n[l][a]!=n[l][a-1]){var i=O(n[l][a]);i.attr("rowspan",parseInt(i.attr("rowspan"),10)+1)}}else o+="<td><br></td>";o+="</tr>",r=0<E.$el.find("th.fr-selected-cell").length&&"below"==e?O(t.find("tbody").not(t.find("> table tbody"))):O(t.find("tr").not(t.find("> table tr")).get(l)),"below"==e?"TBODY"==r.attr("tagName")?r.prepend(o):r[0].parentNode&&r[0].insertAdjacentHTML("afterend",o):"above"==e&&(r.before(o),E.popups.isVisible("table.edit")&&h())}}function g(e,t,a){var l,r,n,s,o,i=0,f=_(a);if(e<(t=Math.min(t,f[0].length-1)))for(r=e;r<=t;r++)if(!(e<r&&f[0][r]==f[0][r-1])&&1<(s=Math.min(parseInt(f[0][r].getAttribute("colspan"),10)||1,t-e+1))&&f[0][r]==f[0][r+1])for(i=s-1,l=1;l<f.length;l++)if(f[l][r]!=f[l-1][r]){for(n=r;n<r+s;n++)if(1<(o=parseInt(f[l][n].getAttribute("colspan"),10)||1)&&f[l][n]==f[l][n+1])n+=i=Math.min(i,o-1);else if(!(i=Math.max(0,i-1)))break;if(!i)break}i&&v(f,i,"colspan",0,f.length-1,e,t)}function m(e,t,a){var l,r,n,s,o,i=0,f=_(a);if(e<(t=Math.min(t,f.length-1)))for(l=e;l<=t;l++)if(!(e<l&&f[l][0]==f[l-1][0])&&1<(s=Math.min(parseInt(f[l][0].getAttribute("rowspan"),10)||1,t-e+1))&&f[l][0]==f[l+1][0])for(i=s-1,r=1;r<f[0].length;r++)if(f[l][r]!=f[l][r-1]){for(n=l;n<l+s;n++)if(1<(o=parseInt(f[n][r].getAttribute("rowspan"),10)||1)&&f[n][r]==f[n+1][r])n+=i=Math.min(i,o-1);else if(!(i=Math.max(0,i-1)))break;if(!i)break}i&&v(f,i,"rowspan",e,t,0,f[0].length-1)}function v(e,t,a,l,r,n,s){var o,i,f;for(o=l;o<=r;o++)for(i=n;i<=s;i++)l<o&&e[o][i]==e[o-1][i]||n<i&&e[o][i]==e[o][i-1]||1<(f=parseInt(e[o][i].getAttribute(a),10)||1)&&(1<f-t?e[o][i].setAttribute(a,f-t):e[o][i].removeAttribute(a))}function w(e,t,a,l,r){m(e,t,r),g(a,l,r)}function t(e){var t=E.$el.find(".fr-selected-cell");"REMOVE"!=e?t.css("background-color",E.helpers.HEXtoRGB(e)):t.css("background-color",""),h()}function _(e){var f=[];return null==(e=e||null)&&0<Z().length&&(e=Q()),e&&e.findVisible("tr").not(e.find("> table tr")).each(function(o,e){var t=O(e),i=0;t.find("> th, > td").each(function(e,t){for(var a=O(t),l=parseInt(a.attr("colspan"),10)||1,r=parseInt(a.attr("rowspan"),10)||1,n=o;n<o+r;n++)for(var s=i;s<i+l;s++)f[n]||(f[n]=[]),f[n][s]?i++:f[n][s]=t;i+=l})}),f}function x(e,t){for(var a=0;a<t.length;a++)for(var l=0;l<t[a].length;l++)if(t[a][l]==e)return{row:a,col:l}}function $(e,t,a){for(var l=e+1,r=t+1;l<a.length;){if(a[l][t]!=a[e][t]){l--;break}l++}for(l==a.length&&l--;r<a[e].length;){if(a[e][r]!=a[e][t]){r--;break}r++}return r==a[e].length&&r--,{row:l,col:r}}function C(){E.el.querySelector(".fr-cell-fixed")&&E.el.querySelector(".fr-cell-fixed").classList.remove("fr-cell-fixed"),E.el.querySelector(".fr-cell-handler")&&E.el.querySelector(".fr-cell-handler").classList.remove("fr-cell-handler")}function D(){var e=E.$el.find(".fr-selected-cell");0<e.length&&e.each(function(){var e=O(this);e.removeClass("fr-selected-cell"),""===e.attr("class")&&e.removeAttr("class")}),C()}function y(){E.events.disableBlur(),E.selection.clear(),E.$el.addClass("fr-no-selection"),E.$el.blur(),E.events.enableBlur()}function M(e){var t=E.$el.find(".fr-selected-cell");if(0<t.length){var a,l=e.length,r=0,n=e[0].length,s=0;for(a=0;a<t.length;a++){var o=x(t[a],e),i=$(o.row,o.col,e);l=Math.min(o.row,l),r=Math.max(i.row,r),n=Math.min(o.col,n),s=Math.max(i.col,s)}return{min_i:l,max_i:r,min_j:n,max_j:s}}return null}function I(e){var t=M(e);if(null!=t){var a=O(e[t.min_i][t.min_j]),l=O(e[t.min_i][t.max_j]),r=O(e[t.max_i][t.min_j]);return{left:a.offset().left,right:l.offset().left+l.outerWidth(),top:a.offset().top,bottom:r.offset().top+r.outerHeight()}}}function S(t,a){if(O(t).is(a))D(),O(t).addClass("fr-selected-cell");else{y(),E.edit.off();var l=_(),r=x(t,l),n=x(a,l),s=function e(t,a,l,r,n){var s,o,i,f,d=t,c=a,p=l,h=r;for(s=d;s<=c;s++)(1<(parseInt(O(n[s][p]).attr("rowspan"),10)||1)||1<(parseInt(O(n[s][p]).attr("colspan"),10)||1))&&(f=$((i=x(n[s][p],n)).row,i.col,n),d=Math.min(i.row,d),c=Math.max(f.row,c),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(O(n[s][h]).attr("rowspan"),10)||1)||1<(parseInt(O(n[s][h]).attr("colspan"),10)||1))&&(f=$((i=x(n[s][h],n)).row,i.col,n),d=Math.min(i.row,d),c=Math.max(f.row,c),p=Math.min(i.col,p),h=Math.max(f.col,h));for(o=p;o<=h;o++)(1<(parseInt(O(n[d][o]).attr("rowspan"),10)||1)||1<(parseInt(O(n[d][o]).attr("colspan"),10)||1))&&(f=$((i=x(n[d][o],n)).row,i.col,n),d=Math.min(i.row,d),c=Math.max(f.row,c),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(O(n[c][o]).attr("rowspan"),10)||1)||1<(parseInt(O(n[c][o]).attr("colspan"),10)||1))&&(f=$((i=x(n[c][o],n)).row,i.col,n),d=Math.min(i.row,d),c=Math.max(f.row,c),p=Math.min(i.col,p),h=Math.max(f.col,h));return d==t&&c==a&&p==l&&h==r?{min_i:t,max_i:a,min_j:l,max_j:r}:e(d,c,p,h,n)}(Math.min(r.row,n.row),Math.max(r.row,n.row),Math.min(r.col,n.col),Math.max(r.col,n.col),l);D(),t.classList.add("fr-cell-fixed"),a.classList.add("fr-cell-handler");for(var o=s.min_i;o<=s.max_i;o++)for(var i=s.min_j;i<=s.max_j;i++)O(l[o][i]).addClass("fr-selected-cell")}}function T(e){var t=null,a=O(e.target);return"TD"==e.target.tagName||"TH"==e.target.tagName?t=e.target:0<a.closest("td").length?t=a.closest("td").get(0):0<a.closest("th").length&&(t=a.closest("th").get(0)),-1===E.$el.html.toString().search(t)?null:t}function N(){D(),E.popups.hide("table.edit")}function e(e){var t=T(e);if("false"==O(t).parents("[contenteditable]").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;if(0<Z().length&&!t&&N(),!E.edit.isDisabled()||E.popups.isVisible("table.edit"))if(1!=e.which||1==e.which&&E.helpers.isMac()&&e.ctrlKey)(3==e.which||1==e.which&&E.helpers.isMac()&&e.ctrlKey)&&t&&N();else if(n=!0,t){0<Z().length&&!e.shiftKey&&N(),e.stopPropagation(),E.events.trigger("image.hideResizer"),E.events.trigger("video.hideResizer"),r=!0;var a=t.tagName.toLowerCase();e.shiftKey&&0<E.$el.find(a+".fr-selected-cell").length?O(E.$el.find(a+".fr-selected-cell").closest("table")).is(O(t).closest("table"))?S(l,t):y():((E.keys.ctrlKey(e)||e.shiftKey)&&(1<Z().length||0===O(t).find(E.selection.element()).length&&!O(t).is(E.selection.element()))&&y(),l=t,0<E.opts.tableEditButtons.length&&S(l,l))}}function a(e){if(E.popups.areVisible())return!0;if(r||E.$tb.is(e.target)||E.$tb.is(O(e.target).closest(".fr-toolbar"))||(0<Z().length&&E.toolbar.enable(),D()),!(1!=e.which||1==e.which&&E.helpers.isMac()&&e.ctrlKey)){if(n=!1,r)r=!1,T(e)||1!=Z().length?0<Z().length&&(E.selection.isCollapsed()?h():D()):D();if(A){A=!1,R.removeClass("fr-moving"),E.$el.removeClass("fr-no-selection"),E.edit.on();var t=parseFloat(R.css("left"))+E.opts.tableResizerOffset+E.$wp.offset().left;E.opts.iframe&&(t-=E.$iframe.offset().left),R.data("release-position",t),R.removeData("max-left"),R.removeData("max-right"),function(){var e=R.data("origin"),t=R.data("release-position");if(e!==t){var a=R.data("first"),l=R.data("second"),r=R.data("table"),n=r.outerWidth();if(E.undo.canDo()||E.undo.saveStep(),null!=a&&null!=l){var s,o,i,f=_(r),d=[],c=[],p=[],h=[];for(s=0;s<f.length;s++)o=O(f[s][a]),i=O(f[s][l]),d[s]=o.outerWidth(),p[s]=i.outerWidth(),c[s]=d[s]/n*100,h[s]=p[s]/n*100;for(s=0;s<f.length;s++)if(o=O(f[s][a]),i=O(f[s][l]),f[s][a]!=f[s][l]){var u=(c[s]*(d[s]+t-e)/d[s]).toFixed(4);o.css("width",u+"%"),i.css("width",(c[s]+h[s]-u).toFixed(4)+"%")}}else{var b,g=r.parent(),m=n/g.width()*100,v=(parseInt(r.css("margin-left"),10)||0)/g.width()*100,w=(parseInt(r.css("margin-right"),10)||0)/g.width()*100;"rtl"==E.opts.direction&&0===l||"rtl"!=E.opts.direction&&0!==l?(b=(n+t-e)/n*m,r.css("margin-right","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(v).toFixed(4)+"%)")):("rtl"==E.opts.direction&&0!==l||"rtl"!=E.opts.direction&&0===l)&&(b=(n-t+e)/n*m,r.css("margin-left","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(w).toFixed(4)+"%)")),r.css("width",Math.round(b).toFixed(4)+"%")}E.selection.restore(),E.undo.saveStep(),E.events.trigger("table.resized",[r.get(0)])}R.removeData("origin"),R.removeData("release-position"),R.removeData("first"),R.removeData("second"),R.removeData("table")}(),Y()}}}function K(e){if(!0===r&&0<E.opts.tableEditButtons.length){if(O(e.currentTarget).closest("table").is(Q())){if("TD"==e.currentTarget.tagName&&0===E.$el.find("th.fr-selected-cell").length)return void S(l,e.currentTarget);if("TH"==e.currentTarget.tagName&&0===E.$el.find("td.fr-selected-cell").length)return void S(l,e.currentTarget)}y()}}function z(e,t,a,l){for(var r,n=t;n!=E.el&&"TD"!=n.tagName&&"TH"!=n.tagName&&("up"==l?r=n.previousElementSibling:"down"==l&&(r=n.nextElementSibling),!r);)n=n.parentNode;"TD"==n.tagName||"TH"==n.tagName?function(e,t){for(var a=e;a&&"TABLE"!=a.tagName&&a.parentNode!=E.el;)a=a.parentNode;if(a&&"TABLE"==a.tagName){var l=_(O(a));"up"==t?B(x(e,l),a,l):"down"==t&&k(x(e,l),a,l)}}(n,l):r&&("up"==l&&E.selection.setAtEnd(r),"down"==l&&E.selection.setAtStart(r))}function B(e,t,a){0<e.row?E.selection.setAtEnd(a[e.row-1][e.col]):z(0,t,0,"up")}function k(e,t,a){var l=parseInt(a[e.row][e.col].getAttribute("rowspan"),10)||1;e.row<a.length-l?E.selection.setAtStart(a[e.row+l][e.col]):z(0,t,0,"down")}function Y(){R&&(R.find("div").css("opacity",0),R.css("top",0),R.css("left",0),R.css("height",0),R.find("div").css("height",0),R.hide())}function W(){f&&f.removeClass("fr-visible").css("left","-9999px")}function L(e,t){var a=O(t),l=a.closest("table"),r=l.parent();if(t&&"TD"!=t.tagName&&"TH"!=t.tagName&&(0<a.closest("td").length?t=a.closest("td"):0<a.closest("th").length&&(t=a.closest("th"))),!t||"TD"!=t.tagName&&"TH"!=t.tagName)R&&a.get(0)!=R.get(0)&&a.parent().get(0)!=R.get(0)&&E.core.sameInstance(R)&&Y();else{if(a=O(t),0===E.$el.find(a).length)return!1;var n=a.offset().left-1,s=n+a.outerWidth();if(Math.abs(e.pageX-n)<=E.opts.tableResizerOffset||Math.abs(s-e.pageX)<=E.opts.tableResizerOffset){var o,i,f,d,c,p=_(l),h=x(t,p),u=$(h.row,h.col,p),b=l.offset().top,g=l.outerHeight()-1;"rtl"!=E.opts.direction?e.pageX-n<=E.opts.tableResizerOffset?(f=n,0<h.col?(d=n-j(h.col-1,p)+E.opts.tableResizingLimit,c=n+j(h.col,p)-E.opts.tableResizingLimit,o=h.col-1,i=h.col):(o=null,i=0,d=l.offset().left-1-parseInt(l.css("margin-left"),10),c=l.offset().left-1+l.width()-p[0].length*E.opts.tableResizingLimit)):s-e.pageX<=E.opts.tableResizerOffset&&(f=s,u.col<p[u.row].length&&p[u.row][u.col+1]?(d=s-j(u.col,p)+E.opts.tableResizingLimit,c=s+j(u.col+1,p)-E.opts.tableResizingLimit,o=u.col,i=u.col+1):(o=u.col,i=null,d=l.offset().left-1+p[0].length*E.opts.tableResizingLimit,c=r.offset().left-1+r.width()+parseFloat(r.css("padding-left")))):s-e.pageX<=E.opts.tableResizerOffset?(f=s,0<h.col?(d=s-j(h.col,p)+E.opts.tableResizingLimit,c=s+j(h.col-1,p)-E.opts.tableResizingLimit,o=h.col,i=h.col-1):(o=null,i=0,d=l.offset().left+p[0].length*E.opts.tableResizingLimit,c=r.offset().left-1+r.width()+parseFloat(r.css("padding-left")))):e.pageX-n<=E.opts.tableResizerOffset&&(f=n,u.col<p[u.row].length&&p[u.row][u.col+1]?(d=n-j(u.col+1,p)+E.opts.tableResizingLimit,c=n+j(u.col,p)-E.opts.tableResizingLimit,o=u.col+1,i=u.col):(o=u.col,i=null,d=r.offset().left+parseFloat(r.css("padding-left")),c=l.offset().left-1+l.width()-p[0].length*E.opts.tableResizingLimit)),R||(E.shared.$table_resizer||(E.shared.$table_resizer=O(document.createElement("div")).attr("class","fr-table-resizer").html("<div></div>")),R=E.shared.$table_resizer,E.events.$on(R,"mousedown",function(e){return!E.core.sameInstance(R)||(0<Z().length&&N(),1==e.which?(E.selection.save(),A=!0,R.addClass("fr-moving"),y(),E.edit.off(),R.find("div").css("opacity",1),!1):void 0)}),E.events.$on(R,"mousemove",function(e){if(!E.core.sameInstance(R))return!0;A&&(E.opts.iframe&&(e.pageX-=E.$iframe.offset().left),G(e))}),E.events.on("shared.destroy",function(){R.html("").removeData().remove(),R=null},!0),E.events.on("destroy",function(){E.$el.find(".fr-selected-cell").removeClass("fr-selected-cell"),O("body").first().append(R.hide())},!0)),R.data("table",l),R.data("first",o),R.data("second",i),R.data("instance",E),E.$wp.append(R);var m=f-E.win.pageXOffset-E.opts.tableResizerOffset-E.$wp.offset().left,v=b-E.$wp.offset().top+E.$wp.scrollTop();if(E.opts.iframe){var w=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-top")),C=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-left"));m+=E.$iframe.offset().left+C,v+=E.$iframe.offset().top+w,d+=E.$iframe.offset().left,c+=E.$iframe.offset().left}R.data("max-left",d),R.data("max-right",c),R.data("origin",f-E.win.pageXOffset),R.css("top",v),R.css("left",m),R.css("height",g),R.find("div").css("height",g),R.css("padding-left",E.opts.tableResizerOffset),R.css("padding-right",E.opts.tableResizerOffset),R.show()}else E.core.sameInstance(R)&&Y()}}function F(e,t){if(E.$box.find(".fr-line-breaker").isVisible())return!1;f||q(),E.$box.append(f),f.data("instance",E);var a,l=O(t).find("tr").first(),r=e.pageX,n=0,s=0;if(E.opts.iframe){var o=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-top")),i=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-left"));n+=E.$iframe.offset().left-E.helpers.scrollLeft()+i,s+=E.$iframe.offset().top-E.helpers.scrollTop()+o}l.find("th, td").each(function(){var e=O(this);return e.offset().left<=r&&r<e.offset().left+e.outerWidth()/2?(a=parseInt(f.find("a").css("width"),10),f.css("top",s+e.offset().top-E.$box.offset().top-a-5),f.css("left",n+e.offset().left-E.$box.offset().left-a/2),f.data("selected-cell",e),f.data("position","before"),f.addClass("fr-visible"),!1):e.offset().left+e.outerWidth()/2<=r&&r<e.offset().left+e.outerWidth()?(a=parseInt(f.find("a").css("width"),10),f.css("top",s+e.offset().top-E.$box.offset().top-a-5),f.css("left",n+e.offset().left-E.$box.offset().left+e.outerWidth()-a/2),f.data("selected-cell",e),f.data("position","after"),f.addClass("fr-visible"),!1):void 0})}function H(e,t){if(E.$box.find(".fr-line-breaker").isVisible())return!1;f||q(),E.$box.append(f),f.data("instance",E);var a,l=O(t),r=e.pageY,n=0,s=0;if(E.opts.iframe){var o=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-top")),i=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-left"));n+=E.$iframe.offset().left-E.helpers.scrollLeft()+i,s+=E.$iframe.offset().top-E.helpers.scrollTop()+o}l.find("tr").each(function(){var e=O(this);return e.offset().top<=r&&r<e.offset().top+e.outerHeight()/2?(a=parseInt(f.find("a").css("width"),10),f.css("top",s+e.offset().top-E.$box.offset().top-a/2),f.css("left",n+e.offset().left-E.$box.offset().left-a-5),f.data("selected-cell",e.find("td").first()),f.data("position","above"),f.addClass("fr-visible"),!1):e.offset().top+e.outerHeight()/2<=r&&r<e.offset().top+e.outerHeight()?(a=parseInt(f.find("a").css("width"),10),f.css("top",s+e.offset().top-E.$box.offset().top+e.outerHeight()-a/2),f.css("left",n+e.offset().left-E.$box.offset().left-a-5),f.data("selected-cell",e.find("td").first()),f.data("position","below"),f.addClass("fr-visible"),!1):void 0})}function V(e){s=null;var t=E.doc.elementFromPoint(e.pageX-E.win.pageXOffset,e.pageY-E.win.pageYOffset);E.opts.tableResizer&&(!E.popups.areVisible()||E.popups.areVisible()&&E.popups.isVisible("table.edit"))&&L(e,t),!E.opts.tableInsertHelper||E.popups.areVisible()||E.$tb.hasClass("fr-inline")&&E.$tb.isVisible()||function(e,t){if(0===Z().length){var a,l,r;if(t&&("HTML"==t.tagName||"BODY"==t.tagName||E.node.isElement(t)))for(a=1;a<=E.opts.tableInsertHelperOffset;a++){if(l=E.doc.elementFromPoint(e.pageX-E.win.pageXOffset,e.pageY-E.win.pageYOffset+a),O(l).hasClass("fr-tooltip"))return;if(l&&("TH"==l.tagName||"TD"==l.tagName||"TABLE"==l.tagName)&&(O(l).parents(".fr-wrapper").length||E.opts.iframe))return F(e,O(l).closest("table"));if(r=E.doc.elementFromPoint(e.pageX-E.win.pageXOffset+a,e.pageY-E.win.pageYOffset),O(r).hasClass("fr-tooltip"))return;if(r&&("TH"==r.tagName||"TD"==r.tagName||"TABLE"==r.tagName)&&(O(r).parents(".fr-wrapper").length||E.opts.iframe))return H(e,O(r).closest("table"))}E.core.sameInstance(f)&&W()}}(e,t)}function P(){if(A){var e=R.data("table").offset().top-E.win.pageYOffset;if(E.opts.iframe){var t=E.helpers.getPX(E.$wp.find(".fr-iframe").css("padding-top"));e+=E.$iframe.offset().top-E.helpers.scrollTop()+t}R.css("top",e)}}function j(e,t){var a,l=O(t[0][e]).outerWidth();for(a=1;a<t.length;a++)l=Math.min(l,O(t[a][e]).outerWidth());return l}function X(e,t,a){var l,r=0;for(l=e;l<=t;l++)r+=j(l,a);return r}function G(e){if(1<Z().length&&n&&y(),!1===n&&!1===r&&!1===A)s&&clearTimeout(s),E.edit.isDisabled()&&!E.popups.isVisible("table.edit")||(s=setTimeout(V,30,e));else if(A){var t=e.pageX-E.win.pageXOffset;E.opts.iframe&&(t+=E.$iframe.offset().left);var a=R.data("max-left"),l=R.data("max-right");a<=t&&t<=l?R.css("left",t-E.opts.tableResizerOffset-E.$wp.offset().left):t<a&&parseFloat(R.css("left"),10)>a-E.opts.tableResizerOffset?R.css("left",a-E.opts.tableResizerOffset-E.$wp.offset().left):l<t&&parseFloat(R.css("left"),10)<l-E.opts.tableResizerOffset&&R.css("left",l-E.opts.tableResizerOffset-E.$wp.offset().left)}else n&&W()}function U(e){E.node.isEmpty(e.get(0))?e.prepend(ee.MARKERS):e.prepend(ee.START_MARKER).append(ee.END_MARKER)}function q(){E.shared.$ti_helper||(E.shared.$ti_helper=O(document.createElement("div")).attr("class","fr-insert-helper").html('<a class="fr-floating-btn" role="button" tabIndex="-1" title="'+E.language.translate("Insert")+'"><svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M22,16.75 L16.75,16.75 L16.75,22 L15.25,22.000 L15.25,16.75 L10,16.75 L10,15.25 L15.25,15.25 L15.25,10 L16.75,10 L16.75,15.25 L22,15.25 L22,16.75 Z"/></svg></a>'),E.events.bindClick(E.shared.$ti_helper,"a",function(){var e=f.data("selected-cell"),t=f.data("position"),a=f.data("instance")||E;"before"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertColumn(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"after"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertColumn(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"above"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertRow(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"below"==t&&(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertRow(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()),W()}),E.events.on("shared.destroy",function(){E.shared.$ti_helper.html("").removeData().remove(),E.shared.$ti_helper=null},!0),E.events.$on(E.shared.$ti_helper,"mousemove",function(e){e.stopPropagation()},!0),E.events.$on(O(E.o_win),"scroll",function(){W()},!0),E.events.$on(E.$wp,"scroll",function(){W()},!0)),f=E.shared.$ti_helper,E.events.on("destroy",function(){f=null}),E.tooltip.bind(E.$box,".fr-insert-helper > a.fr-floating-btn")}function J(){l=null,clearTimeout(s)}function Z(){return E.el.querySelectorAll(".fr-selected-cell")}function Q(){var e=Z();if(e.length){for(var t=e[0];t&&"TABLE"!=t.tagName&&t.parentNode!=E.el;)t=t.parentNode;return t&&"TABLE"==t.tagName?O(t):O([])}return O([])}return{_init:function(){if(!E.$wp)return!1;if(!E.helpers.isMobile()){A=r=n=!1,E.events.$on(E.$el,"mousedown",e),E.popups.onShow("image.edit",function(){D(),r=n=!1}),E.popups.onShow("link.edit",function(){D(),r=n=!1}),E.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&D()}),E.events.$on(E.$el,"mouseover","th, td",K),E.events.$on(E.$win,"mouseup",a),E.opts.iframe&&E.events.$on(O(E.o_win),"mouseup",a),E.events.$on(E.$win,"mousemove",G),E.events.$on(O(E.o_win),"scroll",P),E.events.on("contentChanged",function(){0<Z().length&&(h(),E.$el.find("img").on("load.selected-cells",function(){O(this).off("load.selected-cells"),0<Z().length&&h()}))}),E.events.$on(O(E.o_win),"resize",function(){D()}),E.events.on("toolbar.esc",function(){if(0<Z().length)return E.events.disableBlur(),E.events.focus(),!1},!0),E.events.$on(O(E.o_win),"keydown",function(){n&&r&&(r=n=!1,E.$el.removeClass("fr-no-selection"),E.edit.on(),E.selection.setAtEnd(E.$el.find(".fr-selected-cell").last().get(0)),E.selection.restore(),D())}),E.events.$on(E.$el,"keydown",function(e){e.shiftKey?!1===function(e){var t=Z();if(null!=t&&0<t.length){var a,l,r=_(),n=e.which;1==t.length?l=a=t[0]:(a=E.el.querySelector(".fr-cell-fixed"),l=E.el.querySelector(".fr-cell-handler"));var s=x(l,r);if(ee.KEYCODE.ARROW_RIGHT==n){if(s.col<r[0].length-1)return S(a,r[s.row][s.col+1]),!1}else if(ee.KEYCODE.ARROW_DOWN==n){if(s.row<r.length-1)return S(a,r[s.row+1][s.col]),!1}else if(ee.KEYCODE.ARROW_LEFT==n){if(0<s.col)return S(a,r[s.row][s.col-1]),!1}else if(ee.KEYCODE.ARROW_UP==n&&0<s.row)return S(a,r[s.row-1][s.col]),!1}}(e)&&setTimeout(function(){h()},0):function(e){var t=e.which,a=E.selection.blocks();if(a.length&&("TD"==(a=a[0]).tagName||"TH"==a.tagName)){for(var l=a;l&&"TABLE"!=l.tagName&&l.parentNode!=E.el;)l=l.parentNode;if(l&&"TABLE"==l.tagName&&(ee.KEYCODE.ARROW_LEFT==t||ee.KEYCODE.ARROW_UP==t||ee.KEYCODE.ARROW_RIGHT==t||ee.KEYCODE.ARROW_DOWN==t)&&(0<Z().length&&N(),E.browser.webkit&&(ee.KEYCODE.ARROW_UP==t||ee.KEYCODE.ARROW_DOWN==t))){var r=E.selection.ranges(0).startContainer;if(r.nodeType==Node.TEXT_NODE&&(ee.KEYCODE.ARROW_UP==t&&r.previousSibling||ee.KEYCODE.ARROW_DOWN==t&&r.nextSibling))return;e.preventDefault(),e.stopPropagation();var n=_(O(l)),s=x(a,n);ee.KEYCODE.ARROW_UP==t?B(s,l,n):ee.KEYCODE.ARROW_DOWN==t&&k(s,l,n),E.selection.restore()}}}(e)}),E.events.on("keydown",function(e){if(!1===function(e){if(e.which==ee.KEYCODE.TAB){var t;if(0<Z().length)t=E.$el.find(".fr-selected-cell").last();else{var a=E.selection.element();"TD"==a.tagName||"TH"==a.tagName?t=O(a):a!=E.el&&(0<O(a).parentsUntil(E.$el,"td").length?t=O(a).parents("td").first():0<O(a).parentsUntil(E.$el,"th").length&&(t=O(a).parents("th").first()))}if(t)return e.preventDefault(),!!(0<O(E.selection.element()).parentsUntil(E.$el,"ol, ul").length&&(0<O(E.selection.element()).parents("li").prev().length||O(E.selection.element()).is("li")&&0<O(E.selection.element()).prev().length))||(N(),e.shiftKey?0<t.prev().length?U(t.prev()):0<t.closest("tr").length&&0<t.closest("tr").prev().length?U(t.closest("tr").prev().find("td").last()):0<t.closest("tbody").length&&0<t.closest("table").find("thead tr").length&&U(t.closest("table").find("thead tr th").last()):0<t.next().length?U(t.next()):0<t.closest("tr").length&&0<t.closest("tr").next().length?U(t.closest("tr").next().find("td").first()):0<t.closest("thead").length&&0<t.closest("table").find("tbody tr").length?U(t.closest("table").find("tbody tr td").first()):(t.addClass("fr-selected-cell"),b("below"),D(),U(t.closest("tr").next().find("td").first())),E.selection.restore(),!1)}}(e))return!1;var t=Z();if(0<t.length){if(0<t.length&&E.keys.ctrlKey(e)&&e.which==ee.KEYCODE.A)return D(),E.popups.isVisible("table.edit")&&E.popups.hide("table.edit"),t=[],!0;if(e.which==ee.KEYCODE.ESC&&E.popups.isVisible("table.edit"))return D(),E.popups.hide("table.edit"),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!(t=[]);if(1<t.length&&(e.which==ee.KEYCODE.BACKSPACE||e.which==ee.KEYCODE.DELETE)){E.undo.saveStep();for(var a=0;a<t.length;a++)O(t[a]).html("<br>"),a==t.length-1&&O(t[a]).prepend(ee.MARKERS);return E.selection.restore(),E.undo.saveStep(),!(t=[])}if(1<t.length&&e.which!=ee.KEYCODE.F10&&!E.keys.isBrowserAction(e))return e.preventDefault(),!(t=[])}else if(!(t=[])===function(e){if(e.altKey&&e.which==ee.KEYCODE.SPACE){var t,a=E.selection.element();if("TD"==a.tagName||"TH"==a.tagName?t=a:0<O(a).closest("td").length?t=O(a).closest("td").get(0):0<O(a).closest("th").length&&(t=O(a).closest("th").get(0)),t)return e.preventDefault(),S(t,t),h(),!1}}(e))return!1},!0);var t=[];E.events.on("html.beforeGet",function(){t=Z();for(var e=0;e<t.length;e++)t[e].className=(t[e].className||"").replace(/fr-selected-cell/g,"")}),E.events.on("html.afterGet",function(){for(var e=0;e<t.length;e++)t[e].className=(t[e].className?t[e].className.trim()+" ":"")+"fr-selected-cell";t=[]}),i(!0),p(!0)}E.events.on("destroy",J)},insert:function(e,t){var a,l,r="<table "+(E.opts.tableDefaultWidth?'style="width: '+E.opts.tableDefaultWidth+';" ':"")+'class="fr-inserted-table"><tbody>',n=100/t;for(a=0;a<e;a++){for(r+="<tr>",l=0;l<t;l++)r+="<td"+(E.opts.tableDefaultWidth?' style="width: '+n.toFixed(4)+'%;"':"")+">",0===a&&0===l&&(r+=ee.MARKERS),r+="<br></td>";r+="</tr>"}r+="</tbody></table>",E.html.insert(r),E.selection.restore();var s=E.$el.find(".fr-inserted-table");s.removeClass("fr-inserted-table"),E.events.trigger("table.inserted",[s.get(0)])},remove:u,insertRow:b,deleteRow:function(){var e=Q();if(0<e.length){var t,a,l,r=_(),n=M(r);if(null==n)return;if(0===n.min_i&&n.max_i==r.length-1)u();else{for(t=n.max_i;t>=n.min_i;t--){for(l=O(e.find("tr").not(e.find("> table tr")).get(t)),a=0;a<r[t].length;a++)if(0===a||r[t][a]!=r[t][a-1]){var s=O(r[t][a]);if(1<parseInt(s.attr("rowspan"),10)){var o=parseInt(s.attr("rowspan"),10)-1;1==o?s.removeAttr("rowspan"):s.attr("rowspan",o)}if(t<r.length-1&&r[t][a]==r[t+1][a]&&(0===t||r[t][a]!=r[t-1][a])){for(var i=r[t][a],f=a;0<f&&r[t][f]==r[t][f-1];)f--;0===f?O(e.find("tr").not(e.find("> table tr")).get(t+1)).prepend(i):O(r[t+1][f-1])[0].parentNode&&O(r[t+1][f-1])[0].insertAdjacentElement("afterend",i)}}var d=l.parent();l.remove(),0===d.find("tr").length&&d.remove(),r=_(e)}w(0,r.length-1,0,r[0].length-1,e),0<n.min_i?E.selection.setAtEnd(r[n.min_i-1][0]):E.selection.setAtEnd(r[0][0]),E.selection.restore(),E.popups.hide("table.edit")}}},insertColumn:function(i){var e=Q();if(0<e.length){var f,d=_(),t=M(d);f="before"==i?t.min_j:t.max_j;var a,c=100/d[0].length,p=100/(d[0].length+1);e.find("th, td").each(function(){(a=O(this)).data("old-width",a.outerWidth()/e.outerWidth()*100)}),e.find("tr").not(e.find("> table tr")).each(function(e){for(var t,a=O(this),l=0,r=0;l-1<f;){if(!(t=a.find("> th, > td").get(r))){t=null;break}t==d[e][l]?(l+=parseInt(O(t).attr("colspan"),10)||1,r++):(l+=parseInt(O(d[e][l]).attr("colspan"),10)||1,"after"==i&&(t=0===r?-1:a.find("> th, > td").get(r-1)))}var n,s=O(t);if("after"==i&&f<l-1||"before"==i&&0<f&&d[e][f]==d[e][f-1]){if(0===e||0<e&&d[e][f]!=d[e-1][f]){var o=parseInt(s.attr("colspan"),10)+1;s.attr("colspan",o),s.css("width",(s.data("old-width")*p/c+p).toFixed(4)+"%"),s.removeData("old-width")}}else n=0<a.find("th").length?'<th style="width: '+p.toFixed(4)+'%;"><br></th>':'<td style="width: '+p.toFixed(4)+'%;"><br></td>',-1==t?a.prepend(n):null==t?a.append(n):"before"==i?s.before(n):"after"==i&&s[0].parentNode&&s[0].insertAdjacentHTML("afterend",n)}),e.find("th, td").each(function(){(a=O(this)).data("old-width")&&(a.css("width",(a.data("old-width")*p/c).toFixed(4)+"%"),a.removeData("old-width"))}),E.popups.isVisible("table.edit")&&h()}},deleteColumn:function(){var e=Q();if(0<e.length){var t,a,l,r=_(),n=M(r);if(null==n)return;if(0===n.min_j&&n.max_j==r[0].length-1)u();else{var s=0;for(t=0;t<r.length;t++)for(a=0;a<r[0].length;a++)(l=O(r[t][a])).hasClass("fr-selected-cell")||(l.data("old-width",l.outerWidth()/e.outerWidth()*100),(a<n.min_j||a>n.max_j)&&(s+=l.outerWidth()/e.outerWidth()*100));for(s/=r.length,a=n.max_j;a>=n.min_j;a--)for(t=0;t<r.length;t++)if(0===t||r[t][a]!=r[t-1][a])if(l=O(r[t][a]),1<(parseInt(l.attr("colspan"),10)||1)){var o=parseInt(l.attr("colspan"),10)-1;1==o?l.removeAttr("colspan"):l.attr("colspan",o),l.css("width",(100*(l.data("old-width")-j(a,r))/s).toFixed(4)+"%"),l.removeData("old-width")}else{var i=O(l.parent().get(0));l.remove(),0===i.find("> th, > td").length&&(0===i.prev().length||0===i.next().length||i.prev().find("> th[rowspan], > td[rowspan]").length<i.prev().find("> th, > td").length)&&i.remove()}w(0,r.length-1,0,r[0].length-1,e),0<n.min_j?E.selection.setAtEnd(r[n.min_i][n.min_j-1]):E.selection.setAtEnd(r[n.min_i][0]),E.selection.restore(),E.popups.hide("table.edit"),e.find("th, td").each(function(){(l=O(this)).data("old-width")&&(l.css("width",(100*l.data("old-width")/s).toFixed(4)+"%"),l.removeData("old-width"))})}}},mergeCells:function(){if(1<Z().length&&(0===E.$el.find("th.fr-selected-cell").length||0===E.$el.find("td.fr-selected-cell").length)){C();var e,t,a=M(_());if(null==a)return;var l=E.$el.find(".fr-selected-cell"),r=O(l[0]),n=r.parent().find(".fr-selected-cell"),s=r.closest("table"),o=r.html(),i=0;for(e=0;e<n.length;e++)i+=O(n[e]).outerWidth();for(r.css("width",Math.min(100,i/s.outerWidth()*100).toFixed(4)+"%"),a.min_j<a.max_j&&r.attr("colspan",a.max_j-a.min_j+1),a.min_i<a.max_i&&r.attr("rowspan",a.max_i-a.min_i+1),e=1;e<l.length;e++)"<br>"!=(t=O(l[e])).html()&&""!==t.html()&&(o+="<br>"+t.html()),t.remove();r.html(o),E.selection.setAtEnd(r.get(0)),E.selection.restore(),E.toolbar.enable(),m(a.min_i,a.max_i,s);var f=s.find("tr:empty");for(e=f.length-1;0<=e;e--)O(f[e]).remove();g(a.min_j,a.max_j,s),h()}},splitCellVertically:function(){if(1==Z().length){var e=E.$el.find(".fr-selected-cell"),t=parseInt(e.attr("colspan"),10)||1,a=e.parent().outerWidth(),l=e.outerWidth(),r=e.clone().html("<br>"),n=_(),s=x(e.get(0),n);if(1<t){var o=Math.ceil(t/2);l=X(s.col,s.col+o-1,n)/a*100;var i=X(s.col+o,s.col+t-1,n)/a*100;1<o?e.attr("colspan",o):e.removeAttr("colspan"),1<t-o?r.attr("colspan",t-o):r.removeAttr("colspan"),e.css("width",l.toFixed(4)+"%"),r.css("width",i.toFixed(4)+"%")}else{var f;for(f=0;f<n.length;f++)if(0===f||n[f][s.col]!=n[f-1][s.col]){var d=O(n[f][s.col]);if(!d.is(e)){var c=(parseInt(d.attr("colspan"),10)||1)+1;d.attr("colspan",c)}}l=l/a*100/2,e.css("width",l.toFixed(4)+"%"),r.css("width",l.toFixed(4)+"%")}e[0].parentNode&&e[0].insertAdjacentElement("afterend",r[0]),D(),E.popups.hide("table.edit")}},splitCellHorizontally:function(){if(1==Z().length){var e=E.$el.find(".fr-selected-cell"),t=e.parent(),a=e.closest("table"),l=parseInt(e.attr("rowspan"),10),r=_(),n=x(e.get(0),r),s=e.clone().html("<br>");if(1<l){var o=Math.ceil(l/2);1<o?e.attr("rowspan",o):e.removeAttr("rowspan"),1<l-o?s.attr("rowspan",l-o):s.removeAttr("rowspan");for(var i=n.row+o,f=0===n.col?n.col:n.col-1;0<=f&&(r[i][f]==r[i][f-1]||0<i&&r[i][f]==r[i-1][f]);)f--;-1==f?O(a.find("tr").not(a.find("> table tr")).get(i)).prepend(s):O(r[i][f])[0].parentNode&&O(r[i][f])[0].insertAdjacentElement("afterend",s[0])}else{var d,c=O(document.createElement("tr")).append(s);for(d=0;d<r[0].length;d++)if(0===d||r[n.row][d]!=r[n.row][d-1]){var p=O(r[n.row][d]);p.is(e)||p.attr("rowspan",(parseInt(p.attr("rowspan"),10)||1)+1)}t[0].parentNode&&t[0].insertAdjacentElement("afterend",c[0])}D(),E.popups.hide("table.edit")}},addHeader:function(){var e=Q();if(0<e.length&&0===e.find("th").length){var t,a="<thead><tr>",l=0;for(e.find("tr").first().find("> td").each(function(){var e=O(this);l+=parseInt(e.attr("colspan"),10)||1}),t=0;t<l;t++)a+="<th><br></th>";a+="</tr></thead>",e.prepend(a),h()}},removeHeader:function(){var e=Q(),t=e.find("thead");if(0<t.length)if(0===e.find("tbody tr").length)u();else if(t.remove(),0<Z().length)h();else{E.popups.hide("table.edit");var a=e.find("tbody tr").first().find("td").first().get(0);a&&(E.selection.setAtEnd(a),E.selection.restore())}},setBackground:t,showInsertPopup:function(){var e=E.$tb.find('.fr-command[data-cmd="insertTable"]'),t=E.popups.get("table.insert");if(t||(t=i()),!t.hasClass("fr-active")){E.popups.refresh("table.insert"),E.popups.setContainer("table.insert",E.$tb);var a=E.button.getPosition(e),l=a.left,r=a.top;E.popups.show("table.insert",l,r,e.outerHeight())}},showEditPopup:h,showColorsPopup:d,back:function(){0<Z().length?h():(E.popups.hide("table.insert"),E.toolbar.showInline())},verticalAlign:function(e){E.$el.find(".fr-selected-cell").css("vertical-align",e)},horizontalAlign:function(e){E.$el.find(".fr-selected-cell").css("text-align",e)},applyStyle:function(e,t,a,l){if(0<t.length){if(!a){var r=Object.keys(l);r.splice(r.indexOf(e),1),t.removeClass(r.join(" "))}t.toggleClass(e)}},selectedTable:Q,selectedCells:Z,customColor:function(){var e=E.popups.get("table.colors").find(".fr-table-colors-hex-layer input");e.length&&t(e.val())},selectCells:S}},ee.DefineIcon("insertTable",{NAME:"table",SVG_KEY:"insertTable"}),ee.RegisterCommand("insertTable",{title:"Insert Table",undo:!1,focus:!0,refreshOnCallback:!1,popup:!0,callback:function(){this.popups.isVisible("table.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("table.insert")):this.table.showInsertPopup()},plugin:"table"}),ee.RegisterCommand("tableInsert",{callback:function(e,t,a){this.table.insert(t,a),this.popups.hide("table.insert")}}),ee.DefineIcon("tableHeader",{NAME:"header",FA5NAME:"heading",SVG_KEY:"tableHeader"}),ee.RegisterCommand("tableHeader",{title:"Table Header",focus:!1,toggle:!0,callback:function(){this.popups.get("table.edit").find('.fr-command[data-cmd="tableHeader"]').hasClass("fr-active")?this.table.removeHeader():this.table.addHeader()},refresh:function(e){var t=this.table.selectedTable();0<t.length&&(0===t.find("th").length?e.removeClass("fr-active").attr("aria-pressed",!1):e.addClass("fr-active").attr("aria-pressed",!0))}}),ee.DefineIcon("tableRows",{NAME:"bars",SVG_KEY:"row"}),ee.RegisterCommand("tableRows",{type:"dropdown",focus:!1,title:"Row",options:{above:"Insert row above",below:"Insert row below","delete":"Delete row"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableRows.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableRows" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){"above"==t||"below"==t?this.table.insertRow(t):this.table.deleteRow()}}),ee.DefineIcon("tableColumns",{NAME:"bars fa-rotate-90",SVG_KEY:"columns"}),ee.RegisterCommand("tableColumns",{type:"dropdown",focus:!1,title:"Column",options:{before:"Insert column before",after:"Insert column after","delete":"Delete column"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableColumns.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableColumns" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){"before"==t||"after"==t?this.table.insertColumn(t):this.table.deleteColumn()}}),ee.DefineIcon("tableCells",{NAME:"square-o",FA5NAME:"square",SVG_KEY:"cellOptions"}),ee.RegisterCommand("tableCells",{type:"dropdown",focus:!1,title:"Cell",options:{merge:"Merge cells","vertical-split":"Vertical split","horizontal-split":"Horizontal split"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableCells.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCells" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){"merge"==t?this.table.mergeCells():"vertical-split"==t?this.table.splitCellVertically():this.table.splitCellHorizontally()},refreshOnShow:function(e,t){1<this.$el.find(".fr-selected-cell").length?(t.find('a[data-param1="vertical-split"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="horizontal-split"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="merge"]').removeClass("fr-disabled").attr("aria-disabled",!1)):(t.find('a[data-param1="merge"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="vertical-split"]').removeClass("fr-disabled").attr("aria-disabled",!1),t.find('a[data-param1="horizontal-split"]').removeClass("fr-disabled").attr("aria-disabled",!1))}}),ee.DefineIcon("tableRemove",{NAME:"trash",SVG_KEY:"removeTable"}),ee.RegisterCommand("tableRemove",{title:"Remove Table",focus:!1,callback:function(){this.table.remove()}}),ee.DefineIcon("tableStyle",{NAME:"paint-brush",SVG_KEY:"tableStyle"}),ee.RegisterCommand("tableStyle",{title:"Table Style",type:"dropdown",focus:!1,html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.tableStyles;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableStyle" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.applyStyle(t,this.$el.find(".fr-selected-cell").closest("table"),this.opts.tableMultipleStyles,this.opts.tableStyles)},refreshOnShow:function(e,t){var a=this.$,l=this.$el.find(".fr-selected-cell").closest("table");l&&t.find(".fr-command").each(function(){var e=a(this).data("param1"),t=l.hasClass(e);a(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),ee.DefineIcon("tableCellBackground",{NAME:"tint",SVG_KEY:"cellBackground"}),ee.RegisterCommand("tableCellBackground",{title:"Cell Background",focus:!1,popup:!0,callback:function(){this.table.showColorsPopup()}}),ee.RegisterCommand("tableCellBackgroundColor",{undo:!0,focus:!1,callback:function(e,t){this.table.setBackground(t)}}),ee.DefineIcon("tableBack",{NAME:"arrow-left",SVG_KEY:"back"}),ee.RegisterCommand("tableBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.table.back()},refresh:function(e){0!==this.table.selectedCells().length||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.DefineIcon("tableCellVerticalAlign",{NAME:"arrows-v",FA5NAME:"arrows-alt-v",SVG_KEY:"verticalAlignMiddle"}),ee.RegisterCommand("tableCellVerticalAlign",{type:"dropdown",focus:!1,title:"Vertical Align",options:{Top:"Align Top",Middle:"Align Middle",Bottom:"Align Bottom"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableCellVerticalAlign.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellVerticalAlign" data-param1="'+a.toLowerCase()+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(a)+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.verticalAlign(t)},refreshOnShow:function(e,t){t.find('.fr-command[data-param1="'+this.$el.find(".fr-selected-cell").css("vertical-align")+'"]').addClass("fr-active").attr("aria-selected",!0)}}),ee.DefineIcon("tableCellHorizontalAlign",{NAME:"align-left",SVG_KEY:"alignLeft"}),ee.DefineIcon("align-left",{NAME:"align-left",SVG_KEY:"alignLeft"}),ee.DefineIcon("align-right",{NAME:"align-right",SVG_KEY:"alignRight"}),ee.DefineIcon("align-center",{NAME:"align-center",SVG_KEY:"alignCenter"}),ee.DefineIcon("align-justify",{NAME:"align-justify",SVG_KEY:"alignJustify"}),ee.RegisterCommand("tableCellHorizontalAlign",{type:"dropdown",focus:!1,title:"Horizontal Align",options:{left:"Align Left",center:"Align Center",right:"Align Right",justify:"Align Justify"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=ee.COMMANDS.tableCellHorizontalAlign.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="tableCellHorizontalAlign" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.icon.create("align-"+a)+'<span class="fr-sr-only">'+this.language.translate(t[a])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.table.horizontalAlign(t)},refresh:function(e){var t=this.table.selectedCells(),a=this.$;t.length&&e.find("> *").first().replaceWith(this.icon.create("align-"+this.helpers.getAlignment(a(t[0]))))},refreshOnShow:function(e,t){t.find('.fr-command[data-param1="'+this.helpers.getAlignment(this.$el.find(".fr-selected-cell").first())+'"]').addClass("fr-active").attr("aria-selected",!0)}}),ee.DefineIcon("tableCellStyle",{NAME:"magic",SVG_KEY:"cellStyle"}),ee.RegisterCommand("tableCellStyle",{title:"Cell Style",type:"dropdown",focus:!1,html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.tableCellStyles;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellStyle" data-param1="'+a+'" title="'+this.language.translate(t[a])+'">'+this.language.translate(t[a])+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.applyStyle(t,this.$el.find(".fr-selected-cell"),this.opts.tableCellMultipleStyles,this.opts.tableCellStyles)},refreshOnShow:function(e,t){var a=this.$,l=this.$el.find(".fr-selected-cell").first();l&&t.find(".fr-command").each(function(){var e=a(this).data("param1"),t=l.hasClass(e);a(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),ee.RegisterCommand("tableCellBackgroundCustomColor",{title:"OK",undo:!0,callback:function(){this.table.customColor()}}),ee.DefineIcon("tableColorRemove",{NAME:"eraser",SVG_KEY:"remove"})}); |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(J){"use strict";J=J&&J.hasOwnProperty("default")?J["default"]:J,Object.assign(J.POPUP_TEMPLATES,{"video.insert":"[_BUTTONS_][_BY_URL_LAYER_][_EMBED_LAYER_][_UPLOAD_LAYER_][_PROGRESS_BAR_]","video.edit":"[_BUTTONS_]","video.size":"[_BUTTONS_][_SIZE_LAYER_]"}),Object.assign(J.DEFAULTS,{videoAllowedTypes:["mp4","webm","ogg"],videoAllowedProviders:[".*"],videoDefaultAlign:"center",videoDefaultDisplay:"block",videoDefaultWidth:600,videoEditButtons:["videoReplace","videoRemove","videoDisplay","videoAlign","videoSize"],videoInsertButtons:["videoBack","|","videoByURL","videoEmbed","videoUpload"],videoMaxSize:52428800,videoMove:!0,videoResize:!0,videoResponsive:!1,videoSizeButtons:["videoBack","|"],videoSplitHTML:!1,videoTextNear:!0,videoUpload:!0,videoUploadMethod:"POST",videoUploadParam:"file",videoUploadParams:{},videoUploadToS3:!1,videoUploadURL:null}),J.VIDEO_PROVIDERS=[{test_regex:/^.*((youtu.be)|(youtube.com))\/((v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))?\??v?=?([^#\&\?]*).*/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=|embed\/)?([0-9a-zA-Z_\-]+)(.+)?/g,url_text:"https://www.youtube.com/embed/$1",html:'<iframe width="640" height="360" src="{url}?wmode=opaque" frameborder="0" allowfullscreen></iframe>',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:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',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:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'<iframe width="640" height="360" src="{url}?format=embed" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"https://rutube.ru/play/embed/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/g,url_text:"https://play.vidyard.com/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"vidyard"}],J.VIDEO_EMBED_REGEX=/^\W*((<iframe(.|\n)*>(\s|\n)*<\/iframe>)|(<embed(.|\n)*>))\W*$/i,J.PLUGINS.video=function(v){var a,f,p,u,o,i,c=v.$,d="https://i.froala.com/upload",l=2,h=3,g=4,m=5,b=6,r={};function y(){var e=v.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 s(){var e=v.popups.get("video.edit");if(e||(e=function(){var e="";if(0<v.opts.videoEditButtons.length){v.opts.videoResponsive&&(v.opts.videoEditButtons.splice(v.opts.videoEditButtons.indexOf("videoSize"),1),v.opts.videoEditButtons.splice(v.opts.videoEditButtons.indexOf("videoDisplay"),1),v.opts.videoEditButtons.splice(v.opts.videoEditButtons.indexOf("videoAlign"),1));var t={buttons:e+='<div class="fr-buttons"> \n '.concat(v.button.buildList(v.opts.videoEditButtons)," \n </div>")},i=v.popups.create("video.edit",t);return v.events.$on(v.$wp,"scroll.video-edit",function(){u&&v.popups.isVisible("video.edit")&&(v.events.disableBlur(),R(u))}),i}return!1}()),e){v.popups.setContainer("video.edit",v.$sc),v.popups.refresh("video.edit");var t=u.find("iframe, embed, video"),i=t.offset().left+t.outerWidth()/2,o=t.offset().top+t.outerHeight();v.popups.show("video.edit",i,o,t.outerHeight(),!0)}}function n(e){if(e)return v.popups.onRefresh("video.insert",y),v.popups.onHide("video.insert",W),!0;var t="";v.opts.videoUpload||v.opts.videoInsertButtons.splice(v.opts.videoInsertButtons.indexOf("videoUpload"),1),1<v.opts.videoInsertButtons.length&&(t='<div class="fr-buttons fr-tabs">'+v.button.buildList(v.opts.videoInsertButtons)+"</div>");var i,o="",r=v.opts.videoInsertButtons.indexOf("videoUpload"),s=v.opts.videoInsertButtons.indexOf("videoByURL"),n=v.opts.videoInsertButtons.indexOf("videoEmbed");0<=s&&(i=" fr-active",(r<s&&0<=r||n<s&&0<=n)&&(i=""),o='<div class="fr-video-by-url-layer fr-layer'+i+'" id="fr-video-by-url-layer-'+v.id+'"><div class="fr-input-line"><input id="fr-video-by-url-layer-text-'+v.id+'" type="text" placeholder="'+v.language.translate("Paste in a video URL")+'" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoInsertByURL" tabIndex="2" role="button">'+v.language.translate("Insert")+"</button></div></div>");var a="";0<=n&&(i=" fr-active",(r<n&&0<=r||s<n&&0<=s)&&(i=""),a='<div class="fr-video-embed-layer fr-layer'+i+'" id="fr-video-embed-layer-'+v.id+'"><div class="fr-input-line"><textarea id="fr-video-embed-layer-text'+v.id+'" type="text" placeholder="'+v.language.translate("Embedded Code")+'" tabIndex="1" aria-required="true" rows="5"></textarea></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoInsertEmbed" tabIndex="2" role="button">'+v.language.translate("Insert")+"</button></div></div>");var d="";0<=r&&(i=" fr-active",(n<r&&0<=n||s<r&&0<=s)&&(i=""),d='<div class="fr-video-upload-layer fr-layer'+i+'" id="fr-video-upload-layer-'+v.id+'"><strong>'+v.language.translate("Drop video")+"</strong><br>("+v.language.translate("or click")+')<div class="fr-form"><input type="file" accept="video/'+v.opts.videoAllowedTypes.join(", video/").toLowerCase()+'" tabIndex="-1" aria-labelledby="fr-video-upload-layer-'+v.id+'" role="button"></div></div>');var l={buttons:t,by_url_layer:o,embed_layer:a,upload_layer:d,progress_bar:'<div class="fr-video-progress-bar-layer fr-layer"><h3 tabIndex="-1" class="fr-message">Uploading</h3><div class="fr-loader"><span class="fr-progress"></span></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-dismiss" data-cmd="videoDismissError" tabIndex="2" role="button">OK</button></div></div>'},f=v.popups.create("video.insert",l);return function(o){v.events.$on(o,"dragover dragenter",".fr-video-upload-layer",function(){return c(this).addClass("fr-drop"),!1},!0),v.events.$on(o,"dragleave dragend",".fr-video-upload-layer",function(){return c(this).removeClass("fr-drop"),!1},!0),v.events.$on(o,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),c(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var i=o.data("instance")||v;i.events.disableBlur(),i.video.upload(t.files),i.events.enableBlur()}},!0),v.helpers.isIOS()&&v.events.$on(o,"touchstart",'.fr-video-upload-layer input[type="file"]',function(){c(this).trigger("click")},!0);v.events.$on(o,"change",'.fr-video-upload-layer input[type="file"]',function(){if(this.files){var e=o.data("instance")||v;e.events.disableBlur(),o.find("input:focus").blur(),e.events.enableBlur(),e.video.upload(this.files)}c(this).val("")},!0)}(f),f}function w(e){v.events.focus(!0),v.selection.restore();var t=!1;u&&(F(),t=!0),v.html.insert('<span contenteditable="false" draggable="true" class="fr-jiv fr-video">'+e+"</span>",!1,v.opts.videoSplitHTML),v.popups.hide("video.insert");var i=v.$el.find(".fr-jiv");i.removeClass("fr-jiv"),i.toggleClass("fr-rv",v.opts.videoResponsive),j(i,v.opts.videoDefaultDisplay,v.opts.videoDefaultAlign),i.toggleClass("fr-draggable",v.opts.videoMove),v.events.trigger(t?"video.replaced":"video.inserted",[i])}function E(){var e=c(this);v.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),R(e.parent()),v.events.trigger("video.loaded",[e.parent()])}function C(a,e,d,l,f){v.edit.off(),A("Loading video"),e&&(a=v.helpers.sanitizeURL(a));_("Loading video"),function(){var e,t;if(l){v.undo.canDo()||l.find("video").hasClass("fr-uploading")||v.undo.saveStep();var i=l.find("video").data("fr-old-src"),o=l.data("fr-replaced");l.data("fr-replaced",!1),v.$wp?((e=l.clone(!0)).find("video").removeData("fr-old-src").removeClass("fr-uploading"),e.find("video").off("canplay"),i&&l.find("video").attr("src",i),l.replaceWith(e)):e=l;for(var r=e.find("video").get(0).attributes,s=0;s<r.length;s++){var n=r[s];0===n.nodeName.indexOf("data-")&&e.find("video").removeAttr(n.nodeName)}if(void 0!==d)for(t in d)d.hasOwnProperty(t)&&"link"!=t&&e.find("video").attr("data-"+t,d[t]);e.find("video").on("canplay",E),e.find("video").attr("src",a),v.edit.on(),P(),v.undo.saveStep(),v.$el.blur(),v.events.trigger(o?"video.replaced":"video.inserted",[e,f])}else e=function(e,t,i){var o,r="";if(t&&void 0!==t)for(o in t)t.hasOwnProperty(o)&&"link"!=o&&(r+=" data-"+o+'="'+t[o]+'"');var s=v.opts.videoDefaultWidth;s&&"auto"!=s&&(s+="px");var n=c(document.createElement("span")).attr("contenteditable","false").attr("draggable","true").attr("class","fr-video fr-dv"+v.opts.videoDefaultDisplay[0]+("center"!=v.opts.videoDefaultAlign?" fr-fv"+v.opts.videoDefaultAlign[0]:"")).html('<video src="'+e+'" '+r+(s?' style="width: '+s+';" ':"")+" controls>"+v.language.translate("Your browser does not support HTML5 video.")+"</video>");n.toggleClass("fr-draggable",v.opts.videoMove),v.edit.on(),v.events.focus(!0),v.selection.restore(),v.undo.saveStep(),v.opts.videoSplitHTML?v.markers.split():v.markers.insert(),v.html.wrap();var a=v.$el.find(".fr-marker");return v.node.isLastSibling(a)&&a.parent().hasClass("fr-deletable")&&a.insertAfter(a.parent()),a.replaceWith(n),v.selection.clear(),n.find("video").get(0).readyState>n.find("video").get(0).HAVE_FUTURE_DATA||v.helpers.isIOS()?i.call(n.find("video").get(0)):n.find("video").on("canplaythrough load",i),n}(a,d,E),P(),v.undo.saveStep(),v.events.trigger("video.inserted",[e,f])}()}function _(e){var t=v.popups.get("video.insert");if(t||(t=n()),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 i=u.find("video");v.popups.setContainer("video.insert",v.$sc);var o=i.offset().left,r=i.offset().top+i.height();v.popups.show("video.insert",o,r,i.outerHeight())}void 0===e&&A(v.language.translate("Uploading"),0)}function S(e){var t=v.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||v.$el.find("video.fr-error").length)){if(v.events.focus(),v.$el.find("video.fr-error").length&&(v.$el.find("video.fr-error").parent().remove(),v.undo.saveStep(),v.undo.run(),v.undo.dropRedo()),!v.$wp&&u){var i=u;T(!0),v.selection.setAfter(i.find("video").get(0)),v.selection.restore()}v.popups.hide("video.insert")}}function A(e,t){var i=v.popups.get("video.insert");if(i){var o=i.find(".fr-video-progress-bar-layer");o.find("h3").text(e+(t?" "+t+"%":"")),o.removeClass("fr-error"),t?(o.find("div").removeClass("fr-indeterminate"),o.find("div > span").css("width",t+"%")):o.find("div").addClass("fr-indeterminate")}}function R(e){t.call(e.get(0))}function x(e){A("Loading video");var t=this.status,i=this.response,o=this.responseXML,r=this.responseText;try{if(v.opts.videoUploadToS3)if(201==t){var s=function(e){try{var t=c(e).find("Location").text(),i=c(e).find("Key").text();return!1===v.events.trigger("video.uploadedToS3",[t,i,e],!0)?(v.edit.on(),!1):t}catch(o){return N(g,e),!1}}(o);s&&C(s,!1,[],e,i||o)}else N(g,i||o);else if(200<=t&&t<300){var n=function(e){try{if(!1===v.events.trigger("video.uploaded",[e],!0))return v.edit.on(),!1;var t=JSON.parse(e);return t.link?t:(N(l,e),!1)}catch(i){return N(g,e),!1}}(r);n&&C(n.link,!1,n,e,i||r)}else N(h,i||r)}catch(a){N(g,i||r)}}function D(){N(g,this.response||this.responseText||this.responseXML)}function U(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;A(v.language.translate("Uploading"),t)}}function B(){v.edit.on(),S(!0)}function $(e){if(!v.core.sameInstance(p))return!0;e.preventDefault(),e.stopPropagation();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),i=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!i)return!1;if("mousedown"==e.type){var o=v.$oel.get(0).ownerDocument,r=o.defaultView||o.parentWindow,s=!1;try{s=r.location!=r.parent.location&&!(r.$&&r.$.FE)}catch(n){}s&&r.frameElement&&(t+=v.helpers.getPX(c(r.frameElement).offset().left)+r.frameElement.clientLeft,i=e.clientY+v.helpers.getPX(c(r.frameElement).offset().top)+r.frameElement.clientTop)}v.undo.canDo()||v.undo.saveStep(),(f=c(this)).data("start-x",t),f.data("start-y",i),a.show(),v.popups.hideAll(),M()}function I(e){if(!v.core.sameInstance(p))return!0;if(f){e.preventDefault();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),i=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!i)return!1;var o=f.data("start-x"),r=f.data("start-y");f.data("start-x",t),f.data("start-y",i);var s=t-o,n=i-r,a=u.find("iframe, embed, video"),d=a.width(),l=a.height();(f.hasClass("fr-hnw")||f.hasClass("fr-hsw"))&&(s=0-s),(f.hasClass("fr-hnw")||f.hasClass("fr-hne"))&&(n=0-n),a.css("width",d+s),a.css("height",l+n),a.removeAttr("width"),a.removeAttr("height"),z()}}function k(e){if(!v.core.sameInstance(p))return!0;f&&u&&(e&&e.stopPropagation(),f=null,a.hide(),z(),s(),v.undo.saveStep())}function O(e){return'<div class="fr-handler fr-h'+e+'"></div>'}function L(e,t,i,o){return e.pageX=t,e.pageY=t,$.call(this,e),e.pageX=e.pageX+i*Math.floor(Math.pow(1.1,o)),e.pageY=e.pageY+i*Math.floor(Math.pow(1.1,o)),I.call(this,e),k.call(this,e),++o}function P(){var e,t=Array.prototype.slice.call(v.el.querySelectorAll("video, .fr-video > *")),i=[];for(e=0;e<t.length;e++)i.push(t[e].getAttribute("src")),c(t[e]).toggleClass("fr-draggable",v.opts.videoMove),""===t[e].getAttribute("class")&&t[e].removeAttribute("class"),""===t[e].getAttribute("style")&&t[e].removeAttribute("style");if(o)for(e=0;e<o.length;e++)i.indexOf(o[e].getAttribute("src"))<0&&v.events.trigger("video.removed",[c(o[e])]);o=t}function z(){p||function(){var e;if(v.shared.$video_resizer?(p=v.shared.$video_resizer,a=v.shared.$vid_overlay,v.events.on("destroy",function(){c("body").first().append(p.removeClass("fr-active"))},!0)):(v.shared.$video_resizer=c(document.createElement("div")).attr("class","fr-video-resizer"),p=v.shared.$video_resizer,v.events.$on(p,"mousedown",function(e){e.stopPropagation()},!0),v.opts.videoResize&&(p.append(O("nw")+O("ne")+O("sw")+O("se")),v.shared.$vid_overlay=c(document.createElement("div")).attr("class","fr-video-overlay"),a=v.shared.$vid_overlay,e=p.get(0).ownerDocument,c(e).find("body").first().append(a))),v.events.on("shared.destroy",function(){p.html("").removeData().remove(),p=null,v.opts.videoResize&&(a.remove(),a=null)},!0),v.helpers.isMobile()||v.events.$on(c(v.o_win),"resize.video",function(){T(!0)}),v.opts.videoResize){e=p.get(0).ownerDocument,v.events.$on(p,v._mousedown,".fr-handler",$),v.events.$on(c(e),v._mousemove,I),v.events.$on(c(e.defaultView||e.parentWindow),v._mouseup,k),v.events.$on(a,"mouseleave",k);var o=1,r=null,s=0;v.events.on("keydown",function(e){if(u){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,i=e.which;(i!==r||200<e.timeStamp-s)&&(o=1),(i==J.KEYCODE.EQUALS||v.browser.mozilla&&i==J.KEYCODE.FF_EQUALS)&&t&&!e.altKey?o=L.call(this,e,1,1,o):(i==J.KEYCODE.HYPHEN||v.browser.mozilla&&i==J.KEYCODE.FF_HYPHEN)&&t&&!e.altKey&&(o=L.call(this,e,2,-1,o)),r=i,s=e.timeStamp}}),v.events.on("keyup",function(){o=1})}}(),(v.$wp||v.$sc).append(p),p.data("instance",v);var e=u.find("iframe, embed, video"),t=0,i=0;v.opts.iframe&&(i=v.helpers.getPX(v.$wp.find(".fr-iframe").css("padding-top")),t=v.helpers.getPX(v.$wp.find(".fr-iframe").css("padding-left"))),p.css("top",(v.opts.iframe?e.offset().top+i-1:e.offset().top-v.$wp.offset().top-1)+v.$wp.scrollTop()).css("left",(v.opts.iframe?e.offset().left+t-1:e.offset().left-v.$wp.offset().left-1)+v.$wp.scrollLeft()).css("width",e.get(0).getBoundingClientRect().width).css("height",e.get(0).getBoundingClientRect().height).addClass("fr-active")}function t(e){if(e&&"touchend"==e.type&&i)return!0;if(e&&v.edit.isDisabled())return e.stopPropagation(),e.preventDefault(),!1;if(v.edit.isDisabled())return!1;for(var t=0;t<J.INSTANCES.length;t++)J.INSTANCES[t]!=v&&J.INSTANCES[t].events.trigger("video.hideResizer");v.toolbar.disable(),v.helpers.isMobile()&&(v.events.disableBlur(),v.$el.blur(),v.events.enableBlur()),v.$el.find(".fr-video.fr-active").removeClass("fr-active"),(u=c(this)).addClass("fr-active"),v.opts.iframe&&v.size.syncIframe(),Z(),z(),s(),v.selection.clear(),v.button.bulkRefresh(),v.events.trigger("image.hideResizer")}function T(e){u&&(v.shared.vid_exit_flag||!0===e)&&(p.removeClass("fr-active"),v.toolbar.enable(),u.removeClass("fr-active"),u=null,M())}function e(){v.shared.vid_exit_flag=!0}function M(){v.shared.vid_exit_flag=!1}function V(e){var t=e.originalEvent.dataTransfer;if(t&&t.files&&t.files.length){var i=t.files[0];if(i&&i.type&&-1!==i.type.indexOf("video")){if(!v.opts.videoUpload)return e.preventDefault(),e.stopPropagation(),!1;v.markers.remove(),v.markers.insertAtPoint(e.originalEvent),v.$el.find(".fr-marker").replaceWith(J.MARKERS),v.popups.hideAll();var o=v.popups.get("video.insert");return o||(o=n()),v.popups.setContainer("video.insert",v.$sc),v.popups.show("video.insert",e.originalEvent.pageX,e.originalEvent.pageY),_(),0<=v.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))?Y(t.files):N(b),e.preventDefault(),e.stopPropagation(),!1}}}function Y(e){if(void 0!==e&&0<e.length){if(!1===v.events.trigger("video.beforeUpload",[e]))return!1;var t,i=e[0];if((null===v.opts.videoUploadURL||v.opts.videoUploadURL==d)&&!v.opts.videoUploadToS3)return function(o){u&&u.find("iframe")&&u.find("iframe").length&&F();var r=new FileReader;r.onload=function(){r.result;for(var e=atob(r.result.split(",")[1]),t=[],i=0;i<e.length;i++)t.push(e.charCodeAt(i));C(window.URL.createObjectURL(new Blob([new Uint8Array(t)],{type:o.type})),!1,null,u)},_(),r.readAsDataURL(o)}(i),!1;if(i.size>v.opts.videoMaxSize)return N(m),!1;if(v.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))<0)return N(b),!1;if(v.drag_support.formdata&&(t=v.drag_support.formdata?new FormData:null),t){var o;if(!1!==v.opts.videoUploadToS3)for(o in t.append("key",v.opts.videoUploadToS3.keyStart+(new Date).getTime()+"-"+(i.name||"untitled")),t.append("success_action_status","201"),t.append("X-Requested-With","xhr"),t.append("Content-Type",i.type),v.opts.videoUploadToS3.params)v.opts.videoUploadToS3.params.hasOwnProperty(o)&&t.append(o,v.opts.videoUploadToS3.params[o]);for(o in v.opts.videoUploadParams)v.opts.videoUploadParams.hasOwnProperty(o)&&t.append(o,v.opts.videoUploadParams[o]);t.append(v.opts.videoUploadParam,i);var r=v.opts.videoUploadURL;v.opts.videoUploadToS3&&(r=v.opts.videoUploadToS3.uploadURL?v.opts.videoUploadToS3.uploadURL:"https://"+v.opts.videoUploadToS3.region+".amazonaws.com/"+v.opts.videoUploadToS3.bucket);var s=v.core.getXHR(r,v.opts.videoUploadMethod);s.onload=function(){x.call(s,u)},s.onerror=D,s.upload.onprogress=U,s.onabort=B,_(),v.events.disableBlur(),v.edit.off(),v.events.enableBlur();var n=v.popups.get("video.insert");n&&c(n.off("abortUpload")).on("abortUpload",function(){4!=s.readyState&&s.abort()}),s.send(t)}}}function N(e,t){v.edit.on(),u&&u.find("video").addClass("fr-error"),function(e){_();var t=v.popups.get("video.insert").find(".fr-video-progress-bar-layer");t.addClass("fr-error");var i=t.find("h3");i.text(e),v.events.disableBlur(),i.focus()}(v.language.translate("Something went wrong. Please try again.")),v.events.trigger("video.error",[{code:e,message:r[e]},t])}function K(){if(u){var e=v.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 X(e){if(e)return v.popups.onRefresh("video.size",K),!0;var t={buttons:'<div class="fr-buttons fr-tabs">'+v.button.buildList(v.opts.videoSizeButtons)+"</div>",size_layer:'<div class="fr-video-size-layer fr-layer fr-active" id="fr-video-size-layer-'+v.id+'"><div class="fr-video-group"><div class="fr-input-line"><input id="fr-video-size-layer-width-'+v.id+'" type="text" name="width" placeholder="'+v.language.translate("Width")+'" tabIndex="1"></div><div class="fr-input-line"><input id="fr-video-size-layer-height-'+v.id+'" type="text" name="height" placeholder="'+v.language.translate("Height")+'" tabIndex="1"></div></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoSetSize" tabIndex="2" role="button">'+v.language.translate("Update")+"</button></div></div>"},i=v.popups.create("video.size",t);return v.events.$on(v.$wp,"scroll",function(){u&&v.popups.isVisible("video.size")&&(v.events.disableBlur(),R(u))}),i}function H(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 F(){if(u&&!1!==v.events.trigger("video.beforeRemove",[u])){var e=u;v.popups.hideAll(),T(!0),v.selection.setBefore(e.get(0))||v.selection.setAfter(e.get(0)),e.remove(),v.selection.restore(),v.html.fillEmptyBlocks(),v.events.trigger("video.removed",[e])}}function W(){S()}function j(e,t,i){!v.opts.htmlUntouched&&v.opts.useClasses?(e.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),e.addClass("fr-fv"+i[0]+" fr-dv"+t[0])):"inline"==t?(e.css({display:"inline-block"}),"center"==i?e.css({"float":"none"}):"left"==i?e.css({"float":"left"}):e.css({"float":"right"})):(e.css({display:"block",clear:"both"}),"left"==i?e.css({textAlign:"left"}):"right"==i?e.css({textAlign:"right"}):e.css({textAlign:"center"}))}function q(){var e=v.$el.find("video").filter(function(){return 0===c(this).parents("span.fr-video").length});if(0!=e.length){e.wrap(c(document.createElement("span")).attr("class","fr-video").attr("contenteditable","false")),v.$el.find("embed, iframe").filter(function(){if(v.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0<c(this).parents("span.fr-video").length)return!1;for(var e=c(this).attr("src"),t=0;t<J.VIDEO_PROVIDERS.length;t++){var i=J.VIDEO_PROVIDERS[t];if(i.test_regex.test(e)&&new RegExp(v.opts.videoAllowedProviders.join("|")).test(i.provider))return!0}return!1}).map(function(){return 0===c(this).parents("object").length?this:c(this).parents("object").get(0)}).wrap(c(document.createElement("span")).attr("class","fr-video").attr("contenteditable","false"));for(var t,i,o=v.$el.find("span.fr-video, video"),r=0;r<o.length;r++){var s=c(o[r]);!v.opts.htmlUntouched&&v.opts.useClasses?((i=s).hasClass("fr-dvi")||i.hasClass("fr-dvb")||(i.addClass("fr-fv"+H(i)[0]),i.addClass("fr-dv"+G(i)[0])),v.opts.videoTextNear||s.removeClass("fr-dvi").addClass("fr-dvb")):v.opts.htmlUntouched||v.opts.useClasses||(j(t=s,t.hasClass("fr-dvb")?"block":t.hasClass("fr-dvi")?"inline":null,t.hasClass("fr-fvl")?"left":t.hasClass("fr-fvr")?"right":H(t)),t.removeClass("fr-dvb fr-dvi fr-fvr fr-fvl"))}o.toggleClass("fr-draggable",v.opts.videoMove)}}function Z(){if(u){v.selection.clear();var e=v.doc.createRange();e.selectNode(u.get(0)),v.selection.get().addRange(e)}}return r[1]="Video cannot be loaded from the passed link.",r[l]="No link in upload response.",r[h]="Error during file upload.",r[g]="Parsing response failed.",r[m]="File is too large.",r[b]="Video file type is invalid.",r[7]="Files can be uploaded only to same domain in IE 8 and IE 9.",v.shared.vid_exit_flag=!1,{_init:function(){v.opts.videoResponsive&&(v.opts.videoResize=!1),v.events.on("drop",V,!0),v.events.on("mousedown window.mousedown",e),v.events.on("window.touchmove",M),v.events.on("mouseup window.mouseup",T),v.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&T()}),v.events.on("video.hideResizer commands.undo commands.redo element.dropped",function(){T(!0)}),v.helpers.isMobile()&&(v.events.$on(v.$el,"touchstart","span.fr-video",function(){i=!1}),v.events.$on(v.$el,"touchmove",function(){i=!0})),v.events.on("html.set",q),q(),v.events.$on(v.$el,"mousedown","span.fr-video",function(e){e.stopPropagation(),(v.browser.msie||v.browser.edge)&&(e.target.dragDrop(),t.call(this,e))}),v.events.$on(v.$el,"click touchend","span.fr-video",function(e){if("false"==c(this).parents("[contenteditable]").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;t.call(this,e)}),v.events.on("keydown",function(e){var t=e.which;return!u||t!=J.KEYCODE.BACKSPACE&&t!=J.KEYCODE.DELETE?u&&t==J.KEYCODE.ESC?(T(!0),e.preventDefault(),!1):u&&t!=J.KEYCODE.F10&&!v.keys.isBrowserAction(e)?(e.preventDefault(),!1):void 0:(e.preventDefault(),F(),v.undo.saveStep(),!1)},!0),v.events.on("toolbar.esc",function(){if(u)return v.events.disableBlur(),v.events.focus(),!1},!0),v.events.on("toolbar.focusEditor",function(){if(u)return!1},!0),v.events.on("keydown",function(){v.$el.find("span.fr-video:empty").remove()}),v.$wp&&(P(),v.events.on("contentChanged",P)),n(!0),X(!0)},showInsertPopup:function(){var e=v.$tb.find('.fr-command[data-cmd="insertVideo"]'),t=v.popups.get("video.insert");if(t||(t=n()),S(),!t.hasClass("fr-active"))if(v.popups.refresh("video.insert"),v.popups.setContainer("video.insert",v.$tb),e.isVisible()){var i=v.button.getPosition(e),o=i.left,r=i.top;v.popups.show("video.insert",o,r,e.outerHeight())}else v.position.forSelection(t),v.popups.show("video.insert")},showLayer:function(e){var t,i,o=v.popups.get("video.insert");if(!u&&!v.opts.toolbarInline){var r=v.$tb.find('.fr-command[data-cmd="insertVideo"]');t=r.offset().left,i=r.offset().top+(v.opts.toolbarBottom?10:r.outerHeight()-10)}v.opts.toolbarInline&&(i=o.offset().top-v.helpers.getPX(o.css("margin-top")),o.hasClass("fr-above")&&(i+=o.outerHeight())),o.find(".fr-layer").removeClass("fr-active"),o.find(".fr-"+e+"-layer").addClass("fr-active"),v.popups.show("video.insert",t,i,0),v.accessibility.focusPopup(o)},refreshByURLButton:function(e){var t=v.popups.get("video.insert");t&&t.find(".fr-video-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshEmbedButton:function(e){var t=v.popups.get("video.insert");t&&t.find(".fr-video-embed-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshUploadButton:function(e){var t=v.popups.get("video.insert");t&&t.find(".fr-video-upload-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},upload:Y,insertByURL:function(e){void 0===e&&(e=(v.popups.get("video.insert").find('.fr-video-by-url-layer input[type="text"]').val()||"").trim());var t=null;if(/^http/.test(e)||(e="https://"+e),v.helpers.isURL(e))for(var i=0;i<J.VIDEO_PROVIDERS.length;i++){var o=J.VIDEO_PROVIDERS[i];if(o.test_regex.test(e)&&new RegExp(v.opts.videoAllowedProviders.join("|")).test(o.provider)){t=e.replace(o.url_regex,o.url_text),t=o.html.replace(/\{url\}/,t);break}}t?w(t):v.events.trigger("video.linkError",[e])},insertEmbed:function(e){void 0===e&&(e=v.popups.get("video.insert").find(".fr-video-embed-layer textarea").val()||""),0!==e.length&&J.VIDEO_EMBED_REGEX.test(e)?w(e):v.events.trigger("video.codeError",[e])},insert:w,align:function(e){u.removeClass("fr-fvr fr-fvl"),!v.opts.htmlUntouched&&v.opts.useClasses?"left"==e?u.addClass("fr-fvl"):"right"==e&&u.addClass("fr-fvr"):j(u,G(),e),Z(),z(),s(),v.selection.clear()},refreshAlign:function(e){if(!u)return!1;e.find(">*").first().replaceWith(v.icon.create("video-align-"+H()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+H()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){u.removeClass("fr-dvi fr-dvb"),!v.opts.htmlUntouched&&v.opts.useClasses?"inline"==e?u.addClass("fr-dvi"):"block"==e&&u.addClass("fr-dvb"):j(u,e,H()),Z(),z(),s(),v.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+G()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:F,hideProgressBar:S,showSizePopup:function(){var e=v.popups.get("video.size");e||(e=X()),S(),v.popups.refresh("video.size"),v.popups.setContainer("video.size",v.$sc);var t=u.find("iframe, embed, video"),i=t.offset().left+t.outerWidth()/2,o=t.offset().top+t.height();v.popups.show("video.size",i,o,t.height(),!0)},replace:function(){var e=v.popups.get("video.insert");e||(e=n()),v.popups.isVisible("video.insert")||(S(),v.popups.refresh("video.insert"),v.popups.setContainer("video.insert",v.$sc));var t=u.offset().left+u.outerWidth()/2,i=u.offset().top+u.height();v.popups.show("video.insert",t,i,u.outerHeight(),!0)},back:function(){u?(v.events.disableBlur(),u[0].click()):(v.events.disableBlur(),v.selection.restore(),v.events.enableBlur(),v.popups.hide("video.insert"),v.toolbar.showInline())},setSize:function(e,t){if(u){var i=v.popups.get("video.size"),o=u.find("iframe, embed, video");o.css("width",e||i.find('input[name="width"]').val()),o.css("height",t||i.find('input[name="height"]').val()),o.get(0).style.width&&o.removeAttr("width"),o.get(0).style.height&&o.removeAttr("height"),i.find("input:focus").blur(),setTimeout(function(){u.trigger("click")},v.helpers.isAndroid()?50:0)}},get:function(){return u},showProgressBar:_}},J.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"}),J.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera",SVG_KEY:"insertVideo"}),J.DefineIcon("videoByURL",{NAME:"link",SVG_KEY:"insertLink"}),J.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)}}),J.DefineIcon("videoEmbed",{NAME:"code",SVG_KEY:"codeView"}),J.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)}}),J.DefineIcon("videoUpload",{NAME:"upload",SVG_KEY:"upload"}),J.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)}}),J.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),J.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),J.DefineIcon("videoDisplay",{NAME:"star",SVG_KEY:"star"}),J.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)}}),J.DefineIcon("video-align",{NAME:"align-left",SVG_KEY:"align Left"}),J.DefineIcon("video-align-left",{NAME:"align-left",SVG_KEY:"alignLeft"}),J.DefineIcon("video-align-right",{NAME:"align-right",SVG_KEY:"alignRight"}),J.DefineIcon("video-align-center",{NAME:"align-justify",SVG_KEY:"alignJustify"}),J.DefineIcon("videoAlign",{NAME:"align-center",SVG_KEY:"alignCenter"}),J.RegisterCommand("videoAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=J.COMMANDS.videoAlign.options;for(var i in t)t.hasOwnProperty(i)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="videoAlign" data-param1="'+i+'" title="'+this.language.translate(t[i])+'">'+this.icon.create("video-align-"+i)+'<span class="fr-sr-only">'+this.language.translate(t[i])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.video.align(t)},refresh:function(e){this.video.refreshAlign(e)},refreshOnShow:function(e,t){this.video.refreshAlignOnShow(e,t)}}),J.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt",SVG_KEY:"replaceImage"}),J.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),J.DefineIcon("videoRemove",{NAME:"trash",SVG_KEY:"remove"}),J.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),J.DefineIcon("videoSize",{NAME:"arrows-alt",SVG_KEY:"imageSize"}),J.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),J.DefineIcon("videoBack",{NAME:"arrow-left",SVG_KEY:"back"}),J.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"))}}),J.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),J.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(Q){"use strict";Q=Q&&Q.hasOwnProperty("default")?Q["default"]:Q,Object.assign(Q.POPUP_TEMPLATES,{"video.insert":"[_BUTTONS_][_BY_URL_LAYER_][_EMBED_LAYER_][_UPLOAD_LAYER_][_PROGRESS_BAR_]","video.edit":"[_BUTTONS_]","video.size":"[_BUTTONS_][_SIZE_LAYER_]"}),Object.assign(Q.DEFAULTS,{videoAllowedTypes:["mp4","webm","ogg"],videoAllowedProviders:[".*"],videoDefaultAlign:"center",videoDefaultDisplay:"block",videoDefaultWidth:600,videoEditButtons:["videoReplace","videoRemove","videoDisplay","videoAlign","videoSize"],videoInsertButtons:["videoBack","|","videoByURL","videoEmbed","videoUpload"],videoMaxSize:52428800,videoMove:!0,videoResize:!0,videoResponsive:!1,videoSizeButtons:["videoBack","|"],videoSplitHTML:!1,videoTextNear:!0,videoUpload:!0,videoUploadMethod:"POST",videoUploadParam:"file",videoUploadParams:{},videoUploadToS3:!1,videoUploadURL:null}),Q.VIDEO_PROVIDERS=[{test_regex:/^.*((youtu.be)|(youtube.com))\/((v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))?\??v?=?([^#\&\?]*).*/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=|embed\/)?([0-9a-zA-Z_\-]+)(.+)?/g,url_text:"https://www.youtube.com/embed/$1?$2",html:'<iframe width="640" height="360" src="{url}&wmode=opaque" frameborder="0" allowfullscreen></iframe>',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:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',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:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'<iframe width="640" height="360" src="{url}?format=embed" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"https://rutube.ru/play/embed/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/g,url_text:"https://play.vidyard.com/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"vidyard"}],Q.VIDEO_EMBED_REGEX=/^\W*((<iframe(.|\n)*>(\s|\n)*<\/iframe>)|(<embed(.|\n)*>))\W*$/i,Q.PLUGINS.video=function(p){var a,f,v,u,o,i,c=p.$,d="https://i.froala.com/upload",l=2,h=3,g=4,m=5,b=6,r={};function y(){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 s(){var e=p.popups.get("video.edit");if(e||(e=function(){var e="";if(0<p.opts.videoEditButtons.length){p.opts.videoResponsive&&(p.opts.videoEditButtons.splice(p.opts.videoEditButtons.indexOf("videoSize"),1),p.opts.videoEditButtons.splice(p.opts.videoEditButtons.indexOf("videoDisplay"),1),p.opts.videoEditButtons.splice(p.opts.videoEditButtons.indexOf("videoAlign"),1));var t={buttons:e+='<div class="fr-buttons"> \n '.concat(p.button.buildList(p.opts.videoEditButtons)," \n </div>")},i=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(),x(u))}),i}return!1}()),e){p.popups.setContainer("video.edit",p.$sc),p.popups.refresh("video.edit");var t=u.find("iframe, embed, video"),i=t.offset().left+t.outerWidth()/2,o=t.offset().top+t.outerHeight();p.popups.show("video.edit",i,o,t.outerHeight(),!0)}}function n(e){if(e)return p.popups.onRefresh("video.insert",y),p.popups.onHide("video.insert",j),!0;var t="";p.opts.videoUpload||-1===p.opts.videoInsertButtons.indexOf("videoUpload")||p.opts.videoInsertButtons.splice(p.opts.videoInsertButtons.indexOf("videoUpload"),1);var i=p.button.buildList(p.opts.videoInsertButtons);""!==i&&(t='<div class="fr-buttons">'+i+"</div>");var o,r="",s=p.opts.videoInsertButtons.indexOf("videoUpload"),n=p.opts.videoInsertButtons.indexOf("videoByURL"),a=p.opts.videoInsertButtons.indexOf("videoEmbed");0<=n&&(o=" fr-active",(s<n&&0<=s||a<n&&0<=a)&&(o=""),r='<div class="fr-video-by-url-layer fr-layer'+o+'" id="fr-video-by-url-layer-'+p.id+'"><div class="fr-input-line"><input id="fr-video-by-url-layer-text-'+p.id+'" type="text" placeholder="'+p.language.translate("Paste in a video URL")+'" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoInsertByURL" tabIndex="2" role="button">'+p.language.translate("Insert")+"</button></div></div>");var d="";0<=a&&(o=" fr-active",(s<a&&0<=s||n<a&&0<=n)&&(o=""),d='<div class="fr-video-embed-layer fr-layer'+o+'" id="fr-video-embed-layer-'+p.id+'"><div class="fr-input-line"><textarea id="fr-video-embed-layer-text'+p.id+'" type="text" placeholder="'+p.language.translate("Embedded Code")+'" tabIndex="1" aria-required="true" rows="5"></textarea></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoInsertEmbed" tabIndex="2" role="button">'+p.language.translate("Insert")+"</button></div></div>");var l="";0<=s&&(o=" fr-active",(a<s&&0<=a||n<s&&0<=n)&&(o=""),l='<div class="fr-video-upload-layer fr-layer'+o+'" id="fr-video-upload-layer-'+p.id+'"><strong>'+p.language.translate("Drop video")+"</strong><br>("+p.language.translate("or click")+')<div class="fr-form"><input type="file" accept="video/'+p.opts.videoAllowedTypes.join(", video/").toLowerCase()+'" tabIndex="-1" aria-labelledby="fr-video-upload-layer-'+p.id+'" role="button"></div></div>');var f={buttons:t,by_url_layer:r,embed_layer:d,upload_layer:l,progress_bar:'<div class="fr-video-progress-bar-layer fr-layer"><h3 tabIndex="-1" class="fr-message">Uploading</h3><div class="fr-loader"><span class="fr-progress"></span></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-dismiss" data-cmd="videoDismissError" tabIndex="2" role="button">OK</button></div></div>'},v=p.popups.create("video.insert",f);return function(o){p.events.$on(o,"dragover dragenter",".fr-video-upload-layer",function(){return c(this).addClass("fr-drop"),!1},!0),p.events.$on(o,"dragleave dragend",".fr-video-upload-layer",function(){return c(this).removeClass("fr-drop"),!1},!0),p.events.$on(o,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),c(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var i=o.data("instance")||p;i.events.disableBlur(),i.video.upload(t.files),i.events.enableBlur()}},!0),p.helpers.isIOS()&&p.events.$on(o,"touchstart",'.fr-video-upload-layer input[type="file"]',function(){c(this).trigger("click")},!0);p.events.$on(o,"change",'.fr-video-upload-layer input[type="file"]',function(){if(this.files){var e=o.data("instance")||p;e.events.disableBlur(),o.find("input:focus").blur(),e.events.enableBlur(),e.video.upload(this.files)}c(this).val("")},!0)}(v),v}function w(e){p.events.focus(!0),p.selection.restore();var t=!1;u&&(W(),t=!0),p.html.insert('<span contenteditable="false" draggable="true" class="fr-jiv fr-video">'+e+"</span>",!1,p.opts.videoSplitHTML),p.popups.hide("video.insert");var i=p.$el.find(".fr-jiv");i.removeClass("fr-jiv"),i.toggleClass("fr-rv",p.opts.videoResponsive),q(i,p.opts.videoDefaultDisplay,p.opts.videoDefaultAlign),i.toggleClass("fr-draggable",p.opts.videoMove),p.events.trigger(t?"video.replaced":"video.inserted",[i])}function E(){var e=c(this);p.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),x(e.parent()),p.events.trigger("video.loaded",[e.parent()])}function C(a,e,d,l,f){p.edit.off(),A("Loading video"),e&&(a=p.helpers.sanitizeURL(a));_("Loading video"),function(){var e,t;if(l){p.undo.canDo()||l.find("video").hasClass("fr-uploading")||p.undo.saveStep();var i=l.find("video").data("fr-old-src"),o=l.data("fr-replaced");l.data("fr-replaced",!1),p.$wp?((e=l.clone(!0)).find("video").removeData("fr-old-src").removeClass("fr-uploading"),e.find("video").off("canplay"),i&&l.find("video").attr("src",i),l.replaceWith(e)):e=l;for(var r=e.find("video").get(0).attributes,s=0;s<r.length;s++){var n=r[s];0===n.nodeName.indexOf("data-")&&e.find("video").removeAttr(n.nodeName)}if(void 0!==d)for(t in d)d.hasOwnProperty(t)&&"link"!=t&&e.find("video").attr("data-"+t,d[t]);e.find("video").on("canplay",E),e.find("video").attr("src",a),p.edit.on(),z(),p.undo.saveStep(),p.$el.blur(),p.events.trigger(o?"video.replaced":"video.inserted",[e,f])}else e=function(e,t,i){var o,r="";if(t&&void 0!==t)for(o in t)t.hasOwnProperty(o)&&"link"!=o&&(r+=" data-"+o+'="'+t[o]+'"');var s=p.opts.videoDefaultWidth;s&&"auto"!=s&&(s+="px");var n=c(document.createElement("span")).attr("contenteditable","false").attr("draggable","true").attr("class","fr-video fr-dv"+p.opts.videoDefaultDisplay[0]+("center"!=p.opts.videoDefaultAlign?" fr-fv"+p.opts.videoDefaultAlign[0]:"")).html('<video src="'+e+'" '+r+(s?' style="width: '+s+';" ':"")+" controls>"+p.language.translate("Your browser does not support HTML5 video.")+"</video>");n.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 a=p.$el.find(".fr-marker");return p.node.isLastSibling(a)&&a.parent().hasClass("fr-deletable")&&a.insertAfter(a.parent()),a.replaceWith(n),p.selection.clear(),n.find("video").get(0).readyState>n.find("video").get(0).HAVE_FUTURE_DATA||p.helpers.isIOS()?i.call(n.find("video").get(0)):n.find("video").on("canplaythrough load",i),n}(a,d,E),z(),p.undo.saveStep(),p.events.trigger("video.inserted",[e,f])}()}function _(e){var t=p.popups.get("video.insert");if(t||(t=n()),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 i=u.find("video");p.popups.setContainer("video.insert",p.$sc);var o=i.offset().left,r=i.offset().top+i.height();p.popups.show("video.insert",o,r,i.outerHeight())}void 0===e&&A(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 i=u;M(!0),p.selection.setAfter(i.find("video").get(0)),p.selection.restore()}p.popups.hide("video.insert")}}function A(e,t){var i=p.popups.get("video.insert");if(i){var o=i.find(".fr-video-progress-bar-layer");o.find("h3").text(e+(t?" "+t+"%":"")),o.removeClass("fr-error"),t?(o.find("div").removeClass("fr-indeterminate"),o.find("div > span").css("width",t+"%")):o.find("div").addClass("fr-indeterminate")}}function R(e){_();var t=p.popups.get("video.insert").find(".fr-video-progress-bar-layer");t.addClass("fr-error");var i=t.find("h3");i.text(e),p.events.disableBlur(),i.focus()}function x(e){t.call(e.get(0))}function D(e){A("Loading video");var t=this.status,i=this.response,o=this.responseXML,r=this.responseText;try{if(p.opts.videoUploadToS3)if(201==t){var s=function(e){try{var t=c(e).find("Location").text(),i=c(e).find("Key").text();return!1===p.events.trigger("video.uploadedToS3",[t,i,e],!0)?(p.edit.on(),!1):t}catch(o){return K(g,e),!1}}(o);s&&C(s,!1,[],e,i||o)}else K(g,i||o);else if(200<=t&&t<300){var n=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:(K(l,e),!1)}catch(i){return K(g,e),!1}}(r);n&&C(n.link,!1,n,e,i||r)}else K(h,i||r)}catch(a){K(g,i||r)}}function U(){K(g,this.response||this.responseText||this.responseXML)}function B(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;A(p.language.translate("Uploading"),t)}}function $(){p.edit.on(),S(!0)}function I(e){if(!p.core.sameInstance(v))return!0;e.preventDefault(),e.stopPropagation();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),i=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!i)return!1;if("mousedown"==e.type){var o=p.$oel.get(0).ownerDocument,r=o.defaultView||o.parentWindow,s=!1;try{s=r.location!=r.parent.location&&!(r.$&&r.$.FE)}catch(n){}s&&r.frameElement&&(t+=p.helpers.getPX(c(r.frameElement).offset().left)+r.frameElement.clientLeft,i=e.clientY+p.helpers.getPX(c(r.frameElement).offset().top)+r.frameElement.clientTop)}p.undo.canDo()||p.undo.saveStep(),(f=c(this)).data("start-x",t),f.data("start-y",i),a.show(),p.popups.hideAll(),V()}function k(e){if(!p.core.sameInstance(v))return!0;if(f){e.preventDefault();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),i=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!i)return!1;var o=f.data("start-x"),r=f.data("start-y");f.data("start-x",t),f.data("start-y",i);var s=t-o,n=i-r,a=u.find("iframe, embed, video"),d=a.width(),l=a.height();(f.hasClass("fr-hnw")||f.hasClass("fr-hsw"))&&(s=0-s),(f.hasClass("fr-hnw")||f.hasClass("fr-hne"))&&(n=0-n),a.css("width",d+s),a.css("height",l+n),a.removeAttr("width"),a.removeAttr("height"),T()}}function O(e){if(!p.core.sameInstance(v))return!0;f&&u&&(e&&e.stopPropagation(),f=null,a.hide(),T(),s(),p.undo.saveStep())}function L(e){return'<div class="fr-handler fr-h'+e+'"></div>'}function P(e,t,i,o){return e.pageX=t,e.pageY=t,I.call(this,e),e.pageX=e.pageX+i*Math.floor(Math.pow(1.1,o)),e.pageY=e.pageY+i*Math.floor(Math.pow(1.1,o)),k.call(this,e),O.call(this,e),++o}function z(){var e,t=Array.prototype.slice.call(p.el.querySelectorAll("video, .fr-video > *")),i=[];for(e=0;e<t.length;e++)i.push(t[e].getAttribute("src")),c(t[e]).toggleClass("fr-draggable",p.opts.videoMove),""===t[e].getAttribute("class")&&t[e].removeAttribute("class"),""===t[e].getAttribute("style")&&t[e].removeAttribute("style");if(o)for(e=0;e<o.length;e++)i.indexOf(o[e].getAttribute("src"))<0&&p.events.trigger("video.removed",[c(o[e])]);o=t}function T(){v||function(){var e;if(p.shared.$video_resizer?(v=p.shared.$video_resizer,a=p.shared.$vid_overlay,p.events.on("destroy",function(){c("body").first().append(v.removeClass("fr-active"))},!0)):(p.shared.$video_resizer=c(document.createElement("div")).attr("class","fr-video-resizer"),v=p.shared.$video_resizer,p.events.$on(v,"mousedown",function(e){e.stopPropagation()},!0),p.opts.videoResize&&(v.append(L("nw")+L("ne")+L("sw")+L("se")),p.shared.$vid_overlay=c(document.createElement("div")).attr("class","fr-video-overlay"),a=p.shared.$vid_overlay,e=v.get(0).ownerDocument,c(e).find("body").first().append(a))),p.events.on("shared.destroy",function(){v.html("").removeData().remove(),v=null,p.opts.videoResize&&(a.remove(),a=null)},!0),p.helpers.isMobile()||p.events.$on(c(p.o_win),"resize.video",function(){M(!0)}),p.opts.videoResize){e=v.get(0).ownerDocument,p.events.$on(v,p._mousedown,".fr-handler",I),p.events.$on(c(e),p._mousemove,k),p.events.$on(c(e.defaultView||e.parentWindow),p._mouseup,O),p.events.$on(a,"mouseleave",O);var o=1,r=null,s=0;p.events.on("keydown",function(e){if(u){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,i=e.which;(i!==r||200<e.timeStamp-s)&&(o=1),(i==Q.KEYCODE.EQUALS||p.browser.mozilla&&i==Q.KEYCODE.FF_EQUALS)&&t&&!e.altKey?o=P.call(this,e,1,1,o):(i==Q.KEYCODE.HYPHEN||p.browser.mozilla&&i==Q.KEYCODE.FF_HYPHEN)&&t&&!e.altKey&&(o=P.call(this,e,2,-1,o)),r=i,s=e.timeStamp}}),p.events.on("keyup",function(){o=1})}}(),(p.$wp||p.$sc).append(v),v.data("instance",p);var e=u.find("iframe, embed, video"),t=0,i=0;p.opts.iframe&&(i=p.helpers.getPX(p.$wp.find(".fr-iframe").css("padding-top")),t=p.helpers.getPX(p.$wp.find(".fr-iframe").css("padding-left"))),v.css("top",(p.opts.iframe?e.offset().top+i-1:e.offset().top-p.$wp.offset().top-1)+p.$wp.scrollTop()).css("left",(p.opts.iframe?e.offset().left+t-1:e.offset().left-p.$wp.offset().left-1)+p.$wp.scrollLeft()).css("width",e.get(0).getBoundingClientRect().width).css("height",e.get(0).getBoundingClientRect().height).addClass("fr-active")}function t(e){if(e&&"touchend"==e.type&&i)return!0;if(e&&p.edit.isDisabled())return e.stopPropagation(),e.preventDefault(),!1;if(p.edit.isDisabled())return!1;for(var t=0;t<Q.INSTANCES.length;t++)Q.INSTANCES[t]!=p&&Q.INSTANCES[t].events.trigger("video.hideResizer");p.toolbar.disable(),p.helpers.isMobile()&&(p.events.disableBlur(),p.$el.blur(),p.events.enableBlur()),p.$el.find(".fr-video.fr-active").removeClass("fr-active"),(u=c(this)).addClass("fr-active"),p.opts.iframe&&p.size.syncIframe(),J(),T(),s(),p.selection.clear(),p.button.bulkRefresh(),p.events.trigger("image.hideResizer")}function M(e){u&&(p.shared.vid_exit_flag||!0===e)&&(v.removeClass("fr-active"),p.toolbar.enable(),u.removeClass("fr-active"),u=null,V())}function e(){p.shared.vid_exit_flag=!0}function V(){p.shared.vid_exit_flag=!1}function Y(e){var t=e.originalEvent.dataTransfer;if(t&&t.files&&t.files.length){var i=t.files[0];if(i&&i.type&&-1!==i.type.indexOf("video")){if(!p.opts.videoUpload)return e.preventDefault(),e.stopPropagation(),!1;p.markers.remove(),p.markers.insertAtPoint(e.originalEvent),p.$el.find(".fr-marker").replaceWith(Q.MARKERS),p.popups.hideAll();var o=p.popups.get("video.insert");return o||(o=n()),p.popups.setContainer("video.insert",p.$sc),p.popups.show("video.insert",e.originalEvent.pageX,e.originalEvent.pageY),_(),0<=p.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))?N(t.files):K(b),e.preventDefault(),e.stopPropagation(),!1}}}function N(e){if(void 0!==e&&0<e.length){if(!1===p.events.trigger("video.beforeUpload",[e]))return!1;var t,i=e[0];if((null===p.opts.videoUploadURL||p.opts.videoUploadURL==d)&&!p.opts.videoUploadToS3)return function(o){u&&u.find("iframe")&&u.find("iframe").length&&W();var r=new FileReader;r.onload=function(){r.result;for(var e=atob(r.result.split(",")[1]),t=[],i=0;i<e.length;i++)t.push(e.charCodeAt(i));C(window.URL.createObjectURL(new Blob([new Uint8Array(t)],{type:o.type})),!1,null,u)},_(),r.readAsDataURL(o)}(i),!1;if(i.size>p.opts.videoMaxSize)return K(m),!1;if(p.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))<0)return K(b),!1;if(p.drag_support.formdata&&(t=p.drag_support.formdata?new FormData:null),t){var o;if(!1!==p.opts.videoUploadToS3)for(o in t.append("key",p.opts.videoUploadToS3.keyStart+(new Date).getTime()+"-"+(i.name||"untitled")),t.append("success_action_status","201"),t.append("X-Requested-With","xhr"),t.append("Content-Type",i.type),p.opts.videoUploadToS3.params)p.opts.videoUploadToS3.params.hasOwnProperty(o)&&t.append(o,p.opts.videoUploadToS3.params[o]);for(o in p.opts.videoUploadParams)p.opts.videoUploadParams.hasOwnProperty(o)&&t.append(o,p.opts.videoUploadParams[o]);t.append(p.opts.videoUploadParam,i);var r=p.opts.videoUploadURL;p.opts.videoUploadToS3&&(r=p.opts.videoUploadToS3.uploadURL?p.opts.videoUploadToS3.uploadURL:"https://"+p.opts.videoUploadToS3.region+".amazonaws.com/"+p.opts.videoUploadToS3.bucket);var s=p.core.getXHR(r,p.opts.videoUploadMethod);s.onload=function(){D.call(s,u)},s.onerror=U,s.upload.onprogress=B,s.onabort=$,_(),p.events.disableBlur(),p.edit.off(),p.events.enableBlur();var n=p.popups.get("video.insert");n&&c(n.off("abortUpload")).on("abortUpload",function(){4!=s.readyState&&s.abort()}),s.send(t)}}}function K(e,t){p.edit.on(),u&&u.find("video").addClass("fr-error"),R(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.error",[{code:e,message:r[e]},t])}function X(){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 H(e){if(e)return p.popups.onRefresh("video.size",X),!0;var t={buttons:'<div class="fr-buttons fr-tabs">'+p.button.buildList(p.opts.videoSizeButtons)+"</div>",size_layer:'<div class="fr-video-size-layer fr-layer fr-active" id="fr-video-size-layer-'+p.id+'"><div class="fr-video-group"><div class="fr-input-line"><input id="fr-video-size-layer-width-'+p.id+'" type="text" name="width" placeholder="'+p.language.translate("Width")+'" tabIndex="1"></div><div class="fr-input-line"><input id="fr-video-size-layer-height-'+p.id+'" type="text" name="height" placeholder="'+p.language.translate("Height")+'" tabIndex="1"></div></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoSetSize" tabIndex="2" role="button">'+p.language.translate("Update")+"</button></div></div>"},i=p.popups.create("video.size",t);return p.events.$on(p.$wp,"scroll",function(){u&&p.popups.isVisible("video.size")&&(p.events.disableBlur(),x(u))}),i}function G(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 F(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 W(){if(u&&!1!==p.events.trigger("video.beforeRemove",[u])){var e=u;p.popups.hideAll(),M(!0),p.selection.setBefore(e.get(0))||p.selection.setAfter(e.get(0)),e.remove(),p.selection.restore(),p.html.fillEmptyBlocks()}}function j(){S()}function q(e,t,i){!p.opts.htmlUntouched&&p.opts.useClasses?(e.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),e.addClass("fr-fv"+i[0]+" fr-dv"+t[0])):"inline"==t?(e.css({display:"inline-block"}),"center"==i?e.css({"float":"none"}):"left"==i?e.css({"float":"left"}):e.css({"float":"right"})):(e.css({display:"block",clear:"both"}),"left"==i?e.css({textAlign:"left"}):"right"==i?e.css({textAlign:"right"}):e.css({textAlign:"center"}))}function Z(){var e=p.$el.find("video").filter(function(){return 0===c(this).parents("span.fr-video").length});if(0!=e.length){e.wrap(c(document.createElement("span")).attr("class","fr-video").attr("contenteditable","false")),p.$el.find("embed, iframe").filter(function(){if(p.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0<c(this).parents("span.fr-video").length)return!1;for(var e=c(this).attr("src"),t=0;t<Q.VIDEO_PROVIDERS.length;t++){var i=Q.VIDEO_PROVIDERS[t];if(i.test_regex.test(e)&&new RegExp(p.opts.videoAllowedProviders.join("|")).test(i.provider))return!0}return!1}).map(function(){return 0===c(this).parents("object").length?this:c(this).parents("object").get(0)}).wrap(c(document.createElement("span")).attr("class","fr-video").attr("contenteditable","false"));for(var t,i,o=p.$el.find("span.fr-video, video"),r=0;r<o.length;r++){var s=c(o[r]);!p.opts.htmlUntouched&&p.opts.useClasses?((i=s).hasClass("fr-dvi")||i.hasClass("fr-dvb")||(i.addClass("fr-fv"+G(i)[0]),i.addClass("fr-dv"+F(i)[0])),p.opts.videoTextNear||s.removeClass("fr-dvi").addClass("fr-dvb")):p.opts.htmlUntouched||p.opts.useClasses||(q(t=s,t.hasClass("fr-dvb")?"block":t.hasClass("fr-dvi")?"inline":null,t.hasClass("fr-fvl")?"left":t.hasClass("fr-fvr")?"right":G(t)),t.removeClass("fr-dvb fr-dvi fr-fvr fr-fvl"))}o.toggleClass("fr-draggable",p.opts.videoMove)}}function J(){if(u){p.selection.clear();var e=p.doc.createRange();e.selectNode(u.get(0)),p.selection.get().addRange(e)}}return r[1]="Video cannot be loaded from the passed link.",r[l]="No link in upload response.",r[h]="Error during file upload.",r[g]="Parsing response failed.",r[m]="File is too large.",r[b]="Video file type is invalid.",r[7]="Files can be uploaded only to same domain in IE 8 and IE 9.",p.shared.vid_exit_flag=!1,{_init:function(){p.opts.videoResponsive&&(p.opts.videoResize=!1),p.events.on("drop",Y,!0),p.events.on("mousedown window.mousedown",e),p.events.on("window.touchmove",V),p.events.on("mouseup window.mouseup",M),p.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&M()}),p.events.on("video.hideResizer commands.undo commands.redo element.dropped",function(){M(!0)}),p.helpers.isMobile()&&(p.events.$on(p.$el,"touchstart","span.fr-video",function(){i=!1}),p.events.$on(p.$el,"touchmove",function(){i=!0})),p.events.on("html.set",Z),Z(),p.events.$on(p.$el,"mousedown","span.fr-video",function(e){e.stopPropagation(),(p.browser.msie||p.browser.edge)&&(e.target.dragDrop(),t.call(this,e))}),p.events.$on(p.$el,"click touchend","span.fr-video",function(e){if("false"==c(this).parents("[contenteditable]").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;t.call(this,e)}),p.events.on("keydown",function(e){var t=e.which;return!u||t!=Q.KEYCODE.BACKSPACE&&t!=Q.KEYCODE.DELETE?u&&t==Q.KEYCODE.ESC?(M(!0),e.preventDefault(),!1):u&&t!=Q.KEYCODE.F10&&!p.keys.isBrowserAction(e)?(e.preventDefault(),!1):void 0:(e.preventDefault(),W(),p.undo.saveStep(),!1)},!0),p.events.on("toolbar.esc",function(){if(u)return p.events.disableBlur(),p.events.focus(),!1},!0),p.events.on("toolbar.focusEditor",function(){if(u)return!1},!0),p.events.on("keydown",function(){p.$el.find("span.fr-video:empty").remove()}),p.$wp&&(z(),p.events.on("contentChanged",z)),n(!0),H(!0)},showInsertPopup:function(){var e=p.$tb.find('.fr-command[data-cmd="insertVideo"]'),t=p.popups.get("video.insert");if(t||(t=n()),S(),!t.hasClass("fr-active"))if(p.popups.refresh("video.insert"),p.popups.setContainer("video.insert",p.$tb),e.isVisible()){var i=p.button.getPosition(e),o=i.left,r=i.top;p.popups.show("video.insert",o,r,e.outerHeight())}else p.position.forSelection(t),p.popups.show("video.insert")},showLayer:function(e){var t,i,o=p.popups.get("video.insert");if(!u&&!p.opts.toolbarInline){var r=p.$tb.find('.fr-command[data-cmd="insertVideo"]');t=r.offset().left,i=r.offset().top+(p.opts.toolbarBottom?10:r.outerHeight()-10)}p.opts.toolbarInline&&(i=o.offset().top-p.helpers.getPX(o.css("margin-top")),o.hasClass("fr-above")&&(i+=o.outerHeight())),o.find(".fr-layer").removeClass("fr-active"),o.find(".fr-"+e+"-layer").addClass("fr-active"),p.popups.show("video.insert",t,i,0),p.accessibility.focusPopup(o)},refreshByURLButton:function(e){var t=p.popups.get("video.insert");t&&t.find(".fr-video-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshEmbedButton:function(e){var t=p.popups.get("video.insert");t&&t.find(".fr-video-embed-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshUploadButton:function(e){var t=p.popups.get("video.insert");t&&t.find(".fr-video-upload-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},upload:N,insertByURL:function(e){void 0===e&&(e=(p.popups.get("video.insert").find('.fr-video-by-url-layer input[type="text"]').val()||"").trim());var t=null;if(/^http/.test(e)||(e="https://"+e),p.helpers.isURL(e))for(var i=0;i<Q.VIDEO_PROVIDERS.length;i++){var o=Q.VIDEO_PROVIDERS[i];if(o.test_regex.test(e)&&new RegExp(p.opts.videoAllowedProviders.join("|")).test(o.provider)){t=e.replace(o.url_regex,o.url_text),t=o.html.replace(/\{url\}/,t);break}}t?w(t):(R(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.linkError",[e]))},insertEmbed:function(e){void 0===e&&(e=p.popups.get("video.insert").find(".fr-video-embed-layer textarea").val()||""),0!==e.length&&Q.VIDEO_EMBED_REGEX.test(e)?w(e):(R(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.codeError",[e]))},insert:w,align:function(e){u.removeClass("fr-fvr fr-fvl"),!p.opts.htmlUntouched&&p.opts.useClasses?"left"==e?u.addClass("fr-fvl"):"right"==e&&u.addClass("fr-fvr"):q(u,F(),e),J(),T(),s(),p.selection.clear()},refreshAlign:function(e){if(!u)return!1;e.find(">*").first().replaceWith(p.icon.create("video-align-"+G()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+G()+'"]').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,G()),J(),T(),s(),p.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+F()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:W,hideProgressBar:S,showSizePopup:function(){var e=p.popups.get("video.size");e||(e=H()),S(),p.popups.refresh("video.size"),p.popups.setContainer("video.size",p.$sc);var t=u.find("iframe, embed, video"),i=t.offset().left+t.outerWidth()/2,o=t.offset().top+t.height();p.popups.show("video.size",i,o,t.height(),!0)},replace:function(){var e=p.popups.get("video.insert");e||(e=n()),p.popups.isVisible("video.insert")||(S(),p.popups.refresh("video.insert"),p.popups.setContainer("video.insert",p.$sc));var t=u.offset().left+u.outerWidth()/2,i=u.offset().top+u.height();p.popups.show("video.insert",t,i,u.outerHeight(),!0)},back:function(){u?(p.events.disableBlur(),u[0].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 i=p.popups.get("video.size"),o=u.find("iframe, embed, video");o.css("width",e||i.find('input[name="width"]').val()),o.css("height",t||i.find('input[name="height"]').val()),o.get(0).style.width&&o.removeAttr("width"),o.get(0).style.height&&o.removeAttr("height"),i.find("input:focus").blur(),setTimeout(function(){u.trigger("click")},p.helpers.isAndroid()?50:0)}},get:function(){return u},showProgressBar:_}},Q.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"}),Q.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera",SVG_KEY:"insertVideo"}),Q.DefineIcon("videoByURL",{NAME:"link",SVG_KEY:"insertLink"}),Q.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)}}),Q.DefineIcon("videoEmbed",{NAME:"code",SVG_KEY:"codeView"}),Q.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)}}),Q.DefineIcon("videoUpload",{NAME:"upload",SVG_KEY:"upload"}),Q.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)}}),Q.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),Q.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),Q.DefineIcon("videoDisplay",{NAME:"star",SVG_KEY:"star"}),Q.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)}}),Q.DefineIcon("video-align",{NAME:"align-left",SVG_KEY:"align Left"}),Q.DefineIcon("video-align-left",{NAME:"align-left",SVG_KEY:"alignLeft"}),Q.DefineIcon("video-align-right",{NAME:"align-right",SVG_KEY:"alignRight"}),Q.DefineIcon("video-align-center",{NAME:"align-justify",SVG_KEY:"alignJustify"}),Q.DefineIcon("videoAlign",{NAME:"align-center",SVG_KEY:"alignCenter"}),Q.RegisterCommand("videoAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=Q.COMMANDS.videoAlign.options;for(var i in t)t.hasOwnProperty(i)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="videoAlign" data-param1="'+i+'" title="'+this.language.translate(t[i])+'">'+this.icon.create("video-align-"+i)+'<span class="fr-sr-only">'+this.language.translate(t[i])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.video.align(t)},refresh:function(e){this.video.refreshAlign(e)},refreshOnShow:function(e,t){this.video.refreshAlignOnShow(e,t)}}),Q.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt",SVG_KEY:"replaceImage"}),Q.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),Q.DefineIcon("videoRemove",{NAME:"trash",SVG_KEY:"remove"}),Q.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),Q.DefineIcon("videoSize",{NAME:"arrows-alt",SVG_KEY:"imageSize"}),Q.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),Q.DefineIcon("videoBack",{NAME:"arrow-left",SVG_KEY:"back"}),Q.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"))}}),Q.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),Q.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}})}); |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],o):o(e.FroalaEditor)}(this,function(g){"use strict";g=g&&g.hasOwnProperty("default")?g["default"]:g,Object.assign(g.DEFAULTS,{fontAwesomeTemplate:'<i class="fa fa-[NAME] fr-deletable" aria-hidden="true"></i>',fontAwesomeSets:[{title:"Web Application Icons",icon:"address-book",list:["address-book","address-book-o","address-card","address-card-o","adjust","american-sign-language-interpreting","anchor","archive","area-chart","arrows","arrows-h","arrows-v","asl-interpreting ","assistive-listening-systems","asterisk","at","audio-description","automobile ","balance-scale","ban","bank ","bar-chart","bar-chart-o ","barcode","bars","bath","bathtub ","battery ","battery-0 ","battery-1 ","battery-2 ","battery-3 ","battery-4 ","battery-empty","battery-full","battery-half","battery-quarter","battery-three-quarters","bed","beer","bell","bell-o","bell-slash","bell-slash-o","bicycle","binoculars","birthday-cake","blind","bluetooth","bluetooth-b","bolt","bomb","book","bookmark","bookmark-o","braille","briefcase","bug","building","building-o","bullhorn","bullseye","bus","cab ","calculator","calendar","calendar-check-o","calendar-minus-o","calendar-o","calendar-plus-o","calendar-times-o","camera","camera-retro","car","caret-square-o-down","caret-square-o-left","caret-square-o-right","caret-square-o-up","cart-arrow-down","cart-plus","cc","certificate","check","check-circle","check-circle-o","check-square","check-square-o","child","circle","circle-o","circle-o-notch","circle-thin","clock-o","clone","close ","cloud","cloud-download","cloud-upload","code","code-fork","coffee","cog","cogs","comment","comment-o","commenting","commenting-o","comments","comments-o","compass","copyright","creative-commons","credit-card","credit-card-alt","crop","crosshairs","cube","cubes","cutlery","dashboard ","database","deaf","deafness ","desktop","diamond","dot-circle-o","download","drivers-license ","drivers-license-o ","edit ","ellipsis-h","ellipsis-v","envelope","envelope-o","envelope-open","envelope-open-o","envelope-square","eraser","exchange","exclamation","exclamation-circle","exclamation-triangle","external-link","external-link-square","eye","eye-slash","eyedropper","fax","feed ","female","fighter-jet","file-archive-o","file-audio-o","file-code-o","file-excel-o","file-image-o","file-movie-o ","file-pdf-o","file-photo-o ","file-picture-o ","file-powerpoint-o","file-sound-o ","file-video-o","file-word-o","file-zip-o ","film","filter","fire","fire-extinguisher","flag","flag-checkered","flag-o","flash ","flask","folder","folder-o","folder-open","folder-open-o","frown-o","futbol-o","gamepad","gavel","gear ","gears ","gift","glass","globe","graduation-cap","group ","hand-grab-o ","hand-lizard-o","hand-paper-o","hand-peace-o","hand-pointer-o","hand-rock-o","hand-scissors-o","hand-spock-o","hand-stop-o ","handshake-o","hard-of-hearing ","hashtag","hdd-o","headphones","heart","heart-o","heartbeat","history","home","hotel ","hourglass","hourglass-1 ","hourglass-2 ","hourglass-3 ","hourglass-end","hourglass-half","hourglass-o","hourglass-start","i-cursor","id-badge","id-card","id-card-o","image ","inbox","industry","info","info-circle","institution ","key","keyboard-o","language","laptop","leaf","legal ","lemon-o","level-down","level-up","life-bouy ","life-buoy ","life-ring","life-saver ","lightbulb-o","line-chart","location-arrow","lock","low-vision","magic","magnet","mail-forward ","mail-reply ","mail-reply-all ","male","map","map-marker","map-o","map-pin","map-signs","meh-o","microchip","microphone","microphone-slash","minus","minus-circle","minus-square","minus-square-o","mobile","mobile-phone ","money","moon-o","mortar-board ","motorcycle","mouse-pointer","music","navicon ","newspaper-o","object-group","object-ungroup","paint-brush","paper-plane","paper-plane-o","paw","pencil","pencil-square","pencil-square-o","percent","phone","phone-square","photo ","picture-o","pie-chart","plane","plug","plus","plus-circle","plus-square","plus-square-o","podcast","power-off","print","puzzle-piece","qrcode","question","question-circle","question-circle-o","quote-left","quote-right","random","recycle","refresh","registered","remove ","reorder ","reply","reply-all","retweet","road","rocket","rss","rss-square","s15 ","search","search-minus","search-plus","send ","send-o ","server","share","share-alt","share-alt-square","share-square","share-square-o","shield","ship","shopping-bag","shopping-basket","shopping-cart","shower","sign-in","sign-language","sign-out","signal","signing ","sitemap","sliders","smile-o","snowflake-o","soccer-ball-o ","sort","sort-alpha-asc","sort-alpha-desc","sort-amount-asc","sort-amount-desc","sort-asc","sort-desc","sort-down ","sort-numeric-asc","sort-numeric-desc","sort-up ","space-shuttle","spinner","spoon","square","square-o","star","star-half","star-half-empty ","star-half-full ","star-half-o","star-o","sticky-note","sticky-note-o","street-view","suitcase","sun-o","support ","tablet","tachometer","tag","tags","tasks","taxi","television","terminal","thermometer ","thermometer-0 ","thermometer-1 ","thermometer-2 ","thermometer-3 ","thermometer-4 ","thermometer-empty","thermometer-full","thermometer-half","thermometer-quarter","thermometer-three-quarters","thumb-tack","thumbs-down","thumbs-o-down","thumbs-o-up","thumbs-up","ticket","times","times-circle","times-circle-o","times-rectangle ","times-rectangle-o ","tint","toggle-down ","toggle-left ","toggle-off","toggle-on","toggle-right ","toggle-up ","trademark","trash","trash-o","tree","trophy","truck","tty","tv ","umbrella","universal-access","university","unlock","unlock-alt","unsorted ","upload","user","user-circle","user-circle-o","user-o","user-plus","user-secret","user-times","users","vcard ","vcard-o ","video-camera","volume-control-phone","volume-down","volume-off","volume-up","warning ","wheelchair","wheelchair-alt","wifi","window-close","window-close-o","window-maximize","window-minimize","window-restore","wrench"]},{title:"Accessibility Icons",icon:"american-sign-language-interpreting",list:["american-sign-language-interpreting","asl-interpreting ","assistive-listening-systems","audio-description","blind","braille","cc","deaf","deafness ","hard-of-hearing ","low-vision","question-circle-o","sign-language","signing ","tty","universal-access","volume-control-phone","wheelchair","wheelchair-alt"]},{title:"Hand Icons",icon:"hand-grab-o",list:["hand-grab-o ","hand-lizard-o","hand-o-down","hand-o-left","hand-o-right","hand-o-up","hand-paper-o","hand-peace-o","hand-pointer-o","hand-rock-o","hand-scissors-o","hand-spock-o","hand-stop-o ","thumbs-down","thumbs-o-down","thumbs-o-up","thumbs-up"]},{title:"Transportation Icons",icon:"ambulance",list:["ambulance","automobile ","bicycle","bus","cab ","car","fighter-jet","motorcycle","plane","rocket","ship","space-shuttle","subway","taxi","train","truck","wheelchair","wheelchair-alt"]},{title:"Gender Icons",icon:"genderless",list:["genderless","intersex ","mars","mars-double","mars-stroke","mars-stroke-h","mars-stroke-v","mercury","neuter","transgender","transgender-alt","venus","venus-double","venus-mars"]},{title:"Form Control Icons",icon:"check-square",list:["check-square","check-square-o","circle","circle-o","dot-circle-o","minus-square","minus-square-o","plus-square","plus-square-o","square","square-o"]},{title:"Payment Icons",icon:"cc-amex",list:["cc-amex","cc-diners-club","cc-discover","cc-jcb","cc-mastercard","cc-paypal","cc-stripe","cc-visa","credit-card","credit-card-alt","google-wallet","paypal"]},{title:"Chart Icons",icon:"area-chart",list:["area-chart","bar-chart","bar-chart-o ","line-chart","pie-chart"]},{title:"Currency Icons",icon:"bitcoin",list:["bitcoin ","btc","cny ","dollar ","eur","euro ","gbp","gg","gg-circle","ils","inr","jpy","krw","money","rmb ","rouble ","rub","ruble ","rupee ","shekel ","sheqel ","try","turkish-lira ","usd","viacoin","won ","yen"]},{title:"Text Editor Icons",icon:"align-center",list:["align-center","align-justify","align-left","align-right","bold","chain ","chain-broken","clipboard","columns","copy ","cut ","dedent ","eraser","file","file-o","file-text","file-text-o","files-o","floppy-o","font","header","indent","italic","link","list","list-alt","list-ol","list-ul","outdent","paperclip","paragraph","paste ","repeat","rotate-left ","rotate-right ","save ","scissors","strikethrough","subscript","superscript","table","text-height","text-width","th","th-large","th-list","underline","undo","unlink"]},{title:"Brand Icons",icon:"500px",list:["500px","adn","amazon","android","angellist","apple","bandcamp","behance","behance-square","bitbucket","bitbucket-square","bitcoin ","black-tie","bluetooth","bluetooth-b","btc","buysellads","cc-amex","cc-diners-club","cc-discover","cc-jcb","cc-mastercard","cc-paypal","cc-stripe","cc-visa","chrome","codepen","codiepie","connectdevelop","contao","css3","dashcube","delicious","deviantart","digg","dribbble","dropbox","drupal","edge","eercast","empire","envira","etsy","expeditedssl","fa ","facebook","facebook-f ","facebook-official","facebook-square","firefox","first-order","flickr","font-awesome","fonticons","fort-awesome","forumbee","foursquare","free-code-camp","ge ","get-pocket","gg","gg-circle","git","git-square","github","github-alt","github-square","gitlab","gittip ","glide","glide-g","google","google-plus","google-plus-circle ","google-plus-official","google-plus-square","google-wallet","gratipay","grav","hacker-news","houzz","html5","imdb","instagram","internet-explorer","ioxhost","joomla","jsfiddle","lastfm","lastfm-square","leanpub","linkedin","linkedin-square","linode","linux","maxcdn","meanpath","medium","meetup","mixcloud","modx","odnoklassniki","odnoklassniki-square","opencart","openid","opera","optin-monster","pagelines","paypal","pied-piper","pied-piper-alt","pied-piper-pp","pinterest","pinterest-p","pinterest-square","product-hunt","qq","quora","ra ","ravelry","rebel","reddit","reddit-alien","reddit-square","renren","resistance ","safari","scribd","sellsy","share-alt","share-alt-square","shirtsinbulk","simplybuilt","skyatlas","skype","slack","slideshare","snapchat","snapchat-ghost","snapchat-square","soundcloud","spotify","stack-exchange","stack-overflow","steam","steam-square","stumbleupon","stumbleupon-circle","superpowers","telegram","tencent-weibo","themeisle","trello","tripadvisor","tumblr","tumblr-square","twitch","twitter","twitter-square","usb","viacoin","viadeo","viadeo-square","vimeo","vimeo-square","vine","vk","wechat ","weibo","weixin","whatsapp","wikipedia-w","windows","wordpress","wpbeginner","wpexplorer","wpforms","xing","xing-square","y-combinator","y-combinator-square ","yahoo","yc ","yc-square ","yelp","yoast","youtube","youtube-play","youtube-square"]}],faButtons:["fontAwesomeBack","|"]}),Object.assign(g.POPUP_TEMPLATES,{fontAwesome:"[_BUTTONS_][_CUSTOM_LAYER_]"}),g.PLUGINS.fontAwesome=function(f){var b=f.$,p=f.opts.fontAwesomeSets[0],d=f.opts.fontAwesomeSets,t="";function s(){f.opts.toolbarInline&&0<f.opts.faButtons.length&&(t='<div class="fr-buttons fr-tabs">'.concat(f.button.buildList(f.opts.faButtons),"</div>"));var m,e={buttons:t,custom_layer:a()},o=f.popups.create("fontAwesome",e);return m=o,f.events.on("popup.tab",function(e){var o=b(e.currentTarget);if(!f.popups.isVisible("fontAwesome")||!o.is("span, a"))return!0;var t,a,r,s=e.which;if(g.KEYCODE.TAB==s){if(o.is("span.fr-icon")&&e.shiftKey||o.is("a")&&!e.shiftKey){var i=m.find(".fr-buttons");t=!f.accessibility.focusToolbar(i,!!e.shiftKey)}if(!1!==t){var n=m.find("span.fr-icon:focus").first().concat(m.findVisible(" span.fr-icon").first().concat(m.find("a")));o.is("span.fr-icon")&&(n=n.not("span.fr-icon:not(:focus)")),a=n.index(o),a=e.shiftKey?((a-1)%n.length+n.length)%n.length:(a+1)%n.length,r=n.get(a),f.events.disableBlur(),r.focus(),t=!1}}else if(g.KEYCODE.ARROW_UP==s||g.KEYCODE.ARROW_DOWN==s||g.KEYCODE.ARROW_LEFT==s||g.KEYCODE.ARROW_RIGHT==s){if(o.is("span.fr-icon")){var c=o.parent().find("span.fr-icon");a=c.index(o);var l=Math.floor(c.length/8),u=a%8,p=Math.floor(a/8),d=8*p+u,h=8*l;g.KEYCODE.ARROW_UP==s?d=((d-8)%h+h)%h:g.KEYCODE.ARROW_DOWN==s?d=(d+8)%h:g.KEYCODE.ARROW_LEFT==s?d=((d-1)%h+h)%h:g.KEYCODE.ARROW_RIGHT==s&&(d=(d+1)%h),r=b(c.get(d)),f.events.disableBlur(),r.focus(),t=!1}}else g.KEYCODE.ENTER==s&&(o.is("a")?o[0].click():f.button.exec(o),t=!1);return!1===t&&(e.preventDefault(),e.stopPropagation()),t},!0),o}function a(){var e,o,t,a,r,s,i,n,c,l,u;return"".concat((r=d,s=p,i=f.opts.fontAwesomeTemplate,'\n <div class="fr-buttons fr-tabs fr-tabs-scroll">\n '.concat((n=r,c=s,l=i,u="",n.forEach(function(e){var o={elementClass:e.title===c.title?"fr-active fr-active-tab":"",title:e.title,dataCmd:"setIconCategory",dataParam1:e.title,iconValue:l.replace(/\[NAME\]/g,e.icon)};u+='<button class="fr-fa-icon-category fr-command fr-btn '.concat(o.elementClass,'" title="').concat(o.title,'" data-cmd="').concat(o.dataCmd,'" data-param1="').concat(o.dataParam1,'"</button><span>').concat(o.iconValue,"</span>")}),u),"\n </div>\n ")),"\n ").concat((e=p,o=f.opts.fontAwesomeTemplate,'\n <div class="fr-icon-container fr-fa-container">\n '.concat((t=o,a="",e.list.forEach(function(e){var o={dataParam1:e,title:e,iconValue:t.replace(/\[NAME\]/g,e)};a+='<span class="fr-command fr-fa-icon fr-icon" role="button" data-cmd="insertIcon" data-param1="'.concat(o.dataParam1,'" title="').concat(o.title,'">').concat(o.iconValue,"</span>")}),a),"\n </div>\n ")))}return{setIconCategory:function(o){p=d.filter(function(e){return e.title===o})[0],f.popups.get("fontAwesome").html(t+a())},showFontAwesomePopup:function(){var e=f.popups.get("fontAwesome");if(e||(e=s()),!e.hasClass("fr-active")){f.popups.refresh("fontAwesome"),f.popups.setContainer("fontAwesome",f.$tb);var o=f.$tb.find('.fr-command[data-cmd="fontAwesome"]'),t=f.button.getPosition(o),a=t.left,r=t.top;f.popups.show("fontAwesome",a,r,o.outerHeight())}},back:function(){f.popups.hide("fontAwesome"),f.toolbar.showInline()}}},g.DefineIcon("fontAwesome",{NAME:"flag",SVG_KEY:"fontAwesome"}),g.RegisterCommand("fontAwesome",{title:"Font Awesome",icon:"fontAwesome",undo:!1,focus:!1,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("fontAwesome")?(this.$el.find(".fr-marker")&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("fontAwesome")):this.fontAwesome.showFontAwesomePopup()},plugin:"fontAwesome",showOnMobile:!0}),g.RegisterCommand("insertIcon",{callback:function(e,o){this.undo.saveStep(),this.html.insert(this.opts.fontAwesomeTemplate.replace(/\[NAME\]/g,o)),this.undo.saveStep(),this.popups.hide("fontAwesome")}}),g.RegisterCommand("setIconCategory",{undo:!1,focus:!1,callback:function(e,o){this.fontAwesome.setIconCategory(o)}}),g.DefineIcon("fontAwesomeBack",{NAME:"arrow-left",SVG_KEY:"back"}),g.RegisterCommand("fontAwesomeBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.fontAwesome.back()}})}); | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],o):o(e.FroalaEditor)}(this,function(g){"use strict";g=g&&g.hasOwnProperty("default")?g["default"]:g,Object.assign(g.DEFAULTS,{fontAwesomeTemplate:'<i class="fa fa-[NAME] fr-deletable" aria-hidden="true"></i>',fontAwesomeSets:[{title:"Web Application Icons",icon:"address-book",list:["address-book","address-book-o","address-card","address-card-o","adjust","american-sign-language-interpreting","anchor","archive","area-chart","arrows","arrows-h","arrows-v","asl-interpreting ","assistive-listening-systems","asterisk","at","audio-description","automobile ","balance-scale","ban","bank ","bar-chart","bar-chart-o ","barcode","bars","bath","bathtub ","battery ","battery-0 ","battery-1 ","battery-2 ","battery-3 ","battery-4 ","battery-empty","battery-full","battery-half","battery-quarter","battery-three-quarters","bed","beer","bell","bell-o","bell-slash","bell-slash-o","bicycle","binoculars","birthday-cake","blind","bluetooth","bluetooth-b","bolt","bomb","book","bookmark","bookmark-o","braille","briefcase","bug","building","building-o","bullhorn","bullseye","bus","cab ","calculator","calendar","calendar-check-o","calendar-minus-o","calendar-o","calendar-plus-o","calendar-times-o","camera","camera-retro","car","caret-square-o-down","caret-square-o-left","caret-square-o-right","caret-square-o-up","cart-arrow-down","cart-plus","cc","certificate","check","check-circle","check-circle-o","check-square","check-square-o","child","circle","circle-o","circle-o-notch","circle-thin","clock-o","clone","close ","cloud","cloud-download","cloud-upload","code","code-fork","coffee","cog","cogs","comment","comment-o","commenting","commenting-o","comments","comments-o","compass","copyright","creative-commons","credit-card","credit-card-alt","crop","crosshairs","cube","cubes","cutlery","dashboard ","database","deaf","deafness ","desktop","diamond","dot-circle-o","download","drivers-license ","drivers-license-o ","edit ","ellipsis-h","ellipsis-v","envelope","envelope-o","envelope-open","envelope-open-o","envelope-square","eraser","exchange","exclamation","exclamation-circle","exclamation-triangle","external-link","external-link-square","eye","eye-slash","eyedropper","fax","feed ","female","fighter-jet","file-archive-o","file-audio-o","file-code-o","file-excel-o","file-image-o","file-movie-o ","file-pdf-o","file-photo-o ","file-picture-o ","file-powerpoint-o","file-sound-o ","file-video-o","file-word-o","file-zip-o ","film","filter","fire","fire-extinguisher","flag","flag-checkered","flag-o","flash ","flask","folder","folder-o","folder-open","folder-open-o","frown-o","futbol-o","gamepad","gavel","gear ","gears ","gift","glass","globe","graduation-cap","group ","hand-grab-o ","hand-lizard-o","hand-paper-o","hand-peace-o","hand-pointer-o","hand-rock-o","hand-scissors-o","hand-spock-o","hand-stop-o ","handshake-o","hard-of-hearing ","hashtag","hdd-o","headphones","heart","heart-o","heartbeat","history","home","hotel ","hourglass","hourglass-1 ","hourglass-2 ","hourglass-3 ","hourglass-end","hourglass-half","hourglass-o","hourglass-start","i-cursor","id-badge","id-card","id-card-o","image ","inbox","industry","info","info-circle","institution ","key","keyboard-o","language","laptop","leaf","legal ","lemon-o","level-down","level-up","life-bouy ","life-buoy ","life-ring","life-saver ","lightbulb-o","line-chart","location-arrow","lock","low-vision","magic","magnet","mail-forward ","mail-reply ","mail-reply-all ","male","map","map-marker","map-o","map-pin","map-signs","meh-o","microchip","microphone","microphone-slash","minus","minus-circle","minus-square","minus-square-o","mobile","mobile-phone ","money","moon-o","mortar-board ","motorcycle","mouse-pointer","music","navicon ","newspaper-o","object-group","object-ungroup","paint-brush","paper-plane","paper-plane-o","paw","pencil","pencil-square","pencil-square-o","percent","phone","phone-square","photo ","picture-o","pie-chart","plane","plug","plus","plus-circle","plus-square","plus-square-o","podcast","power-off","print","puzzle-piece","qrcode","question","question-circle","question-circle-o","quote-left","quote-right","random","recycle","refresh","registered","remove ","reorder ","reply","reply-all","retweet","road","rocket","rss","rss-square","s15 ","search","search-minus","search-plus","send ","send-o ","server","share","share-alt","share-alt-square","share-square","share-square-o","shield","ship","shopping-bag","shopping-basket","shopping-cart","shower","sign-in","sign-language","sign-out","signal","signing ","sitemap","sliders","smile-o","snowflake-o","soccer-ball-o ","sort","sort-alpha-asc","sort-alpha-desc","sort-amount-asc","sort-amount-desc","sort-asc","sort-desc","sort-down ","sort-numeric-asc","sort-numeric-desc","sort-up ","space-shuttle","spinner","spoon","square","square-o","star","star-half","star-half-empty ","star-half-full ","star-half-o","star-o","sticky-note","sticky-note-o","street-view","suitcase","sun-o","support ","tablet","tachometer","tag","tags","tasks","taxi","television","terminal","thermometer ","thermometer-0 ","thermometer-1 ","thermometer-2 ","thermometer-3 ","thermometer-4 ","thermometer-empty","thermometer-full","thermometer-half","thermometer-quarter","thermometer-three-quarters","thumb-tack","thumbs-down","thumbs-o-down","thumbs-o-up","thumbs-up","ticket","times","times-circle","times-circle-o","times-rectangle ","times-rectangle-o ","tint","toggle-down ","toggle-left ","toggle-off","toggle-on","toggle-right ","toggle-up ","trademark","trash","trash-o","tree","trophy","truck","tty","tv ","umbrella","universal-access","university","unlock","unlock-alt","unsorted ","upload","user","user-circle","user-circle-o","user-o","user-plus","user-secret","user-times","users","vcard ","vcard-o ","video-camera","volume-control-phone","volume-down","volume-off","volume-up","warning ","wheelchair","wheelchair-alt","wifi","window-close","window-close-o","window-maximize","window-minimize","window-restore","wrench"]},{title:"Accessibility Icons",icon:"american-sign-language-interpreting",list:["american-sign-language-interpreting","asl-interpreting ","assistive-listening-systems","audio-description","blind","braille","cc","deaf","deafness ","hard-of-hearing ","low-vision","question-circle-o","sign-language","signing ","tty","universal-access","volume-control-phone","wheelchair","wheelchair-alt"]},{title:"Hand Icons",icon:"hand-grab-o",list:["hand-grab-o ","hand-lizard-o","hand-o-down","hand-o-left","hand-o-right","hand-o-up","hand-paper-o","hand-peace-o","hand-pointer-o","hand-rock-o","hand-scissors-o","hand-spock-o","hand-stop-o ","thumbs-down","thumbs-o-down","thumbs-o-up","thumbs-up"]},{title:"Transportation Icons",icon:"ambulance",list:["ambulance","automobile ","bicycle","bus","cab ","car","fighter-jet","motorcycle","plane","rocket","ship","space-shuttle","subway","taxi","train","truck","wheelchair","wheelchair-alt"]},{title:"Gender Icons",icon:"genderless",list:["genderless","intersex ","mars","mars-double","mars-stroke","mars-stroke-h","mars-stroke-v","mercury","neuter","transgender","transgender-alt","venus","venus-double","venus-mars"]},{title:"Form Control Icons",icon:"check-square",list:["check-square","check-square-o","circle","circle-o","dot-circle-o","minus-square","minus-square-o","plus-square","plus-square-o","square","square-o"]},{title:"Payment Icons",icon:"cc-amex",list:["cc-amex","cc-diners-club","cc-discover","cc-jcb","cc-mastercard","cc-paypal","cc-stripe","cc-visa","credit-card","credit-card-alt","google-wallet","paypal"]},{title:"Chart Icons",icon:"area-chart",list:["area-chart","bar-chart","bar-chart-o ","line-chart","pie-chart"]},{title:"Currency Icons",icon:"bitcoin",list:["bitcoin ","btc","cny ","dollar ","eur","euro ","gbp","gg","gg-circle","ils","inr","jpy","krw","money","rmb ","rouble ","rub","ruble ","rupee ","shekel ","sheqel ","try","turkish-lira ","usd","viacoin","won ","yen"]},{title:"Text Editor Icons",icon:"align-center",list:["align-center","align-justify","align-left","align-right","bold","chain ","chain-broken","clipboard","columns","copy ","cut ","dedent ","eraser","file","file-o","file-text","file-text-o","files-o","floppy-o","font","header","indent","italic","link","list","list-alt","list-ol","list-ul","outdent","paperclip","paragraph","paste ","repeat","rotate-left ","rotate-right ","save ","scissors","strikethrough","subscript","superscript","table","text-height","text-width","th","th-large","th-list","underline","undo","unlink"]},{title:"Brand Icons",icon:"500px",list:["500px","adn","amazon","android","angellist","apple","bandcamp","behance","behance-square","bitbucket","bitbucket-square","bitcoin ","black-tie","bluetooth","bluetooth-b","btc","buysellads","cc-amex","cc-diners-club","cc-discover","cc-jcb","cc-mastercard","cc-paypal","cc-stripe","cc-visa","chrome","codepen","codiepie","connectdevelop","contao","css3","dashcube","delicious","deviantart","digg","dribbble","dropbox","drupal","edge","eercast","empire","envira","etsy","expeditedssl","fa ","facebook","facebook-f ","facebook-official","facebook-square","firefox","first-order","flickr","font-awesome","fonticons","fort-awesome","forumbee","foursquare","free-code-camp","ge ","get-pocket","gg","gg-circle","git","git-square","github","github-alt","github-square","gitlab","gittip ","glide","glide-g","google","google-plus","google-plus-circle ","google-plus-official","google-plus-square","google-wallet","gratipay","grav","hacker-news","houzz","html5","imdb","instagram","internet-explorer","ioxhost","joomla","jsfiddle","lastfm","lastfm-square","leanpub","linkedin","linkedin-square","linode","linux","maxcdn","meanpath","medium","meetup","mixcloud","modx","odnoklassniki","odnoklassniki-square","opencart","openid","opera","optin-monster","pagelines","paypal","pied-piper","pied-piper-alt","pied-piper-pp","pinterest","pinterest-p","pinterest-square","product-hunt","qq","quora","ra ","ravelry","rebel","reddit","reddit-alien","reddit-square","renren","resistance ","safari","scribd","sellsy","share-alt","share-alt-square","shirtsinbulk","simplybuilt","skyatlas","skype","slack","slideshare","snapchat","snapchat-ghost","snapchat-square","soundcloud","spotify","stack-exchange","stack-overflow","steam","steam-square","stumbleupon","stumbleupon-circle","superpowers","telegram","tencent-weibo","themeisle","trello","tripadvisor","tumblr","tumblr-square","twitch","twitter","twitter-square","usb","viacoin","viadeo","viadeo-square","vimeo","vimeo-square","vine","vk","wechat ","weibo","weixin","whatsapp","wikipedia-w","windows","wordpress","wpbeginner","wpexplorer","wpforms","xing","xing-square","y-combinator","y-combinator-square ","yahoo","yc ","yc-square ","yelp","yoast","youtube","youtube-play","youtube-square"]}],faButtons:["fontAwesomeBack","|"]}),Object.assign(g.POPUP_TEMPLATES,{fontAwesome:"[_BUTTONS_][_CUSTOM_LAYER_]"}),g.PLUGINS.fontAwesome=function(f){var b=f.$,p=f.opts.fontAwesomeSets[0],d=f.opts.fontAwesomeSets,t="";function s(){f.opts.toolbarInline&&0<f.opts.faButtons.length&&(t='<div class="fr-buttons fr-tabs">'.concat(f.button.buildList(f.opts.faButtons),"</div>"));var m,e={buttons:t,custom_layer:a()},o=f.popups.create("fontAwesome",e);return m=o,f.events.on("popup.tab",function(e){var o=b(e.currentTarget);if(!f.popups.isVisible("fontAwesome")||!o.is("span, a"))return!0;var t,a,r,s=e.which;if(g.KEYCODE.TAB==s){if(o.is("span.fr-icon")&&e.shiftKey||o.is("a")&&!e.shiftKey){var i=m.find(".fr-buttons");t=!f.accessibility.focusToolbar(i,!!e.shiftKey)}if(!1!==t){var n=m.find("span.fr-icon:focus").first().concat(m.findVisible(" span.fr-icon").first().concat(m.find("a")));o.is("span.fr-icon")&&(n=n.not("span.fr-icon:not(:focus)")),a=n.index(o),a=e.shiftKey?((a-1)%n.length+n.length)%n.length:(a+1)%n.length,r=n.get(a),f.events.disableBlur(),r.focus(),t=!1}}else if(g.KEYCODE.ARROW_UP==s||g.KEYCODE.ARROW_DOWN==s||g.KEYCODE.ARROW_LEFT==s||g.KEYCODE.ARROW_RIGHT==s){if(o.is("span.fr-icon")){var c=o.parent().find("span.fr-icon");a=c.index(o);var l=Math.floor(c.length/8),u=a%8,p=Math.floor(a/8),d=8*p+u,h=8*l;g.KEYCODE.ARROW_UP==s?d=((d-8)%h+h)%h:g.KEYCODE.ARROW_DOWN==s?d=(d+8)%h:g.KEYCODE.ARROW_LEFT==s?d=((d-1)%h+h)%h:g.KEYCODE.ARROW_RIGHT==s&&(d=(d+1)%h),r=b(c.get(d)),f.events.disableBlur(),r.focus(),t=!1}}else g.KEYCODE.ENTER==s&&(o.is("a")?o[0].click():f.button.exec(o),t=!1);return!1===t&&(e.preventDefault(),e.stopPropagation()),t},!0),o}function a(){var e,o,t,a,r,s,i,n,c,l,u;return"".concat((r=d,s=p,i=f.opts.fontAwesomeTemplate,'\n <div class="fr-buttons fr-tabs fr-tabs-scroll">\n '.concat((n=r,c=s,l=i,u="",n.forEach(function(e){var o={elementClass:e.title===c.title?"fr-active fr-active-tab":"",title:e.title,dataCmd:"setIconCategory",dataParam1:e.title,iconValue:l.replace(/\[NAME\]/g,e.icon)};u+='<button class="fr-fa-icon-category fr-command fr-btn '.concat(o.elementClass,'" title="').concat(o.title,'" data-cmd="').concat(o.dataCmd,'" data-param1="').concat(o.dataParam1,'"</button><span>').concat(o.iconValue,"</span>")}),u),"\n </div>\n ")),"\n ").concat((e=p,o=f.opts.fontAwesomeTemplate,'\n <div class="fr-icon-container fr-fa-container">\n '.concat((t=o,a="",e.list.forEach(function(e){var o={dataParam1:e,title:e,iconValue:t.replace(/\[NAME\]/g,e)};a+='<span class="fr-command fr-fa-icon fr-icon" role="button" data-cmd="insertIcon" data-param1="'.concat(o.dataParam1,'" title="').concat(o.title,'">').concat(o.iconValue,"</span>")}),a),"\n </div>\n ")))}return{setIconCategory:function(o){p=d.filter(function(e){return e.title===o})[0],f.popups.get("fontAwesome").html(t+a())},showFontAwesomePopup:function(){var e=f.popups.get("fontAwesome");if(e||(e=s()),!e.hasClass("fr-active")){f.popups.refresh("fontAwesome"),f.popups.setContainer("fontAwesome",f.$tb);var o=f.$tb.find('.fr-command[data-cmd="fontAwesome"]'),t=f.button.getPosition(o),a=t.left,r=t.top;f.popups.show("fontAwesome",a,r,o.outerHeight())}},back:function(){f.popups.hide("fontAwesome"),f.toolbar.showInline()}}},g.DefineIcon("fontAwesome",{NAME:"flag",SVG_KEY:"fontAwesome"}),g.RegisterCommand("fontAwesome",{title:"Font Awesome",icon:"fontAwesome",undo:!1,focus:!1,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("fontAwesome")?(this.$el.find(".fr-marker")&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("fontAwesome")):this.fontAwesome.showFontAwesomePopup()},plugin:"fontAwesome",showOnMobile:!0}),g.RegisterCommand("insertIcon",{callback:function(e,o){this.undo.saveStep(),this.html.insert("".concat(this.opts.fontAwesomeTemplate.replace(/\[NAME\]/g,o)," ")),this.undo.saveStep(),this.popups.hide("fontAwesome")}}),g.RegisterCommand("setIconCategory",{undo:!1,focus:!1,callback:function(e,o){this.fontAwesome.setIconCategory(o)}}),g.DefineIcon("fontAwesomeBack",{NAME:"arrow-left",SVG_KEY:"back"}),g.RegisterCommand("fontAwesomeBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.fontAwesome.back()}})}); |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v3.0.0-rc.1 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
{ | ||
"name": "froala-editor", | ||
"version": "3.0.0-beta.2-1", | ||
"version": "3.0.0-rc.1", | ||
"description": "The next generation Javascript WYSIWYG HTML rich text editor made by devs for devs. High performance and modern design make it easy to use for developers and loved by users.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3985752
23278