froala-editor
Advanced tools
Comparing version 2.9.3 to 2.9.4
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -34,4 +34,4 @@ * Copyright 2014-2019 Froala Labs | ||
/** | ||
* Spanish | ||
*/ | ||
* Spanish | ||
*/ | ||
@@ -93,19 +93,4 @@ $.FE.LANGUAGE['es'] = { | ||
"Ordered List": "Lista ordenada", | ||
"Default": "Defecto", | ||
"Lower Alpha": "Alfa inferior", | ||
"Lower Greek": "Griego inferior", | ||
"Lower Roman": "Baja romana", | ||
"Upper Alpha": "Alfa superior", | ||
"Upper Roman": "Romano superior", | ||
"Unordered List": "Lista desordenada", | ||
"Circle": "Circulo", | ||
"Disc": "Dto", | ||
"Square": "Cuadrado", | ||
// Line height | ||
"Line Height": "Altura de la línea", | ||
"Single": "Soltero", | ||
"Double": "Doble", | ||
// Indent | ||
@@ -134,3 +119,3 @@ "Decrease Indent": "Reducir sangr\u00eda", | ||
"Tags": "Etiquetas", | ||
"Are you sure? Image will be deleted.": "\u00bfEst\u00e1 seguro? Imagen ser\u00e1 borrada.", | ||
"Are you sure? Image will be deleted.": "\u00bfEst\u00e1 seguro? La imagen ser\u00e1 borrada.", | ||
"Replace": "Reemplazar", | ||
@@ -191,5 +176,5 @@ "Uploading": "Carga", | ||
// Emoticons | ||
"Emoticons": "Emoticones", | ||
"Grinning face": "Sonriendo cara", | ||
"Grinning face with smiling eyes": "Sonriendo cara con ojos sonrientes", | ||
"Emoticons": "Emoticonos", | ||
"Grinning face": "Cara sonriendo", | ||
"Grinning face with smiling eyes": "Cara sonriendo con ojos sonrientes", | ||
"Face with tears of joy": "Cara con l\u00e1grimas de alegr\u00eda", | ||
@@ -204,3 +189,3 @@ "Smiling face with open mouth": "Cara sonriente con la boca abierta", | ||
"Smiling face with smiling eyes": "Cara sonriente con ojos sonrientes", | ||
"Face savoring delicious food": "Care saborear una deliciosa comida", | ||
"Face savoring delicious food": "Cara de saborear una deliciosa comida", | ||
"Relieved face": "Cara Aliviado", | ||
@@ -212,15 +197,15 @@ "Smiling face with heart-shaped eyes": "Cara sonriente con los ojos en forma de coraz\u00f3n", | ||
"Expressionless face": "Rostro inexpresivo", | ||
"Unamused face": "Cara no divertido", | ||
"Unamused face": "Cara aburrida", | ||
"Face with cold sweat": "Cara con sudor fr\u00edo", | ||
"Pensive face": "Rostro pensativo", | ||
"Confused face": "Cara confusa", | ||
"Confounded face": "Cara Averg\u00fc\u00e9ncense", | ||
"Kissing face": "Besar la cara", | ||
"Confounded face": "Cara aturdida", | ||
"Kissing face": "Cara besando", | ||
"Face throwing a kiss": "Cara lanzando un beso", | ||
"Kissing face with smiling eyes": "Besar a cara con ojos sonrientes", | ||
"Kissing face with closed eyes": "Besar a cara con los ojos cerrados", | ||
"Kissing face with smiling eyes": "Cara besando con ojos sonrientes", | ||
"Kissing face with closed eyes": "Cara besando con los ojos cerrados", | ||
"Face with stuck out tongue": "Cara con la lengua pegada", | ||
"Face with stuck out tongue and winking eye": "Cara con pegado a la lengua y los ojos gui\u00f1o", | ||
"Face with stuck out tongue and tightly-closed eyes": "Cara con la lengua pegada a y los ojos fuertemente cerrados", | ||
"Disappointed face": "Cara decepcionado", | ||
"Face with stuck out tongue and winking eye": "Cara con la lengua pegada y el ojo parpadeante", | ||
"Face with stuck out tongue and tightly-closed eyes": "Cara con la lengua pegada y los ojos fuertemente cerrados", | ||
"Disappointed face": "Cara de decepcionado", | ||
"Worried face": "Cara de preocupaci\u00f3n", | ||
@@ -230,13 +215,13 @@ "Angry face": "Cara enojada", | ||
"Crying face": "Cara llorando", | ||
"Persevering face": "Perseverar cara", | ||
"Persevering face": "Cara de perseverancia", | ||
"Face with look of triumph": "Cara con expresi\u00f3n de triunfo", | ||
"Disappointed but relieved face": "Decepcionado pero el rostro aliviado", | ||
"Frowning face with open mouth": "Con el ce\u00f1o fruncido la cara con la boca abierta", | ||
"Frowning face with open mouth": "Cara con la boca abierta con el ce\u00f1o fruncido", | ||
"Anguished face": "Rostro angustiado", | ||
"Fearful face": "Cara Temeroso", | ||
"Fearful face": "Cara temerosa", | ||
"Weary face": "Rostro cansado", | ||
"Sleepy face": "Rostro so\u00f1oliento", | ||
"Sleepy face": "Rostro somnoliento", | ||
"Tired face": "Rostro cansado", | ||
"Grimacing face": "Haciendo una mueca cara", | ||
"Loudly crying face": "Llorando en voz alta la cara", | ||
"Grimacing face": "Cara haciendo una mueca", | ||
"Loudly crying face": "Cara llorando en voz alta", | ||
"Face with open mouth": "Cara con la boca abierta", | ||
@@ -249,3 +234,3 @@ "Hushed face": "Cara callada", | ||
"Sleeping face": "Rostro dormido", | ||
"Dizzy face": "Cara Mareado", | ||
"Dizzy face": "Cara mareada", | ||
"Face without mouth": "Cara sin boca", | ||
@@ -270,5 +255,2 @@ "Face with medical mask": "Cara con la m\u00e1scara m\u00e9dica", | ||
// Save | ||
"Save": "Salvar", | ||
// Undo, redo | ||
@@ -315,3 +297,3 @@ "Undo": "Deshacer", | ||
"Common actions": "Acciones comunes", | ||
"Copy": "Dupdo", | ||
"Copy": "Copiar", | ||
"Cut": "Cortar", | ||
@@ -318,0 +300,0 @@ "Paste": "Pegar", |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -166,3 +166,3 @@ * Copyright 2014-2019 Froala Labs | ||
"Column": "Kolumn", | ||
"Insert column before": "Infoga kollumn f\u00f6re", | ||
"Insert column before": "Infoga kolumn f\u00f6re", | ||
"Insert column after": "Infoga kolumn efter", | ||
@@ -169,0 +169,0 @@ "Delete column": "Ta bort kolumn", |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(x){x.extend(x.FE.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"]}),x.FE.PLUGINS.codeView=function(l){var d,c;function h(){return l.$box.hasClass("fr-code-view")}function f(){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 p,g=!1;function m(){h()&&l.events.trigger("blur")}function b(){h()&&g&&l.events.trigger("focus")}function s(e){d||(!function(){d=x('<textarea class="fr-code" tabIndex="-1">'),l.$wp.append(d),d.attr("dir",l.opts.direction),l.$box.hasClass("fr-basic")||(p=x('<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(p),l.events.bindClick(l.$box,"a.html-switch",function(){l.events.trigger("commands.before",["html"]),v(!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",M,!0),l.events.on("html.set",function(){h()&&v(!0)}),l.events.on("codeView.update",u),l.events.on("form.submit",function(){h()&&(l.html.set(f()),l.events.trigger("contentChanged",[],!0))},!0)}(),!c&&l.opts.codeMirror?((c=l.opts.codeMirror.fromTextArea(d.get(0),l.opts.codeMirrorOptions)).on("blur",m),c.on("focus",b)):(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",m),l.events.$on(d,"focus",b))),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 n,r,s=!1;if(l.core.hasFocus()&&(s=!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){n=t.indexOf("FROALA-SM"),(r=t.indexOf("FROALA-EM"))<n?n=r:r-=9;var i=(t=t.replace(/FROALA-SM/g,"").replace(/FROALA-EM/g,"")).substring(0,n).length-t.substring(0,n).replace(/\n/g,"").length,o=t.substring(0,r).length-t.substring(0,r).replace(/\n/g,"").length;n=t.substring(0,n).length-t.substring(0,t.substring(0,n).lastIndexOf("\n")+1).length,r=t.substring(0,r).length-t.substring(0,t.substring(0,r).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),g=!s,c.focus(),g=!0,c.setSelection({line:i,ch:n},{line:o,ch:r}),c.refresh(),c.clearHistory()}else{n=t.indexOf("FROALA-SM"),r=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=x(l.o_doc).scrollTop();g=!s,d.focus(),g=!0,d.get(0).setSelectionRange(n,r),x(l.o_doc).scrollTop(a)}l.$tb.find(" > .fr-command, > .fr-btn-wrap > .fr-command").not(e).filter(function(){return l.opts.codeViewKeepActiveButtons.indexOf(x(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 v(e){void 0===e&&(e=!h());var t,n,r=l.$tb.find('.fr-command[data-cmd="html"]');e?(l.popups.hideAll(),s(r)):(l.$box.toggleClass("fr-code-view",!1),t=r,n=f(),l.html.set(n),l.$el.blur(),l.$tb.find(" > .fr-command, > .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 M(){h()&&v(!1),c&&c.toTextArea(),d.val("").removeData().remove(),d=null,p&&(p.remove(),p=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-command").not(e).filter(function(){return l.opts.codeViewKeepActiveButtons.indexOf(x(this).data("cmd"))<0}).addClass("fr-disabled").attr("aria-disabled",!1),e.addClass("fr-active").attr("aria-pressed",!1)):(l.$tb.find(" > .fr-command").not(e).removeClass("fr-disabled").attr("aria-disabled",!1),e.removeClass("fr-active").attr("aria-pressed",!1)))}),!l.$wp)return!1},toggle:v,isActive:h,get:f}},x.FE.RegisterCommand("html",{title:"Code View",undo:!1,focus:!1,forcedRefresh:!0,toggle:!0,callback:function(){this.codeView.toggle()},plugin:"codeView"}),x.FE.DefineIcon("html",{NAME:"code"})}); | ||
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(M){M.extend(M.FE.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"]}),M.FE.PLUGINS.codeView=function(l){var d,c;function f(){return l.$box.hasClass("fr-code-view")}function h(){return c?c.getValue():d.val()}function u(){f()&&(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 p,g=!1;function m(){f()&&l.events.trigger("blur")}function b(){f()&&g&&l.events.trigger("focus")}function s(e){d||(!function(){d=M('<textarea class="fr-code" tabIndex="-1">'),l.$wp.append(d),d.attr("dir",l.opts.direction),l.$box.hasClass("fr-basic")||(p=M('<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(p),l.events.bindClick(l.$box,"a.html-switch",function(){l.events.trigger("commands.before",["html"]),v(!1),l.events.trigger("commands.after",["html"])}));var e=function(){return!f()};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(){f()&&v(!0)}),l.events.on("codeView.update",u),l.events.on("form.submit",function(){f()&&(l.html.set(h()),l.events.trigger("contentChanged",[],!0))},!0)}(),!c&&l.opts.codeMirror?((c=l.opts.codeMirror.fromTextArea(d.get(0),l.opts.codeMirrorOptions)).on("blur",m),c.on("focus",b)):(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",m),l.events.$on(d,"focus",b))),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 n,r,s=!1;if(l.core.hasFocus()&&(s=!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){n=t.indexOf("FROALA-SM"),(r=t.indexOf("FROALA-EM"))<n?n=r:r-=9;var i=(t=t.replace(/FROALA-SM/g,"").replace(/FROALA-EM/g,"")).substring(0,n).length-t.substring(0,n).replace(/\n/g,"").length,o=t.substring(0,r).length-t.substring(0,r).replace(/\n/g,"").length;n=t.substring(0,n).length-t.substring(0,t.substring(0,n).lastIndexOf("\n")+1).length,r=t.substring(0,r).length-t.substring(0,t.substring(0,r).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),g=!s,c.focus(),g=!0,c.setSelection({line:i,ch:n},{line:o,ch:r}),c.refresh(),c.clearHistory()}else{n=t.indexOf("FROALA-SM"),r=t.indexOf("FROALA-EM")-9,l.opts.heightMin&&d.css("min-height",l.opts.heightMin),l.opts.height&&d.css("height",l.opts.height),d.val(t.replace(/FROALA-SM/g,"").replace(/FROALA-EM/g,"")).trigger("change");var a=M(l.o_doc).scrollTop();g=!s,d.focus(),g=!0,d.get(0).setSelectionRange(n,r),M(l.o_doc).scrollTop(a)}l.$tb.find(" > .fr-command, > .fr-btn-wrap > .fr-command").not(e).filter(function(){return l.opts.codeViewKeepActiveButtons.indexOf(M(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 v(e){void 0===e&&(e=!f());var t,n,r=l.$tb.find('.fr-command[data-cmd="html"]');e?(l.popups.hideAll(),s(r)):(l.$box.toggleClass("fr-code-view",!1),t=r,n=h(),l.html.set(n),l.$el.blur(),l.$tb.find(" > .fr-command, > .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(){f()&&v(!1),c&&c.toTextArea(),d.val("").removeData().remove(),d=null,p&&(p.remove(),p=null)}return{_init:function(){if(l.events.on("focus",function(){var e;l.opts.toolbarContainer&&(e=l.$tb.find('.fr-command[data-cmd="html"]'),f()?(l.$tb.find(" > .fr-command").not(e).filter(function(){return l.opts.codeViewKeepActiveButtons.indexOf(M(this).data("cmd"))<0}).addClass("fr-disabled").attr("aria-disabled",!1),e.addClass("fr-active").attr("aria-pressed",!1)):(l.$tb.find(" > .fr-command").not(e).removeClass("fr-disabled").attr("aria-disabled",!1),e.removeClass("fr-active").attr("aria-pressed",!1)))}),!l.$wp)return!1},toggle:v,isActive:f,get:h}},M.FE.RegisterCommand("html",{title:"Code View",undo:!1,focus:!1,forcedRefresh:!0,toggle:!0,callback:function(){this.codeView.toggle()},plugin:"codeView"}),M.FE.DefineIcon("html",{NAME:"code"})}); |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(o){"function"==typeof define&&define.amd?define(["jquery"],o):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),o(t)}:o(window.jQuery)}(function(c){c.FE.PLUGINS.fullscreen=function(o){var t,s,r,n;function i(){return o.$box.hasClass("fr-fullscreen")}function e(){if(o.helpers.isIOS()&&o.core.hasFocus())return o.$el.blur(),setTimeout(d,250),!1;t=o.helpers.scrollTop(),o.$box.toggleClass("fr-fullscreen"),c("body:first").toggleClass("fr-fullscreen"),o.helpers.isMobile()&&(o.$tb.data("parent",o.$tb.parent()),o.$tb.prependTo(o.$box),o.$tb.data("sticky-dummy")&&o.$tb.after(o.$tb.data("sticky-dummy"))),s=o.opts.height,r=o.opts.heightMax,n=o.opts.zIndex,o.position.refresh(),o.opts.height=o.o_win.innerHeight-(o.opts.toolbarInline?0:o.$tb.outerHeight()),o.opts.zIndex=2147483641,o.opts.heightMax=null,o.size.refresh(),o.opts.toolbarInline&&o.toolbar.showInline();for(var e=o.$box.parent();!e.is("body:first");)e.data("z-index",e.css("z-index")).data("width",e.css("width")).data("margin",e.css("margin")).data("padding",e.css("padding")).data("overflow",e.css("overflow")).css("z-index","2147483640").css("width","100%").css("margin","0px").css("padding","0px").css("overflow","visible"),e=e.parent();o.opts.toolbarContainer&&o.$box.prepend(o.$tb),o.events.trigger("charCounter.update"),o.events.trigger("codeView.update"),o.$win.trigger("scroll")}function a(){if(o.helpers.isIOS()&&o.core.hasFocus())return o.$el.blur(),setTimeout(d,250),!1;o.$box.toggleClass("fr-fullscreen"),c("body:first").toggleClass("fr-fullscreen"),o.$tb.prependTo(o.$tb.data("parent")),o.$tb.data("sticky-dummy")&&o.$tb.after(o.$tb.data("sticky-dummy")),o.opts.height=s,o.opts.heightMax=r,o.opts.zIndex=n,o.size.refresh(),c(o.o_win).scrollTop(t),o.opts.toolbarInline&&o.toolbar.showInline(),o.events.trigger("charCounter.update"),o.opts.toolbarSticky&&o.opts.toolbarStickyOffset&&(o.opts.toolbarBottom?o.$tb.css("bottom",o.opts.toolbarStickyOffset).data("bottom",o.opts.toolbarStickyOffset):o.$tb.css("top",o.opts.toolbarStickyOffset).data("top",o.opts.toolbarStickyOffset));for(var e=o.$box.parent();!e.is("body:first");)e.data("z-index")&&(e.css("z-index",""),e.css("z-index")!=e.data("z-index")&&e.css("z-index",e.data("z-index")),e.removeData("z-index")),e.data("width")&&(e.css("width",""),e.css("width")!=e.data("width")&&e.css("width",e.data("width")),e.removeData("width")),e.data("margin")&&(e.css("margin",""),e.css("margin")!=e.data("margin")&&e.css("margin",e.data("margin")),e.removeData("margin")),e.data("padding")&&(e.css("padding",""),e.css("padding")!=e.data("padding")&&e.css("padding",e.data("padding")),e.removeData("padding")),e.data("overflow")?(e.css("overflow",""),e.css("overflow")!=e.data("overflow")&&e.css("overflow",e.data("overflow"))):e.css("overflow",""),e.removeData("overflow"),e=e.parent();o.opts.toolbarContainer&&c(o.opts.toolbarContainer).append(o.$tb),c(o.o_win).trigger("scroll"),o.events.trigger("codeView.update")}function d(){i()?a():e(),l(o.$tb.find('.fr-command[data-cmd="fullscreen"]'))}function l(e){var t=i();e.toggleClass("fr-active",t).attr("aria-pressed",t),e.find("> *:not(.fr-sr-only)").replaceWith(t?o.icon.create("fullscreenCompress"):o.icon.create("fullscreen"))}return{_init:function(){if(!o.$wp)return!1;o.events.$on(c(o.o_win),"resize",function(){i()&&(a(),e())}),o.events.on("toolbar.hide",function(){if(i()&&o.helpers.isMobile())return!1}),o.events.on("position.refresh",function(){if(o.helpers.isIOS())return!i()}),o.events.on("destroy",function(){i()&&a()},!0)},toggle:d,refresh:l,isActive:i}},c.FE.RegisterCommand("fullscreen",{title:"Fullscreen",undo:!1,focus:!1,accessibilityFocus:!0,forcedRefresh:!0,toggle:!0,callback:function(){this.fullscreen.toggle()},refresh:function(e){this.fullscreen.refresh(e)},plugin:"fullscreen"}),c.FE.DefineIcon("fullscreen",{NAME:"expand"}),c.FE.DefineIcon("fullscreenCompress",{NAME:"compress"})}); | ||
!function(o){"function"==typeof define&&define.amd?define(["jquery"],o):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),o(t)}:o(window.jQuery)}(function(c){c.FE.PLUGINS.fullscreen=function(o){var t,r,s,n;function i(){return o.$box.hasClass("fr-fullscreen")}function e(){if(o.helpers.isIOS()&&o.core.hasFocus())return o.$el.blur(),setTimeout(f,250),!1;t=o.helpers.scrollTop(),o.$box.toggleClass("fr-fullscreen"),c("body:first").toggleClass("fr-fullscreen"),o.helpers.isMobile()&&(o.$tb.data("parent",o.$tb.parent()),o.$tb.prependTo(o.$box),o.$tb.data("sticky-dummy")&&o.$tb.after(o.$tb.data("sticky-dummy"))),r=o.opts.height,s=o.opts.heightMax,n=o.opts.zIndex,o.position.refresh(),o.opts.height=o.o_win.innerHeight-(o.opts.toolbarInline?0:o.$tb.outerHeight()),o.opts.zIndex=2147483641,o.opts.heightMax=null,o.size.refresh(),o.opts.toolbarInline&&o.toolbar.showInline();for(var e=o.$box.parent();!e.is("body:first");)e.addClass("fr-fullscreen-wrapper"),e=e.parent();o.opts.toolbarContainer&&o.$box.prepend(o.$tb),o.events.trigger("charCounter.update"),o.events.trigger("codeView.update"),o.$win.trigger("scroll")}function l(){if(o.helpers.isIOS()&&o.core.hasFocus())return o.$el.blur(),setTimeout(f,250),!1;o.$box.toggleClass("fr-fullscreen"),c("body:first").toggleClass("fr-fullscreen"),o.$tb.prependTo(o.$tb.data("parent")),o.$tb.data("sticky-dummy")&&o.$tb.after(o.$tb.data("sticky-dummy")),o.opts.height=r,o.opts.heightMax=s,o.opts.zIndex=n,o.size.refresh(),c(o.o_win).scrollTop(t),o.opts.toolbarInline&&o.toolbar.showInline(),o.events.trigger("charCounter.update"),o.opts.toolbarSticky&&o.opts.toolbarStickyOffset&&(o.opts.toolbarBottom?o.$tb.css("bottom",o.opts.toolbarStickyOffset).data("bottom",o.opts.toolbarStickyOffset):o.$tb.css("top",o.opts.toolbarStickyOffset).data("top",o.opts.toolbarStickyOffset));for(var e=o.$box.parent();!e.is("body:first");)e.removeClass("fr-fullscreen-wrapper"),e=e.parent();o.opts.toolbarContainer&&c(o.opts.toolbarContainer).append(o.$tb),c(o.o_win).trigger("scroll"),o.events.trigger("codeView.update")}function f(){i()?l():e(),a(o.$tb.find('.fr-command[data-cmd="fullscreen"]'))}function a(e){var t=i();e.toggleClass("fr-active",t).attr("aria-pressed",t),e.find("> *:not(.fr-sr-only)").replaceWith(t?o.icon.create("fullscreenCompress"):o.icon.create("fullscreen"))}return{_init:function(){if(!o.$wp)return!1;o.events.$on(c(o.o_win),"resize",function(){i()&&(l(),e())}),o.events.on("toolbar.hide",function(){if(i()&&o.helpers.isMobile())return!1}),o.events.on("position.refresh",function(){if(o.helpers.isIOS())return!i()}),o.events.on("destroy",function(){i()&&l()},!0)},toggle:f,refresh:a,isActive:i}},c.FE.RegisterCommand("fullscreen",{title:"Fullscreen",undo:!1,focus:!1,accessibilityFocus:!0,forcedRefresh:!0,toggle:!0,callback:function(){this.fullscreen.toggle()},refresh:function(e){this.fullscreen.refresh(e)},plugin:"fullscreen"}),c.FE.DefineIcon("fullscreen",{NAME:"expand"}),c.FE.DefineIcon("fullscreenCompress",{NAME:"compress"})}); |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),a(t)}:a(window.jQuery)}(function(be){be.extend(be.FE.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_]"}),be.extend(be.FE.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}),be.FE.PLUGINS.image=function(g){var d,l,f,p,o,a,c="https://i.froala.com/upload",t=!1,i=1,u=2,m=3,h=4,v=5,b=6,r={};function y(){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=U()),e){var t=he();ve()&&(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())}}function w(){$()}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=be(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"+ge(t)[0]),t.addClass("fr-di"+de(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")),pe(e,e.hasClass("fr-dib")?"block":e.hasClass("fr-dii")?"inline":null,e.hasClass("fr-fil")?"left":e.hasClass("fr-fir")?"right":ge(e)),e.removeClass("fr-dib fr-dii fr-fir fr-fil")),g.opts.iframe&&r.on("load",g.size.syncIframe)}}function E(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")),be(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",[be(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",[be(a[t])])}o=a}function C(){if(l||function(){var e;g.shared.$image_resizer?(l=g.shared.$image_resizer,p=g.shared.$img_overlay,g.events.on("destroy",function(){l.removeClass("fr-active").appendTo(be("body:first"))},!0)):(g.shared.$image_resizer=be('<div class="fr-image-resizer"></div>'),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=be('<div class="fr-image-overlay"></div>'),p=g.shared.$img_overlay,e=l.get(0).ownerDocument,be(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(be(g.o_win),"resize",function(){d&&!d.hasClass("fr-uploading")?se(!0):d&&(C(),ce(),I(!1))});if(g.opts.imageResize){e=l.get(0).ownerDocument,g.events.$on(l,g._mousedown,".fr-handler",R),g.events.$on(be(e),g._mousemove,S),g.events.$on(be(e.defaultView||e.parentWindow),g._mouseup,D),g.events.$on(p,"mouseleave",D);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==be.FE.KEYCODE.EQUALS||g.browser.mozilla&&a==be.FE.KEYCODE.FF_EQUALS)&&t&&!e.altKey?i=q.call(this,e,1,1,i):(a==be.FE.KEYCODE.HYPHEN||g.browser.mozilla&&a==be.FE.KEYCODE.FF_HYPHEN)&&t&&!e.altKey?i=q.call(this,e,2,-1,i):g.keys.ctrlKey(e)||a!=be.FE.KEYCODE.ENTER||(d.before("<br>"),k(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=he();ve()&&(i=i.find(".fr-img-wrap")),l.css("top",(g.opts.iframe?i.offset().top:i.offset().top+t)-1).css("left",(g.opts.iframe?i.offset().left: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 A(e){ve()?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(be(i.frameElement).offset().left)+i.frameElement.clientLeft)}(f=be(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/be(s).outerWidth()*100).toFixed(2)+"%"}A(n),p.show(),g.popups.hideAll(),fe()}function S(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)/be(n).outerWidth()*100).toFixed(2),g.opts.imageRoundPercent&&(r=Math.round(r)),A(r+"%"),(t=ve()?(g.helpers.getPX(d.parents(".fr-img-caption").css("width"))/be(n).outerWidth()*100).toFixed(2):(g.helpers.getPX(d.css("width"))/be(n).outerWidth()*100).toFixed(2))===r||g.opts.imageRoundPercent||A(t+"%"),d.css("height","").removeAttr("height")}else r+i>=g.opts.imageMinWidth&&(A(r+i),t=ve()?g.helpers.getPX(d.parents(".fr-img-caption").css("width")):g.helpers.getPX(d.css("width"))),t!==r+i&&A(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"));C(),g.events.trigger("image.resize",[me()])}}function D(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(),C(),n(),g.undo.saveStep(),g.events.trigger("image.resizeEnd",[me()])}}function x(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&&Q(a),g.events.trigger("image.error",[{code:e,message:r[e]},t,a])}function U(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){t+='<div class="fr-buttons">',t+=g.button.buildList(g.opts.imageEditButtons);var a={buttons:t+="</div>"};return g.popups.create("image.edit",a)}return!1}function I(e){var t=g.popups.get("image.insert");if(t||(t=W()),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=he();g.popups.setContainer("image.insert",g.$sc);var i=a.offset().left+a.width()/2,r=a.offset().top+a.height();g.popups.show("image.insert",i,r,a.outerHeight())}void 0===e&&F(g.language.translate("Uploading"),0)}function $(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;se(!0),g.selection.setAfter(a.get(0)),g.selection.restore()}g.popups.hide("image.insert")}}function F(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 k(e){ne.call(e.get(0))}function N(){var e=be(this);g.popups.hide("image.insert"),e.removeClass("fr-uploading"),e.next().is("br")&&e.next().remove(),k(e),g.events.trigger("image.loaded",[e])}function B(s,e,o,l,f){g.edit.off(),F(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",N),e.attr("src",s),g.edit.on(),E(!1),g.undo.saveStep(),g.events.disableBlur(),g.$el.blur(),g.events.trigger(a?"image.replaced":"image.inserted",[e,f])}else e=L(s,o,N),E(!1),g.undo.saveStep(),g.events.disableBlur(),g.$el.blur(),g.events.trigger("image.inserted",[e,f])},t.onerror=function(){x(i)},I(g.language.translate("Loading image")),t.src=s}function O(e){F(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=be(e).find("Location").text(),a=be(e).find("Key").text();return!1===g.events.trigger("image.uploadedToS3",[t,a,e],!0)?(g.edit.on(),!1):t}catch(i){return x(h,e),!1}}(i);n&&B(n,!1,[],e,a||i)}else x(h,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:(x(u,e),!1)}catch(a){return x(h,e),!1}}(r);s&&B(s.link,!1,s,e,a||r)}else x(m,a||r,e)}catch(o){x(h,a||r,e)}}function P(){x(h,this.response||this.responseText||this.responseXML)}function T(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;F(g.language.translate("Uploading"),t)}}function L(e,t,a){var i,r="";if(t&&void 0!==t)for(i in t)t.hasOwnProperty(i)&&"link"!=i&&(r+=" data-"+i+'="'+t[i]+'"');var n=g.opts.imageDefaultWidth;n&&"auto"!=n&&(n+=g.opts.imageResizeWithPercent?"%":"px");var s=be('<img src="'+e+'"'+r+(n?' style="width: '+n+';"':"")+">");pe(s,g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign),s.on("load",a),s.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 o=g.$el.find(".fr-marker");return o.length?(o.parent().is("hr")&&o.parent().after(o),g.node.isLastSibling(o)&&o.parent().hasClass("fr-deletable")&&o.insertAfter(o.parent()),o.replaceWith(s)):g.$el.append(s),g.selection.clear(),s}function M(){g.edit.on(),$(!0)}function z(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==c)&&!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 x(v),!1;if(g.opts.imageAllowedTypes.indexOf(i.type.replace(/image\//g,""))<0)return x(b),!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=be(this);e.off("load"),e.addClass("fr-uploading"),e.next().is("br")&&e.next().remove(),g.placeholder.refresh(),k(e),C(),I(),g.edit.off(),t.onload=function(){O.call(t,e)},t.onerror=P,t.upload.onprogress=T,t.onabort=M,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.one("error",n),g.edit.on(),g.undo.saveStep(),r.data("fr-old-src",r.attr("src")),r.attr("src",e)):L(e,null,n)},s.readAsDataURL(e)}(g.core.getXHR(n,g.opts.imageUploadMethod),a,i,t||d)}}var s,o,l}function _(e){if(e.is("img")&&0<e.parents(".fr-img-caption").length)return e.parents(".fr-img-caption")}function K(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(be.FE.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=W()),g.popups.setContainer("image.insert",g.$sc);var r=e.originalEvent.pageX,n=e.originalEvent.pageY;return g.opts.iframe&&(n+=g.$iframe.offset().top,r+=g.$iframe.offset().left),g.popups.show("image.insert",r,n),I(),0<=g.opts.imageAllowedTypes.indexOf(a.type.replace(/image\//g,""))?(se(!0),z(t.files)):x(b),e.preventDefault(),e.stopPropagation(),!1}}}function W(e){if(e)return g.popups.onRefresh("image.insert",y),g.popups.onHide("image.insert",w),!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">'+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")&&ce()}),f=a,g.events.$on(f,"dragover dragenter",".fr-image-upload-layer",function(){return be(this).addClass("fr-drop"),!1},!0),g.events.$on(f,"dragleave dragend",".fr-image-upload-layer",function(){return be(this).removeClass("fr-drop"),!1},!0),g.events.$on(f,"drop",".fr-image-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),be(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(){be(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)}be(this).val("")},!0),a}function H(){d&&g.popups.get("image.alt").find("input").val(d.attr("alt")||"").trigger("change")}function Y(){var e=g.popups.get("image.alt");e||(e=X()),$(),g.popups.refresh("image.alt"),g.popups.setContainer("image.alt",g.$sc);var t=he();ve()&&(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())}function X(e){if(e)return g.popups.onRefresh("image.alt",H),!0;var t={buttons:'<div class="fr-buttons">'+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")&&Y()}),a}function j(){var e=g.popups.get("image.size");if(d)if(ve()){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 G(){var e=g.popups.get("image.size");e||(e=V()),$(),g.popups.refresh("image.size"),g.popups.setContainer("image.size",g.$sc);var t=he();ve()&&(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())}function V(e){if(e)return g.popups.onRefresh("image.size",j),!0;var t={buttons:'<div class="fr-buttons">'+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")&&G()}),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)),S.call(this,e),D.call(this,e),++i}function Q(e){(e=e||he())&&!1!==g.events.trigger("image.beforeRemove",[e])&&(g.popups.hideAll(),ue(),se(!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(be.FE.MARKERS),be(e.get(0).parentNode).remove()):(g.selection.setBefore(e.get(0))||g.selection.setAfter(e.get(0))||e.after(be.FE.MARKERS),e.remove()),g.html.fillEmptyBlocks(),g.selection.restore()),g.undo.saveStep())}function J(e){var t=e.which;if(d&&(t==be.FE.KEYCODE.BACKSPACE||t==be.FE.KEYCODE.DELETE))return e.preventDefault(),e.stopPropagation(),Q(),!1;if(d&&t==be.FE.KEYCODE.ESC){var a=d;return se(!0),g.selection.setAfter(a.get(0)),g.selection.restore(),e.preventDefault(),!1}if(d&&(t==be.FE.KEYCODE.ARROW_LEFT||t==be.FE.KEYCODE.ARROW_RIGHT)){var i=d.get(0);return se(!0),t==be.FE.KEYCODE.ARROW_LEFT?g.selection.setBefore(i):g.selection.setAfter(i),g.selection.restore(),e.preventDefault(),!1}return d&&t!=be.FE.KEYCODE.F10&&!g.keys.isBrowserAction(e)?(e.preventDefault(),e.stopPropagation(),!1):void 0}function Z(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++)Z(i[r])}function ee(e){if(!1===g.events.trigger("image.beforePasteUpload",[e]))return!1;d=be(e),C(),n(),ce(),I(),d.one("load",function(){C(),I()});for(var t=be(e).attr("src").split(","),a=atob(t[1]),i=[],r=0;r<a.length;r++)i.push(a.charCodeAt(r));z([new Blob([new Uint8Array(i)],{type:t[0].replace(/data\:/g,"").replace(/;base64/g,"")})],d)}function te(){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"),be(a).css("width",t).removeClass("fr-dii fr-dib fr-fir fr-fil"),pe(be(a),g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign)}if(0===a.src.indexOf("data:"))ee(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(){ee(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(),be(a).remove(),g.selection.restore()):be(a).removeAttr("data-fr-image-pasted")}):g.$el.find("img[data-fr-image-pasted]").remove()}function ae(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&&pe(i,g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign),g.events.trigger("paste.after")}function ie(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=ae,r.readAsDataURL(i),!1}var i,r}function re(e){return e=e.replace(/<img /gi,'<img data-fr-image-pasted="true" ')}function ne(e){if("false"==be(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<be.FE.INSTANCES.length;t++)be.FE.INSTANCES[t]!=g&&be.FE.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=be(this),ue(),C(),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 se(e){d&&(oe||!0===e)&&(g.toolbar.enable(),l.removeClass("fr-active"),g.popups.hide("image.edit"),d=null,fe(),f=null,p&&p.hide())}r[i]="Image cannot be loaded from the passed link.",r[u]="No link in upload response.",r[m]="Error during file upload.",r[h]="Parsing response failed.",r[v]="File is too large.",r[b]="Image file type is invalid.",r[7]="Files can be uploaded only to same domain in IE 8 and IE 9.";var oe=!(r[8]="Image file is corrupted.");function le(){oe=!0}function fe(){oe=!1}function pe(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 ge(e){if(void 0===e&&(e=he()),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 de(e){void 0===e&&(e=he());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 ce(){var e=g.popups.get("image.insert");e||(e=W()),g.popups.isVisible("image.insert")||($(),g.popups.refresh("image.insert"),g.popups.setContainer("image.insert",g.$sc));var t=he();ve()&&(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))}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 me(){return d}function he(){return ve()?d.parents(".fr-img-caption:first"):d}function ve(){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"==be(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"==be(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?k(be(t)):a&&"IMG"==a.tagName&&k(be(a))}},!0),g.events.on("drop",K),g.events.on("element.beforeDrop",_),g.events.on("mousedown window.mousedown",le),g.events.on("window.touchmove",fe),g.events.on("mouseup window.mouseup",function(){if(d)return se(),!1;fe()}),g.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&se()}),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(){se(!(t=!1))}),g.events.on("modals.hide",function(){d&&(ue(),g.selection.clear())}),g.events.on("image.resizeEnd",function(){g.win.getSelection&&k(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===be.FE.ENTER_BR?e.after("<br>"):be(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"])',ne),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",J,!0),g.events.on("keyup",function(e){if(d&&e.which==be.FE.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=be(e).parents(".fr-img-caption").get(0)),g.node.hasClass(e,"fr-img-caption")&&(be(e).after(be.FE.INVISIBLE_SPACE+be.FE.MARKERS),g.selection.restore()))})):g.events.$on(g.$win,"keydown",J),g.events.on("toolbar.esc",function(){if(d){if(g.$wp)g.events.disableBlur(),g.events.focus();else{var e=d;se(!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=he();ve()?(t.before(be.FE.START_MARKER),t.after(be.FE.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(){k(d)}):(se(!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==be.FE.KEYCODE.C&&g.keys.ctrlKey(e)?g.events.trigger("window.copy"):t==be.FE.KEYCODE.X&&g.keys.ctrlKey(e)&&g.events.trigger("window.cut")}),g.events.$on(be(g.o_win),"keydown",function(e){var t=e.which;if(d&&t==be.FE.KEYCODE.BACKSPACE)return e.preventDefault(),!1}),g.events.$on(g.$win,"keydown",function(e){var t=e.which;d&&d.hasClass("fr-uploading")&&t==be.FE.KEYCODE.ESC&&d.trigger("abortUpload")}),g.events.on("destroy",function(){d&&d.hasClass("fr-uploading")&&d.trigger("abortUpload")}),g.events.on("paste.before",ie),g.events.on("paste.beforeCleanup",re),g.events.on("paste.after",te),g.events.on("html.set",e),g.events.on("html.inserted",e),e(),g.events.on("destroy",function(){o=[]}),g.events.on("html.processGet",Z),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||be(i[e]).width(),a=i[e].style.height||be(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&&(E(),g.events.on("contentChanged",E)),g.events.$on(be(g.o_win),"orientationchange.image",function(){setTimeout(function(){d&&k(d)},100)}),U(!0),W(!0),V(!0),X(!0),g.events.on("node.remove",function(e){if("IMG"==e.get(0).tagName)return Q(e),!1})},showInsertPopup:function(){var e=g.$tb.find('.fr-command[data-cmd="insertImage"]'),t=g.popups.get("image.insert");if(t||(t=W()),$(),!t.hasClass("fr-active"))if(g.popups.refresh("image.insert"),g.popups.setContainer("image.insert",g.$tb),e.is(":visible")){var a=e.offset().left+e.outerWidth()/2,i=e.offset().top+(g.opts.toolbarBottom?10:e.outerHeight()-10);g.popups.show("image.insert",a,i,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=he();ve()&&(r=r.find(".fr-img-wrap")),a=r.offset().top+r.outerHeight(),t=r.offset().left+r.outerWidth()/2}}else{var n=g.$tb.find('.fr-command[data-cmd="insertImage"]');t=n.offset().left+n.outerWidth()/2,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){g.popups.get("image.insert").find(".fr-image-upload-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshByURLButton:function(e){g.popups.get("image.insert").find(".fr-image-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},upload:z,insertByURL:function(){var e=g.popups.get("image.insert").find(".fr-image-by-url-layer input");if(0<e.val().length){I(),F(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?z([new Blob([this.response],{type:this.response.type||"image/png"})],d):x(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=he();t.removeClass("fr-fir fr-fil"),!g.opts.htmlUntouched&&g.opts.useClasses?"left"==e?t.addClass("fr-fil"):"right"==e&&t.addClass("fr-fir"):pe(t,de(),e),ue(),C(),n(),g.selection.clear()},refreshAlign:function(e){d&&e.find("> *:first").replaceWith(g.icon.create("image-align-"+ge()))},refreshAlignOnShow:function(e,t){d&&t.find('.fr-command[data-param1="'+ge()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){var t=he();t.removeClass("fr-dii fr-dib"),!g.opts.htmlUntouched&&g.opts.useClasses?"inline"==e?t.addClass("fr-dii"):"block"==e&&t.addClass("fr-dib"):pe(t,e,ge()),ue(),C(),n(),g.selection.clear()},refreshDisplayOnShow:function(e,t){d&&t.find('.fr-command[data-param1="'+de()+'"]').addClass("fr-active").attr("aria-selected",!0)},replace:ce,back:function(){d?(g.events.disableBlur(),be(".fr-popup input:focus").blur(),k(d)):(g.events.disableBlur(),g.selection.restore(),g.events.enableBlur(),g.popups.hide("image.insert"),g.toolbar.showInline())},get:me,getEl:he,insert:B,showProgressBar:I,remove:Q,hideProgressBar:$,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=he();if(!a){var r=Object.keys(t);r.splice(r.indexOf(e),1),i.removeClass(r.join(" "))}"object"==typeof t[e]?(i.removeAttr("style"),i.css(t[e].style)):i.toggleClass(e),k(d)},showAltPopup:Y,showSizePopup:G,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(),k(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",""),ve()&&(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(),k(d)}},toggleCaption:function(){var e;if(d&&!ve()){(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")+'" style="'+(g.opts.useClasses?"":e.attr("style"))+'" draggable="false"></span>'),e.wrap('<span class="fr-img-wrap"></span>'),e.after('<span class="fr-inner"'+(g.browser.mozilla?"":' contenteditable="true"')+">"+be.FE.START_MARKER+"Image caption"+be.FE.END_MARKER+"</span>"),d.removeAttr("class").removeAttr("style").removeAttr("width"),d.parents(".fr-img-caption").css("width",t+"px"),se(!0),g.selection.restore()}else e=he(),d.insertAfter(e),d.attr("class",e.attr("class").replace("fr-img-caption","")).attr("style",e.attr("style")),e.remove(),k(d)},hasCaption:ve,exitEdit:se,edit:k}},be.FE.DefineIcon("insertImage",{NAME:"image"}),be.FE.RegisterShortcut(be.FE.KEYCODE.P,"insertImage",null,"P"),be.FE.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"}),be.FE.DefineIcon("imageUpload",{NAME:"upload"}),be.FE.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)}}),be.FE.DefineIcon("imageByURL",{NAME:"link"}),be.FE.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)}}),be.FE.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"))}}),be.FE.DefineIcon("imageDisplay",{NAME:"star"}),be.FE.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)}}),be.FE.DefineIcon("image-align",{NAME:"align-left"}),be.FE.DefineIcon("image-align-left",{NAME:"align-left"}),be.FE.DefineIcon("image-align-right",{NAME:"align-right"}),be.FE.DefineIcon("image-align-center",{NAME:"align-justify"}),be.FE.DefineIcon("imageAlign",{NAME:"align-justify"}),be.FE.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=be.FE.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)}}),be.FE.DefineIcon("imageReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),be.FE.RegisterCommand("imageReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.image.replace()}}),be.FE.DefineIcon("imageRemove",{NAME:"trash"}),be.FE.RegisterCommand("imageRemove",{title:"Remove",callback:function(){this.image.remove()}}),be.FE.DefineIcon("imageBack",{NAME:"arrow-left"}),be.FE.RegisterCommand("imageBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.image.back()},refresh:function(e){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"))}}),be.FE.RegisterCommand("imageDismissError",{title:"OK",undo:!1,callback:function(){this.image.hideProgressBar(!0)}}),be.FE.DefineIcon("imageStyle",{NAME:"magic"}),be.FE.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"==typeof 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.image.getEl();a&&t.find(".fr-command").each(function(){var e=be(this).data("param1"),t=a.hasClass(e);be(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),be.FE.DefineIcon("imageAlt",{NAME:"info"}),be.FE.RegisterCommand("imageAlt",{undo:!1,focus:!1,popup:!0,title:"Alternative Text",callback:function(){this.image.showAltPopup()}}),be.FE.RegisterCommand("imageSetAlt",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.image.setAlt()}}),be.FE.DefineIcon("imageSize",{NAME:"arrows-alt"}),be.FE.RegisterCommand("imageSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.image.showSizePopup()}}),be.FE.RegisterCommand("imageSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.image.setSize()}}),be.FE.DefineIcon("imageCaption",{NAME:"commenting",FA5NAME:"comment-alt"}),be.FE.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(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),a(t)}:a(window.jQuery)}(function(be){be.extend(be.FE.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_]"}),be.extend(be.FE.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}),be.FE.PLUGINS.image=function(g){var d,l,f,p,o,a,c="https://i.froala.com/upload",t=!1,i=1,u=2,m=3,h=4,v=5,b=6,r={};function y(){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=U()),e){var t=he();ve()&&(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")?$():g.popups.show("image.edit",a,i,t.outerHeight())}}function w(){I()}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=be(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"+ge(t)[0]),t.addClass("fr-di"+de(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")),pe(e,e.hasClass("fr-dib")?"block":e.hasClass("fr-dii")?"inline":null,e.hasClass("fr-fil")?"left":e.hasClass("fr-fir")?"right":ge(e)),e.removeClass("fr-dib fr-dii fr-fir fr-fil")),g.opts.iframe&&r.on("load",g.size.syncIframe)}}function E(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")),be(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",[be(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",[be(a[t])])}o=a}function C(){if(l||function(){var e;g.shared.$image_resizer?(l=g.shared.$image_resizer,p=g.shared.$img_overlay,g.events.on("destroy",function(){l.removeClass("fr-active").appendTo(be("body:first"))},!0)):(g.shared.$image_resizer=be('<div class="fr-image-resizer"></div>'),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=be('<div class="fr-image-overlay"></div>'),p=g.shared.$img_overlay,e=l.get(0).ownerDocument,be(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(be(g.o_win),"resize",function(){d&&!d.hasClass("fr-uploading")?se(!0):d&&(C(),ce(),$(!1))});if(g.opts.imageResize){e=l.get(0).ownerDocument,g.events.$on(l,g._mousedown,".fr-handler",R),g.events.$on(be(e),g._mousemove,S),g.events.$on(be(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==be.FE.KEYCODE.EQUALS||g.browser.mozilla&&a==be.FE.KEYCODE.FF_EQUALS)&&t&&!e.altKey?i=q.call(this,e,1,1,i):(a==be.FE.KEYCODE.HYPHEN||g.browser.mozilla&&a==be.FE.KEYCODE.FF_HYPHEN)&&t&&!e.altKey?i=q.call(this,e,2,-1,i):g.keys.ctrlKey(e)||a!=be.FE.KEYCODE.ENTER||(d.before("<br>"),k(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=he();ve()&&(i=i.find(".fr-img-wrap")),l.css("top",(g.opts.iframe?i.offset().top:i.offset().top+t)-1).css("left",(g.opts.iframe?i.offset().left: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 A(e){ve()?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(be(i.frameElement).offset().left)+i.frameElement.clientLeft)}(f=be(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/be(s).outerWidth()*100).toFixed(2)+"%"}A(n),p.show(),g.popups.hideAll(),fe()}function S(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)/be(n).outerWidth()*100).toFixed(2),g.opts.imageRoundPercent&&(r=Math.round(r)),A(r+"%"),(t=ve()?(g.helpers.getPX(d.parents(".fr-img-caption").css("width"))/be(n).outerWidth()*100).toFixed(2):(g.helpers.getPX(d.css("width"))/be(n).outerWidth()*100).toFixed(2))===r||g.opts.imageRoundPercent||A(t+"%"),d.css("height","").removeAttr("height")}else r+i>=g.opts.imageMinWidth&&(A(r+i),t=ve()?g.helpers.getPX(d.parents(".fr-img-caption").css("width")):g.helpers.getPX(d.css("width"))),t!==r+i&&A(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"));C(),g.events.trigger("image.resize",[me()])}}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(),C(),n(),g.undo.saveStep(),g.events.trigger("image.resizeEnd",[me()])}}function D(e,t,a){g.edit.on(),d&&d.addClass("fr-error"),function(e){$();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&&Q(a),g.events.trigger("image.error",[{code:e,message:r[e]},t,a])}function U(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){t+='<div class="fr-buttons">',t+=g.button.buildList(g.opts.imageEditButtons);var a={buttons:t+="</div>"};return g.popups.create("image.edit",a)}return!1}function $(e){var t=g.popups.get("image.insert");if(t||(t=K()),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=he();g.popups.setContainer("image.insert",g.$sc);var i=a.offset().left+a.width()/2,r=a.offset().top+a.height();g.popups.show("image.insert",i,r,a.outerHeight())}void 0===e&&F(g.language.translate("Uploading"),0)}function I(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;se(!0),g.selection.setAfter(a.get(0)),g.selection.restore()}g.popups.hide("image.insert")}}function F(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 k(e){ne.call(e.get(0))}function B(){var e=be(this);g.popups.hide("image.insert"),e.removeClass("fr-uploading"),e.next().is("br")&&e.next().remove(),k(e),g.events.trigger("image.loaded",[e])}function N(s,e,o,l,f){g.edit.off(),F(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(),E(!1),g.undo.saveStep(),g.events.disableBlur(),g.$el.blur(),g.events.trigger(a?"image.replaced":"image.inserted",[e,f])}else e=L(s,o,B),E(!1),g.undo.saveStep(),g.events.disableBlur(),g.$el.blur(),g.events.trigger("image.inserted",[e,f])},t.onerror=function(){D(i)},$(g.language.translate("Loading image")),t.src=s}function O(e){F(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=be(e).find("Location").text(),a=be(e).find("Key").text();return!1===g.events.trigger("image.uploadedToS3",[t,a,e],!0)?(g.edit.on(),!1):t}catch(i){return D(h,e),!1}}(i);n&&N(n,!1,[],e,a||i)}else D(h,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:(D(u,e),!1)}catch(a){return D(h,e),!1}}(r);s&&N(s.link,!1,s,e,a||r)}else D(m,a||r,e)}catch(o){D(h,a||r,e)}}function P(){D(h,this.response||this.responseText||this.responseXML)}function T(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;F(g.language.translate("Uploading"),t)}}function L(e,t,a){var i,r="";if(t&&void 0!==t)for(i in t)t.hasOwnProperty(i)&&"link"!=i&&(r+=" data-"+i+'="'+t[i]+'"');var n=g.opts.imageDefaultWidth;n&&"auto"!=n&&(n=g.opts.imageResizeWithPercent?"100%":n+"px");var s=be('<img src="'+e+'"'+r+(n?' style="width: '+n+';"':"")+">");pe(s,g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign),s.on("load",a),s.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 o=g.$el.find(".fr-marker");return o.length?(o.parent().is("hr")&&o.parent().after(o),g.node.isLastSibling(o)&&o.parent().hasClass("fr-deletable")&&o.insertAfter(o.parent()),o.replaceWith(s)):g.$el.append(s),g.selection.clear(),s}function M(){g.edit.on(),I(!0)}function z(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==c)&&!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)}},$(),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 D(v),!1;if(g.opts.imageAllowedTypes.indexOf(i.type.replace(/image\//g,""))<0)return D(b),!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=be(this);e.off("load"),e.addClass("fr-uploading"),e.next().is("br")&&e.next().remove(),g.placeholder.refresh(),k(e),C(),$(),g.edit.off(),t.onload=function(){O.call(t,e)},t.onerror=P,t.upload.onprogress=T,t.onabort=M,e.off("abortUpload").on("abortUpload",function(){4!=t.readyState&&(t.abort(),r?(r.attr("src",r.data("fr-old-src")),r.removeClass("fr-uploading")):e.remove(),se(!0))}),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.one("error",n),g.edit.on(),g.undo.saveStep(),r.data("fr-old-src",r.attr("src")),r.attr("src",e)):L(e,null,n)},s.readAsDataURL(e)}(g.core.getXHR(n,g.opts.imageUploadMethod),a,i,t||d)}}var s,o,l}function _(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(be.FE.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=K()),g.popups.setContainer("image.insert",g.$sc);var r=e.originalEvent.pageX,n=e.originalEvent.pageY;return g.opts.iframe&&(n+=g.$iframe.offset().top,r+=g.$iframe.offset().left),g.popups.show("image.insert",r,n),$(),0<=g.opts.imageAllowedTypes.indexOf(a.type.replace(/image\//g,""))?(se(!0),z(t.files)):D(b),e.preventDefault(),e.stopPropagation(),!1}}}function K(e){if(e)return g.popups.onRefresh("image.insert",y),g.popups.onHide("image.insert",w),!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">'+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")&&ce()}),f=a,g.events.$on(f,"dragover dragenter",".fr-image-upload-layer",function(){return be(this).addClass("fr-drop"),!1},!0),g.events.$on(f,"dragleave dragend",".fr-image-upload-layer",function(){return be(this).removeClass("fr-drop"),!1},!0),g.events.$on(f,"drop",".fr-image-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),be(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(){be(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)}be(this).val("")},!0),a}function H(){d&&g.popups.get("image.alt").find("input").val(d.attr("alt")||"").trigger("change")}function Y(){var e=g.popups.get("image.alt");e||(e=X()),I(),g.popups.refresh("image.alt"),g.popups.setContainer("image.alt",g.$sc);var t=he();ve()&&(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())}function X(e){if(e)return g.popups.onRefresh("image.alt",H),!0;var t={buttons:'<div class="fr-buttons">'+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")&&Y()}),a}function j(){var e=g.popups.get("image.size");if(d)if(ve()){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 G(){var e=g.popups.get("image.size");e||(e=V()),I(),g.popups.refresh("image.size"),g.popups.setContainer("image.size",g.$sc);var t=he();ve()&&(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())}function V(e){if(e)return g.popups.onRefresh("image.size",j),!0;var t={buttons:'<div class="fr-buttons">'+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")&&G()}),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)),S.call(this,e),x.call(this,e),++i}function Q(e){(e=e||he())&&!1!==g.events.trigger("image.beforeRemove",[e])&&(g.popups.hideAll(),ue(),se(!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(be.FE.MARKERS),be(e.get(0).parentNode).remove()):(g.selection.setBefore(e.get(0))||g.selection.setAfter(e.get(0))||e.after(be.FE.MARKERS),e.remove()),g.html.fillEmptyBlocks(),g.selection.restore()),g.undo.saveStep())}function J(e){var t=e.which;if(d&&(t==be.FE.KEYCODE.BACKSPACE||t==be.FE.KEYCODE.DELETE))return e.preventDefault(),e.stopPropagation(),Q(),!1;if(d&&t==be.FE.KEYCODE.ESC){var a=d;return se(!0),g.selection.setAfter(a.get(0)),g.selection.restore(),e.preventDefault(),!1}if(d&&(t==be.FE.KEYCODE.ARROW_LEFT||t==be.FE.KEYCODE.ARROW_RIGHT)){var i=d.get(0);return se(!0),t==be.FE.KEYCODE.ARROW_LEFT?g.selection.setBefore(i):g.selection.setAfter(i),g.selection.restore(),e.preventDefault(),!1}return d&&t===be.FE.KEYCODE.TAB?(e.preventDefault(),e.stopPropagation(),se(!0),!1):d&&t!=be.FE.KEYCODE.F10&&!g.keys.isBrowserAction(e)?(e.preventDefault(),e.stopPropagation(),!1):void 0}function Z(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++)Z(i[r])}function ee(e){if(!1===g.events.trigger("image.beforePasteUpload",[e]))return!1;d=be(e),C(),n(),ce(),$(),d.one("load",function(){C(),$()});for(var t=be(e).attr("src").split(","),a=atob(t[1]),i=[],r=0;r<a.length;r++)i.push(a.charCodeAt(r));z([new Blob([new Uint8Array(i)],{type:t[0].replace(/data\:/g,"").replace(/;base64/g,"")})],d)}function te(){g.opts.imagePaste?g.$el.find("img[data-fr-image-pasted]").each(function(e,i){if(g.opts.imagePasteProcess){var t=g.opts.imageDefaultWidth;t&&"auto"!=t&&(t+=g.opts.imageResizeWithPercent?"%":"px"),be(i).css("width",t).removeClass("fr-dii fr-dib fr-fir fr-fil"),pe(be(i),g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign)}if(0===i.src.indexOf("data:"))ee(i);else if(0===i.src.indexOf("blob:")||0===i.src.indexOf("http")&&g.opts.imageUploadRemoteUrls&&g.opts.imageCORSProxy){var a=new Image;a.crossOrigin="Anonymous",a.onload=function(){var e,t=g.o_doc.createElement("CANVAS"),a=t.getContext("2d");t.height=this.naturalHeight,t.width=this.naturalWidth,a.drawImage(this,0,0),setTimeout(function(){ee(i)},0),e=2e3<this.naturalWidth||1500<this.naturalHeight?"jpeg":"png",i.src=t.toDataURL("image/"+e)},a.src=(0===i.src.indexOf("blob:")?"":g.opts.imageCORSProxy+"/")+i.src}else 0!==i.src.indexOf("http")||0===i.src.indexOf("https://mail.google.com/mail")?(g.selection.save(),be(i).remove(),g.selection.restore()):be(i).removeAttr("data-fr-image-pasted")}):g.$el.find("img[data-fr-image-pasted]").remove()}function ae(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&&pe(i,g.opts.imageDefaultDisplay,g.opts.imageDefaultAlign),g.events.trigger("paste.after")}function ie(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=ae,r.readAsDataURL(i),!1}var i,r}function re(e){return e=e.replace(/<img /gi,'<img data-fr-image-pasted="true" ')}function ne(e){if("false"==be(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<be.FE.INSTANCES.length;t++)be.FE.INSTANCES[t]!=g&&be.FE.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=be(this),ue(),C(),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 se(e){d&&(oe||!0===e)&&(g.toolbar.enable(),l.removeClass("fr-active"),g.popups.hide("image.edit"),d=null,fe(),f=null,p&&p.hide())}r[i]="Image cannot be loaded from the passed link.",r[u]="No link in upload response.",r[m]="Error during file upload.",r[h]="Parsing response failed.",r[v]="File is too large.",r[b]="Image file type is invalid.",r[7]="Files can be uploaded only to same domain in IE 8 and IE 9.";var oe=!(r[8]="Image file is corrupted.");function le(){oe=!0}function fe(){oe=!1}function pe(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 ge(e){if(void 0===e&&(e=he()),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 de(e){void 0===e&&(e=he());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 ce(){var e=g.popups.get("image.insert");e||(e=K()),g.popups.isVisible("image.insert")||(I(),g.popups.refresh("image.insert"),g.popups.setContainer("image.insert",g.$sc));var t=he();ve()&&(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))}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 me(){return d}function he(){return ve()?d.parents(".fr-img-caption:first"):d}function ve(){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"==be(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._mousedown,".fr-img-caption .fr-inner",function(e){g.core.hasFocus()||g.events.focus(),e.stopPropagation()}),g.events.$on(g.$el,"paste",".fr-img-caption .fr-inner",function(e){g.toolbar.hide(),e.stopPropagation()}),g.events.$on(g.$el,g._mouseup,"IMG"==g.el.tagName?null:'img:not([contenteditable="false"])',function(e){if("false"==be(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?k(be(t)):a&&"IMG"==a.tagName&&k(be(a))}},!0),g.events.on("drop",W),g.events.on("element.beforeDrop",_),g.events.on("mousedown window.mousedown",le),g.events.on("window.touchmove",fe),g.events.on("mouseup window.mouseup",function(){if(d)return se(),!1;fe()}),g.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&se()}),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(){se(!(t=!1))}),g.events.on("modals.hide",function(){d&&(ue(),g.selection.clear())}),g.events.on("image.resizeEnd",function(){g.win.getSelection&&k(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===be.FE.ENTER_BR?e.after("<br>"):be(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"])',ne),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",J,!0),g.events.on("keyup",function(e){if(d&&e.which==be.FE.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=be(e).parents(".fr-img-caption").get(0)),g.node.hasClass(e,"fr-img-caption")&&(be(e).after(be.FE.INVISIBLE_SPACE+be.FE.MARKERS),g.selection.restore()))})):g.events.$on(g.$win,"keydown",J),g.events.on("toolbar.esc",function(){if(d){if(g.$wp)g.events.disableBlur(),g.events.focus();else{var e=d;se(!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=he();ve()?(t.before(be.FE.START_MARKER),t.after(be.FE.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(){k(d)}):(se(!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==be.FE.KEYCODE.C&&g.keys.ctrlKey(e)?g.events.trigger("window.copy"):t==be.FE.KEYCODE.X&&g.keys.ctrlKey(e)&&g.events.trigger("window.cut")}),g.events.$on(be(g.o_win),"keydown",function(e){var t=e.which;if(d&&t==be.FE.KEYCODE.BACKSPACE)return e.preventDefault(),!1}),g.events.$on(g.$win,"keydown",function(e){var t=e.which;d&&d.hasClass("fr-uploading")&&t==be.FE.KEYCODE.ESC&&d.trigger("abortUpload")}),g.events.on("destroy",function(){d&&d.hasClass("fr-uploading")&&d.trigger("abortUpload")}),g.events.on("paste.before",ie),g.events.on("paste.beforeCleanup",re),g.events.on("paste.after",te),g.events.on("html.set",e),g.events.on("html.inserted",e),e(),g.events.on("destroy",function(){o=[]}),g.events.on("html.processGet",Z),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||be(i[e]).width(),a=i[e].style.height||be(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&&(E(),g.events.on("contentChanged",E)),g.events.$on(be(g.o_win),"orientationchange.image",function(){setTimeout(function(){d&&k(d)},100)}),U(!0),K(!0),V(!0),X(!0),g.events.on("node.remove",function(e){if("IMG"==e.get(0).tagName)return Q(e),!1})},showInsertPopup:function(){var e=g.$tb.find('.fr-command[data-cmd="insertImage"]'),t=g.popups.get("image.insert");if(t||(t=K()),I(),!t.hasClass("fr-active"))if(g.popups.refresh("image.insert"),g.popups.setContainer("image.insert",g.$tb),e.is(":visible")){var a=e.offset().left+e.outerWidth()/2,i=e.offset().top+(g.opts.toolbarBottom?10:e.outerHeight()-10);g.popups.show("image.insert",a,i,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=he();ve()&&(r=r.find(".fr-img-wrap")),a=r.offset().top+r.outerHeight(),t=r.offset().left+r.outerWidth()/2}}else{var n=g.$tb.find('.fr-command[data-cmd="insertImage"]');t=n.offset().left+n.outerWidth()/2,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){g.popups.get("image.insert").find(".fr-image-upload-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshByURLButton:function(e){g.popups.get("image.insert").find(".fr-image-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},upload:z,insertByURL:function(){var e=g.popups.get("image.insert").find(".fr-image-by-url-layer input");if(0<e.val().length){$(),F(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?z([new Blob([this.response],{type:this.response.type||"image/png"})],d):D(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=he();t.removeClass("fr-fir fr-fil"),!g.opts.htmlUntouched&&g.opts.useClasses?"left"==e?t.addClass("fr-fil"):"right"==e&&t.addClass("fr-fir"):pe(t,de(),e),ue(),C(),n(),g.selection.clear()},refreshAlign:function(e){d&&e.find("> *:first").replaceWith(g.icon.create("image-align-"+ge()))},refreshAlignOnShow:function(e,t){d&&t.find('.fr-command[data-param1="'+ge()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){var t=he();t.removeClass("fr-dii fr-dib"),!g.opts.htmlUntouched&&g.opts.useClasses?"inline"==e?t.addClass("fr-dii"):"block"==e&&t.addClass("fr-dib"):pe(t,e,ge()),ue(),C(),n(),g.selection.clear()},refreshDisplayOnShow:function(e,t){d&&t.find('.fr-command[data-param1="'+de()+'"]').addClass("fr-active").attr("aria-selected",!0)},replace:ce,back:function(){d?(g.events.disableBlur(),be(".fr-popup input:focus").blur(),k(d)):(g.events.disableBlur(),g.selection.restore(),g.events.enableBlur(),g.popups.hide("image.insert"),g.toolbar.showInline())},get:me,getEl:he,insert:N,showProgressBar:$,remove:Q,hideProgressBar:I,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=he();if(!a){var r=Object.keys(t);r.splice(r.indexOf(e),1),i.removeClass(r.join(" "))}"object"==typeof t[e]?(i.removeAttr("style"),i.css(t[e].style)):i.toggleClass(e),k(d)},showAltPopup:Y,showSizePopup:G,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(),k(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",""),ve()&&(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(),k(d)}},toggleCaption:function(){var e;if(d&&!ve()){var t,a;(e=d).parent().is("a")&&(e=d.parent()),e.attr("style")&&(a=-1<(t=e.attr("style").split(":")).indexOf("width")?t[t.indexOf("width")+1].replace(";",""):"");var i=g.opts.imageResizeWithPercent?(-1<a.indexOf("px")?null:a)||"100%":d.width()+"px";e.wrap("<span "+(g.browser.mozilla?"":'contenteditable="false"')+'class="fr-img-caption '+d.attr("class")+'" style="'+(g.opts.useClasses?"":e.attr("style"))+'" draggable="false"></span>'),e.wrap('<span class="fr-img-wrap"></span>'),d.after('<span class="fr-inner"'+(g.browser.mozilla?"":' contenteditable="true"')+">"+be.FE.START_MARKER+g.language.translate("Image Caption")+be.FE.END_MARKER+"</span>"),d.removeAttr("class").removeAttr("style").removeAttr("width"),d.parents(".fr-img-caption").css("width",i),se(!0),g.selection.restore()}else e=he(),d.insertAfter(e),d.attr("class",e.attr("class").replace("fr-img-caption","")).attr("style",e.attr("style")),e.remove(),k(d)},hasCaption:ve,exitEdit:se,edit:k}},be.FE.DefineIcon("insertImage",{NAME:"image"}),be.FE.RegisterShortcut(be.FE.KEYCODE.P,"insertImage",null,"P"),be.FE.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"}),be.FE.DefineIcon("imageUpload",{NAME:"upload"}),be.FE.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)}}),be.FE.DefineIcon("imageByURL",{NAME:"link"}),be.FE.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)}}),be.FE.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"))}}),be.FE.DefineIcon("imageDisplay",{NAME:"star"}),be.FE.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)}}),be.FE.DefineIcon("image-align",{NAME:"align-left"}),be.FE.DefineIcon("image-align-left",{NAME:"align-left"}),be.FE.DefineIcon("image-align-right",{NAME:"align-right"}),be.FE.DefineIcon("image-align-center",{NAME:"align-justify"}),be.FE.DefineIcon("imageAlign",{NAME:"align-justify"}),be.FE.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=be.FE.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)}}),be.FE.DefineIcon("imageReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),be.FE.RegisterCommand("imageReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.image.replace()}}),be.FE.DefineIcon("imageRemove",{NAME:"trash"}),be.FE.RegisterCommand("imageRemove",{title:"Remove",callback:function(){this.image.remove()}}),be.FE.DefineIcon("imageBack",{NAME:"arrow-left"}),be.FE.RegisterCommand("imageBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.image.back()},refresh:function(e){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"))}}),be.FE.RegisterCommand("imageDismissError",{title:"OK",undo:!1,callback:function(){this.image.hideProgressBar(!0)}}),be.FE.DefineIcon("imageStyle",{NAME:"magic"}),be.FE.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"==typeof 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.image.getEl();a&&t.find(".fr-command").each(function(){var e=be(this).data("param1"),t=a.hasClass(e);be(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),be.FE.DefineIcon("imageAlt",{NAME:"info"}),be.FE.RegisterCommand("imageAlt",{undo:!1,focus:!1,popup:!0,title:"Alternative Text",callback:function(){this.image.showAltPopup()}}),be.FE.RegisterCommand("imageSetAlt",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.image.setAlt()}}),be.FE.DefineIcon("imageSize",{NAME:"arrows-alt"}),be.FE.RegisterCommand("imageSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.image.showSizePopup()}}),be.FE.RegisterCommand("imageSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.image.setSize()}}),be.FE.DefineIcon("imageCaption",{NAME:"commenting",FA5NAME:"comment-alt"}),be.FE.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 v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(m){m.extend(m.FE.POPUP_TEMPLATES,{"link.edit":"[_BUTTONS_]","link.insert":"[_BUTTONS_][_INPUT_LAYER_]"}),m.extend(m.FE.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.FE.PLUGINS.link=function(d){function c(){var e=d.image?d.image.get():null;if(!e&&d.$wp){var t=d.selection.ranges(0).commonAncestorContainer;try{t&&(t.contains&&t.contains(d.el)||!d.el.contains(t)||d.el==t)&&(t=null)}catch(r){t=null}if(t&&"A"===t.tagName)return t;var n=d.selection.element(),i=d.selection.endElement();"A"==n.tagName||d.node.isElement(n)||(n=m(n).parentsUntil(d.$el,"a:first").get(0)),"A"==i.tagName||d.node.isElement(i)||(i=m(i).parentsUntil(d.$el,"a:first").get(0));try{i&&(i.contains&&i.contains(d.el)||!d.el.contains(i)||d.el==i)&&(i=null)}catch(r){i=null}try{n&&(n.contains&&n.contains(d.el)||!d.el.contains(n)||d.el==n)&&(n=null)}catch(r){n=null}return i&&i==n&&"A"==i.tagName?(d.browser.msie||d.helpers.isMobile())&&(d.selection.info(n).atEnd||d.selection.info(n).atStart)?null:n:null}return"A"==d.el.tagName?d.el:e&&e.get(0).parentNode&&"A"==e.get(0).parentNode.tagName?e.get(0).parentNode:void 0}function u(){var e,t,n,i,r=d.image?d.image.get():null,l=[];if(r)"A"==r.get(0).parentNode.tagName&&l.push(r.get(0).parentNode);else if(d.win.getSelection){var a=d.win.getSelection();if(a.getRangeAt&&a.rangeCount){i=d.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(d.doc.selection&&"Control"!=d.doc.selection.type)if("a"==(t=(e=d.doc.selection.createRange()).parentElement()).nodeName.toLowerCase())l.push(t);else{n=t.getElementsByTagName("a"),i=d.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 k(r){if(d.core.hasFocus()){if(a(),r&&"keyup"===r.type&&(r.altKey||r.which==m.FE.KEYCODE.ALT))return!0;setTimeout(function(){if(!r||r&&(1==r.which||"mouseup"!=r.type)){var e=c(),t=d.image?d.image.get():null;if(e&&!t){if(d.image){var n=d.node.contents(e);if(1==n.length&&"IMG"==n[0].tagName){var i=d.selection.ranges(0);return 0===i.startOffset&&0===i.endOffset?m(e).before(m.FE.MARKERS):m(e).after(m.FE.MARKERS),d.selection.restore(),!1}}r&&r.stopPropagation(),l(e)}}},d.helpers.isIOS()?100:0)}}function l(e){var t=d.popups.get("link.edit");t||(t=function(){var e="";1<=d.opts.linkEditButtons.length&&("A"==d.el.tagName&&0<=d.opts.linkEditButtons.indexOf("linkRemove")&&d.opts.linkEditButtons.splice(d.opts.linkEditButtons.indexOf("linkRemove"),1),e='<div class="fr-buttons">'+d.button.buildList(d.opts.linkEditButtons)+"</div>");var t={buttons:e},n=d.popups.create("link.edit",t);d.$wp&&d.events.$on(d.$wp,"scroll.link-edit",function(){c()&&d.popups.isVisible("link.edit")&&l(c())});return n}());var n=m(e);d.popups.isVisible("link.edit")||d.popups.refresh("link.edit"),d.popups.setContainer("link.edit",d.$sc);var i=n.offset().left+m(e).outerWidth()/2,r=n.offset().top+n.outerHeight();d.popups.show("link.edit",i,r,n.outerHeight())}function a(){d.popups.hide("link.edit")}function o(){}function p(){var e=d.popups.get("link.insert"),t=c();if(t){var n,i,r=m(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=m(l[n])).val(r.attr(i.attr("name")||""));for(a.prop("checked",!1),n=0;n<a.length;n++)i=m(a[n]),r.attr(i.attr("name"))==i.data("checked")&&i.prop("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"]').prop("checked",!1),e.find('input.fr-link-attr[type="text"][name="text"]').val(d.selection.text());e.find("input.fr-link-attr").trigger("change"),(d.image?d.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 d.popups.onRefresh("link.insert",p),d.popups.onHide("link.insert",o),!0;var t="";1<=d.opts.linkInsertButtons.length&&(t='<div class="fr-buttons">'+d.button.buildList(d.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-'+d.id+'">',n+='<div class="fr-input-line"><input id="fr-link-insert-layer-url-'+d.id+'" name="href" type="text" class="fr-link-attr" placeholder="'+d.language.translate("URL")+'" tabIndex="'+ ++i+'"></div>',d.opts.linkText&&(n+='<div class="fr-input-line"><input id="fr-link-insert-layer-text-'+d.id+'" name="text" type="text" class="fr-link-attr" placeholder="'+d.language.translate("Text")+'" tabIndex="'+ ++i+'"></div>'),d.opts.linkAttributes)if(d.opts.linkAttributes.hasOwnProperty(r)){var l=d.opts.linkAttributes[r];n+='<div class="fr-input-line"><input name="'+r+'" type="text" class="fr-link-attr" placeholder="'+d.language.translate(l)+'" tabIndex="'+ ++i+'"></div>'}d.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-'+d.id+'" tabIndex="'+ ++i+'"><span><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 for="fr-link-target-'+d.id+'">'+d.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">'+d.language.translate("Insert")+"</button></div></div>"},s=d.popups.create("link.insert",a);return d.$wp&&d.events.$on(d.$wp,"scroll.link-insert",function(){(d.image?d.image.get():null)&&d.popups.isVisible("link.insert")&&h(),d.popups.isVisible("link.insert")&&g()}),s}function f(e,t,n){if(void 0===n&&(n={}),!1===d.events.trigger("link.beforeInsert",[e,t,n]))return!1;var i=d.image?d.image.get():null;i||"A"==d.el.tagName?"A"==d.el.tagName&&d.$el.focus():(d.selection.restore(),d.popups.hide("link.insert"));var r=e;d.opts.linkConvertEmailAddress&&d.helpers.isEmail(e)&&!/^mailto:.*/i.test(e)&&(e="mailto:"+e);if(""===d.opts.linkAutoPrefix||new RegExp("^("+m.FE.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=d.opts.linkAutoPrefix+d.helpers.sanitizeURL(e)),e=d.helpers.sanitizeURL(e),d.opts.linkAlwaysBlank&&(n.target="_blank"),d.opts.linkAlwaysNoFollow&&(n.rel="nofollow"),d.helpers.isEmail(r)&&(n.target=null,n.rel=null),"_blank"==n.target?(d.opts.linkNoOpener&&(n.rel?n.rel+=" noopener":n.rel="noopener"),d.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===d.opts.linkAutoPrefix)return d.popups.get("link.insert").find('input[name="href"]').addClass("fr-error"),d.events.trigger("link.bad",[r]),!1;var l,a=c();if(a){if((l=m(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];m(s).text(t)}i||l.prepend(m.FE.START_MARKER).append(m.FE.END_MARKER),l.attr(n),i||d.selection.restore()}else{i?i.wrap('<a href="'+e+'"></a>'):(d.format.remove("a"),d.selection.isCollapsed()?(t=0===t.length?r:t,d.html.insert('<a href="'+e+'">'+m.FE.START_MARKER+t.replace(/&/g,"&").replace(/</,"<",">",">")+m.FE.END_MARKER+"</a>"),d.selection.restore()):0<t.length&&t!=d.selection.text().replace(/\n/g,"")?(d.selection.remove(),d.html.insert('<a href="'+e+'">'+m.FE.START_MARKER+t.replace(/&/g,"&")+m.FE.END_MARKER+"</a>"),d.selection.restore()):(!function(){if(!d.selection.isCollapsed()){d.selection.save();for(var e=d.$el.find(".fr-marker").addClass("fr-unprocessed").toArray();e.length;){var t=m(e.pop());t.removeClass("fr-unprocessed");var n=d.node.deepestParent(t.get(0));if(n){for(var i=t.get(0),r="",l="";i=i.parentNode,d.node.isBlock(i)||(r+=d.node.closeTagString(i),l=d.node.openTagString(i)+l),i!=n;);var a=d.node.openTagString(t.get(0))+t.html()+d.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=d.$el.find(".fr-marker.fr-unprocessed").toArray()}d.html.cleanEmptyTags(),d.selection.restore()}}(),d.format.apply("a",{href:e})));for(var o=u(),p=0;p<o.length;p++)(l=m(o[p])).attr(n),l.removeAttr("_moz_dirty");1==o.length&&d.$wp&&!i&&(m(o[0]).prepend(m.FE.START_MARKER).append(m.FE.END_MARKER),d.selection.restore())}if(i){var f=d.popups.get("link.insert");f&&f.find("input:focus").blur(),d.image.edit(i)}else k()}function g(){a();var e=c();if(e){var t=d.popups.get("link.insert");t||(t=s()),d.popups.isVisible("link.insert")||(d.popups.refresh("link.insert"),d.selection.save(),d.helpers.isMobile()&&(d.events.disableBlur(),d.$el.blur(),d.events.enableBlur())),d.popups.setContainer("link.insert",d.$sc);var n=(d.image?d.image.get():null)||m(e),i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();d.popups.show("link.insert",i,r,n.outerHeight())}}function h(){var e=d.image?d.image.getEl():null;if(e){var t=d.popups.get("link.insert");d.image.hasCaption()&&(e=e.find(".fr-img-wrap")),t||(t=s()),p(),d.popups.setContainer("link.insert",d.$sc);var n=e.offset().left+e.outerWidth()/2,i=e.offset().top+e.outerHeight();d.popups.show("link.insert",n,i,e.outerHeight())}}return{_init:function(){d.events.on("keyup",function(e){e.which!=m.FE.KEYCODE.ESC&&k(e)}),d.events.on("window.mouseup",k),d.events.$on(d.$el,"click","a",function(e){d.edit.isDisabled()&&e.preventDefault()}),d.helpers.isMobile()&&d.events.$on(d.$doc,"selectionchange",k),s(!0),"A"==d.el.tagName&&d.$el.addClass("fr-view"),d.events.on("toolbar.esc",function(){if(d.popups.isVisible("link.edit"))return d.events.disableBlur(),d.events.focus(),!1},!0)},remove:function(){var e=c(),t=d.image?d.image.get():null;if(!1===d.events.trigger("link.beforeRemove",[e]))return!1;t&&e?(t.unwrap(),d.image.edit(t)):e&&(d.selection.save(),m(e).replaceWith(m(e).html()),d.selection.restore(),a())},showInsertPopup:function(){var e=d.$tb.find('.fr-command[data-cmd="insertLink"]'),t=d.popups.get("link.insert");if(t||(t=s()),!t.hasClass("fr-active"))if(d.popups.refresh("link.insert"),d.popups.setContainer("link.insert",d.$tb||d.$sc),e.is(":visible")){var n=e.offset().left+e.outerWidth()/2,i=e.offset().top+(d.opts.toolbarBottom?10:e.outerHeight()-10);d.popups.show("link.insert",n,i,e.outerHeight())}else d.position.forSelection(t),d.popups.show("link.insert")},usePredefined:function(e){var t,n,i=d.opts.linkList[e],r=d.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=m(l[n])).attr("name")]?t.val(i[t.attr("name")]):"text"!=t.attr("name")&&t.val("");for(n=0;n<a.length;n++)(t=m(a[n])).prop("checked",t.data("checked")==i[t.attr("name")]);d.accessibility.focusPopup(r)},insertCallback:function(){var e,t,n=d.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=m(i[t]),["href","text"].indexOf(e.attr("name"))<0&&(s[e.attr("name")]=e.val());for(t=0;t<r.length;t++)(e=m(r[t])).is(":checked")?s[e.attr("name")]=e.data("checked"):s[e.attr("name")]=e.data("unchecked")||null;var o=d.helpers.scrollTop();f(l,a,s),m(d.o_win).scrollTop(o)},insert:f,update:g,get:c,allSelected:u,back:function(){d.image&&d.image.get()?d.image.back():(d.events.disableBlur(),d.selection.restore(),d.events.enableBlur(),c()&&d.$wp?(d.selection.restore(),a(),k()):"A"==d.el.tagName?(d.$el.focus(),k()):(d.popups.hide("link.insert"),d.toolbar.showInline()))},imageLink:h,applyStyle:function(e,t,n){void 0===n&&(n=d.opts.linkMultipleStyles),void 0===t&&(t=d.opts.linkStyles);var i=c();if(!i)return!1;if(!n){var r=Object.keys(t);r.splice(r.indexOf(e),1),m(i).removeClass(r.join(" "))}m(i).toggleClass(e),k()}}},m.FE.DefineIcon("insertLink",{NAME:"link"}),m.FE.RegisterShortcut(m.FE.KEYCODE.K,"insertLink",null,"K"),m.FE.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.FE.DefineIcon("linkOpen",{NAME:"external-link",FA5NAME:"external-link-alt"}),m.FE.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.FE.DefineIcon("linkEdit",{NAME:"edit"}),m.FE.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.FE.DefineIcon("linkRemove",{NAME:"unlink"}),m.FE.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.FE.DefineIcon("linkBack",{NAME:"arrow-left"}),m.FE.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.FE.DefineIcon("linkList",{NAME:"search"}),m.FE.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.FE.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.FE.DefineIcon("imageLink",{NAME:"link"}),m.FE.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.FE.DefineIcon("linkStyle",{NAME:"magic"}),m.FE.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.link.get();if(n){var i=m(n);t.find(".fr-command").each(function(){var e=m(this).data("param1"),t=i.hasClass(e);m(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(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(m){m.extend(m.FE.POPUP_TEMPLATES,{"link.edit":"[_BUTTONS_]","link.insert":"[_BUTTONS_][_INPUT_LAYER_]"}),m.extend(m.FE.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.FE.PLUGINS.link=function(d){function c(){var e=d.image?d.image.get():null;if(!e&&d.$wp){var t=d.selection.ranges(0).commonAncestorContainer;try{t&&(t.contains&&t.contains(d.el)||!d.el.contains(t)||d.el==t)&&(t=null)}catch(r){t=null}if(t&&"A"===t.tagName)return t;var n=d.selection.element(),i=d.selection.endElement();"A"==n.tagName||d.node.isElement(n)||(n=m(n).parentsUntil(d.$el,"a:first").get(0)),"A"==i.tagName||d.node.isElement(i)||(i=m(i).parentsUntil(d.$el,"a:first").get(0));try{i&&(i.contains&&i.contains(d.el)||!d.el.contains(i)||d.el==i)&&(i=null)}catch(r){i=null}try{n&&(n.contains&&n.contains(d.el)||!d.el.contains(n)||d.el==n)&&(n=null)}catch(r){n=null}return i&&i==n&&"A"==i.tagName?(d.browser.msie||d.helpers.isMobile())&&(d.selection.info(n).atEnd||d.selection.info(n).atStart)?null:n:null}return"A"==d.el.tagName?d.el:e&&e.get(0).parentNode&&"A"==e.get(0).parentNode.tagName?e.get(0).parentNode:void 0}function u(){var e,t,n,i,r=d.image?d.image.get():null,l=[];if(r)"A"==r.get(0).parentNode.tagName&&l.push(r.get(0).parentNode);else if(d.win.getSelection){var a=d.win.getSelection();if(a.getRangeAt&&a.rangeCount){i=d.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(d.doc.selection&&"Control"!=d.doc.selection.type)if("a"==(t=(e=d.doc.selection.createRange()).parentElement()).nodeName.toLowerCase())l.push(t);else{n=t.getElementsByTagName("a"),i=d.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 k(r){if(d.core.hasFocus()){if(a(),r&&"keyup"===r.type&&(r.altKey||r.which==m.FE.KEYCODE.ALT))return!0;setTimeout(function(){if(!r||r&&(1==r.which||"mouseup"!=r.type)){var e=c(),t=d.image?d.image.get():null;if(e&&!t){if(d.image){var n=d.node.contents(e);if(1==n.length&&"IMG"==n[0].tagName){var i=d.selection.ranges(0);return 0===i.startOffset&&0===i.endOffset?m(e).before(m.FE.MARKERS):m(e).after(m.FE.MARKERS),d.selection.restore(),!1}}r&&r.stopPropagation(),l(e)}}},d.helpers.isIOS()?100:0)}}function l(e){var t=d.popups.get("link.edit");t||(t=function(){var e="";1<=d.opts.linkEditButtons.length&&("A"==d.el.tagName&&0<=d.opts.linkEditButtons.indexOf("linkRemove")&&d.opts.linkEditButtons.splice(d.opts.linkEditButtons.indexOf("linkRemove"),1),e='<div class="fr-buttons">'+d.button.buildList(d.opts.linkEditButtons)+"</div>");var t={buttons:e},n=d.popups.create("link.edit",t);d.$wp&&d.events.$on(d.$wp,"scroll.link-edit",function(){c()&&d.popups.isVisible("link.edit")&&l(c())});return n}());var n=m(e);d.popups.isVisible("link.edit")||d.popups.refresh("link.edit"),d.popups.setContainer("link.edit",d.$sc);var i=n.offset().left+m(e).outerWidth()/2,r=n.offset().top+n.outerHeight();d.popups.show("link.edit",i,r,n.outerHeight())}function a(){d.popups.hide("link.edit")}function o(){}function p(){var e=d.popups.get("link.insert"),t=c();if(t){var n,i,r=m(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=m(l[n])).val(r.attr(i.attr("name")||""));for(a.prop("checked",!1),n=0;n<a.length;n++)i=m(a[n]),r.attr(i.attr("name"))==i.data("checked")&&i.prop("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"]').prop("checked",!1),e.find('input.fr-link-attr[type="text"][name="text"]').val(d.selection.text());e.find("input.fr-link-attr").trigger("change"),(d.image?d.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 d.popups.onRefresh("link.insert",p),d.popups.onHide("link.insert",o),!0;var t="";1<=d.opts.linkInsertButtons.length&&(t='<div class="fr-buttons">'+d.button.buildList(d.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-'+d.id+'">',n+='<div class="fr-input-line"><input id="fr-link-insert-layer-url-'+d.id+'" name="href" type="text" class="fr-link-attr" placeholder="'+d.language.translate("URL")+'" tabIndex="'+ ++i+'"></div>',d.opts.linkText&&(n+='<div class="fr-input-line"><input id="fr-link-insert-layer-text-'+d.id+'" name="text" type="text" class="fr-link-attr" placeholder="'+d.language.translate("Text")+'" tabIndex="'+ ++i+'"></div>'),d.opts.linkAttributes)if(d.opts.linkAttributes.hasOwnProperty(r)){var l=d.opts.linkAttributes[r];n+='<div class="fr-input-line"><input name="'+r+'" type="text" class="fr-link-attr" placeholder="'+d.language.translate(l)+'" tabIndex="'+ ++i+'"></div>'}d.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-'+d.id+'" tabIndex="'+ ++i+'"><span><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 for="fr-link-target-'+d.id+'">'+d.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">'+d.language.translate("Insert")+"</button></div></div>"},s=d.popups.create("link.insert",a);return d.$wp&&d.events.$on(d.$wp,"scroll.link-insert",function(){(d.image?d.image.get():null)&&d.popups.isVisible("link.insert")&&h(),d.popups.isVisible("link.insert")&&g()}),s}function f(e,t,n){if(void 0===n&&(n={}),!1===d.events.trigger("link.beforeInsert",[e,t,n]))return!1;var i=d.image?d.image.get():null;i||"A"==d.el.tagName?"A"==d.el.tagName&&d.$el.focus():(d.selection.restore(),d.popups.hide("link.insert"));var r=e;d.opts.linkConvertEmailAddress&&d.helpers.isEmail(e)&&!/^mailto:.*/i.test(e)&&(e="mailto:"+e);if(""===d.opts.linkAutoPrefix||new RegExp("^("+m.FE.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=d.opts.linkAutoPrefix+d.helpers.sanitizeURL(e)),e=d.helpers.sanitizeURL(e),d.opts.linkAlwaysBlank&&(n.target="_blank"),d.opts.linkAlwaysNoFollow&&(n.rel="nofollow"),d.helpers.isEmail(r)&&(n.target=null,n.rel=null),"_blank"==n.target?(d.opts.linkNoOpener&&(n.rel?n.rel+=" noopener":n.rel="noopener"),d.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===d.opts.linkAutoPrefix)return d.popups.get("link.insert").find('input[name="href"]').addClass("fr-error"),d.events.trigger("link.bad",[r]),!1;var l,a=c();if(a){if((l=m(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];m(s).text(t)}i||l.prepend(m.FE.START_MARKER).append(m.FE.END_MARKER),l.attr(n),i||d.selection.restore()}else{i?(i.wrap('<a href="'+e+'"></a>'),d.image.hasCaption()&&i.parent().append(i.parents(".fr-img-caption").find(".fr-inner"))):(d.format.remove("a"),d.selection.isCollapsed()?(t=0===t.length?r:t,d.html.insert('<a href="'+e+'">'+m.FE.START_MARKER+t.replace(/&/g,"&").replace(/</,"<",">",">")+m.FE.END_MARKER+"</a>"),d.selection.restore()):0<t.length&&t!=d.selection.text().replace(/\n/g,"")?(d.selection.remove(),d.html.insert('<a href="'+e+'">'+m.FE.START_MARKER+t.replace(/&/g,"&")+m.FE.END_MARKER+"</a>"),d.selection.restore()):(!function(){if(!d.selection.isCollapsed()){d.selection.save();for(var e=d.$el.find(".fr-marker").addClass("fr-unprocessed").toArray();e.length;){var t=m(e.pop());t.removeClass("fr-unprocessed");var n=d.node.deepestParent(t.get(0));if(n){for(var i=t.get(0),r="",l="";i=i.parentNode,d.node.isBlock(i)||(r+=d.node.closeTagString(i),l=d.node.openTagString(i)+l),i!=n;);var a=d.node.openTagString(t.get(0))+t.html()+d.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=d.$el.find(".fr-marker.fr-unprocessed").toArray()}d.html.cleanEmptyTags(),d.selection.restore()}}(),d.format.apply("a",{href:e})));for(var o=u(),p=0;p<o.length;p++)(l=m(o[p])).attr(n),l.removeAttr("_moz_dirty");1==o.length&&d.$wp&&!i&&(m(o[0]).prepend(m.FE.START_MARKER).append(m.FE.END_MARKER),d.selection.restore())}if(i){var f=d.popups.get("link.insert");f&&f.find("input:focus").blur(),d.image.edit(i)}else k()}function g(){a();var e=c();if(e){var t=d.popups.get("link.insert");t||(t=s()),d.popups.isVisible("link.insert")||(d.popups.refresh("link.insert"),d.selection.save(),d.helpers.isMobile()&&(d.events.disableBlur(),d.$el.blur(),d.events.enableBlur())),d.popups.setContainer("link.insert",d.$sc);var n=(d.image?d.image.get():null)||m(e),i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();d.popups.show("link.insert",i,r,n.outerHeight())}}function h(){var e=d.image?d.image.getEl():null;if(e){var t=d.popups.get("link.insert");d.image.hasCaption()&&(e=e.find(".fr-img-wrap")),t||(t=s()),p(),d.popups.setContainer("link.insert",d.$sc);var n=e.offset().left+e.outerWidth()/2,i=e.offset().top+e.outerHeight();d.popups.show("link.insert",n,i,e.outerHeight())}}return{_init:function(){d.events.on("keyup",function(e){e.which!=m.FE.KEYCODE.ESC&&k(e)}),d.events.on("window.mouseup",k),d.events.$on(d.$el,"click","a",function(e){d.edit.isDisabled()&&e.preventDefault()}),d.helpers.isMobile()&&d.events.$on(d.$doc,"selectionchange",k),s(!0),"A"==d.el.tagName&&d.$el.addClass("fr-view"),d.events.on("toolbar.esc",function(){if(d.popups.isVisible("link.edit"))return d.events.disableBlur(),d.events.focus(),!1},!0)},remove:function(){var e=c(),t=d.image?d.image.get():null;if(!1===d.events.trigger("link.beforeRemove",[e]))return!1;t&&e?(t.unwrap(),d.image.edit(t)):e&&(d.selection.save(),m(e).replaceWith(m(e).html()),d.selection.restore(),a())},showInsertPopup:function(){var e=d.$tb.find('.fr-command[data-cmd="insertLink"]'),t=d.popups.get("link.insert");if(t||(t=s()),!t.hasClass("fr-active"))if(d.popups.refresh("link.insert"),d.popups.setContainer("link.insert",d.$tb||d.$sc),e.is(":visible")){var n=e.offset().left+e.outerWidth()/2,i=e.offset().top+(d.opts.toolbarBottom?10:e.outerHeight()-10);d.popups.show("link.insert",n,i,e.outerHeight())}else d.position.forSelection(t),d.popups.show("link.insert")},usePredefined:function(e){var t,n,i=d.opts.linkList[e],r=d.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=m(l[n])).attr("name")]?t.val(i[t.attr("name")]):"text"!=t.attr("name")&&t.val("");for(n=0;n<a.length;n++)(t=m(a[n])).prop("checked",t.data("checked")==i[t.attr("name")]);d.accessibility.focusPopup(r)},insertCallback:function(){var e,t,n=d.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=m(i[t]),["href","text"].indexOf(e.attr("name"))<0&&(s[e.attr("name")]=e.val());for(t=0;t<r.length;t++)(e=m(r[t])).is(":checked")?s[e.attr("name")]=e.data("checked"):s[e.attr("name")]=e.data("unchecked")||null;var o=d.helpers.scrollTop();f(l,a,s),m(d.o_win).scrollTop(o)},insert:f,update:g,get:c,allSelected:u,back:function(){d.image&&d.image.get()?d.image.back():(d.events.disableBlur(),d.selection.restore(),d.events.enableBlur(),c()&&d.$wp?(d.selection.restore(),a(),k()):"A"==d.el.tagName?(d.$el.focus(),k()):(d.popups.hide("link.insert"),d.toolbar.showInline()))},imageLink:h,applyStyle:function(e,t,n){void 0===n&&(n=d.opts.linkMultipleStyles),void 0===t&&(t=d.opts.linkStyles);var i=c();if(!i)return!1;if(!n){var r=Object.keys(t);r.splice(r.indexOf(e),1),m(i).removeClass(r.join(" "))}m(i).toggleClass(e),k()}}},m.FE.DefineIcon("insertLink",{NAME:"link"}),m.FE.RegisterShortcut(m.FE.KEYCODE.K,"insertLink",null,"K"),m.FE.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.FE.DefineIcon("linkOpen",{NAME:"external-link",FA5NAME:"external-link-alt"}),m.FE.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.FE.DefineIcon("linkEdit",{NAME:"edit"}),m.FE.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.FE.DefineIcon("linkRemove",{NAME:"unlink"}),m.FE.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.FE.DefineIcon("linkBack",{NAME:"arrow-left"}),m.FE.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.FE.DefineIcon("linkList",{NAME:"search"}),m.FE.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.FE.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.FE.DefineIcon("imageLink",{NAME:"link"}),m.FE.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.FE.DefineIcon("linkStyle",{NAME:"magic"}),m.FE.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.link.get();if(n){var i=m(n);t.find(".fr-command").each(function(){var e=m(this).data("param1"),t=i.hasClass(e);m(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 v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(e){e.extend(e.FE.DEFAULTS,{html2pdf:window.html2pdf}),e.FE.PLUGINS.print=function(l){return{run:function(){!function(e){var t=l.$el.html(),n=null;l.shared.print_iframe?n=l.shared.print_iframe:((n=document.createElement("iframe")).name="fr-print",n.style.position="fixed",n.style.top="0",n.style.left="-9999px",n.style.height="100%",n.style.width="0",n.style.overflow="hidden",n.style["z-index"]="2147483647",n.style.tabIndex="-1",l.events.on("shared.destroy",function(){n.remove()}),l.shared.print_iframe=n);try{document.body.removeChild(n)}catch(d){}document.body.appendChild(n);var i=function(){e(),n.removeEventListener("load",i)};n.addEventListener("load",i);var o=n.contentWindow;o.document.open(),o.document.write("<!DOCTYPE html><html "+(l.opts.documentReady?'style="margin: 0; padding: 0;"':"")+"><head><title>"+document.title+"</title>"),Array.prototype.forEach.call(document.querySelectorAll("style"),function(e){e=e.cloneNode(!0),o.document.write(e.outerHTML)});var r=document.querySelectorAll("link[rel=stylesheet]");Array.prototype.forEach.call(r,function(e){var t=document.createElement("link");t.rel=e.rel,t.href=e.href,t.media="print",t.type="text/css",t.media="all",o.document.write(t.outerHTML)}),o.document.write('</head><body style="text-align: '+("rtl"==l.opts.direction?"right":"left")+"; direction: "+l.opts.direction+"; "+(l.opts.documentReady?" padding: 2cm; width: 17cm; margin: 0;":"")+'"><div class="fr-view">'),o.document.write(t),o.document.write("</div></body></html>"),o.document.close()}(function(){setTimeout(function(){l.events.disableBlur(),window.frames["fr-print"].focus(),window.frames["fr-print"].print(),l.$win.get(0).focus(),l.events.disableBlur(),l.events.focus()},0)})},toPDF:function(){l.opts.html2pdf&&(l.$el.css("text-align","left"),l.opts.html2pdf().set({margin:[10,20],html2canvas:{useCORS:!0}}).from(l.el).save(),setTimeout(function(){l.$el.css("text-align","")},100))}}},e.FE.DefineIcon("print",{NAME:"print"}),e.FE.RegisterCommand("print",{title:"Print",undo:!1,focus:!1,plugin:"print",callback:function(){this.print.run()}}),e.FE.DefineIcon("getPDF",{NAME:"file-pdf-o",FA5NAME:"file-pdf"}),e.FE.RegisterCommand("getPDF",{title:"Download PDF",type:"button",focus:!1,undo:!1,callback:function(){this.print.toPDF()}})}); | ||
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(e){e.extend(e.FE.DEFAULTS,{html2pdf:window.html2pdf}),e.FE.PLUGINS.print=function(l){return{run:function(){!function(e){var t=l.$el.html(),n=null;l.shared.print_iframe?n=l.shared.print_iframe:((n=document.createElement("iframe")).name="fr-print",n.style.position="fixed",n.style.top="0",n.style.left="-9999px",n.style.height="100%",n.style.width="0",n.style.overflow="hidden",n.style["z-index"]="2147483647",n.style.tabIndex="-1",l.events.on("shared.destroy",function(){n.remove()}),l.shared.print_iframe=n);try{document.body.removeChild(n)}catch(d){}document.body.appendChild(n);var i=function(){e(),n.removeEventListener("load",i)};n.addEventListener("load",i);var o=n.contentWindow;o.document.open(),o.document.write("<!DOCTYPE html><html "+(l.opts.documentReady?'style="margin: 0; padding: 0;"':"")+"><head><title>"+document.title+"</title>"),Array.prototype.forEach.call(document.querySelectorAll("style"),function(e){e=e.cloneNode(!0),o.document.write(e.outerHTML)});var r=document.querySelectorAll("link[rel=stylesheet]");Array.prototype.forEach.call(r,function(e){var t=document.createElement("link");t.rel=e.rel,t.href=e.href,t.media="print",t.type="text/css",t.media="all",o.document.write(t.outerHTML)}),o.document.write('</head><body style="height:auto;text-align: '+("rtl"==l.opts.direction?"right":"left")+"; direction: "+l.opts.direction+"; "+(l.opts.documentReady?" padding: 2cm; width: 17cm; margin: 0;":"")+'"><div class="fr-view">'),o.document.write(t),o.document.write("</div></body></html>"),o.document.close()}(function(){setTimeout(function(){l.events.disableBlur(),window.frames["fr-print"].focus(),window.frames["fr-print"].print(),l.$win.get(0).focus(),l.events.disableBlur(),l.events.focus()},0)})},toPDF:function(){l.opts.html2pdf&&(l.$el.css("text-align","left"),l.opts.html2pdf().set({margin:[10,20],html2canvas:{useCORS:!0}}).from(l.el).save(),setTimeout(function(){l.$el.css("text-align","")},100))}}},e.FE.DefineIcon("print",{NAME:"print"}),e.FE.RegisterCommand("print",{title:"Print",undo:!1,focus:!1,plugin:"print",callback:function(){this.print.run()}}),e.FE.DefineIcon("getPDF",{NAME:"file-pdf-o",FA5NAME:"file-pdf"}),e.FE.RegisterCommand("getPDF",{title:"Download PDF",type:"button",focus:!1,undo:!1,callback:function(){this.print.toPDF()}})}); |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),i(t)}:i(window.jQuery)}(function(d){d.extend(d.FE.DEFAULTS,{quickInsertButtons:["image","video","embedly","table","ul","ol","hr"],quickInsertTags:["p","div","h1","h2","h3","h4","h5","h6","pre","blockquote"],quickInsertEnabled:!0}),d.FE.QUICK_INSERT_BUTTONS={},d.FE.DefineIcon("quickInsert",{PATH:'<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"/>',template:"svg"}),d.FE.RegisterQuickInsertButton=function(e,t){d.FE.QUICK_INSERT_BUTTONS[e]=d.extend({undo:!0},t)},d.FE.RegisterQuickInsertButton("image",{icon:"insertImage",requiredPlugin:"image",title:"Insert Image",undo:!1,callback:function(){var e=this;e.shared.$qi_image_input||(e.shared.$qi_image_input=d('<input accept="image/'+e.opts.imageAllowedTypes.join(", image/").toLowerCase()+'" name="quickInsertImage'+this.id+'" style="display: none;" type="file">'),d("body:first").append(e.shared.$qi_image_input),e.events.$on(e.shared.$qi_image_input,"change",function(){var e=d(this).data("inst");this.files&&(e.quickInsert.hide(),e.image.upload(this.files)),d(this).val("")},!0)),e.$qi_image_input=e.shared.$qi_image_input,e.helpers.isMobile()&&e.selection.save(),e.events.disableBlur(),e.$qi_image_input.data("inst",e).trigger("click")}}),d.FE.RegisterQuickInsertButton("video",{icon:"insertVideo",requiredPlugin:"video",title:"Insert Video",undo:!1,callback:function(){var e=prompt(this.language.translate("Paste the URL of the video you want to insert."));e&&this.video.insertByURL(e)}}),d.FE.RegisterQuickInsertButton("embedly",{icon:"embedly",requiredPlugin:"embedly",title:"Embed URL",undo:!1,callback:function(){var e=prompt(this.language.translate("Paste the URL of any web content you want to insert."));e&&this.embedly.add(e)}}),d.FE.RegisterQuickInsertButton("table",{icon:"insertTable",requiredPlugin:"table",title:"Insert Table",callback:function(){this.table.insert(2,2)}}),d.FE.RegisterQuickInsertButton("ol",{icon:"formatOL",requiredPlugin:"lists",title:"Ordered List",callback:function(){this.lists.format("OL")}}),d.FE.RegisterQuickInsertButton("ul",{icon:"formatUL",requiredPlugin:"lists",title:"Unordered List",callback:function(){this.lists.format("UL")}}),d.FE.RegisterQuickInsertButton("hr",{icon:"insertHR",title:"Insert Horizontal Line",callback:function(){this.commands.insertHR()}}),d.FE.PLUGINS.quickInsert=function(r){var a,l;function t(e){var t,i,n;t=e.offset().top-r.$box.offset().top,i=0-a.outerWidth(),r.opts.enter!=d.FE.ENTER_BR?n=(a.outerHeight()-e.outerHeight())/2:(d("<span>"+d.FE.INVISIBLE_SPACE+"</span>").insertAfter(e),n=(a.outerHeight()-e.next().outerHeight())/2,e.next().remove()),r.opts.iframe&&(t+=r.$iframe.offset().top),a.hasClass("fr-on")&&0<=t&&l.css("top",t-n),0<=t&&t-n<=r.$box.outerHeight()-e.outerHeight()?(a.hasClass("fr-hidden")&&(a.hasClass("fr-on")&&o(),a.removeClass("fr-hidden")),a.css("top",t-n)):a.hasClass("fr-visible")&&(a.addClass("fr-hidden"),u()),a.css("left",i)}function i(e){a||function(){r.shared.$quick_insert||(r.shared.$quick_insert=d('<div class="fr-quick-insert"><a class="fr-floating-btn" role="button" tabIndex="-1" title="'+r.language.translate("Quick Insert")+'">'+r.icon.create("quickInsert")+"</a></div>"));a=r.shared.$quick_insert,r.tooltip.bind(r.$box,".fr-quick-insert > a.fr-floating-btn"),r.events.on("destroy",function(){a.removeClass("fr-on").appendTo(d("body:first")).css("left",-9999).css("top",-9999),l&&(u(),l.appendTo(d("body:first")))},!0),r.events.on("shared.destroy",function(){a.html("").removeData().remove(),a=null,l&&(l.html("").removeData().remove(),l=null)},!0),r.events.on("commands.before",s),r.events.on("commands.after",function(){r.popups.areVisible()||n()}),r.events.bindClick(r.$box,".fr-quick-insert > a",o),r.events.bindClick(r.$box,".fr-qi-helper > a.fr-btn",function(e){var t=d(e.currentTarget).data("cmd");if(!1===r.events.trigger("quickInsert.commands.before",[t]))return!1;d.FE.QUICK_INSERT_BUTTONS[t].callback.apply(r,[e.currentTarget]),d.FE.QUICK_INSERT_BUTTONS[t].undo&&r.undo.saveStep(),r.events.trigger("quickInsert.commands.after",[t]),r.quickInsert.hide()}),r.events.$on(r.$wp,"scroll",function(){a.hasClass("fr-visible")&&t(a.data("tag"))})}(),a.hasClass("fr-on")&&u(),r.$box.append(a),t(e),a.data("tag",e),a.addClass("fr-visible")}function n(){if(r.core.hasFocus()){var e=r.selection.element();if(r.opts.enter==d.FE.ENTER_BR||r.node.isBlock(e)||(e=r.node.blockParent(e)),r.opts.enter==d.FE.ENTER_BR&&!r.node.isBlock(e)){var t=r.node.deepestParent(e);t&&(e=t)}e&&(r.opts.enter!=d.FE.ENTER_BR&&r.node.isEmpty(e)&&0<=r.opts.quickInsertTags.indexOf(e.tagName.toLowerCase())||r.opts.enter==d.FE.ENTER_BR&&("BR"==e.tagName&&(!e.previousSibling||"BR"==e.previousSibling.tagName||r.node.isBlock(e.previousSibling))||r.node.isEmpty(e)&&(!e.previousSibling||"BR"==e.previousSibling.tagName||r.node.isBlock(e.previousSibling))&&(!e.nextSibling||"BR"==e.nextSibling.tagName||r.node.isBlock(e.nextSibling))))?a&&a.data("tag").is(d(e))&&a.hasClass("fr-on")?u():r.selection.isCollapsed()&&i(d(e)):s()}}function s(){a&&(a.hasClass("fr-on")&&u(),a.removeClass("fr-visible fr-on"),a.css("left",-9999).css("top",-9999))}function o(e){if(e&&e.preventDefault(),a.hasClass("fr-on")&&!a.hasClass("fr-hidden"))u();else{if(!r.shared.$qi_helper){for(var t=r.opts.quickInsertButtons,i='<div class="fr-qi-helper">',n=0,s=0;s<t.length;s++){var o=d.FE.QUICK_INSERT_BUTTONS[t[s]];o&&(!o.requiredPlugin||d.FE.PLUGINS[o.requiredPlugin]&&0<=r.opts.pluginsEnabled.indexOf(o.requiredPlugin))&&(i+='<a class="fr-btn fr-floating-btn" role="button" title="'+r.language.translate(o.title)+'" tabIndex="-1" data-cmd="'+t[s]+'" style="transition-delay: '+.025*n+++'s;">'+r.icon.create(o.icon)+"</a>")}i+="</div>",r.shared.$qi_helper=d(i),r.tooltip.bind(r.shared.$qi_helper,"> a.fr-btn"),r.events.$on(r.shared.$qi_helper,"mousedown",function(e){e.preventDefault()},!0)}(l=r.shared.$qi_helper).appendTo(r.$box),setTimeout(function(){l.css("top",parseFloat(a.css("top"))),l.css("left",parseFloat(a.css("left"))+a.outerWidth()),l.find("a").addClass("fr-size-1"),a.addClass("fr-on")},10)}}function u(){var e=r.$box.find(".fr-qi-helper");e.length&&(e.find("a").removeClass("fr-size-1"),e.css("left",-9999),a.hasClass("fr-hidden")||a.removeClass("fr-on"))}return{_init:function(){if(!r.$wp||!r.opts.quickInsertEnabled)return!1;r.popups.onShow("image.edit",s),r.events.on("mouseup",n),r.helpers.isMobile()&&r.events.$on(d(r.o_doc),"selectionchange",n),r.events.on("blur",s),r.events.on("keyup",n),r.events.on("keydown",function(){setTimeout(function(){n()},0)})},hide:s}}}); | ||
!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),i(t)}:i(window.jQuery)}(function(d){d.extend(d.FE.DEFAULTS,{quickInsertButtons:["image","video","embedly","table","ul","ol","hr"],quickInsertTags:["p","div","h1","h2","h3","h4","h5","h6","pre","blockquote"],quickInsertEnabled:!0}),d.FE.QUICK_INSERT_BUTTONS={},d.FE.DefineIcon("quickInsert",{PATH:'<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"/>',template:"svg"}),d.FE.RegisterQuickInsertButton=function(e,t){d.FE.QUICK_INSERT_BUTTONS[e]=d.extend({undo:!0},t)},d.FE.RegisterQuickInsertButton("image",{icon:"insertImage",requiredPlugin:"image",title:"Insert Image",undo:!1,callback:function(){var e=this;e.shared.$qi_image_input||(e.shared.$qi_image_input=d('<input accept="image/'+e.opts.imageAllowedTypes.join(", image/").toLowerCase()+'" name="quickInsertImage'+this.id+'" style="display: none;" type="file">'),d("body:first").append(e.shared.$qi_image_input),e.events.$on(e.shared.$qi_image_input,"change",function(){var e=d(this).data("inst");this.files&&(e.quickInsert.hide(),e.image.upload(this.files)),d(this).val("")},!0)),e.$qi_image_input=e.shared.$qi_image_input,e.helpers.isMobile()&&e.selection.save(),e.events.disableBlur(),e.$qi_image_input.data("inst",e).trigger("click")}}),d.FE.RegisterQuickInsertButton("video",{icon:"insertVideo",requiredPlugin:"video",title:"Insert Video",undo:!1,callback:function(){var e=prompt(this.language.translate("Paste the URL of the video you want to insert."));e&&this.video.insertByURL(e)}}),d.FE.RegisterQuickInsertButton("embedly",{icon:"embedly",requiredPlugin:"embedly",title:"Embed URL",undo:!1,callback:function(){var e=prompt(this.language.translate("Paste the URL of any web content you want to insert."));e&&this.embedly.add(e)}}),d.FE.RegisterQuickInsertButton("table",{icon:"insertTable",requiredPlugin:"table",title:"Insert Table",callback:function(){this.table.insert(2,2)}}),d.FE.RegisterQuickInsertButton("ol",{icon:"formatOL",requiredPlugin:"lists",title:"Ordered List",callback:function(){this.lists.format("OL")}}),d.FE.RegisterQuickInsertButton("ul",{icon:"formatUL",requiredPlugin:"lists",title:"Unordered List",callback:function(){this.lists.format("UL")}}),d.FE.RegisterQuickInsertButton("hr",{icon:"insertHR",title:"Insert Horizontal Line",callback:function(){this.commands.insertHR()}}),d.FE.PLUGINS.quickInsert=function(r){var a,l;function t(e){var t,i,n;t=e.offset().top-r.$box.offset().top,i=(r.$iframe&&r.$iframe.offset().left||0)+e.offset().left<a.outerWidth()?e.offset().left+a.outerWidth():0-a.outerWidth(),r.opts.enter!=d.FE.ENTER_BR?n=(a.outerHeight()-e.outerHeight())/2:(d("<span>"+d.FE.INVISIBLE_SPACE+"</span>").insertAfter(e),n=(a.outerHeight()-e.next().outerHeight())/2,e.next().remove()),r.opts.iframe&&(t+=r.$iframe.offset().top),a.hasClass("fr-on")&&0<=t&&l.css("top",t-n),0<=t&&t-Math.abs(n)<=r.$box.outerHeight()-e.outerHeight()?(a.hasClass("fr-hidden")&&(a.hasClass("fr-on")&&o(),a.removeClass("fr-hidden")),a.css("top",t-n)):a.hasClass("fr-visible")&&(a.addClass("fr-hidden"),u()),a.css("left",i)}function i(e){a||function(){r.shared.$quick_insert||(r.shared.$quick_insert=d('<div class="fr-quick-insert"><a class="fr-floating-btn" role="button" tabIndex="-1" title="'+r.language.translate("Quick Insert")+'">'+r.icon.create("quickInsert")+"</a></div>"));a=r.shared.$quick_insert,r.tooltip.bind(r.$box,".fr-quick-insert > a.fr-floating-btn"),r.events.on("destroy",function(){a.removeClass("fr-on").appendTo(d("body:first")).css("left",-9999).css("top",-9999),l&&(u(),l.appendTo(d("body:first")))},!0),r.events.on("shared.destroy",function(){a.html("").removeData().remove(),a=null,l&&(l.html("").removeData().remove(),l=null)},!0),r.events.on("commands.before",s),r.events.on("commands.after",function(){r.popups.areVisible()||n()}),r.events.bindClick(r.$box,".fr-quick-insert > a",o),r.events.bindClick(r.$box,".fr-qi-helper > a.fr-btn",function(e){var t=d(e.currentTarget).data("cmd");if(!1===r.events.trigger("quickInsert.commands.before",[t]))return!1;d.FE.QUICK_INSERT_BUTTONS[t].callback.apply(r,[e.currentTarget]),d.FE.QUICK_INSERT_BUTTONS[t].undo&&r.undo.saveStep(),r.events.trigger("quickInsert.commands.after",[t]),r.quickInsert.hide()}),r.events.$on(r.$wp,"scroll",function(){a.hasClass("fr-visible")&&t(a.data("tag"))})}(),a.hasClass("fr-on")&&u(),r.$box.append(a),t(e),a.data("tag",e),a.addClass("fr-visible")}function n(){if(r.core.hasFocus()){var e=r.selection.element();if(r.opts.enter==d.FE.ENTER_BR||r.node.isBlock(e)||(e=r.node.blockParent(e)),r.opts.enter==d.FE.ENTER_BR&&!r.node.isBlock(e)){var t=r.node.deepestParent(e);t&&(e=t)}e&&(r.opts.enter!=d.FE.ENTER_BR&&r.node.isEmpty(e)&&0<=r.opts.quickInsertTags.indexOf(e.tagName.toLowerCase())||r.opts.enter==d.FE.ENTER_BR&&("BR"==e.tagName&&(!e.previousSibling||"BR"==e.previousSibling.tagName||r.node.isBlock(e.previousSibling))||r.node.isEmpty(e)&&(!e.previousSibling||"BR"==e.previousSibling.tagName||r.node.isBlock(e.previousSibling))&&(!e.nextSibling||"BR"==e.nextSibling.tagName||r.node.isBlock(e.nextSibling))))?a&&a.data("tag").is(d(e))&&a.hasClass("fr-on")?u():r.selection.isCollapsed()&&i(d(e)):s()}}function s(){a&&(a.hasClass("fr-on")&&u(),a.removeClass("fr-visible fr-on"),a.css("left",-9999).css("top",-9999))}function o(e){if(e&&e.preventDefault(),a.hasClass("fr-on")&&!a.hasClass("fr-hidden"))u();else{if(!r.shared.$qi_helper){for(var t=r.opts.quickInsertButtons,i='<div class="fr-qi-helper">',n=0,s=0;s<t.length;s++){var o=d.FE.QUICK_INSERT_BUTTONS[t[s]];o&&(!o.requiredPlugin||d.FE.PLUGINS[o.requiredPlugin]&&0<=r.opts.pluginsEnabled.indexOf(o.requiredPlugin))&&(i+='<a class="fr-btn fr-floating-btn" role="button" title="'+r.language.translate(o.title)+'" tabIndex="-1" data-cmd="'+t[s]+'" style="transition-delay: '+.025*n+++'s;">'+r.icon.create(o.icon)+"</a>")}i+="</div>",r.shared.$qi_helper=d(i),r.tooltip.bind(r.shared.$qi_helper,"> a.fr-btn"),r.events.$on(r.shared.$qi_helper,"mousedown",function(e){e.preventDefault()},!0)}(l=r.shared.$qi_helper).appendTo(r.$box),setTimeout(function(){l.css("top",parseFloat(a.css("top"))),l.css("left",parseFloat(a.css("left"))+a.outerWidth()),l.find("a").addClass("fr-size-1"),a.addClass("fr-on")},10)}}function u(){var e=r.$box.find(".fr-qi-helper");e.length&&(e.find("a").removeClass("fr-size-1"),e.css("left",-9999),a.hasClass("fr-hidden")||a.removeClass("fr-on"))}return{_init:function(){if(!r.$wp||!r.opts.quickInsertEnabled)return!1;r.popups.onShow("image.edit",s),r.events.on("mouseup",n),r.helpers.isMobile()&&r.events.$on(d(r.o_doc),"selectionchange",n),r.events.on("blur",s),r.events.on("keyup",n),r.events.on("keydown",function(){setTimeout(function(){n()},0)})},hide:s}}}); |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(l){"function"==typeof define&&define.amd?define(["jquery"],l):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),l(t)}:l(window.jQuery)}(function(Z){Z.extend(Z.FE.POPUP_TEMPLATES,{"table.insert":"[_BUTTONS_][_ROWS_COLUMNS_]","table.edit":"[_BUTTONS_]","table.colors":"[_BUTTONS_][_COLORS_][_CUSTOM_COLOR_]"}),Z.extend(Z.FE.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}),Z.FE.PLUGINS.table=function(w){var C,o,r,s,a,n,E;function h(){var e=O();if(e){var t=w.popups.get("table.edit");if(t||(t=p()),t){w.popups.setContainer("table.edit",w.$sc);var l=M(e),a=(l.left+l.right)/2,r=l.bottom;w.popups.show("table.edit",a,r,l.bottom-l.top),w.edit.isDisabled()&&(1<J().length&&w.toolbar.disable(),w.$el.removeClass("fr-no-selection"),w.edit.on(),w.button.bulkRefresh(),w.selection.setAtEnd(w.$el.find(".fr-selected-cell:last").get(0)),w.selection.restore())}}}function f(){var e,t,l,a,r=O();if(r){var s=w.popups.get("table.colors");s||(s=function(){var e="";0<w.opts.tableColorsButtons.length&&(e='<div class="fr-buttons fr-table-colors-buttons">'+w.button.buildList(w.opts.tableColorsButtons)+"</div>");var t="";w.opts.colorsHEXInput&&(t='<div class="fr-table-colors-hex-layer fr-active fr-layer" id="fr-table-colors-hex-layer-'+w.id+'"><div class="fr-input-line"><input maxlength="7" id="fr-table-colors-hex-layer-text-'+w.id+'" type="text" placeholder="'+w.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">'+w.language.translate("OK")+"</button></div></div>");var l={buttons:e,colors:function(){for(var e='<div class="fr-table-colors">',t=0;t<w.opts.tableColors.length;t++)0!==t&&t%w.opts.tableColorsStep==0&&(e+="<br>"),"REMOVE"!=w.opts.tableColors[t]?e+='<span class="fr-command" style="background: '+w.opts.tableColors[t]+';" tabIndex="-1" role="button" data-cmd="tableCellBackgroundColor" data-param1="'+w.opts.tableColors[t]+'"><span class="fr-sr-only">'+w.language.translate("Color")+" "+w.opts.tableColors[t]+" </span></span>":e+='<span class="fr-command" data-cmd="tableCellBackgroundColor" tabIndex="-1" role="button" data-param1="REMOVE" title="'+w.language.translate("Clear Formatting")+'">'+w.icon.create("tableColorRemove")+'<span class="fr-sr-only">'+w.language.translate("Clear Formatting")+"</span></span>";return e+="</div>"}(),custom_color:t},a=w.popups.create("table.colors",l);return w.events.$on(w.$wp,"scroll.table-colors",function(){w.popups.isVisible("table.colors")&&f()}),u=a,w.events.on("popup.tab",function(e){var t=Z(e.currentTarget);if(!w.popups.isVisible("table.colors")||!t.is("span"))return!0;var l=e.which,a=!0;if(Z.FE.KEYCODE.TAB==l){var r=u.find(".fr-buttons");a=!w.accessibility.focusToolbar(r,!!e.shiftKey)}else if(Z.FE.KEYCODE.ARROW_UP==l||Z.FE.KEYCODE.ARROW_DOWN==l||Z.FE.KEYCODE.ARROW_LEFT==l||Z.FE.KEYCODE.ARROW_RIGHT==l){var s=t.parent().find("span.fr-command"),n=s.index(t),o=w.opts.colorsStep,i=Math.floor(s.length/o),f=n%o,c=Math.floor(n/o),d=c*o+f,p=i*o;Z.FE.KEYCODE.ARROW_UP==l?d=((d-o)%p+p)%p:Z.FE.KEYCODE.ARROW_DOWN==l?d=(d+o)%p:Z.FE.KEYCODE.ARROW_LEFT==l?d=((d-1)%p+p)%p:Z.FE.KEYCODE.ARROW_RIGHT==l&&(d=(d+1)%p);var h=Z(s.get(d));w.events.disableBlur(),h.focus(),a=!1}else Z.FE.KEYCODE.ENTER==l&&(w.button.exec(t),a=!1);return!1===a&&(e.preventDefault(),e.stopPropagation()),a},!0),a;var u}()),w.popups.setContainer("table.colors",w.$sc);var n=M(r),o=(n.left+n.right)/2,i=n.bottom;e=w.popups.get("table.colors"),t=w.$el.find(".fr-selected-cell:first"),l=w.helpers.RGBToHex(t.css("background-color")),a=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="'+l+'"]').addClass("fr-selected-color fr-active-item"),a.val(l).trigger("change"),w.popups.show("table.colors",o,i,n.bottom-n.top)}}function i(){0===J().length&&w.toolbar.enable()}function c(e){if(e)return w.popups.onHide("table.insert",function(){w.popups.get("table.insert").find('.fr-table-size .fr-select-table-size > span[data-row="1"][data-col="1"]').trigger("mouseenter")}),!0;var t="";0<w.opts.tableInsertButtons.length&&(t='<div class="fr-buttons">'+w.button.buildList(w.opts.tableInsertButtons)+"</div>");var l,a={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<=w.opts.tableInsertMaxSize;t++){for(var l=1;l<=w.opts.tableInsertMaxSize;l++){var a="inline-block";2<t&&!w.helpers.isMobile()&&(a="none");var r="fr-table-cell ";1==t&&1==l&&(r+=" hover"),e+='<span class="fr-command '+r+'" tabIndex="-1" data-cmd="tableInsert" data-row="'+t+'" data-col="'+l+'" data-param1="'+t+'" data-param2="'+l+'" style="display: '+a+';" role="button"><span></span><span class="fr-sr-only">'+t+" × "+l+" </span></span>"}e+='<div class="new-line"></div>'}return e+="</div></div>"}()},r=w.popups.create("table.insert",a);return w.events.$on(r,"mouseenter",".fr-table-size .fr-select-table-size .fr-table-cell",function(e){d(Z(e.currentTarget))},!0),l=r,w.events.$on(l,"focus","[tabIndex]",function(e){var t=Z(e.currentTarget);d(t)}),w.events.on("popup.tab",function(e){var t=Z(e.currentTarget);if(!w.popups.isVisible("table.insert")||!t.is("span, a"))return!0;var l,a=e.which;if(Z.FE.KEYCODE.ARROW_UP==a||Z.FE.KEYCODE.ARROW_DOWN==a||Z.FE.KEYCODE.ARROW_LEFT==a||Z.FE.KEYCODE.ARROW_RIGHT==a){if(t.is("span.fr-table-cell")){var r=t.parent().find("span.fr-table-cell"),s=r.index(t),n=w.opts.tableInsertMaxSize,o=s%n,i=Math.floor(s/n);Z.FE.KEYCODE.ARROW_UP==a?i=Math.max(0,i-1):Z.FE.KEYCODE.ARROW_DOWN==a?i=Math.min(w.opts.tableInsertMaxSize-1,i+1):Z.FE.KEYCODE.ARROW_LEFT==a?o=Math.max(0,o-1):Z.FE.KEYCODE.ARROW_RIGHT==a&&(o=Math.min(w.opts.tableInsertMaxSize-1,o+1));var f=i*n+o,c=Z(r.get(f));d(c),w.events.disableBlur(),c.focus(),l=!1}}else Z.FE.KEYCODE.ENTER==a&&(w.button.exec(t),l=!1);return!1===l&&(e.preventDefault(),e.stopPropagation()),l},!0),r}function d(e){var t=e.data("row"),l=e.data("col"),a=e.parent();a.siblings(".fr-table-size-info").html(t+" × "+l),a.find("> span").removeClass("hover fr-active-item");for(var r=1;r<=w.opts.tableInsertMaxSize;r++)for(var s=0;s<=w.opts.tableInsertMaxSize;s++){var n=a.find('> span[data-row="'+r+'"][data-col="'+s+'"]');r<=t&&s<=l?n.addClass("hover"):r<=t+1||r<=2&&!w.helpers.isMobile()?n.css("display","inline-block"):2<r&&!w.helpers.isMobile()&&n.css("display","none")}e.addClass("fr-active-item")}function p(e){if(e)return w.popups.onHide("table.edit",i),!0;if(0<w.opts.tableEditButtons.length){var t={buttons:'<div class="fr-buttons">'+w.button.buildList(w.opts.tableEditButtons)+"</div>"},l=w.popups.create("table.edit",t);return w.events.$on(w.$wp,"scroll.table-edit",function(){w.popups.isVisible("table.edit")&&h()}),l}return!1}function u(){if(0<J().length){var e=Q();w.selection.setBefore(e.get(0))||w.selection.setAfter(e.get(0)),w.selection.restore(),w.popups.hide("table.edit"),e.remove(),w.toolbar.enable()}}function b(e){var t=Q();if(0<t.length){if(0<w.$el.find("th.fr-selected-cell").length&&"above"==e)return;var l,a,r,s=O(),n=$(s);a="above"==e?n.min_i:n.max_i;var o="<tr>";for(l=0;l<s[a].length;l++)if("below"==e&&a<s.length-1&&s[a][l]==s[a+1][l]||"above"==e&&0<a&&s[a][l]==s[a-1][l]){if(0===l||0<l&&s[a][l]!=s[a][l-1]){var i=Z(s[a][l]);i.attr("rowspan",parseInt(i.attr("rowspan"),10)+1)}}else o+="<td><br></td>";o+="</tr>",r=0<w.$el.find("th.fr-selected-cell").length&&"below"==e?Z(t.find("tbody").not(t.find("table tbody"))):Z(t.find("tr").not(t.find("table tr")).get(a)),"below"==e?"TBODY"==r.prop("tagName")?r.prepend(o):r.after(o):"above"==e&&(r.before(o),w.popups.isVisible("table.edit")&&h())}}function g(e,t,l){var a,r,s,n,o,i=0,f=O(l);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<(n=Math.min(parseInt(f[0][r].getAttribute("colspan"),10)||1,t-e+1))&&f[0][r]==f[0][r+1])for(i=n-1,a=1;a<f.length;a++)if(f[a][r]!=f[a-1][r]){for(s=r;s<r+n;s++)if(1<(o=parseInt(f[a][s].getAttribute("colspan"),10)||1)&&f[a][s]==f[a][s+1])s+=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,l){var a,r,s,n,o,i=0,f=O(l);if(e<(t=Math.min(t,f.length-1)))for(a=e;a<=t;a++)if(!(e<a&&f[a][0]==f[a-1][0])&&1<(n=Math.min(parseInt(f[a][0].getAttribute("rowspan"),10)||1,t-e+1))&&f[a][0]==f[a+1][0])for(i=n-1,r=1;r<f[0].length;r++)if(f[a][r]!=f[a][r-1]){for(s=a;s<a+n;s++)if(1<(o=parseInt(f[s][r].getAttribute("rowspan"),10)||1)&&f[s][r]==f[s+1][r])s+=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,l,a,r,s,n){var o,i,f;for(o=a;o<=r;o++)for(i=s;i<=n;i++)a<o&&e[o][i]==e[o-1][i]||s<i&&e[o][i]==e[o][i-1]||1<(f=parseInt(e[o][i].getAttribute(l),10)||1)&&(1<f-t?e[o][i].setAttribute(l,f-t):e[o][i].removeAttribute(l))}function R(e,t,l,a,r){m(e,t,r),g(l,a,r)}function t(e){var t=w.$el.find(".fr-selected-cell");"REMOVE"!=e?t.css("background-color",w.helpers.HEXtoRGB(e)):t.css("background-color",""),h()}function O(e){var f=[];return null==(e=e||null)&&0<J().length&&(e=Q()),e&&e.find("tr:visible").not(e.find("table tr")).each(function(o,e){var t=Z(e),i=0;t.find("> th, > td").each(function(e,t){for(var l=Z(t),a=parseInt(l.attr("colspan"),10)||1,r=parseInt(l.attr("rowspan"),10)||1,s=o;s<o+r;s++)for(var n=i;n<i+a;n++)f[s]||(f[s]=[]),f[s][n]?i++:f[s][n]=t;i+=a})}),f}function A(e,t){for(var l=0;l<t.length;l++)for(var a=0;a<t[l].length;a++)if(t[l][a]==e)return{row:l,col:a}}function F(e,t,l){for(var a=e+1,r=t+1;a<l.length;){if(l[a][t]!=l[e][t]){a--;break}a++}for(a==l.length&&a--;r<l[e].length;){if(l[e][r]!=l[e][t]){r--;break}r++}return r==l[e].length&&r--,{row:a,col:r}}function x(){w.el.querySelector(".fr-cell-fixed")&&w.el.querySelector(".fr-cell-fixed").classList.remove("fr-cell-fixed"),w.el.querySelector(".fr-cell-handler")&&w.el.querySelector(".fr-cell-handler").classList.remove("fr-cell-handler")}function D(){var e=w.$el.find(".fr-selected-cell");0<e.length&&e.each(function(){var e=Z(this);e.removeClass("fr-selected-cell"),""===e.attr("class")&&e.removeAttr("class")}),x()}function y(){w.events.disableBlur(),w.selection.clear(),w.$el.addClass("fr-no-selection"),w.$el.blur(),w.events.enableBlur()}function $(e){var t=w.$el.find(".fr-selected-cell");if(0<t.length){var l,a=e.length,r=0,s=e[0].length,n=0;for(l=0;l<t.length;l++){var o=A(t[l],e),i=F(o.row,o.col,e);a=Math.min(o.row,a),r=Math.max(i.row,r),s=Math.min(o.col,s),n=Math.max(i.col,n)}return{min_i:a,max_i:r,min_j:s,max_j:n}}return null}function M(e){var t=$(e),l=Z(e[t.min_i][t.min_j]),a=Z(e[t.min_i][t.max_j]),r=Z(e[t.max_i][t.min_j]);return{left:l.offset().left,right:a.offset().left+a.outerWidth(),top:l.offset().top,bottom:r.offset().top+r.outerHeight()}}function _(t,l){if(Z(t).is(l))D(),Z(t).addClass("fr-selected-cell");else{y(),w.edit.off();var a=O(),r=A(t,a),s=A(l,a),n=function e(t,l,a,r,s){var n,o,i,f,c=t,d=l,p=a,h=r;for(n=c;n<=d;n++)(1<(parseInt(Z(s[n][p]).attr("rowspan"),10)||1)||1<(parseInt(Z(s[n][p]).attr("colspan"),10)||1))&&(f=F((i=A(s[n][p],s)).row,i.col,s),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(Z(s[n][h]).attr("rowspan"),10)||1)||1<(parseInt(Z(s[n][h]).attr("colspan"),10)||1))&&(f=F((i=A(s[n][h],s)).row,i.col,s),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h));for(o=p;o<=h;o++)(1<(parseInt(Z(s[c][o]).attr("rowspan"),10)||1)||1<(parseInt(Z(s[c][o]).attr("colspan"),10)||1))&&(f=F((i=A(s[c][o],s)).row,i.col,s),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(Z(s[d][o]).attr("rowspan"),10)||1)||1<(parseInt(Z(s[d][o]).attr("colspan"),10)||1))&&(f=F((i=A(s[d][o],s)).row,i.col,s),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h));return c==t&&d==l&&p==a&&h==r?{min_i:t,max_i:l,min_j:a,max_j:r}:e(c,d,p,h,s)}(Math.min(r.row,s.row),Math.max(r.row,s.row),Math.min(r.col,s.col),Math.max(r.col,s.col),a);D(),t.classList.add("fr-cell-fixed"),l.classList.add("fr-cell-handler");for(var o=n.min_i;o<=n.max_i;o++)for(var i=n.min_j;i<=n.max_j;i++)Z(a[o][i]).addClass("fr-selected-cell")}}function I(e){var t=null,l=Z(e.target);return"TD"==e.target.tagName||"TH"==e.target.tagName?t=e.target:0<l.closest("td").length?t=l.closest("td").get(0):0<l.closest("th").length&&(t=l.closest("th").get(0)),0===w.$el.find(t).length?null:t}function T(){D(),w.popups.hide("table.edit")}function e(e){var t=I(e);if("false"==Z(t).parents("[contenteditable]:not(.fr-element):not(.fr-img-caption):not(body):first").attr("contenteditable"))return!0;if(0<J().length&&!t&&T(),!w.edit.isDisabled()||w.popups.isVisible("table.edit"))if(1!=e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)(3==e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)&&t&&T();else if(s=!0,t){0<J().length&&!e.shiftKey&&T(),e.stopPropagation(),w.events.trigger("image.hideResizer"),w.events.trigger("video.hideResizer"),r=!0;var l=t.tagName.toLowerCase();e.shiftKey&&0<w.$el.find(l+".fr-selected-cell").length?Z(w.$el.find(l+".fr-selected-cell").closest("table")).is(Z(t).closest("table"))?_(a,t):y():((w.keys.ctrlKey(e)||e.shiftKey)&&(1<J().length||0===Z(t).find(w.selection.element()).length&&!Z(t).is(w.selection.element()))&&y(),a=t,0<w.opts.tableEditButtons.length&&_(a,a))}}function l(e){if(w.popups.areVisible())return!0;if(r||w.$tb.is(e.target)||w.$tb.is(Z(e.target).closest(w.$tb.get(0)))||(0<J().length&&w.toolbar.enable(),D()),!(1!=e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)){if(s=!1,r)r=!1,I(e)||1!=J().length?0<J().length&&(w.selection.isCollapsed()?h():D()):D();if(E){E=!1,C.removeClass("fr-moving"),w.$el.removeClass("fr-no-selection"),w.edit.on();var t=parseFloat(C.css("left"))+w.opts.tableResizerOffset+w.$wp.offset().left;w.opts.iframe&&(t-=w.$iframe.offset().left),C.data("release-position",t),C.removeData("max-left"),C.removeData("max-right"),function(){var e=C.data("origin"),t=C.data("release-position");if(e!==t){var l=C.data("first"),a=C.data("second"),r=C.data("table"),s=r.outerWidth();if(w.undo.canDo()||w.undo.saveStep(),null!==l&&null!==a){var n,o,i,f=O(r),c=[],d=[],p=[],h=[];for(n=0;n<f.length;n++)o=Z(f[n][l]),i=Z(f[n][a]),c[n]=o.outerWidth(),p[n]=i.outerWidth(),d[n]=c[n]/s*100,h[n]=p[n]/s*100;for(n=0;n<f.length;n++)if(o=Z(f[n][l]),i=Z(f[n][a]),f[n][l]!=f[n][a]){var u=(d[n]*(c[n]+t-e)/c[n]).toFixed(4);o.css("width",u+"%"),i.css("width",(d[n]+h[n]-u).toFixed(4)+"%")}}else{var b,g=r.parent(),m=s/g.width()*100,v=(parseInt(r.css("margin-left"),10)||0)/g.width()*100,E=(parseInt(r.css("margin-right"),10)||0)/g.width()*100;"rtl"==w.opts.direction&&0===a||"rtl"!=w.opts.direction&&0!==a?(b=(s+t-e)/s*m,r.css("margin-right","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(v).toFixed(4)+"%)")):("rtl"==w.opts.direction&&0!==a||"rtl"!=w.opts.direction&&0===a)&&(b=(s-t+e)/s*m,r.css("margin-left","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(E).toFixed(4)+"%)")),r.css("width",Math.round(b).toFixed(4)+"%")}w.selection.restore(),w.undo.saveStep(),w.events.trigger("table.resized",[r.get(0)])}C.removeData("origin"),C.removeData("release-position"),C.removeData("first"),C.removeData("second"),C.removeData("table")}(),W()}}}function N(e){if(!0===r&&0<w.opts.tableEditButtons.length){if(Z(e.currentTarget).closest("table").is(Q())){if("TD"==e.currentTarget.tagName&&0===w.$el.find("th.fr-selected-cell").length)return void _(a,e.currentTarget);if("TH"==e.currentTarget.tagName&&0===w.$el.find("td.fr-selected-cell").length)return void _(a,e.currentTarget)}y()}}function S(e,t,l,a){for(var r,s=t;s!=w.el&&"TD"!=s.tagName&&"TH"!=s.tagName&&("up"==a?r=s.previousElementSibling:"down"==a&&(r=s.nextElementSibling),!r);)s=s.parentNode;"TD"==s.tagName||"TH"==s.tagName?function(e,t){for(var l=e;l&&"TABLE"!=l.tagName&&l.parentNode!=w.el;)l=l.parentNode;if(l&&"TABLE"==l.tagName){var a=O(Z(l));"up"==t?z(A(e,a),l,a):"down"==t&&B(A(e,a),l,a)}}(s,a):r&&("up"==a&&w.selection.setAtEnd(r),"down"==a&&w.selection.setAtStart(r))}function z(e,t,l){0<e.row?w.selection.setAtEnd(l[e.row-1][e.col]):S(0,t,0,"up")}function B(e,t,l){var a=parseInt(l[e.row][e.col].getAttribute("rowspan"),10)||1;e.row<l.length-a?w.selection.setAtStart(l[e.row+a][e.col]):S(0,t,0,"down")}function W(){C&&(C.find("div").css("opacity",0),C.css("top",0),C.css("left",0),C.css("height",0),C.find("div").css("height",0),C.hide())}function k(){o&&o.removeClass("fr-visible").css("left","-9999px")}function K(e,t){var l=Z(t),a=l.closest("table"),r=a.parent();if(t&&"TD"!=t.tagName&&"TH"!=t.tagName&&(0<l.closest("td").length?t=l.closest("td"):0<l.closest("th").length&&(t=l.closest("th"))),!t||"TD"!=t.tagName&&"TH"!=t.tagName)C&&l.get(0)!=C.get(0)&&l.parent().get(0)!=C.get(0)&&w.core.sameInstance(C)&&W();else{if(l=Z(t),0===w.$el.find(l).length)return!1;var s=l.offset().left-1,n=s+l.outerWidth();if(Math.abs(e.pageX-s)<=w.opts.tableResizerOffset||Math.abs(n-e.pageX)<=w.opts.tableResizerOffset){var o,i,f,c,d,p=O(a),h=A(t,p),u=F(h.row,h.col,p),b=a.offset().top,g=a.outerHeight()-1;"rtl"!=w.opts.direction?e.pageX-s<=w.opts.tableResizerOffset?(f=s,0<h.col?(c=s-j(h.col-1,p)+w.opts.tableResizingLimit,d=s+j(h.col,p)-w.opts.tableResizingLimit,o=h.col-1,i=h.col):(o=null,i=0,c=a.offset().left-1-parseInt(a.css("margin-left"),10),d=a.offset().left-1+a.width()-p[0].length*w.opts.tableResizingLimit)):n-e.pageX<=w.opts.tableResizerOffset&&(f=n,u.col<p[u.row].length&&p[u.row][u.col+1]?(c=n-j(u.col,p)+w.opts.tableResizingLimit,d=n+j(u.col+1,p)-w.opts.tableResizingLimit,o=u.col,i=u.col+1):(o=u.col,i=null,c=a.offset().left-1+p[0].length*w.opts.tableResizingLimit,d=r.offset().left-1+r.width()+parseFloat(r.css("padding-left")))):n-e.pageX<=w.opts.tableResizerOffset?(f=n,0<h.col?(c=n-j(h.col,p)+w.opts.tableResizingLimit,d=n+j(h.col-1,p)-w.opts.tableResizingLimit,o=h.col,i=h.col-1):(o=null,i=0,c=a.offset().left+p[0].length*w.opts.tableResizingLimit,d=r.offset().left-1+r.width()+parseFloat(r.css("padding-left")))):e.pageX-s<=w.opts.tableResizerOffset&&(f=s,u.col<p[u.row].length&&p[u.row][u.col+1]?(c=s-j(u.col+1,p)+w.opts.tableResizingLimit,d=s+j(u.col,p)-w.opts.tableResizingLimit,o=u.col+1,i=u.col):(o=u.col,i=null,c=r.offset().left+parseFloat(r.css("padding-left")),d=a.offset().left-1+a.width()-p[0].length*w.opts.tableResizingLimit)),C||(w.shared.$table_resizer||(w.shared.$table_resizer=Z('<div class="fr-table-resizer"><div></div></div>')),C=w.shared.$table_resizer,w.events.$on(C,"mousedown",function(e){return!w.core.sameInstance(C)||(0<J().length&&T(),1==e.which?(w.selection.save(),E=!0,C.addClass("fr-moving"),y(),w.edit.off(),C.find("div").css("opacity",1),!1):void 0)}),w.events.$on(C,"mousemove",function(e){if(!w.core.sameInstance(C))return!0;E&&(w.opts.iframe&&(e.pageX-=w.$iframe.offset().left),X(e))}),w.events.on("shared.destroy",function(){C.html("").removeData().remove(),C=null},!0),w.events.on("destroy",function(){w.$el.find(".fr-selected-cell").removeClass("fr-selected-cell"),C.hide().appendTo(Z("body:first"))},!0)),C.data("table",a),C.data("first",o),C.data("second",i),C.data("instance",w),w.$wp.append(C);var m=f-w.win.pageXOffset-w.opts.tableResizerOffset-w.$wp.offset().left,v=b-w.$wp.offset().top+w.$wp.scrollTop();w.opts.iframe&&(m+=w.$iframe.offset().left,v+=w.$iframe.offset().top,c+=w.$iframe.offset().left,d+=w.$iframe.offset().left),C.data("max-left",c),C.data("max-right",d),C.data("origin",f-w.win.pageXOffset),C.css("top",v),C.css("left",m),C.css("height",g),C.find("div").css("height",g),C.css("padding-left",w.opts.tableResizerOffset),C.css("padding-right",w.opts.tableResizerOffset),C.show()}else w.core.sameInstance(C)&&W()}}function L(e,t){if(w.$box.find(".fr-line-breaker").is(":visible"))return!1;o||q(),w.$box.append(o),o.data("instance",w);var l,a=Z(t).find("tr:first"),r=e.pageX,s=0,n=0;w.opts.iframe&&(s+=w.$iframe.offset().left-w.helpers.scrollLeft(),n+=w.$iframe.offset().top-w.helpers.scrollTop()),a.find("th, td").each(function(){var e=Z(this);return e.offset().left<=r&&r<e.offset().left+e.outerWidth()/2?(l=parseInt(o.find("a").css("width"),10),o.css("top",n+e.offset().top-w.$box.offset().top-l-5),o.css("left",s+e.offset().left-w.$box.offset().left-l/2),o.data("selected-cell",e),o.data("position","before"),o.addClass("fr-visible"),!1):e.offset().left+e.outerWidth()/2<=r&&r<e.offset().left+e.outerWidth()?(l=parseInt(o.find("a").css("width"),10),o.css("top",n+e.offset().top-w.$box.offset().top-l-5),o.css("left",s+e.offset().left-w.$box.offset().left+e.outerWidth()-l/2),o.data("selected-cell",e),o.data("position","after"),o.addClass("fr-visible"),!1):void 0})}function H(e,t){if(w.$box.find(".fr-line-breaker").is(":visible"))return!1;o||q(),w.$box.append(o),o.data("instance",w);var l,a=Z(t),r=e.pageY,s=0,n=0;w.opts.iframe&&(s+=w.$iframe.offset().left-w.helpers.scrollLeft(),n+=w.$iframe.offset().top-w.helpers.scrollTop()),a.find("tr").each(function(){var e=Z(this);return e.offset().top<=r&&r<e.offset().top+e.outerHeight()/2?(l=parseInt(o.find("a").css("width"),10),o.css("top",n+e.offset().top-w.$box.offset().top-l/2),o.css("left",s+e.offset().left-w.$box.offset().left-l-5),o.data("selected-cell",e.find("td:first")),o.data("position","above"),o.addClass("fr-visible"),!1):e.offset().top+e.outerHeight()/2<=r&&r<e.offset().top+e.outerHeight()?(l=parseInt(o.find("a").css("width"),10),o.css("top",n+e.offset().top-w.$box.offset().top+e.outerHeight()-l/2),o.css("left",s+e.offset().left-w.$box.offset().left-l-5),o.data("selected-cell",e.find("td:first")),o.data("position","below"),o.addClass("fr-visible"),!1):void 0})}function Y(e){n=null;var t=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset,e.pageY-w.win.pageYOffset);w.opts.tableResizer&&(!w.popups.areVisible()||w.popups.areVisible()&&w.popups.isVisible("table.edit"))&&K(e,t),!w.opts.tableInsertHelper||w.popups.areVisible()||w.$tb.hasClass("fr-inline")&&w.$tb.is(":visible")||function(e,t){if(0===J().length){var l,a,r;if(t&&("HTML"==t.tagName||"BODY"==t.tagName||w.node.isElement(t)))for(l=1;l<=w.opts.tableInsertHelperOffset;l++){if(a=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset,e.pageY-w.win.pageYOffset+l),Z(a).hasClass("fr-tooltip"))return;if(a&&("TH"==a.tagName||"TD"==a.tagName||"TABLE"==a.tagName)&&(Z(a).parents(".fr-wrapper").length||w.opts.iframe))return L(e,Z(a).closest("table"));if(r=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset+l,e.pageY-w.win.pageYOffset),Z(r).hasClass("fr-tooltip"))return;if(r&&("TH"==r.tagName||"TD"==r.tagName||"TABLE"==r.tagName)&&(Z(r).parents(".fr-wrapper").length||w.opts.iframe))return H(e,Z(r).closest("table"))}w.core.sameInstance(o)&&k()}}(e,t)}function P(){if(E){var e=C.data("table").offset().top-w.win.pageYOffset;w.opts.iframe&&(e+=w.$iframe.offset().top-w.helpers.scrollTop()),C.css("top",e)}}function j(e,t){var l,a=Z(t[0][e]).outerWidth();for(l=1;l<t.length;l++)a=Math.min(a,Z(t[l][e]).outerWidth());return a}function V(e,t,l){var a,r=0;for(a=e;a<=t;a++)r+=j(a,l);return r}function X(e){if(1<J().length&&s&&y(),!1===s&&!1===r&&!1===E)n&&clearTimeout(n),w.edit.isDisabled()&&!w.popups.isVisible("table.edit")||(n=setTimeout(Y,30,e));else if(E){var t=e.pageX-w.win.pageXOffset;w.opts.iframe&&(t+=w.$iframe.offset().left);var l=C.data("max-left"),a=C.data("max-right");l<=t&&t<=a?C.css("left",t-w.opts.tableResizerOffset-w.$wp.offset().left):t<l&&parseFloat(C.css("left"),10)>l-w.opts.tableResizerOffset?C.css("left",l-w.opts.tableResizerOffset-w.$wp.offset().left):a<t&&parseFloat(C.css("left"),10)<a-w.opts.tableResizerOffset&&C.css("left",a-w.opts.tableResizerOffset-w.$wp.offset().left)}else s&&k()}function U(e){w.node.isEmpty(e.get(0))?e.prepend(Z.FE.MARKERS):e.prepend(Z.FE.START_MARKER).append(Z.FE.END_MARKER)}function q(){w.shared.$ti_helper||(w.shared.$ti_helper=Z('<div class="fr-insert-helper"><a class="fr-floating-btn" role="button" tabIndex="-1" title="'+w.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></div>'),w.events.bindClick(w.shared.$ti_helper,"a",function(){var e=o.data("selected-cell"),t=o.data("position"),l=o.data("instance")||w;"before"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertColumn(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"after"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertColumn(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"above"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertRow(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"below"==t&&(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertRow(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()),k()}),w.events.on("shared.destroy",function(){w.shared.$ti_helper.html("").removeData().remove(),w.shared.$ti_helper=null},!0),w.events.$on(w.shared.$ti_helper,"mousemove",function(e){e.stopPropagation()},!0),w.events.$on(Z(w.o_win),"scroll",function(){k()},!0),w.events.$on(w.$wp,"scroll",function(){k()},!0)),o=w.shared.$ti_helper,w.events.on("destroy",function(){o=null}),w.tooltip.bind(w.$box,".fr-insert-helper > a.fr-floating-btn")}function G(){a=null,clearTimeout(n)}function J(){return w.el.querySelectorAll(".fr-selected-cell")}function Q(){var e=J();if(e.length){for(var t=e[0];t&&"TABLE"!=t.tagName&&t.parentNode!=w.el;)t=t.parentNode;return t&&"TABLE"==t.tagName?Z(t):Z([])}return Z([])}return{_init:function(){if(!w.$wp)return!1;if(!w.helpers.isMobile()){E=r=s=!1,w.events.$on(w.$el,"mousedown",e),w.popups.onShow("image.edit",function(){D(),r=s=!1}),w.popups.onShow("link.edit",function(){D(),r=s=!1}),w.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&D()}),w.events.$on(w.$el,"mouseenter","th, td",N),w.events.$on(w.$win,"mouseup",l),w.opts.iframe&&w.events.$on(Z(w.o_win),"mouseup",l),w.events.$on(w.$win,"mousemove",X),w.events.$on(Z(w.o_win),"scroll",P),w.events.on("contentChanged",function(){0<J().length&&(h(),w.$el.find("img").on("load.selected-cells",function(){Z(this).off("load.selected-cells"),0<J().length&&h()}))}),w.events.$on(Z(w.o_win),"resize",function(){D()}),w.events.on("toolbar.esc",function(){if(0<J().length)return w.events.disableBlur(),w.events.focus(),!1},!0),w.events.$on(Z(w.o_win),"keydown",function(){s&&r&&(r=s=!1,w.$el.removeClass("fr-no-selection"),w.edit.on(),w.selection.setAtEnd(w.$el.find(".fr-selected-cell:last").get(0)),w.selection.restore(),D())}),w.events.$on(w.$el,"keydown",function(e){e.shiftKey?!1===function(e){var t=J();if(0<t.length){var l,a,r=O(),s=e.which;1==t.length?a=l=t[0]:(l=w.el.querySelector(".fr-cell-fixed"),a=w.el.querySelector(".fr-cell-handler"));var n=A(a,r);if(Z.FE.KEYCODE.ARROW_RIGHT==s){if(n.col<r[0].length-1)return _(l,r[n.row][n.col+1]),!1}else if(Z.FE.KEYCODE.ARROW_DOWN==s){if(n.row<r.length-1)return _(l,r[n.row+1][n.col]),!1}else if(Z.FE.KEYCODE.ARROW_LEFT==s){if(0<n.col)return _(l,r[n.row][n.col-1]),!1}else if(Z.FE.KEYCODE.ARROW_UP==s&&0<n.row)return _(l,r[n.row-1][n.col]),!1}}(e)&&setTimeout(function(){h()},0):function(e){var t=e.which,l=w.selection.blocks();if(l.length&&("TD"==(l=l[0]).tagName||"TH"==l.tagName)){for(var a=l;a&&"TABLE"!=a.tagName&&a.parentNode!=w.el;)a=a.parentNode;if(a&&"TABLE"==a.tagName&&(Z.FE.KEYCODE.ARROW_LEFT==t||Z.FE.KEYCODE.ARROW_UP==t||Z.FE.KEYCODE.ARROW_RIGHT==t||Z.FE.KEYCODE.ARROW_DOWN==t)&&(0<J().length&&T(),w.browser.webkit&&(Z.FE.KEYCODE.ARROW_UP==t||Z.FE.KEYCODE.ARROW_DOWN==t))){var r=w.selection.ranges(0).startContainer;if(r.nodeType==Node.TEXT_NODE&&(Z.FE.KEYCODE.ARROW_UP==t&&r.previousSibling||Z.FE.KEYCODE.ARROW_DOWN==t&&r.nextSibling))return;e.preventDefault(),e.stopPropagation();var s=O(Z(a)),n=A(l,s);Z.FE.KEYCODE.ARROW_UP==t?z(n,a,s):Z.FE.KEYCODE.ARROW_DOWN==t&&B(n,a,s),w.selection.restore()}}}(e)}),w.events.on("keydown",function(e){if(!1===function(e){if(e.which==Z.FE.KEYCODE.TAB){var t;if(0<J().length)t=w.$el.find(".fr-selected-cell:last");else{var l=w.selection.element();"TD"==l.tagName||"TH"==l.tagName?t=Z(l):l!=w.el&&(0<Z(l).parentsUntil(w.$el,"td").length?t=Z(l).parents("td:first"):0<Z(l).parentsUntil(w.$el,"th").length&&(t=Z(l).parents("th:first")))}if(t)return e.preventDefault(),!!(0<Z(w.selection.element()).parentsUntil(w.$el,"ol, ul").length&&(0<Z(w.selection.element()).parents("li").prev().length||Z(w.selection.element()).is("li")&&0<Z(w.selection.element()).prev().length))||(T(),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"))),w.selection.restore(),!1)}}(e))return!1;var t=J();if(0<t.length){if(0<t.length&&w.keys.ctrlKey(e)&&e.which==Z.FE.KEYCODE.A)return D(),w.popups.isVisible("table.edit")&&w.popups.hide("table.edit"),t=[],!0;if(e.which==Z.FE.KEYCODE.ESC&&w.popups.isVisible("table.edit"))return D(),w.popups.hide("table.edit"),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!(t=[]);if(1<t.length&&(e.which==Z.FE.KEYCODE.BACKSPACE||e.which==Z.FE.KEYCODE.DELETE)){w.undo.saveStep();for(var l=0;l<t.length;l++)Z(t[l]).html("<br>"),l==t.length-1&&Z(t[l]).prepend(Z.FE.MARKERS);return w.selection.restore(),w.undo.saveStep(),!(t=[])}if(1<t.length&&e.which!=Z.FE.KEYCODE.F10&&!w.keys.isBrowserAction(e))return e.preventDefault(),!(t=[])}else if(!(t=[])===function(e){if(e.altKey&&e.which==Z.FE.KEYCODE.SPACE){var t,l=w.selection.element();if("TD"==l.tagName||"TH"==l.tagName?t=l:0<Z(l).closest("td").length?t=Z(l).closest("td").get(0):0<Z(l).closest("th").length&&(t=Z(l).closest("th").get(0)),t)return e.preventDefault(),_(t,t),h(),!1}}(e))return!1},!0);var t=[];w.events.on("html.beforeGet",function(){t=J();for(var e=0;e<t.length;e++)t[e].className=(t[e].className||"").replace(/fr-selected-cell/g,"")}),w.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=[]}),c(!0),p(!0)}w.events.on("destroy",G)},insert:function(e,t){var l,a,r="<table "+(w.opts.tableDefaultWidth?'style="width: '+w.opts.tableDefaultWidth+';" ':"")+'class="fr-inserted-table"><tbody>',s=100/t;for(l=0;l<e;l++){for(r+="<tr>",a=0;a<t;a++)r+="<td"+(w.opts.tableDefaultWidth?' style="width: '+s.toFixed(4)+'%;"':"")+">",0===l&&0===a&&(r+=Z.FE.MARKERS),r+="<br></td>";r+="</tr>"}r+="</tbody></table>",w.html.insert(r),w.selection.restore();var n=w.$el.find(".fr-inserted-table");n.removeClass("fr-inserted-table"),w.events.trigger("table.inserted",[n.get(0)])},remove:u,insertRow:b,deleteRow:function(){var e=Q();if(0<e.length){var t,l,a,r=O(),s=$(r);if(0===s.min_i&&s.max_i==r.length-1)u();else{for(t=s.max_i;t>=s.min_i;t--){for(a=Z(e.find("tr").not(e.find("table tr")).get(t)),l=0;l<r[t].length;l++)if(0===l||r[t][l]!=r[t][l-1]){var n=Z(r[t][l]);if(1<parseInt(n.attr("rowspan"),10)){var o=parseInt(n.attr("rowspan"),10)-1;1==o?n.removeAttr("rowspan"):n.attr("rowspan",o)}if(t<r.length-1&&r[t][l]==r[t+1][l]&&(0===t||r[t][l]!=r[t-1][l])){for(var i=r[t][l],f=l;0<f&&r[t][f]==r[t][f-1];)f--;0===f?Z(e.find("tr").not(e.find("table tr")).get(t+1)).prepend(i):Z(r[t+1][f-1]).after(i)}}var c=a.parent();a.remove(),0===c.find("tr").length&&c.remove(),r=O(e)}R(0,r.length-1,0,r[0].length-1,e),0<s.min_i?w.selection.setAtEnd(r[s.min_i-1][0]):w.selection.setAtEnd(r[0][0]),w.selection.restore(),w.popups.hide("table.edit")}}},insertColumn:function(i){var e=Q();if(0<e.length){var f,c=O(),t=$(c);f="before"==i?t.min_j:t.max_j;var l,d=100/c[0].length,p=100/(c[0].length+1);e.find("th, td").each(function(){(l=Z(this)).data("old-width",l.outerWidth()/e.outerWidth()*100)}),e.find("tr").not(e.find("table tr")).each(function(e){for(var t,l=Z(this),a=0,r=0;a-1<f;){if(!(t=l.find("> th, > td").get(r))){t=null;break}t==c[e][a]?(a+=parseInt(Z(t).attr("colspan"),10)||1,r++):(a+=parseInt(Z(c[e][a]).attr("colspan"),10)||1,"after"==i&&(t=0===r?-1:l.find("> th, > td").get(r-1)))}var s,n=Z(t);if("after"==i&&f<a-1||"before"==i&&0<f&&c[e][f]==c[e][f-1]){if(0===e||0<e&&c[e][f]!=c[e-1][f]){var o=parseInt(n.attr("colspan"),10)+1;n.attr("colspan",o),n.css("width",(n.data("old-width")*p/d+p).toFixed(4)+"%"),n.removeData("old-width")}}else s=0<l.find("th").length?'<th style="width: '+p.toFixed(4)+'%;"><br></th>':'<td style="width: '+p.toFixed(4)+'%;"><br></td>',-1==t?l.prepend(s):null==t?l.append(s):"before"==i?n.before(s):"after"==i&&n.after(s)}),e.find("th, td").each(function(){(l=Z(this)).data("old-width")&&(l.css("width",(l.data("old-width")*p/d).toFixed(4)+"%"),l.removeData("old-width"))}),w.popups.isVisible("table.edit")&&h()}},deleteColumn:function(){var e=Q();if(0<e.length){var t,l,a,r=O(),s=$(r);if(0===s.min_j&&s.max_j==r[0].length-1)u();else{var n=0;for(t=0;t<r.length;t++)for(l=0;l<r[0].length;l++)(a=Z(r[t][l])).hasClass("fr-selected-cell")||(a.data("old-width",a.outerWidth()/e.outerWidth()*100),(l<s.min_j||l>s.max_j)&&(n+=a.outerWidth()/e.outerWidth()*100));for(n/=r.length,l=s.max_j;l>=s.min_j;l--)for(t=0;t<r.length;t++)if(0===t||r[t][l]!=r[t-1][l])if(a=Z(r[t][l]),1<(parseInt(a.attr("colspan"),10)||1)){var o=parseInt(a.attr("colspan"),10)-1;1==o?a.removeAttr("colspan"):a.attr("colspan",o),a.css("width",(100*(a.data("old-width")-j(l,r))/n).toFixed(4)+"%"),a.removeData("old-width")}else{var i=Z(a.parent().get(0));a.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()}R(0,r.length-1,0,r[0].length-1,e),0<s.min_j?w.selection.setAtEnd(r[s.min_i][s.min_j-1]):w.selection.setAtEnd(r[s.min_i][0]),w.selection.restore(),w.popups.hide("table.edit"),e.find("th, td").each(function(){(a=Z(this)).data("old-width")&&(a.css("width",(100*a.data("old-width")/n).toFixed(4)+"%"),a.removeData("old-width"))})}}},mergeCells:function(){if(1<J().length&&(0===w.$el.find("th.fr-selected-cell").length||0===w.$el.find("td.fr-selected-cell").length)){x();var e,t,l=$(O()),a=w.$el.find(".fr-selected-cell"),r=Z(a[0]),s=r.parent().find(".fr-selected-cell"),n=r.closest("table"),o=r.html(),i=0;for(e=0;e<s.length;e++)i+=Z(s[e]).outerWidth();for(r.css("width",Math.min(100,i/n.outerWidth()*100).toFixed(4)+"%"),l.min_j<l.max_j&&r.attr("colspan",l.max_j-l.min_j+1),l.min_i<l.max_i&&r.attr("rowspan",l.max_i-l.min_i+1),e=1;e<a.length;e++)"<br>"!=(t=Z(a[e])).html()&&""!==t.html()&&(o+="<br>"+t.html()),t.remove();r.html(o),w.selection.setAtEnd(r.get(0)),w.selection.restore(),w.toolbar.enable(),m(l.min_i,l.max_i,n);var f=n.find("tr:empty");for(e=f.length-1;0<=e;e--)Z(f[e]).remove();g(l.min_j,l.max_j,n),h()}},splitCellVertically:function(){if(1==J().length){var e=w.$el.find(".fr-selected-cell"),t=parseInt(e.attr("colspan"),10)||1,l=e.parent().outerWidth(),a=e.outerWidth(),r=e.clone().html("<br>"),s=O(),n=A(e.get(0),s);if(1<t){var o=Math.ceil(t/2);a=V(n.col,n.col+o-1,s)/l*100;var i=V(n.col+o,n.col+t-1,s)/l*100;1<o?e.attr("colspan",o):e.removeAttr("colspan"),1<t-o?r.attr("colspan",t-o):r.removeAttr("colspan"),e.css("width",a.toFixed(4)+"%"),r.css("width",i.toFixed(4)+"%")}else{var f;for(f=0;f<s.length;f++)if(0===f||s[f][n.col]!=s[f-1][n.col]){var c=Z(s[f][n.col]);if(!c.is(e)){var d=(parseInt(c.attr("colspan"),10)||1)+1;c.attr("colspan",d)}}a=a/l*100/2,e.css("width",a.toFixed(4)+"%"),r.css("width",a.toFixed(4)+"%")}e.after(r),D(),w.popups.hide("table.edit")}},splitCellHorizontally:function(){if(1==J().length){var e=w.$el.find(".fr-selected-cell"),t=e.parent(),l=e.closest("table"),a=parseInt(e.attr("rowspan"),10),r=O(),s=A(e.get(0),r),n=e.clone().html("<br>");if(1<a){var o=Math.ceil(a/2);1<o?e.attr("rowspan",o):e.removeAttr("rowspan"),1<a-o?n.attr("rowspan",a-o):n.removeAttr("rowspan");for(var i=s.row+o,f=0===s.col?s.col:s.col-1;0<=f&&(r[i][f]==r[i][f-1]||0<i&&r[i][f]==r[i-1][f]);)f--;-1==f?Z(l.find("tr").not(l.find("table tr")).get(i)).prepend(n):Z(r[i][f]).after(n)}else{var c,d=Z("<tr>").append(n);for(c=0;c<r[0].length;c++)if(0===c||r[s.row][c]!=r[s.row][c-1]){var p=Z(r[s.row][c]);p.is(e)||p.attr("rowspan",(parseInt(p.attr("rowspan"),10)||1)+1)}t.after(d)}D(),w.popups.hide("table.edit")}},addHeader:function(){var e=Q();if(0<e.length&&0===e.find("th").length){var t,l="<thead><tr>",a=0;for(e.find("tr:first > td").each(function(){var e=Z(this);a+=parseInt(e.attr("colspan"),10)||1}),t=0;t<a;t++)l+="<th><br></th>";l+="</tr></thead>",e.prepend(l),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<J().length)h();else{w.popups.hide("table.edit");var l=e.find("tbody tr:first td:first").get(0);l&&(w.selection.setAtEnd(l),w.selection.restore())}},setBackground:t,showInsertPopup:function(){var e=w.$tb.find('.fr-command[data-cmd="insertTable"]'),t=w.popups.get("table.insert");if(t||(t=c()),!t.hasClass("fr-active")){w.popups.refresh("table.insert"),w.popups.setContainer("table.insert",w.$tb);var l=e.offset().left+e.outerWidth()/2,a=e.offset().top+(w.opts.toolbarBottom?10:e.outerHeight()-10);w.popups.show("table.insert",l,a,e.outerHeight())}},showEditPopup:h,showColorsPopup:f,back:function(){0<J().length?h():(w.popups.hide("table.insert"),w.toolbar.showInline())},verticalAlign:function(e){w.$el.find(".fr-selected-cell").css("vertical-align",e)},horizontalAlign:function(e){w.$el.find(".fr-selected-cell").css("text-align",e)},applyStyle:function(e,t,l,a){if(0<t.length){if(!l){var r=Object.keys(a);r.splice(r.indexOf(e),1),t.removeClass(r.join(" "))}t.toggleClass(e)}},selectedTable:Q,selectedCells:J,customColor:function(){var e=w.popups.get("table.colors").find(".fr-table-colors-hex-layer input");e.length&&t(e.val())},selectCells:_}},Z.FE.DefineIcon("insertTable",{NAME:"table"}),Z.FE.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"}),Z.FE.RegisterCommand("tableInsert",{callback:function(e,t,l){this.table.insert(t,l),this.popups.hide("table.insert")}}),Z.FE.DefineIcon("tableHeader",{NAME:"header",FA5NAME:"heading"}),Z.FE.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))}}),Z.FE.DefineIcon("tableRows",{NAME:"bars"}),Z.FE.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=Z.FE.COMMANDS.tableRows.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableRows" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){"above"==t||"below"==t?this.table.insertRow(t):this.table.deleteRow()}}),Z.FE.DefineIcon("tableColumns",{NAME:"bars fa-rotate-90"}),Z.FE.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=Z.FE.COMMANDS.tableColumns.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableColumns" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){"before"==t||"after"==t?this.table.insertColumn(t):this.table.deleteColumn()}}),Z.FE.DefineIcon("tableCells",{NAME:"square-o",FA5NAME:"square"}),Z.FE.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=Z.FE.COMMANDS.tableCells.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCells" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</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))}}),Z.FE.DefineIcon("tableRemove",{NAME:"trash"}),Z.FE.RegisterCommand("tableRemove",{title:"Remove Table",focus:!1,callback:function(){this.table.remove()}}),Z.FE.DefineIcon("tableStyle",{NAME:"paint-brush"}),Z.FE.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 l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableStyle" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</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 l=this.$el.find(".fr-selected-cell").closest("table");l&&t.find(".fr-command").each(function(){var e=Z(this).data("param1"),t=l.hasClass(e);Z(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),Z.FE.DefineIcon("tableCellBackground",{NAME:"tint"}),Z.FE.RegisterCommand("tableCellBackground",{title:"Cell Background",focus:!1,popup:!0,callback:function(){this.table.showColorsPopup()}}),Z.FE.RegisterCommand("tableCellBackgroundColor",{undo:!0,focus:!1,callback:function(e,t){this.table.setBackground(t)}}),Z.FE.DefineIcon("tableBack",{NAME:"arrow-left"}),Z.FE.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"))}}),Z.FE.DefineIcon("tableCellVerticalAlign",{NAME:"arrows-v",FA5NAME:"arrows-alt-v"}),Z.FE.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=Z.FE.COMMANDS.tableCellVerticalAlign.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellVerticalAlign" data-param1="'+l.toLowerCase()+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(l)+"</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)}}),Z.FE.DefineIcon("tableCellHorizontalAlign",{NAME:"align-left"}),Z.FE.DefineIcon("align-left",{NAME:"align-left"}),Z.FE.DefineIcon("align-right",{NAME:"align-right"}),Z.FE.DefineIcon("align-center",{NAME:"align-center"}),Z.FE.DefineIcon("align-justify",{NAME:"align-justify"}),Z.FE.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=Z.FE.COMMANDS.tableCellHorizontalAlign.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="tableCellHorizontalAlign" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.icon.create("align-"+l)+'<span class="fr-sr-only">'+this.language.translate(t[l])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.table.horizontalAlign(t)},refresh:function(e){var t=this.table.selectedCells();t.length&&e.find("> *:first").replaceWith(this.icon.create("align-"+this.helpers.getAlignment(Z(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)}}),Z.FE.DefineIcon("tableCellStyle",{NAME:"magic"}),Z.FE.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 l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellStyle" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</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 l=this.$el.find(".fr-selected-cell:first");l&&t.find(".fr-command").each(function(){var e=Z(this).data("param1"),t=l.hasClass(e);Z(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),Z.FE.RegisterCommand("tableCellBackgroundCustomColor",{title:"OK",undo:!0,callback:function(){this.table.customColor()}}),Z.FE.DefineIcon("tableColorRemove",{NAME:"eraser"})}); | ||
!function(l){"function"==typeof define&&define.amd?define(["jquery"],l):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),l(t)}:l(window.jQuery)}(function(Z){Z.extend(Z.FE.POPUP_TEMPLATES,{"table.insert":"[_BUTTONS_][_ROWS_COLUMNS_]","table.edit":"[_BUTTONS_]","table.colors":"[_BUTTONS_][_COLORS_][_CUSTOM_COLOR_]"}),Z.extend(Z.FE.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}),Z.FE.PLUGINS.table=function(w){var C,o,s,n,a,r,E;function h(){var e=O();if(e){var t=w.popups.get("table.edit");if(t||(t=p()),t){w.popups.setContainer("table.edit",w.$sc);var l=M(e),a=(l.left+l.right)/2,s=l.bottom;w.popups.show("table.edit",a,s,l.bottom-l.top),w.edit.isDisabled()&&(1<J().length&&w.toolbar.disable(),w.$el.removeClass("fr-no-selection"),w.edit.on(),w.button.bulkRefresh(),w.selection.setAtEnd(w.$el.find(".fr-selected-cell:last").get(0)),w.selection.restore())}}}function f(){var e,t,l,a,s=O();if(s){var n=w.popups.get("table.colors");n||(n=function(){var e="";0<w.opts.tableColorsButtons.length&&(e='<div class="fr-buttons fr-table-colors-buttons">'+w.button.buildList(w.opts.tableColorsButtons)+"</div>");var t="";w.opts.colorsHEXInput&&(t='<div class="fr-table-colors-hex-layer fr-active fr-layer" id="fr-table-colors-hex-layer-'+w.id+'"><div class="fr-input-line"><input maxlength="7" id="fr-table-colors-hex-layer-text-'+w.id+'" type="text" placeholder="'+w.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">'+w.language.translate("OK")+"</button></div></div>");var l={buttons:e,colors:function(){for(var e='<div class="fr-table-colors">',t=0;t<w.opts.tableColors.length;t++)0!==t&&t%w.opts.tableColorsStep==0&&(e+="<br>"),"REMOVE"!=w.opts.tableColors[t]?e+='<span class="fr-command" style="background: '+w.opts.tableColors[t]+';" tabIndex="-1" role="button" data-cmd="tableCellBackgroundColor" data-param1="'+w.opts.tableColors[t]+'"><span class="fr-sr-only">'+w.language.translate("Color")+" "+w.opts.tableColors[t]+" </span></span>":e+='<span class="fr-command" data-cmd="tableCellBackgroundColor" tabIndex="-1" role="button" data-param1="REMOVE" title="'+w.language.translate("Clear Formatting")+'">'+w.icon.create("tableColorRemove")+'<span class="fr-sr-only">'+w.language.translate("Clear Formatting")+"</span></span>";return e+="</div>"}(),custom_color:t},a=w.popups.create("table.colors",l);return w.events.$on(w.$wp,"scroll.table-colors",function(){w.popups.isVisible("table.colors")&&f()}),u=a,w.events.on("popup.tab",function(e){var t=Z(e.currentTarget);if(!w.popups.isVisible("table.colors")||!t.is("span"))return!0;var l=e.which,a=!0;if(Z.FE.KEYCODE.TAB==l){var s=u.find(".fr-buttons");a=!w.accessibility.focusToolbar(s,!!e.shiftKey)}else if(Z.FE.KEYCODE.ARROW_UP==l||Z.FE.KEYCODE.ARROW_DOWN==l||Z.FE.KEYCODE.ARROW_LEFT==l||Z.FE.KEYCODE.ARROW_RIGHT==l){var n=t.parent().find("span.fr-command"),r=n.index(t),o=w.opts.colorsStep,i=Math.floor(n.length/o),f=r%o,c=Math.floor(r/o),d=c*o+f,p=i*o;Z.FE.KEYCODE.ARROW_UP==l?d=((d-o)%p+p)%p:Z.FE.KEYCODE.ARROW_DOWN==l?d=(d+o)%p:Z.FE.KEYCODE.ARROW_LEFT==l?d=((d-1)%p+p)%p:Z.FE.KEYCODE.ARROW_RIGHT==l&&(d=(d+1)%p);var h=Z(n.get(d));w.events.disableBlur(),h.focus(),a=!1}else Z.FE.KEYCODE.ENTER==l&&(w.button.exec(t),a=!1);return!1===a&&(e.preventDefault(),e.stopPropagation()),a},!0),a;var u}()),w.popups.setContainer("table.colors",w.$sc);var r=M(s),o=(r.left+r.right)/2,i=r.bottom;e=w.popups.get("table.colors"),t=w.$el.find(".fr-selected-cell:first"),l=w.helpers.RGBToHex(t.css("background-color")),a=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="'+l+'"]').addClass("fr-selected-color fr-active-item"),a.val(l).trigger("change"),w.popups.show("table.colors",o,i,r.bottom-r.top)}}function i(){0===J().length&&w.toolbar.enable()}function c(e){if(e)return w.popups.onHide("table.insert",function(){w.popups.get("table.insert").find('.fr-table-size .fr-select-table-size > span[data-row="1"][data-col="1"]').trigger("mouseenter")}),!0;var t="";0<w.opts.tableInsertButtons.length&&(t='<div class="fr-buttons">'+w.button.buildList(w.opts.tableInsertButtons)+"</div>");var l,a={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<=w.opts.tableInsertMaxSize;t++){for(var l=1;l<=w.opts.tableInsertMaxSize;l++){var a="inline-block";2<t&&!w.helpers.isMobile()&&(a="none");var s="fr-table-cell ";1==t&&1==l&&(s+=" hover"),e+='<span class="fr-command '+s+'" tabIndex="-1" data-cmd="tableInsert" data-row="'+t+'" data-col="'+l+'" data-param1="'+t+'" data-param2="'+l+'" style="display: '+a+';" role="button"><span></span><span class="fr-sr-only">'+t+" × "+l+" </span></span>"}e+='<div class="new-line"></div>'}return e+="</div></div>"}()},s=w.popups.create("table.insert",a);return w.events.$on(s,"mouseenter",".fr-table-size .fr-select-table-size .fr-table-cell",function(e){d(Z(e.currentTarget))},!0),l=s,w.events.$on(l,"focus","[tabIndex]",function(e){var t=Z(e.currentTarget);d(t)}),w.events.on("popup.tab",function(e){var t=Z(e.currentTarget);if(!w.popups.isVisible("table.insert")||!t.is("span, a"))return!0;var l,a=e.which;if(Z.FE.KEYCODE.ARROW_UP==a||Z.FE.KEYCODE.ARROW_DOWN==a||Z.FE.KEYCODE.ARROW_LEFT==a||Z.FE.KEYCODE.ARROW_RIGHT==a){if(t.is("span.fr-table-cell")){var s=t.parent().find("span.fr-table-cell"),n=s.index(t),r=w.opts.tableInsertMaxSize,o=n%r,i=Math.floor(n/r);Z.FE.KEYCODE.ARROW_UP==a?i=Math.max(0,i-1):Z.FE.KEYCODE.ARROW_DOWN==a?i=Math.min(w.opts.tableInsertMaxSize-1,i+1):Z.FE.KEYCODE.ARROW_LEFT==a?o=Math.max(0,o-1):Z.FE.KEYCODE.ARROW_RIGHT==a&&(o=Math.min(w.opts.tableInsertMaxSize-1,o+1));var f=i*r+o,c=Z(s.get(f));d(c),w.events.disableBlur(),c.focus(),l=!1}}else Z.FE.KEYCODE.ENTER==a&&(w.button.exec(t),l=!1);return!1===l&&(e.preventDefault(),e.stopPropagation()),l},!0),s}function d(e){var t=e.data("row"),l=e.data("col"),a=e.parent();a.siblings(".fr-table-size-info").html(t+" × "+l),a.find("> span").removeClass("hover fr-active-item");for(var s=1;s<=w.opts.tableInsertMaxSize;s++)for(var n=0;n<=w.opts.tableInsertMaxSize;n++){var r=a.find('> span[data-row="'+s+'"][data-col="'+n+'"]');s<=t&&n<=l?r.addClass("hover"):s<=t+1||s<=2&&!w.helpers.isMobile()?r.css("display","inline-block"):2<s&&!w.helpers.isMobile()&&r.css("display","none")}e.addClass("fr-active-item")}function p(e){if(e)return w.popups.onHide("table.edit",i),!0;if(0<w.opts.tableEditButtons.length){var t={buttons:'<div class="fr-buttons">'+w.button.buildList(w.opts.tableEditButtons)+"</div>"},l=w.popups.create("table.edit",t);return w.events.$on(w.$wp,"scroll.table-edit",function(){w.popups.isVisible("table.edit")&&h()}),l}return!1}function u(){if(0<J().length){var e=Q();w.selection.setBefore(e.get(0))||w.selection.setAfter(e.get(0)),w.selection.restore(),w.popups.hide("table.edit"),e.remove(),w.toolbar.enable()}}function b(e){var t=Q();if(0<t.length){if(0<w.$el.find("th.fr-selected-cell").length&&"above"==e)return;var l,a,s,n=O(),r=$(n);a="above"==e?r.min_i:r.max_i;var o="<tr>";for(l=0;l<n[a].length;l++){if("below"==e&&a<n.length-1&&n[a][l]==n[a+1][l]||"above"==e&&0<a&&n[a][l]==n[a-1][l]){if(0===l||0<l&&n[a][l]!=n[a][l-1]){var i=Z(n[a][l]);i.attr("rowspan",parseInt(i.attr("rowspan"),10)+1)}}else o+='<td style="'+Z(n[a][l]).attr("style")+'" ><br></td>'}o+="</tr>",s=0<w.$el.find("th.fr-selected-cell").length&&"below"==e?Z(t.find("tbody").not(t.find("table tbody"))):Z(t.find("tr").not(t.find("table tr")).get(a)),"below"==e?"TBODY"==s.prop("tagName")?s.prepend(o):s.after(o):"above"==e&&(s.before(o),w.popups.isVisible("table.edit")&&h())}}function g(e,t,l){var a,s,n,r,o,i=0,f=O(l);if(e<(t=Math.min(t,f[0].length-1)))for(s=e;s<=t;s++)if(!(e<s&&f[0][s]==f[0][s-1])&&1<(r=Math.min(parseInt(f[0][s].getAttribute("colspan"),10)||1,t-e+1))&&f[0][s]==f[0][s+1])for(i=r-1,a=1;a<f.length;a++)if(f[a][s]!=f[a-1][s]){for(n=s;n<s+r;n++)if(1<(o=parseInt(f[a][n].getAttribute("colspan"),10)||1)&&f[a][n]==f[a][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,l){var a,s,n,r,o,i=0,f=O(l);if(e<(t=Math.min(t,f.length-1)))for(a=e;a<=t;a++)if(!(e<a&&f[a][0]==f[a-1][0])&&1<(r=Math.min(parseInt(f[a][0].getAttribute("rowspan"),10)||1,t-e+1))&&f[a][0]==f[a+1][0])for(i=r-1,s=1;s<f[0].length;s++)if(f[a][s]!=f[a][s-1]){for(n=a;n<a+r;n++)if(1<(o=parseInt(f[n][s].getAttribute("rowspan"),10)||1)&&f[n][s]==f[n+1][s])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,l,a,s,n,r){var o,i,f;for(o=a;o<=s;o++)for(i=n;i<=r;i++)a<o&&e[o][i]==e[o-1][i]||n<i&&e[o][i]==e[o][i-1]||1<(f=parseInt(e[o][i].getAttribute(l),10)||1)&&(1<f-t?e[o][i].setAttribute(l,f-t):e[o][i].removeAttribute(l))}function R(e,t,l,a,s){m(e,t,s),g(l,a,s)}function t(e){var t=w.$el.find(".fr-selected-cell");"REMOVE"!=e?t.css("background-color",w.helpers.HEXtoRGB(e)):t.css("background-color",""),h()}function O(e){var f=[];return null==(e=e||null)&&0<J().length&&(e=Q()),e&&e.find("tr:visible").not(e.find("table tr")).each(function(o,e){var t=Z(e),i=0;t.find("> th, > td").each(function(e,t){for(var l=Z(t),a=parseInt(l.attr("colspan"),10)||1,s=parseInt(l.attr("rowspan"),10)||1,n=o;n<o+s;n++)for(var r=i;r<i+a;r++)f[n]||(f[n]=[]),f[n][r]?i++:f[n][r]=t;i+=a})}),f}function A(e,t){for(var l=0;l<t.length;l++)for(var a=0;a<t[l].length;a++)if(t[l][a]==e)return{row:l,col:a}}function F(e,t,l){for(var a=e+1,s=t+1;a<l.length;){if(l[a][t]!=l[e][t]){a--;break}a++}for(a==l.length&&a--;s<l[e].length;){if(l[e][s]!=l[e][t]){s--;break}s++}return s==l[e].length&&s--,{row:a,col:s}}function x(){w.el.querySelector(".fr-cell-fixed")&&w.el.querySelector(".fr-cell-fixed").classList.remove("fr-cell-fixed"),w.el.querySelector(".fr-cell-handler")&&w.el.querySelector(".fr-cell-handler").classList.remove("fr-cell-handler")}function D(){var e=w.$el.find(".fr-selected-cell");0<e.length&&e.each(function(){var e=Z(this);e.removeClass("fr-selected-cell"),""===e.attr("class")&&e.removeAttr("class")}),x()}function y(){w.events.disableBlur(),w.selection.clear(),w.$el.addClass("fr-no-selection"),w.$el.blur(),w.events.enableBlur()}function $(e){var t=w.$el.find(".fr-selected-cell");if(0<t.length){var l,a=e.length,s=0,n=e[0].length,r=0;for(l=0;l<t.length;l++){var o=A(t[l],e),i=F(o.row,o.col,e);a=Math.min(o.row,a),s=Math.max(i.row,s),n=Math.min(o.col,n),r=Math.max(i.col,r)}return{min_i:a,max_i:s,min_j:n,max_j:r}}return null}function M(e){var t=$(e),l=Z(e[t.min_i][t.min_j]),a=Z(e[t.min_i][t.max_j]),s=Z(e[t.max_i][t.min_j]);return{left:l.offset().left,right:a.offset().left+a.outerWidth(),top:l.offset().top,bottom:s.offset().top+s.outerHeight()}}function _(t,l){if(Z(t).is(l))D(),Z(t).addClass("fr-selected-cell");else{y(),w.edit.off();var a=O(),s=A(t,a),n=A(l,a),r=function e(t,l,a,s,n){var r,o,i,f,c=t,d=l,p=a,h=s;for(r=c;r<=d;r++)(1<(parseInt(Z(n[r][p]).attr("rowspan"),10)||1)||1<(parseInt(Z(n[r][p]).attr("colspan"),10)||1))&&(f=F((i=A(n[r][p],n)).row,i.col,n),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(Z(n[r][h]).attr("rowspan"),10)||1)||1<(parseInt(Z(n[r][h]).attr("colspan"),10)||1))&&(f=F((i=A(n[r][h],n)).row,i.col,n),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h));for(o=p;o<=h;o++)(1<(parseInt(Z(n[c][o]).attr("rowspan"),10)||1)||1<(parseInt(Z(n[c][o]).attr("colspan"),10)||1))&&(f=F((i=A(n[c][o],n)).row,i.col,n),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(Z(n[d][o]).attr("rowspan"),10)||1)||1<(parseInt(Z(n[d][o]).attr("colspan"),10)||1))&&(f=F((i=A(n[d][o],n)).row,i.col,n),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h));return c==t&&d==l&&p==a&&h==s?{min_i:t,max_i:l,min_j:a,max_j:s}:e(c,d,p,h,n)}(Math.min(s.row,n.row),Math.max(s.row,n.row),Math.min(s.col,n.col),Math.max(s.col,n.col),a);D(),t.classList.add("fr-cell-fixed"),l.classList.add("fr-cell-handler");for(var o=r.min_i;o<=r.max_i;o++)for(var i=r.min_j;i<=r.max_j;i++)Z(a[o][i]).addClass("fr-selected-cell")}}function I(e){var t=null,l=Z(e.target);return"TD"==e.target.tagName||"TH"==e.target.tagName?t=e.target:0<l.closest("td").length?t=l.closest("td").get(0):0<l.closest("th").length&&(t=l.closest("th").get(0)),0===w.$el.find(t).length?null:t}function S(){D(),w.popups.hide("table.edit")}function e(e){var t=I(e);if("false"==Z(t).parents("[contenteditable]:not(.fr-element):not(.fr-img-caption):not(body):first").attr("contenteditable"))return!0;if(0<J().length&&!t&&S(),!w.edit.isDisabled()||w.popups.isVisible("table.edit"))if(1!=e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)(3==e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)&&t&&S();else if(n=!0,t){0<J().length&&!e.shiftKey&&S(),e.stopPropagation(),w.events.trigger("image.hideResizer"),w.events.trigger("video.hideResizer"),s=!0;var l=t.tagName.toLowerCase();e.shiftKey&&0<w.$el.find(l+".fr-selected-cell").length?Z(w.$el.find(l+".fr-selected-cell").closest("table")).is(Z(t).closest("table"))?_(a,t):y():((w.keys.ctrlKey(e)||e.shiftKey)&&(1<J().length||0===Z(t).find(w.selection.element()).length&&!Z(t).is(w.selection.element()))&&y(),a=t,0<w.opts.tableEditButtons.length&&_(a,a))}}function l(e){if(w.popups.areVisible())return!0;if(s||w.$tb.is(e.target)||w.$tb.is(Z(e.target).closest(w.$tb.get(0)))||(0<J().length&&w.toolbar.enable(),D()),!(1!=e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)){if(n=!1,s)s=!1,I(e)||1!=J().length?0<J().length&&(w.selection.isCollapsed()?h():D()):D();if(E){E=!1,C.removeClass("fr-moving"),w.$el.removeClass("fr-no-selection"),w.edit.on();var t=parseFloat(C.css("left"))+w.opts.tableResizerOffset+w.$wp.offset().left;w.opts.iframe&&(t-=w.$iframe.offset().left),C.data("release-position",t),C.removeData("max-left"),C.removeData("max-right"),function(){var e=C.data("origin"),t=C.data("release-position");if(e!==t){var l=C.data("first"),a=C.data("second"),s=C.data("table"),n=s.outerWidth();if(w.undo.canDo()||w.undo.saveStep(),null!==l&&null!==a){var r,o,i,f=O(s),c=[],d=[],p=[],h=[];for(r=0;r<f.length;r++)o=Z(f[r][l]),i=Z(f[r][a]),c[r]=o.outerWidth(),p[r]=i.outerWidth(),d[r]=c[r]/n*100,h[r]=p[r]/n*100;for(r=0;r<f.length;r++)if(o=Z(f[r][l]),i=Z(f[r][a]),f[r][l]!=f[r][a]){var u=(d[r]*(c[r]+t-e)/c[r]).toFixed(4);o.css("width",u+"%"),i.css("width",(d[r]+h[r]-u).toFixed(4)+"%")}}else{var b,g=s.parent(),m=n/g.width()*100,v=(parseInt(s.css("margin-left"),10)||0)/g.width()*100,E=(parseInt(s.css("margin-right"),10)||0)/g.width()*100;"rtl"==w.opts.direction&&0===a||"rtl"!=w.opts.direction&&0!==a?(b=(n+t-e)/n*m,s.css("margin-right","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(v).toFixed(4)+"%)")):("rtl"==w.opts.direction&&0!==a||"rtl"!=w.opts.direction&&0===a)&&(b=(n-t+e)/n*m,s.css("margin-left","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(E).toFixed(4)+"%)")),s.css("width",Math.round(b).toFixed(4)+"%")}w.selection.restore(),w.undo.saveStep(),w.events.trigger("table.resized",[s.get(0)])}C.removeData("origin"),C.removeData("release-position"),C.removeData("first"),C.removeData("second"),C.removeData("table")}(),W()}}}function T(e){if(!0===s&&0<w.opts.tableEditButtons.length){if(Z(e.currentTarget).closest("table").is(Q())){if("TD"==e.currentTarget.tagName&&0===w.$el.find("th.fr-selected-cell").length)return void _(a,e.currentTarget);if("TH"==e.currentTarget.tagName&&0===w.$el.find("td.fr-selected-cell").length)return void _(a,e.currentTarget)}y()}}function N(e,t,l,a){for(var s,n=t;n!=w.el&&"TD"!=n.tagName&&"TH"!=n.tagName&&("up"==a?s=n.previousElementSibling:"down"==a&&(s=n.nextElementSibling),!s);)n=n.parentNode;"TD"==n.tagName||"TH"==n.tagName?function(e,t){for(var l=e;l&&"TABLE"!=l.tagName&&l.parentNode!=w.el;)l=l.parentNode;if(l&&"TABLE"==l.tagName){var a=O(Z(l));"up"==t?B(A(e,a),l,a):"down"==t&&z(A(e,a),l,a)}}(n,a):s&&("up"==a&&w.selection.setAtEnd(s),"down"==a&&w.selection.setAtStart(s))}function B(e,t,l){0<e.row?w.selection.setAtEnd(l[e.row-1][e.col]):N(0,t,0,"up")}function z(e,t,l){var a=parseInt(l[e.row][e.col].getAttribute("rowspan"),10)||1;e.row<l.length-a?w.selection.setAtStart(l[e.row+a][e.col]):N(0,t,0,"down")}function W(){C&&(C.find("div").css("opacity",0),C.css("top",0),C.css("left",0),C.css("height",0),C.find("div").css("height",0),C.hide())}function k(){o&&o.removeClass("fr-visible").css("left","-9999px")}function K(e,t){var l=Z(t),a=l.closest("table"),s=a.parent();if(t&&"TD"!=t.tagName&&"TH"!=t.tagName&&(0<l.closest("td").length?t=l.closest("td"):0<l.closest("th").length&&(t=l.closest("th"))),!t||"TD"!=t.tagName&&"TH"!=t.tagName)C&&l.get(0)!=C.get(0)&&l.parent().get(0)!=C.get(0)&&w.core.sameInstance(C)&&W();else{if(l=Z(t),0===w.$el.find(l).length)return!1;var n=l.offset().left-1,r=n+l.outerWidth();if(Math.abs(e.pageX-n)<=w.opts.tableResizerOffset||Math.abs(r-e.pageX)<=w.opts.tableResizerOffset){var o,i,f,c,d,p=O(a),h=A(t,p),u=F(h.row,h.col,p),b=a.offset().top,g=a.outerHeight()-1;"rtl"!=w.opts.direction?e.pageX-n<=w.opts.tableResizerOffset?(f=n,0<h.col?(c=n-j(h.col-1,p)+w.opts.tableResizingLimit,d=n+j(h.col,p)-w.opts.tableResizingLimit,o=h.col-1,i=h.col):(o=null,i=0,c=a.offset().left-1-parseInt(a.css("margin-left"),10),d=a.offset().left-1+a.width()-p[0].length*w.opts.tableResizingLimit)):r-e.pageX<=w.opts.tableResizerOffset&&(f=r,u.col<p[u.row].length&&p[u.row][u.col+1]?(c=r-j(u.col,p)+w.opts.tableResizingLimit,d=r+j(u.col+1,p)-w.opts.tableResizingLimit,o=u.col,i=u.col+1):(o=u.col,i=null,c=a.offset().left-1+p[0].length*w.opts.tableResizingLimit,d=s.offset().left-1+s.width()+parseFloat(s.css("padding-left")))):r-e.pageX<=w.opts.tableResizerOffset?(f=r,0<h.col?(c=r-j(h.col,p)+w.opts.tableResizingLimit,d=r+j(h.col-1,p)-w.opts.tableResizingLimit,o=h.col,i=h.col-1):(o=null,i=0,c=a.offset().left+p[0].length*w.opts.tableResizingLimit,d=s.offset().left-1+s.width()+parseFloat(s.css("padding-left")))):e.pageX-n<=w.opts.tableResizerOffset&&(f=n,u.col<p[u.row].length&&p[u.row][u.col+1]?(c=n-j(u.col+1,p)+w.opts.tableResizingLimit,d=n+j(u.col,p)-w.opts.tableResizingLimit,o=u.col+1,i=u.col):(o=u.col,i=null,c=s.offset().left+parseFloat(s.css("padding-left")),d=a.offset().left-1+a.width()-p[0].length*w.opts.tableResizingLimit)),C||(w.shared.$table_resizer||(w.shared.$table_resizer=Z('<div class="fr-table-resizer"><div></div></div>')),C=w.shared.$table_resizer,w.events.$on(C,"mousedown",function(e){return!w.core.sameInstance(C)||(0<J().length&&S(),1==e.which?(w.selection.save(),E=!0,C.addClass("fr-moving"),y(),w.edit.off(),C.find("div").css("opacity",1),!1):void 0)}),w.events.$on(C,"mousemove",function(e){if(!w.core.sameInstance(C))return!0;E&&(w.opts.iframe&&(e.pageX-=w.$iframe.offset().left),X(e))}),w.events.on("shared.destroy",function(){C.html("").removeData().remove(),C=null},!0),w.events.on("destroy",function(){w.$el.find(".fr-selected-cell").removeClass("fr-selected-cell"),C.hide().appendTo(Z("body:first"))},!0)),C.data("table",a),C.data("first",o),C.data("second",i),C.data("instance",w),w.$wp.append(C);var m=f-w.win.pageXOffset-w.opts.tableResizerOffset-w.$wp.offset().left,v=b-w.$wp.offset().top+w.$wp.scrollTop();w.opts.iframe&&(m+=w.$iframe.offset().left,v+=w.$iframe.offset().top,c+=w.$iframe.offset().left,d+=w.$iframe.offset().left),C.data("max-left",c),C.data("max-right",d),C.data("origin",f-w.win.pageXOffset),C.css("top",v),C.css("left",m),C.css("height",g),C.find("div").css("height",g),C.css("padding-left",w.opts.tableResizerOffset),C.css("padding-right",w.opts.tableResizerOffset),C.show()}else w.core.sameInstance(C)&&W()}}function L(e,t){if(w.$box.find(".fr-line-breaker").is(":visible"))return!1;o||q(),w.$box.append(o),o.data("instance",w);var l,a=Z(t).find("tr:first"),s=e.pageX,n=0,r=0;w.opts.iframe&&(n+=w.$iframe.offset().left-w.helpers.scrollLeft(),r+=w.$iframe.offset().top-w.helpers.scrollTop()),a.find("th, td").each(function(){var e=Z(this);return e.offset().left<=s&&s<e.offset().left+e.outerWidth()/2?(l=parseInt(o.find("a").css("width"),10),o.css("top",r+e.offset().top-w.$box.offset().top-l-5),o.css("left",n+e.offset().left-w.$box.offset().left-l/2),o.data("selected-cell",e),o.data("position","before"),o.addClass("fr-visible"),!1):e.offset().left+e.outerWidth()/2<=s&&s<e.offset().left+e.outerWidth()?(l=parseInt(o.find("a").css("width"),10),o.css("top",r+e.offset().top-w.$box.offset().top-l-5),o.css("left",n+e.offset().left-w.$box.offset().left+e.outerWidth()-l/2),o.data("selected-cell",e),o.data("position","after"),o.addClass("fr-visible"),!1):void 0})}function H(e,t){if(w.$box.find(".fr-line-breaker").is(":visible"))return!1;o||q(),w.$box.append(o),o.data("instance",w);var l,a=Z(t),s=e.pageY,n=0,r=0;w.opts.iframe&&(n+=w.$iframe.offset().left-w.helpers.scrollLeft(),r+=w.$iframe.offset().top-w.helpers.scrollTop()),a.find("tr").each(function(){var e=Z(this);return e.offset().top<=s&&s<e.offset().top+e.outerHeight()/2?(l=parseInt(o.find("a").css("width"),10),o.css("top",r+e.offset().top-w.$box.offset().top-l/2),o.css("left",n+e.offset().left-w.$box.offset().left-l-5),o.data("selected-cell",e.find("td:first")),o.data("position","above"),o.addClass("fr-visible"),!1):e.offset().top+e.outerHeight()/2<=s&&s<e.offset().top+e.outerHeight()?(l=parseInt(o.find("a").css("width"),10),o.css("top",r+e.offset().top-w.$box.offset().top+e.outerHeight()-l/2),o.css("left",n+e.offset().left-w.$box.offset().left-l-5),o.data("selected-cell",e.find("td:first")),o.data("position","below"),o.addClass("fr-visible"),!1):void 0})}function Y(e){r=null;var t=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset,e.pageY-w.win.pageYOffset);w.opts.tableResizer&&(!w.popups.areVisible()||w.popups.areVisible()&&w.popups.isVisible("table.edit"))&&K(e,t),!w.opts.tableInsertHelper||w.popups.areVisible()||w.$tb.hasClass("fr-inline")&&w.$tb.is(":visible")||function(e,t){if(0===J().length){var l,a,s;if(t&&("HTML"==t.tagName||"BODY"==t.tagName||w.node.isElement(t)))for(l=1;l<=w.opts.tableInsertHelperOffset;l++){if(a=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset,e.pageY-w.win.pageYOffset+l),Z(a).hasClass("fr-tooltip"))return;if(a&&("TH"==a.tagName||"TD"==a.tagName||"TABLE"==a.tagName)&&(Z(a).parents(".fr-wrapper").length||w.opts.iframe))return L(e,Z(a).closest("table"));if(s=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset+l,e.pageY-w.win.pageYOffset),Z(s).hasClass("fr-tooltip"))return;if(s&&("TH"==s.tagName||"TD"==s.tagName||"TABLE"==s.tagName)&&(Z(s).parents(".fr-wrapper").length||w.opts.iframe))return H(e,Z(s).closest("table"))}w.core.sameInstance(o)&&k()}}(e,t)}function P(){if(E){var e=C.data("table").offset().top-w.win.pageYOffset;w.opts.iframe&&(e+=w.$iframe.offset().top-w.helpers.scrollTop()),C.css("top",e)}}function j(e,t){var l,a=Z(t[0][e]).outerWidth();for(l=1;l<t.length;l++)a=Math.min(a,Z(t[l][e]).outerWidth());return a}function V(e,t,l){var a,s=0;for(a=e;a<=t;a++)s+=j(a,l);return s}function X(e){if(1<J().length&&n&&y(),!1===n&&!1===s&&!1===E)r&&clearTimeout(r),w.edit.isDisabled()&&!w.popups.isVisible("table.edit")||(r=setTimeout(Y,30,e));else if(E){var t=e.pageX-w.win.pageXOffset;w.opts.iframe&&(t+=w.$iframe.offset().left);var l=C.data("max-left"),a=C.data("max-right");l<=t&&t<=a?C.css("left",t-w.opts.tableResizerOffset-w.$wp.offset().left):t<l&&parseFloat(C.css("left"),10)>l-w.opts.tableResizerOffset?C.css("left",l-w.opts.tableResizerOffset-w.$wp.offset().left):a<t&&parseFloat(C.css("left"),10)<a-w.opts.tableResizerOffset&&C.css("left",a-w.opts.tableResizerOffset-w.$wp.offset().left)}else n&&k()}function U(e){w.node.isEmpty(e.get(0))?e.prepend(Z.FE.MARKERS):e.prepend(Z.FE.START_MARKER).append(Z.FE.END_MARKER)}function q(){w.shared.$ti_helper||(w.shared.$ti_helper=Z('<div class="fr-insert-helper"><a class="fr-floating-btn" role="button" tabIndex="-1" title="'+w.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></div>'),w.events.bindClick(w.shared.$ti_helper,"a",function(){var e=o.data("selected-cell"),t=o.data("position"),l=o.data("instance")||w;"before"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertColumn(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"after"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertColumn(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"above"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertRow(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"below"==t&&(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertRow(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()),k()}),w.events.on("shared.destroy",function(){w.shared.$ti_helper.html("").removeData().remove(),w.shared.$ti_helper=null},!0),w.events.$on(w.shared.$ti_helper,"mousemove",function(e){e.stopPropagation()},!0),w.events.$on(Z(w.o_win),"scroll",function(){k()},!0),w.events.$on(w.$wp,"scroll",function(){k()},!0)),o=w.shared.$ti_helper,w.events.on("destroy",function(){o=null}),w.tooltip.bind(w.$box,".fr-insert-helper > a.fr-floating-btn")}function G(){a=null,clearTimeout(r)}function J(){return w.el.querySelectorAll(".fr-selected-cell")}function Q(){var e=J();if(e.length){for(var t=e[0];t&&"TABLE"!=t.tagName&&t.parentNode!=w.el;)t=t.parentNode;return t&&"TABLE"==t.tagName?Z(t):Z([])}return Z([])}return{_init:function(){if(!w.$wp)return!1;if(!w.helpers.isMobile()){E=s=n=!1,w.events.$on(w.$el,"mousedown",e),w.popups.onShow("image.edit",function(){D(),s=n=!1}),w.popups.onShow("link.edit",function(){D(),s=n=!1}),w.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&D()}),w.events.$on(w.$el,"mouseenter","th, td",T),w.events.$on(w.$win,"mouseup",l),w.opts.iframe&&w.events.$on(Z(w.o_win),"mouseup",l),w.events.$on(w.$win,"mousemove",X),w.events.$on(Z(w.o_win),"scroll",P),w.events.on("contentChanged",function(){0<J().length&&(h(),w.$el.find("img").on("load.selected-cells",function(){Z(this).off("load.selected-cells"),0<J().length&&h()}))}),w.events.$on(Z(w.o_win),"resize",function(){D()}),w.events.on("toolbar.esc",function(){if(0<J().length)return w.events.disableBlur(),w.events.focus(),!1},!0),w.events.$on(Z(w.o_win),"keydown",function(){n&&s&&(s=n=!1,w.$el.removeClass("fr-no-selection"),w.edit.on(),w.selection.setAtEnd(w.$el.find(".fr-selected-cell:last").get(0)),w.selection.restore(),D())}),w.events.$on(w.$el,"keydown",function(e){e.shiftKey?!1===function(e){var t=J();if(0<t.length){var l,a,s=O(),n=e.which;1==t.length?a=l=t[0]:(l=w.el.querySelector(".fr-cell-fixed"),a=w.el.querySelector(".fr-cell-handler"));var r=A(a,s);if(Z.FE.KEYCODE.ARROW_RIGHT==n){if(r.col<s[0].length-1)return _(l,s[r.row][r.col+1]),!1}else if(Z.FE.KEYCODE.ARROW_DOWN==n){if(r.row<s.length-1)return _(l,s[r.row+1][r.col]),!1}else if(Z.FE.KEYCODE.ARROW_LEFT==n){if(0<r.col)return _(l,s[r.row][r.col-1]),!1}else if(Z.FE.KEYCODE.ARROW_UP==n&&0<r.row)return _(l,s[r.row-1][r.col]),!1}}(e)&&setTimeout(function(){h()},0):function(e){var t=e.which,l=w.selection.blocks();if(l.length&&("TD"==(l=l[0]).tagName||"TH"==l.tagName)){for(var a=l;a&&"TABLE"!=a.tagName&&a.parentNode!=w.el;)a=a.parentNode;if(a&&"TABLE"==a.tagName&&(Z.FE.KEYCODE.ARROW_LEFT==t||Z.FE.KEYCODE.ARROW_UP==t||Z.FE.KEYCODE.ARROW_RIGHT==t||Z.FE.KEYCODE.ARROW_DOWN==t)&&(0<J().length&&S(),w.browser.webkit&&(Z.FE.KEYCODE.ARROW_UP==t||Z.FE.KEYCODE.ARROW_DOWN==t))){var s=w.selection.ranges(0).startContainer;if(s.nodeType==Node.TEXT_NODE&&(Z.FE.KEYCODE.ARROW_UP==t&&(s.previousSibling&&"BR"!==s.previousSibling.tagName||s.previousSibling&&"BR"===s.previousSibling.tagName&&s.previousSibling.previousSibling)||Z.FE.KEYCODE.ARROW_DOWN==t&&(s.nextSibling&&"BR"!==s.nextSibling.tagName||s.nextSibling&&"BR"===s.nextSibling.tagName&&s.nextSibling.nextSibling)))return;e.preventDefault(),e.stopPropagation();var n=O(Z(a)),r=A(l,n);Z.FE.KEYCODE.ARROW_UP==t?B(r,a,n):Z.FE.KEYCODE.ARROW_DOWN==t&&z(r,a,n),w.selection.restore()}}}(e)}),w.events.on("keydown",function(e){if(!1===function(e){if(e.which==Z.FE.KEYCODE.TAB){var t;if(0<J().length)t=w.$el.find(".fr-selected-cell:last");else{var l=w.selection.element();"TD"==l.tagName||"TH"==l.tagName?t=Z(l):l!=w.el&&(0<Z(l).parentsUntil(w.$el,"td").length?t=Z(l).parents("td:first"):0<Z(l).parentsUntil(w.$el,"th").length&&(t=Z(l).parents("th:first")))}if(t)return e.preventDefault(),!!(0===w.selection.get().focusOffset&&0<Z(w.selection.element()).parentsUntil(w.$el,"ol, ul").length&&(0<Z(w.selection.element()).closest("li").prev().length||Z(w.selection.element()).is("li")&&0<Z(w.selection.element()).prev().length))||(S(),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"))),w.selection.restore(),!1)}}(e))return!1;var t=J();if(0<t.length){if(0<t.length&&w.keys.ctrlKey(e)&&e.which==Z.FE.KEYCODE.A)return D(),w.popups.isVisible("table.edit")&&w.popups.hide("table.edit"),t=[],!0;if(e.which==Z.FE.KEYCODE.ESC&&w.popups.isVisible("table.edit"))return D(),w.popups.hide("table.edit"),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!(t=[]);if(1<t.length&&(e.which==Z.FE.KEYCODE.BACKSPACE||e.which==Z.FE.KEYCODE.DELETE)){w.undo.saveStep();for(var l=0;l<t.length;l++)Z(t[l]).html("<br>"),l==t.length-1&&Z(t[l]).prepend(Z.FE.MARKERS);return w.selection.restore(),w.undo.saveStep(),!(t=[])}if(1<t.length&&e.which!=Z.FE.KEYCODE.F10&&!w.keys.isBrowserAction(e))return e.preventDefault(),!(t=[])}else if(!(t=[])===function(e){if(e.altKey&&e.which==Z.FE.KEYCODE.SPACE){var t,l=w.selection.element();if("TD"==l.tagName||"TH"==l.tagName?t=l:0<Z(l).closest("td").length?t=Z(l).closest("td").get(0):0<Z(l).closest("th").length&&(t=Z(l).closest("th").get(0)),t)return e.preventDefault(),_(t,t),h(),!1}}(e))return!1},!0);var t=[];w.events.on("html.beforeGet",function(){t=J();for(var e=0;e<t.length;e++)t[e].className=(t[e].className||"").replace(/fr-selected-cell/g,"")}),w.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=[]}),c(!0),p(!0)}w.events.on("destroy",G)},insert:function(e,t){var l,a,s="<table "+(w.opts.tableDefaultWidth?'style="width: '+w.opts.tableDefaultWidth+';" ':"")+'class="fr-inserted-table"><tbody>',n=100/t;for(l=0;l<e;l++){for(s+="<tr>",a=0;a<t;a++)s+="<td"+(w.opts.tableDefaultWidth?' style="width: '+n.toFixed(4)+'%;"':"")+">",0===l&&0===a&&(s+=Z.FE.MARKERS),s+="<br></td>";s+="</tr>"}s+="</tbody></table>",w.html.insert(s),w.selection.restore();var r=w.$el.find(".fr-inserted-table");r.removeClass("fr-inserted-table"),w.events.trigger("table.inserted",[r.get(0)])},remove:u,insertRow:b,deleteRow:function(){var e=Q();if(0<e.length){var t,l,a,s=O(),n=$(s);if(0===n.min_i&&n.max_i==s.length-1)u();else{for(t=n.max_i;t>=n.min_i;t--){for(a=Z(e.find("tr").not(e.find("table tr")).get(t)),l=0;l<s[t].length;l++)if(0===l||s[t][l]!=s[t][l-1]){var r=Z(s[t][l]);if(1<parseInt(r.attr("rowspan"),10)){var o=parseInt(r.attr("rowspan"),10)-1;1==o?r.removeAttr("rowspan"):r.attr("rowspan",o)}if(t<s.length-1&&s[t][l]==s[t+1][l]&&(0===t||s[t][l]!=s[t-1][l])){for(var i=s[t][l],f=l;0<f&&s[t][f]==s[t][f-1];)f--;0===f?Z(e.find("tr").not(e.find("table tr")).get(t+1)).prepend(i):Z(s[t+1][f-1]).after(i)}}var c=a.parent();a.remove(),0===c.find("tr").length&&c.remove(),s=O(e)}R(0,s.length-1,0,s[0].length-1,e),0<n.min_i?w.selection.setAtEnd(s[n.min_i-1][0]):w.selection.setAtEnd(s[0][0]),w.selection.restore(),w.popups.hide("table.edit")}}},insertColumn:function(i){var e=Q();if(0<e.length){var f,c=O(),t=$(c);f="before"==i?t.min_j:t.max_j;var l,d=100/c[0].length,p=100/(c[0].length+1);e.find("th, td").each(function(){(l=Z(this)).data("old-width",l.outerWidth()/e.outerWidth()*100)}),e.find("tr").not(e.find("table tr")).each(function(e){for(var t,l=Z(this),a=0,s=0;a-1<f;){if(!(t=l.find("> th, > td").get(s))){t=null;break}t==c[e][a]?(a+=parseInt(Z(t).attr("colspan"),10)||1,s++):(a+=parseInt(Z(c[e][a]).attr("colspan"),10)||1,"after"==i&&(t=0===s?-1:l.find("> th, > td").get(s-1)))}var n,r=Z(t);if("after"==i&&f<a-1||"before"==i&&0<f&&c[e][f]==c[e][f-1]){if(0===e||0<e&&c[e][f]!=c[e-1][f]){var o=parseInt(r.attr("colspan"),10)+1;r.attr("colspan",o),r.css("width",(r.data("old-width")*p/d+p).toFixed(4)+"%"),r.removeData("old-width")}}else n=0<l.find("th").length?'<th style="width: '+p.toFixed(4)+'%;"><br></th>':'<td style="width: '+p.toFixed(4)+'%;"><br></td>',-1==t?l.prepend(n):null==t?l.append(n):"before"==i?r.before(n):"after"==i&&r.after(n)}),e.find("th, td").each(function(){(l=Z(this)).data("old-width")&&(l.css("width",(l.data("old-width")*p/d).toFixed(4)+"%"),l.removeData("old-width"))}),w.popups.isVisible("table.edit")&&h()}},deleteColumn:function(){var e=Q();if(0<e.length){var t,l,a,s=O(),n=$(s);if(0===n.min_j&&n.max_j==s[0].length-1)u();else{var r=0;for(t=0;t<s.length;t++)for(l=0;l<s[0].length;l++)(a=Z(s[t][l])).hasClass("fr-selected-cell")||(a.data("old-width",a.outerWidth()/e.outerWidth()*100),(l<n.min_j||l>n.max_j)&&(r+=a.outerWidth()/e.outerWidth()*100));for(r/=s.length,l=n.max_j;l>=n.min_j;l--)for(t=0;t<s.length;t++)if(0===t||s[t][l]!=s[t-1][l])if(a=Z(s[t][l]),1<(parseInt(a.attr("colspan"),10)||1)){var o=parseInt(a.attr("colspan"),10)-1;1==o?a.removeAttr("colspan"):a.attr("colspan",o),a.css("width",(100*(a.data("old-width")-j(l,s))/r).toFixed(4)+"%"),a.removeData("old-width")}else{var i=Z(a.parent().get(0));a.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()}R(0,s.length-1,0,s[0].length-1,e),0<n.min_j?w.selection.setAtEnd(s[n.min_i][n.min_j-1]):w.selection.setAtEnd(s[n.min_i][0]),w.selection.restore(),w.popups.hide("table.edit"),e.find("th, td").each(function(){(a=Z(this)).data("old-width")&&(a.css("width",(100*a.data("old-width")/r).toFixed(4)+"%"),a.removeData("old-width"))})}}},mergeCells:function(){if(1<J().length&&(0===w.$el.find("th.fr-selected-cell").length||0===w.$el.find("td.fr-selected-cell").length)){x();var e,t,l=$(O()),a=w.$el.find(".fr-selected-cell"),s=Z(a[0]),n=s.parent().find(".fr-selected-cell"),r=s.closest("table"),o=s.html(),i=0;for(e=0;e<n.length;e++)i+=Z(n[e]).outerWidth();for(s.css("width",Math.min(100,i/r.outerWidth()*100).toFixed(4)+"%"),l.min_j<l.max_j&&s.attr("colspan",l.max_j-l.min_j+1),l.min_i<l.max_i&&s.attr("rowspan",l.max_i-l.min_i+1),e=1;e<a.length;e++)"<br>"!=(t=Z(a[e])).html()&&""!==t.html()&&(o+="<br>"+t.html()),t.remove();s.html(o),w.selection.setAtEnd(s.get(0)),w.selection.restore(),w.toolbar.enable(),m(l.min_i,l.max_i,r);var f=r.find("tr:empty");for(e=f.length-1;0<=e;e--)Z(f[e]).remove();g(l.min_j,l.max_j,r),h()}},splitCellVertically:function(){if(1==J().length){var e=w.$el.find(".fr-selected-cell"),t=parseInt(e.attr("colspan"),10)||1,l=e.parent().outerWidth(),a=e.outerWidth(),s=e.clone().html("<br>"),n=O(),r=A(e.get(0),n);if(1<t){var o=Math.ceil(t/2);a=V(r.col,r.col+o-1,n)/l*100;var i=V(r.col+o,r.col+t-1,n)/l*100;1<o?e.attr("colspan",o):e.removeAttr("colspan"),1<t-o?s.attr("colspan",t-o):s.removeAttr("colspan"),e.css("width",a.toFixed(4)+"%"),s.css("width",i.toFixed(4)+"%")}else{var f;for(f=0;f<n.length;f++)if(0===f||n[f][r.col]!=n[f-1][r.col]){var c=Z(n[f][r.col]);if(!c.is(e)){var d=(parseInt(c.attr("colspan"),10)||1)+1;c.attr("colspan",d)}}a=a/l*100/2,e.css("width",a.toFixed(4)+"%"),s.css("width",a.toFixed(4)+"%")}e.after(s),D(),w.popups.hide("table.edit")}},splitCellHorizontally:function(){if(1==J().length){var e=w.$el.find(".fr-selected-cell"),t=e.parent(),l=e.closest("table"),a=parseInt(e.attr("rowspan"),10),s=O(),n=A(e.get(0),s),r=e.clone().html("<br>");if(1<a){var o=Math.ceil(a/2);1<o?e.attr("rowspan",o):e.removeAttr("rowspan"),1<a-o?r.attr("rowspan",a-o):r.removeAttr("rowspan");for(var i=n.row+o,f=0===n.col?n.col:n.col-1;0<=f&&(s[i][f]==s[i][f-1]||0<i&&s[i][f]==s[i-1][f]);)f--;-1==f?Z(l.find("tr").not(l.find("table tr")).get(i)).prepend(r):Z(s[i][f]).after(r)}else{var c,d=Z("<tr>").append(r);for(c=0;c<s[0].length;c++)if(0===c||s[n.row][c]!=s[n.row][c-1]){var p=Z(s[n.row][c]);p.is(e)||p.attr("rowspan",(parseInt(p.attr("rowspan"),10)||1)+1)}t.after(d)}D(),w.popups.hide("table.edit")}},addHeader:function(){var e=Q();if(0<e.length&&0===e.find("th").length){var t,l="<thead><tr>",a=0;for(e.find("tr:first > td").each(function(){var e=Z(this);a+=parseInt(e.attr("colspan"),10)||1}),t=0;t<a;t++)l+="<th><br></th>";l+="</tr></thead>",e.prepend(l),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<J().length)h();else{w.popups.hide("table.edit");var l=e.find("tbody tr:first td:first").get(0);l&&(w.selection.setAtEnd(l),w.selection.restore())}},setBackground:t,showInsertPopup:function(){var e=w.$tb.find('.fr-command[data-cmd="insertTable"]'),t=w.popups.get("table.insert");if(t||(t=c()),!t.hasClass("fr-active")){w.popups.refresh("table.insert"),w.popups.setContainer("table.insert",w.$tb);var l=e.offset().left+e.outerWidth()/2,a=e.offset().top+(w.opts.toolbarBottom?10:e.outerHeight()-10);w.popups.show("table.insert",l,a,e.outerHeight())}},showEditPopup:h,showColorsPopup:f,back:function(){0<J().length?h():(w.popups.hide("table.insert"),w.toolbar.showInline())},verticalAlign:function(e){w.$el.find(".fr-selected-cell").css("vertical-align",e)},horizontalAlign:function(e){w.$el.find(".fr-selected-cell").css("text-align",e)},applyStyle:function(e,t,l,a){if(0<t.length){if(!l){var s=Object.keys(a);s.splice(s.indexOf(e),1),t.removeClass(s.join(" "))}t.toggleClass(e)}},selectedTable:Q,selectedCells:J,customColor:function(){var e=w.popups.get("table.colors").find(".fr-table-colors-hex-layer input");e.length&&t(e.val())},selectCells:_}},Z.FE.DefineIcon("insertTable",{NAME:"table"}),Z.FE.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"}),Z.FE.RegisterCommand("tableInsert",{callback:function(e,t,l){this.table.insert(t,l),this.popups.hide("table.insert")}}),Z.FE.DefineIcon("tableHeader",{NAME:"header",FA5NAME:"heading"}),Z.FE.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))}}),Z.FE.DefineIcon("tableRows",{NAME:"bars"}),Z.FE.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=Z.FE.COMMANDS.tableRows.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableRows" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){"above"==t||"below"==t?this.table.insertRow(t):this.table.deleteRow()}}),Z.FE.DefineIcon("tableColumns",{NAME:"bars fa-rotate-90"}),Z.FE.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=Z.FE.COMMANDS.tableColumns.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableColumns" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){"before"==t||"after"==t?this.table.insertColumn(t):this.table.deleteColumn()}}),Z.FE.DefineIcon("tableCells",{NAME:"square-o",FA5NAME:"square"}),Z.FE.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=Z.FE.COMMANDS.tableCells.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCells" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</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))}}),Z.FE.DefineIcon("tableRemove",{NAME:"trash"}),Z.FE.RegisterCommand("tableRemove",{title:"Remove Table",focus:!1,callback:function(){this.table.remove()}}),Z.FE.DefineIcon("tableStyle",{NAME:"paint-brush"}),Z.FE.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 l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableStyle" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</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 l=this.$el.find(".fr-selected-cell").closest("table");l&&t.find(".fr-command").each(function(){var e=Z(this).data("param1"),t=l.hasClass(e);Z(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),Z.FE.DefineIcon("tableCellBackground",{NAME:"tint"}),Z.FE.RegisterCommand("tableCellBackground",{title:"Cell Background",focus:!1,popup:!0,callback:function(){this.table.showColorsPopup()}}),Z.FE.RegisterCommand("tableCellBackgroundColor",{undo:!0,focus:!1,callback:function(e,t){this.table.setBackground(t)}}),Z.FE.DefineIcon("tableBack",{NAME:"arrow-left"}),Z.FE.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"))}}),Z.FE.DefineIcon("tableCellVerticalAlign",{NAME:"arrows-v",FA5NAME:"arrows-alt-v"}),Z.FE.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=Z.FE.COMMANDS.tableCellVerticalAlign.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellVerticalAlign" data-param1="'+l.toLowerCase()+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(l)+"</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)}}),Z.FE.DefineIcon("tableCellHorizontalAlign",{NAME:"align-left"}),Z.FE.DefineIcon("align-left",{NAME:"align-left"}),Z.FE.DefineIcon("align-right",{NAME:"align-right"}),Z.FE.DefineIcon("align-center",{NAME:"align-center"}),Z.FE.DefineIcon("align-justify",{NAME:"align-justify"}),Z.FE.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=Z.FE.COMMANDS.tableCellHorizontalAlign.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="tableCellHorizontalAlign" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.icon.create("align-"+l)+'<span class="fr-sr-only">'+this.language.translate(t[l])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.table.horizontalAlign(t)},refresh:function(e){var t=this.table.selectedCells();t.length&&e.find("> *:first").replaceWith(this.icon.create("align-"+this.helpers.getAlignment(Z(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)}}),Z.FE.DefineIcon("tableCellStyle",{NAME:"magic"}),Z.FE.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 l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellStyle" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</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 l=this.$el.find(".fr-selected-cell:first");l&&t.find(".fr-command").each(function(){var e=Z(this).data("param1"),t=l.hasClass(e);Z(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),Z.FE.RegisterCommand("tableCellBackgroundCustomColor",{title:"OK",undo:!0,callback:function(){this.table.customColor()}}),Z.FE.DefineIcon("tableColorRemove",{NAME:"eraser"})}); |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),i(t)}:i(window.jQuery)}(function(Q){Q.extend(Q.FE.POPUP_TEMPLATES,{"video.insert":"[_BUTTONS_][_BY_URL_LAYER_][_EMBED_LAYER_][_UPLOAD_LAYER_][_PROGRESS_BAR_]","video.edit":"[_BUTTONS_]","video.size":"[_BUTTONS_][_SIZE_LAYER_]"}),Q.extend(Q.FE.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.FE.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.FE.VIDEO_EMBED_REGEX=/^\W*((<iframe(.|\n)*>(\s|\n)*<\/iframe>)|(<embed(.|\n)*>))\W*$/i,Q.FE.PLUGINS.video=function(p){var a,f,v,u,o,i,d="https://i.froala.com/upload",l=2,c=3,h=4,g=5,m=6,r={};function b(){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)),e+='<div class="fr-buttons">',e+=p.button.buildList(p.opts.videoEditButtons);var t={buttons:e+="</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(),R(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())}}function n(e){if(e)return p.popups.onRefresh("video.insert",b),p.popups.onHide("image.insert",W),!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 Q(this).addClass("fr-drop"),!1},!0),p.events.$on(o,"dragleave dragend",".fr-video-upload-layer",function(){return Q(this).removeClass("fr-drop"),!1},!0),p.events.$on(o,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),Q(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(){Q(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)}Q(this).val("")},!0)}(v),v}function y(e){p.events.focus(!0),p.selection.restore();var t=!1;u&&(j(),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 w(){var e=Q(this);p.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),R(e.parent()),p.events.trigger("video.loaded",[e.parent()])}function E(a,e,d,l,f){p.edit.off(),_("Loading video"),e&&(a=p.helpers.sanitizeURL(a));C("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()).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",w),e.find("video").attr("src",a),p.edit.on(),O(),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=Q('<span contenteditable="false" draggable="true" class="fr-video fr-dv'+p.opts.videoDefaultDisplay[0]+("center"!=p.opts.videoDefaultAlign?" fr-fv"+p.opts.videoDefaultAlign[0]:"")+'"><video src="'+e+'" '+r+(s?' style="width: '+s+';" ':"")+" controls>"+p.language.translate("Your browser does not support HTML5 video.")+"</video></span>");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,w),O(),p.undo.saveStep(),p.events.trigger("video.inserted",[e,f])}()}function C(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+i.width()/2,r=i.offset().top+i.height();p.popups.show("video.insert",o,r,i.outerHeight())}void 0===e&&_(p.language.translate("Uploading"),0)}function A(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;P(!0),p.selection.setAfter(i.find("video").get(0)),p.selection.restore()}p.popups.hide("video.insert")}}function _(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 x(e){C();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 R(e){z.call(e.get(0))}function S(e){_("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=Q(e).find("Location").text(),i=Q(e).find("Key").text();return!1===p.events.trigger("video.uploadedToS3",[t,i,e],!0)?(p.edit.on(),!1):t}catch(o){return V(h,e),!1}}(o);s&&E(s,!1,[],e,i||o)}else V(h,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:(V(l,e),!1)}catch(i){return V(h,e),!1}}(r);n&&E(n.link,!1,n,e,i||r)}else V(c,i||r)}catch(a){V(h,i||r)}}function D(){V(h,this.response||this.responseText||this.responseXML)}function U(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;_(p.language.translate("Uploading"),t)}}function B(){p.edit.on(),A(!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(Q(r.frameElement).offset().left)+r.frameElement.clientLeft,i=e.clientY+p.helpers.getPX(Q(r.frameElement).offset().top)+r.frameElement.clientTop)}p.undo.canDo()||p.undo.saveStep(),(f=Q(this)).data("start-x",t),f.data("start-y",i),a.show(),p.popups.hideAll(),T()}function $(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"),L()}}function k(e){if(!p.core.sameInstance(v))return!0;f&&u&&(e&&e.stopPropagation(),f=null,a.hide(),L(),s(),p.undo.saveStep())}function t(e){return'<div class="fr-handler fr-h'+e+'"></div>'}function F(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)),$.call(this,e),k.call(this,e),++o}function O(){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")),Q(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",[Q(o[e])]);o=t}function L(){v||function(){var e;if(p.shared.$video_resizer?(v=p.shared.$video_resizer,a=p.shared.$vid_overlay,p.events.on("destroy",function(){v.removeClass("fr-active").appendTo(Q("body:first"))},!0)):(p.shared.$video_resizer=Q('<div class="fr-video-resizer"></div>'),v=p.shared.$video_resizer,p.events.$on(v,"mousedown",function(e){e.stopPropagation()},!0),p.opts.videoResize&&(v.append(t("nw")+t("ne")+t("sw")+t("se")),p.shared.$vid_overlay=Q('<div class="fr-video-overlay"></div>'),a=p.shared.$vid_overlay,e=v.get(0).ownerDocument,Q(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(Q(p.o_win),"resize.video",function(){P(!0)}),p.opts.videoResize){e=v.get(0).ownerDocument,p.events.$on(v,p._mousedown,".fr-handler",I),p.events.$on(Q(e),p._mousemove,$),p.events.$on(Q(e.defaultView||e.parentWindow),p._mouseup,k),p.events.$on(a,"mouseleave",k);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.FE.KEYCODE.EQUALS||p.browser.mozilla&&i==Q.FE.KEYCODE.FF_EQUALS)&&t&&!e.altKey?o=F.call(this,e,1,1,o):(i==Q.FE.KEYCODE.HYPHEN||p.browser.mozilla&&i==Q.FE.KEYCODE.FF_HYPHEN)&&t&&!e.altKey&&(o=F.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");v.css("top",(p.opts.iframe?e.offset().top-1:e.offset().top-p.$wp.offset().top-1)+p.$wp.scrollTop()).css("left",(p.opts.iframe?e.offset().left-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 z(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.FE.INSTANCES.length;t++)Q.FE.INSTANCES[t]!=p&&Q.FE.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=Q(this)).addClass("fr-active"),p.opts.iframe&&p.size.syncIframe(),Z(),L(),s(),p.selection.clear(),p.button.bulkRefresh(),p.events.trigger("image.hideResizer")}function P(e){u&&(p.shared.vid_exit_flag||!0===e)&&(v.removeClass("fr-active"),p.toolbar.enable(),u.removeClass("fr-active"),u=null,T())}function e(){p.shared.vid_exit_flag=!0}function T(){p.shared.vid_exit_flag=!1}function M(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.FE.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),C(),0<=p.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))?N(t.files):V(m),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&&j();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));E(window.URL.createObjectURL(new Blob([new Uint8Array(t)],{type:o.type})),!1,null,u)},C(),r.readAsDataURL(o)}(i),!1;if(i.size>p.opts.videoMaxSize)return V(g),!1;if(p.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))<0)return V(m),!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(){S.call(s,u)},s.onerror=D,s.upload.onprogress=U,s.onabort=B,C(),p.events.disableBlur(),p.edit.off(),p.events.enableBlur();var n=p.popups.get("video.insert");n&&n.off("abortUpload").on("abortUpload",function(){4!=s.readyState&&s.abort()}),s.send(t)}}}function V(e,t){p.edit.on(),u&&u.find("video").addClass("fr-error"),x(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.error",[{code:e,message:r[e]},t])}function Y(){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",Y),!0;var t={buttons:'<div class="fr-buttons">'+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(),R(u))}),i}function X(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 K(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 j(){if(u&&!1!==p.events.trigger("video.beforeRemove",[u])){var e=u;p.popups.hideAll(),P(!0),p.selection.setBefore(e.get(0))||p.selection.setAfter(e.get(0)),e.remove(),p.selection.restore(),p.html.fillEmptyBlocks()}}function W(){A()}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 G(){p.$el.find("video").filter(function(){return 0===Q(this).parents("span.fr-video").length}).wrap('<span class="fr-video" contenteditable="false"></span>'),p.$el.find("embed, iframe").filter(function(){if(p.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0<Q(this).parents("span.fr-video").length)return!1;for(var e=Q(this).attr("src"),t=0;t<Q.FE.VIDEO_PROVIDERS.length;t++){var i=Q.FE.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===Q(this).parents("object").length?this:Q(this).parents("object").get(0)}).wrap('<span class="fr-video" contenteditable="false"></span>');for(var e,t,i=p.$el.find("span.fr-video, video"),o=0;o<i.length;o++){var r=Q(i[o]);!p.opts.htmlUntouched&&p.opts.useClasses?((t=r).hasClass("fr-dvi")||t.hasClass("fr-dvb")||(t.addClass("fr-fv"+X(t)[0]),t.addClass("fr-dv"+K(t)[0])),p.opts.videoTextNear||r.removeClass("fr-dvi").addClass("fr-dvb")):p.opts.htmlUntouched||p.opts.useClasses||(q(e=r,e.hasClass("fr-dvb")?"block":e.hasClass("fr-dvi")?"inline":null,e.hasClass("fr-fvl")?"left":e.hasClass("fr-fvr")?"right":X(e)),e.removeClass("fr-dvb fr-dvi fr-fvr fr-fvl"))}i.toggleClass("fr-draggable",p.opts.videoMove)}function Z(){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[c]="Error during file upload.",r[h]="Parsing response failed.",r[g]="File is too large.",r[m]="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",M,!0),p.events.on("mousedown window.mousedown",e),p.events.on("window.touchmove",T),p.events.on("mouseup window.mouseup",P),p.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&P()}),p.events.on("video.hideResizer commands.undo commands.redo element.dropped",function(){P(!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",G),G(),p.events.$on(p.$el,"mousedown","span.fr-video",function(e){e.stopPropagation(),(p.browser.msie||p.browser.edge)&&(e.target.dragDrop(),z.call(this,e))}),p.events.$on(p.$el,"click touchend","span.fr-video",function(e){if("false"==Q(this).parents("[contenteditable]:not(.fr-element):not(.fr-img-caption):not(body):first").attr("contenteditable"))return!0;z.call(this,e)}),p.events.on("keydown",function(e){var t=e.which;return!u||t!=Q.FE.KEYCODE.BACKSPACE&&t!=Q.FE.KEYCODE.DELETE?u&&t==Q.FE.KEYCODE.ESC?(P(!0),e.preventDefault(),!1):u&&t!=Q.FE.KEYCODE.F10&&!p.keys.isBrowserAction(e)?(e.preventDefault(),!1):void 0:(e.preventDefault(),j(),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&&(O(),p.events.on("contentChanged",O)),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()),A(),!t.hasClass("fr-active"))if(p.popups.refresh("video.insert"),p.popups.setContainer("video.insert",p.$tb),e.is(":visible")){var i=e.offset().left+e.outerWidth()/2,o=e.offset().top+(p.opts.toolbarBottom?10:e.outerHeight()-10);p.popups.show("video.insert",i,o,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+r.outerWidth()/2,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){p.popups.get("video.insert").find(".fr-video-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshEmbedButton:function(e){p.popups.get("video.insert").find(".fr-video-embed-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshUploadButton:function(e){p.popups.get("video.insert").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.FE.VIDEO_PROVIDERS.length;i++){var o=Q.FE.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?y(t):(x(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.FE.VIDEO_EMBED_REGEX.test(e)?y(e):(x(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.codeError",[e]))},insert:y,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,K(),e),Z(),L(),s(),p.selection.clear()},refreshAlign:function(e){if(!u)return!1;e.find("> *:first").replaceWith(p.icon.create("video-align-"+X()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+X()+'"]').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,X()),Z(),L(),s(),p.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+K()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:j,hideProgressBar:A,showSizePopup:function(){var e=p.popups.get("video.size");e||(e=H()),A(),p.popups.refresh("video.size"),p.popups.setContainer("video.size",p.$sc);var t=u.find("iframe, embed, video"),i=t.offset().left+t.width()/2,o=t.offset().top+t.height();p.popups.show("video.size",i,o,t.height())},replace:function(){var e=p.popups.get("video.insert");e||(e=n()),p.popups.isVisible("video.insert")||(A(),p.popups.refresh("video.insert"),p.popups.setContainer("video.insert",p.$sc));var t=u.offset().left+u.width()/2,i=u.offset().top+u.height();p.popups.show("video.insert",t,i,u.outerHeight())},back:function(){u?(p.events.disableBlur(),u.trigger("click")):(p.events.disableBlur(),p.selection.restore(),p.events.enableBlur(),p.popups.hide("video.insert"),p.toolbar.showInline())},setSize:function(e,t){if(u){var 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:C}},Q.FE.RegisterCommand("insertVideo",{title:"Insert Video",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("video.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("video.insert")):this.video.showInsertPopup()},plugin:"video"}),Q.FE.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera"}),Q.FE.DefineIcon("videoByURL",{NAME:"link"}),Q.FE.RegisterCommand("videoByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-by-url")},refresh:function(e){this.video.refreshByURLButton(e)}}),Q.FE.DefineIcon("videoEmbed",{NAME:"code"}),Q.FE.RegisterCommand("videoEmbed",{title:"Embedded Code",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-embed")},refresh:function(e){this.video.refreshEmbedButton(e)}}),Q.FE.DefineIcon("videoUpload",{NAME:"upload"}),Q.FE.RegisterCommand("videoUpload",{title:"Upload Video",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-upload")},refresh:function(e){this.video.refreshUploadButton(e)}}),Q.FE.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),Q.FE.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),Q.FE.DefineIcon("videoDisplay",{NAME:"star"}),Q.FE.RegisterCommand("videoDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.video.display(t)},refresh:function(e){this.opts.videoTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.video.refreshDisplayOnShow(e,t)}}),Q.FE.DefineIcon("video-align",{NAME:"align-left"}),Q.FE.DefineIcon("video-align-left",{NAME:"align-left"}),Q.FE.DefineIcon("video-align-right",{NAME:"align-right"}),Q.FE.DefineIcon("video-align-center",{NAME:"align-justify"}),Q.FE.DefineIcon("videoAlign",{NAME:"align-center"}),Q.FE.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.FE.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.FE.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),Q.FE.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),Q.FE.DefineIcon("videoRemove",{NAME:"trash"}),Q.FE.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),Q.FE.DefineIcon("videoSize",{NAME:"arrows-alt"}),Q.FE.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),Q.FE.DefineIcon("videoBack",{NAME:"arrow-left"}),Q.FE.RegisterCommand("videoBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.video.back()},refresh:function(e){this.video.get()||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),Q.FE.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),Q.FE.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}})}); | ||
!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),i(t)}:i(window.jQuery)}(function(Q){Q.extend(Q.FE.POPUP_TEMPLATES,{"video.insert":"[_BUTTONS_][_BY_URL_LAYER_][_EMBED_LAYER_][_UPLOAD_LAYER_][_PROGRESS_BAR_]","video.edit":"[_BUTTONS_]","video.size":"[_BUTTONS_][_SIZE_LAYER_]"}),Q.extend(Q.FE.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.FE.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.FE.VIDEO_EMBED_REGEX=/^\W*((<iframe(.|\n)*>(\s|\n)*<\/iframe>)|(<embed(.|\n)*>))\W*$/i,Q.FE.PLUGINS.video=function(p){var a,f,v,u,o,i,d="https://i.froala.com/upload",l=2,c=3,h=4,g=5,m=6,r={};function b(){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&&(-1<p.opts.videoEditButtons.indexOf("videoSize")&&p.opts.videoEditButtons.splice(p.opts.videoEditButtons.indexOf("videoSize"),1),-1<p.opts.videoEditButtons.indexOf("videoDisplay")&&p.opts.videoEditButtons.splice(p.opts.videoEditButtons.indexOf("videoDisplay"),1),-1<p.opts.videoEditButtons.indexOf("videoAlign")&&p.opts.videoEditButtons.splice(p.opts.videoEditButtons.indexOf("videoAlign"),1)),e+='<div class="fr-buttons">',e+=p.button.buildList(p.opts.videoEditButtons);var t={buttons:e+="</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(),R(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())}}function n(e){if(e)return p.popups.onRefresh("video.insert",b),p.popups.onHide("image.insert",W),!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 Q(this).addClass("fr-drop"),!1},!0),p.events.$on(o,"dragleave dragend",".fr-video-upload-layer",function(){return Q(this).removeClass("fr-drop"),!1},!0),p.events.$on(o,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),Q(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(){Q(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)}Q(this).val("")},!0)}(v),v}function y(e){p.events.focus(!0),p.selection.restore();var t=!1;u&&(j(),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 w(){var e=Q(this);p.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),R(e.parent()),p.events.trigger("video.loaded",[e.parent()])}function E(a,e,d,l,f){p.edit.off(),x("Loading video"),e&&(a=p.helpers.sanitizeURL(a));C("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()).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",w),e.find("video").attr("src",a),p.edit.on(),O(),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=Q('<span contenteditable="false" draggable="true" class="fr-video fr-dv'+p.opts.videoDefaultDisplay[0]+("center"!=p.opts.videoDefaultAlign?" fr-fv"+p.opts.videoDefaultAlign[0]:"")+'"><video src="'+e+'" '+r+(s?' style="width: '+s+';" ':"")+" controls>"+p.language.translate("Your browser does not support HTML5 video.")+"</video></span>");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,w),O(),p.undo.saveStep(),p.events.trigger("video.inserted",[e,f])}()}function C(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+i.width()/2,r=i.offset().top+i.height();p.popups.show("video.insert",o,r,i.outerHeight())}void 0===e&&x(p.language.translate("Uploading"),0)}function A(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;P(!0),p.selection.setAfter(i.find("video").get(0)),p.selection.restore()}p.popups.hide("video.insert")}}function x(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 _(e){C();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 R(e){z.call(e.get(0))}function S(e){x("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=Q(e).find("Location").text(),i=Q(e).find("Key").text();return!1===p.events.trigger("video.uploadedToS3",[t,i,e],!0)?(p.edit.on(),!1):t}catch(o){return V(h,e),!1}}(o);s&&E(s,!1,[],e,i||o)}else V(h,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:(V(l,e),!1)}catch(i){return V(h,e),!1}}(r);n&&E(n.link,!1,n,e,i||r)}else V(c,i||r)}catch(a){V(h,i||r)}}function D(){V(h,this.response||this.responseText||this.responseXML)}function U(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;x(p.language.translate("Uploading"),t)}}function B(){p.edit.on(),A(!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(Q(r.frameElement).offset().left)+r.frameElement.clientLeft,i=e.clientY+p.helpers.getPX(Q(r.frameElement).offset().top)+r.frameElement.clientTop)}p.undo.canDo()||p.undo.saveStep(),(f=Q(this)).data("start-x",t),f.data("start-y",i),a.show(),p.popups.hideAll(),T()}function $(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"),L()}}function k(e){if(!p.core.sameInstance(v))return!0;f&&u&&(e&&e.stopPropagation(),f=null,a.hide(),L(),s(),p.undo.saveStep())}function t(e){return'<div class="fr-handler fr-h'+e+'"></div>'}function F(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)),$.call(this,e),k.call(this,e),++o}function O(){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")),Q(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",[Q(o[e])]);o=t}function L(){v||function(){var e;if(p.shared.$video_resizer?(v=p.shared.$video_resizer,a=p.shared.$vid_overlay,p.events.on("destroy",function(){v.removeClass("fr-active").appendTo(Q("body:first"))},!0)):(p.shared.$video_resizer=Q('<div class="fr-video-resizer"></div>'),v=p.shared.$video_resizer,p.events.$on(v,"mousedown",function(e){e.stopPropagation()},!0),p.opts.videoResize&&(v.append(t("nw")+t("ne")+t("sw")+t("se")),p.shared.$vid_overlay=Q('<div class="fr-video-overlay"></div>'),a=p.shared.$vid_overlay,e=v.get(0).ownerDocument,Q(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(Q(p.o_win),"resize.video",function(){P(!0)}),p.opts.videoResize){e=v.get(0).ownerDocument,p.events.$on(v,p._mousedown,".fr-handler",I),p.events.$on(Q(e),p._mousemove,$),p.events.$on(Q(e.defaultView||e.parentWindow),p._mouseup,k),p.events.$on(a,"mouseleave",k);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.FE.KEYCODE.EQUALS||p.browser.mozilla&&i==Q.FE.KEYCODE.FF_EQUALS)&&t&&!e.altKey?o=F.call(this,e,1,1,o):(i==Q.FE.KEYCODE.HYPHEN||p.browser.mozilla&&i==Q.FE.KEYCODE.FF_HYPHEN)&&t&&!e.altKey&&(o=F.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");v.css("top",(p.opts.iframe?e.offset().top-1:e.offset().top-p.$wp.offset().top-1)+p.$wp.scrollTop()).css("left",(p.opts.iframe?e.offset().left-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 z(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.FE.INSTANCES.length;t++)Q.FE.INSTANCES[t]!=p&&Q.FE.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=Q(this)).addClass("fr-active"),p.opts.iframe&&p.size.syncIframe(),Z(),L(),s(),p.selection.clear(),p.button.bulkRefresh(),p.events.trigger("image.hideResizer")}function P(e){u&&(p.shared.vid_exit_flag||!0===e)&&(v.removeClass("fr-active"),p.toolbar.enable(),u.removeClass("fr-active"),u=null,T())}function e(){p.shared.vid_exit_flag=!0}function T(){p.shared.vid_exit_flag=!1}function M(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.FE.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),C(),0<=p.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))?N(t.files):V(m),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&&j();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));E(window.URL.createObjectURL(new Blob([new Uint8Array(t)],{type:o.type})),!1,null,u)},C(),r.readAsDataURL(o)}(i),!1;if(i.size>p.opts.videoMaxSize)return V(g),!1;if(p.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))<0)return V(m),!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(){S.call(s,u)},s.onerror=D,s.upload.onprogress=U,s.onabort=B,C(),p.events.disableBlur(),p.edit.off(),p.events.enableBlur();var n=p.popups.get("video.insert");n&&n.off("abortUpload").on("abortUpload",function(){4!=s.readyState&&s.abort()}),s.send(t)}}}function V(e,t){p.edit.on(),u&&u.find("video").addClass("fr-error"),_(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.error",[{code:e,message:r[e]},t])}function Y(){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",Y),!0;var t={buttons:'<div class="fr-buttons">'+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(),R(u))}),i}function X(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 K(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 j(){if(u&&!1!==p.events.trigger("video.beforeRemove",[u])){var e=u;p.popups.hideAll(),P(!0),p.selection.setBefore(e.get(0))||p.selection.setAfter(e.get(0)),e.remove(),p.selection.restore(),p.html.fillEmptyBlocks()}}function W(){A()}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 G(){p.$el.find("video").filter(function(){return 0===Q(this).parents("span.fr-video").length}).wrap('<span class="fr-video" contenteditable="false"></span>'),p.$el.find("embed, iframe").filter(function(){if(p.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0<Q(this).parents("span.fr-video").length)return!1;for(var e=Q(this).attr("src"),t=0;t<Q.FE.VIDEO_PROVIDERS.length;t++){var i=Q.FE.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===Q(this).parents("object").length?this:Q(this).parents("object").get(0)}).wrap('<span class="fr-video" contenteditable="false"></span>');for(var e,t,i=p.$el.find("span.fr-video, video"),o=0;o<i.length;o++){var r=Q(i[o]);!p.opts.htmlUntouched&&p.opts.useClasses?((t=r).hasClass("fr-dvi")||t.hasClass("fr-dvb")||(t.addClass("fr-fv"+X(t)[0]),t.addClass("fr-dv"+K(t)[0])),p.opts.videoTextNear||r.removeClass("fr-dvi").addClass("fr-dvb")):p.opts.htmlUntouched||p.opts.useClasses||(q(e=r,e.hasClass("fr-dvb")?"block":e.hasClass("fr-dvi")?"inline":null,e.hasClass("fr-fvl")?"left":e.hasClass("fr-fvr")?"right":X(e)),e.removeClass("fr-dvb fr-dvi fr-fvr fr-fvl"))}i.toggleClass("fr-draggable",p.opts.videoMove)}function Z(){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[c]="Error during file upload.",r[h]="Parsing response failed.",r[g]="File is too large.",r[m]="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",M,!0),p.events.on("mousedown window.mousedown",e),p.events.on("window.touchmove",T),p.events.on("mouseup window.mouseup",P),p.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&P()}),p.events.on("video.hideResizer commands.undo commands.redo element.dropped",function(){P(!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",G),G(),p.events.$on(p.$el,"mousedown","span.fr-video",function(e){e.stopPropagation(),(p.browser.msie||p.browser.edge)&&(e.target.dragDrop(),z.call(this,e))}),p.events.$on(p.$el,"click touchend","span.fr-video",function(e){if("false"==Q(this).parents("[contenteditable]:not(.fr-element):not(.fr-img-caption):not(body):first").attr("contenteditable"))return!0;z.call(this,e)}),p.events.on("keydown",function(e){var t=e.which;return!u||t!=Q.FE.KEYCODE.BACKSPACE&&t!=Q.FE.KEYCODE.DELETE?u&&t==Q.FE.KEYCODE.ESC?(P(!0),e.preventDefault(),!1):u&&t!=Q.FE.KEYCODE.F10&&!p.keys.isBrowserAction(e)?(e.preventDefault(),!1):void 0:(e.preventDefault(),j(),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&&(O(),p.events.on("contentChanged",O)),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()),A(),!t.hasClass("fr-active"))if(p.popups.refresh("video.insert"),p.popups.setContainer("video.insert",p.$tb),e.is(":visible")){var i=e.offset().left+e.outerWidth()/2,o=e.offset().top+(p.opts.toolbarBottom?10:e.outerHeight()-10);p.popups.show("video.insert",i,o,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+r.outerWidth()/2,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){p.popups.get("video.insert").find(".fr-video-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshEmbedButton:function(e){p.popups.get("video.insert").find(".fr-video-embed-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshUploadButton:function(e){p.popups.get("video.insert").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.FE.VIDEO_PROVIDERS.length;i++){var o=Q.FE.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?y(t):(_(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.FE.VIDEO_EMBED_REGEX.test(e)?y(e):(_(p.language.translate("Something went wrong. Please try again.")),p.events.trigger("video.codeError",[e]))},insert:y,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,K(),e),Z(),L(),s(),p.selection.clear()},refreshAlign:function(e){if(!u)return!1;e.find("> *:first").replaceWith(p.icon.create("video-align-"+X()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+X()+'"]').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,X()),Z(),L(),s(),p.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+K()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:j,hideProgressBar:A,showSizePopup:function(){var e=p.popups.get("video.size");e||(e=H()),A(),p.popups.refresh("video.size"),p.popups.setContainer("video.size",p.$sc);var t=u.find("iframe, embed, video"),i=t.offset().left+t.width()/2,o=t.offset().top+t.height();p.popups.show("video.size",i,o,t.height())},replace:function(){var e=p.popups.get("video.insert");e||(e=n()),p.popups.isVisible("video.insert")||(A(),p.popups.refresh("video.insert"),p.popups.setContainer("video.insert",p.$sc));var t=u.offset().left+u.width()/2,i=u.offset().top+u.height();p.popups.show("video.insert",t,i,u.outerHeight())},back:function(){u?(p.events.disableBlur(),u.trigger("click")):(p.events.disableBlur(),p.selection.restore(),p.events.enableBlur(),p.popups.hide("video.insert"),p.toolbar.showInline())},setSize:function(e,t){if(u){var 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:C}},Q.FE.RegisterCommand("insertVideo",{title:"Insert Video",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("video.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("video.insert")):this.video.showInsertPopup()},plugin:"video"}),Q.FE.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera"}),Q.FE.DefineIcon("videoByURL",{NAME:"link"}),Q.FE.RegisterCommand("videoByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-by-url")},refresh:function(e){this.video.refreshByURLButton(e)}}),Q.FE.DefineIcon("videoEmbed",{NAME:"code"}),Q.FE.RegisterCommand("videoEmbed",{title:"Embedded Code",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-embed")},refresh:function(e){this.video.refreshEmbedButton(e)}}),Q.FE.DefineIcon("videoUpload",{NAME:"upload"}),Q.FE.RegisterCommand("videoUpload",{title:"Upload Video",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-upload")},refresh:function(e){this.video.refreshUploadButton(e)}}),Q.FE.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),Q.FE.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),Q.FE.DefineIcon("videoDisplay",{NAME:"star"}),Q.FE.RegisterCommand("videoDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.video.display(t)},refresh:function(e){this.opts.videoTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.video.refreshDisplayOnShow(e,t)}}),Q.FE.DefineIcon("video-align",{NAME:"align-left"}),Q.FE.DefineIcon("video-align-left",{NAME:"align-left"}),Q.FE.DefineIcon("video-align-right",{NAME:"align-right"}),Q.FE.DefineIcon("video-align-center",{NAME:"align-justify"}),Q.FE.DefineIcon("videoAlign",{NAME:"align-center"}),Q.FE.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.FE.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.FE.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),Q.FE.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),Q.FE.DefineIcon("videoRemove",{NAME:"trash"}),Q.FE.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),Q.FE.DefineIcon("videoSize",{NAME:"arrows-alt"}),Q.FE.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),Q.FE.DefineIcon("videoBack",{NAME:"arrow-left"}),Q.FE.RegisterCommand("videoBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.video.back()},refresh:function(e){this.video.get()||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),Q.FE.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),Q.FE.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}})}); |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -7,2 +7,2 @@ * Copyright 2014-2019 Froala Labs | ||
!function(r){"function"==typeof define&&define.amd?define(["jquery"],r):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),r(t)}:r(window.jQuery)}(function(S){S.extend(S.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent","border","border-.*"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),S.FE.PLUGINS.wordPaste=function(A){var l,i,a="word_paste";function t(e){var t=A.opts.wordAllowedStyleProps;e||(A.opts.wordAllowedStyleProps=[]),0===i.indexOf("<colgroup>")&&(i="<table>"+i+"</table>"),i=function(e,t){0<=e.indexOf("<html")&&(e=e.replace(/[.\s\S\w\W<>]*(<html[^>]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),r=1;r<t.length;r++){var i=t[r],n=i.split(' id="')[1];if(n&&1<n.length){n=n.split('"')[0];var l=i.split(' o:spid="')[1];l&&1<l.length&&(l=l.split('"')[0],c[n]=l)}}}(e);var r=(new DOMParser).parseFromString(e,"text/html"),i=r.head,n=r.body,a=function(e){var t={},r=e.getElementsByTagName("style");if(r.length){var i=r[0],n=i.innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);if(n)for(var l=0;l<n.length;l++){var a=n[l],o=a.replace(/([\S ]+\s+){[\s\S]+?}/gi,"$1"),s=a.replace(/[\S ]+\s+{([\s\S]+?)}/gi,"$1");o=o.replace(/^[\s]|[\s]$/gm,""),s=s.replace(/^[\s]|[\s]$/gm,""),o=o.replace(/\n|\r|\n\r/g,""),s=s.replace(/\n|\r|\n\r/g,"");for(var d=o.split(", "),g=0;g<d.length;g++)t[d[g]]=s}}return t}(i);g(n,function(e){if(e.nodeType==Node.TEXT_NODE&&/\n|\u00a0|\r/.test(e.data)){if(!/\S| /.test(e.data))return e.data==S.FE.UNICODE_NBSP?(e.data="\u200b",!0):1==e.data.length&&10==e.data.charCodeAt(0)?(e.data=" ",!0):(y(e),!1);e.data=e.data.replace(/\n|\r/gi," ")}return!0}),g(n,function(e){return e.nodeType!=Node.ELEMENT_NODE||"V:IMAGEDATA"!=e.tagName&&"IMG"!=e.tagName||function(e,t){if(!t)return;var r;if("IMG"==e.tagName){var i=e.getAttribute("src");if(!i||-1==i.indexOf("file://"))return;if(0===i.indexOf("file://")&&A.helpers.isURL(e.getAttribute("alt")))return e.setAttribute("src",e.getAttribute("alt"));r=c[e.getAttribute("v:shapes")]}else r=e.parentNode.getAttribute("o:spid");if(e.removeAttribute("height"),!r)return;n=t,p={},u(n,"i","\\shppict"),u(n,"s","\\shp{");var n;var l=p[r.substring(7)];if(l){var a=function(e){for(var t=e.match(/[0-9a-f]{2}/gi),r=[],i=0;i<t.length;i++)r.push(String.fromCharCode(parseInt(t[i],16)));var n=r.join("");return btoa(n)}(l.image_hex),o="data:"+l.image_type+";base64,"+a;"IMG"===e.tagName?(e.src=o,e.setAttribute("data-fr-image-pasted",!0)):S(e.parentNode).before('<img data-fr-image-pasted="true" src="'+o+'" style="'+e.parentNode.getAttribute("style")+'">').remove()}}(e,t),!0});for(var l=n.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),o=l.length-1;0<=o;o--)l[o].previousElementSibling&&"LI"===l[o].previousElementSibling.tagName&&l[o].previousElementSibling.appendChild(l[o]);g(n,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/<br>(\n|\r)/gi,"<br>"),!1;if(t.nodeType==Node.ELEMENT_NODE){if(C(t)){var r=t.parentNode,i=t.previousSibling,n=function e(t,r){var i=/[0-9a-zA-Z]./gi;var n=!1;var l=!1;var a=!1;var o;var s=t.querySelector('span[style="mso-list:Ignore"]');s&&(n=n||i.test(s.textContent));var d=n?"ol":"ul";var g=b(t);var u="<"+d+"><li>"+E(t,r);var f=t.nextElementSibling;null!=f&&(o=f.previousElementSibling);var p=t.parentNode;y(t);t=null;for(;f;){if(!C(f)){if(f.outerHTML&&0<f.outerHTML.indexOf("mso-bookmark")&&0==(f.textContent||"").length){f=f.nextElementSibling;continue}break}var c=b(f);if(g<c)u+=e(f,r).outerHTML;else{if(c<g)break;f.firstElementChild&&f.firstElementChild.firstElementChild&&f.firstElementChild.firstElementChild.firstChild&&(i.lastIndex=0,l=i.test(f.firstElementChild.firstElementChild.firstChild.data||"")),o&&o.firstElementChild&&o.firstElementChild.firstElementChild&&o.firstElementChild.firstElementChild.firstChild&&(i.lastIndex=0,a=i.test(o.firstElementChild.firstElementChild.firstChild.data||"")),a===undefined||a===l?u+="</li><li>"+E(f,r):u+=e(f,r).outerHTML}if(g=c,f.previousElementSibling||f.nextElementSibling||f.parentNode){var m=f;f=f.nextElementSibling,y(m),m=null}else f=o?o.nextElementSibling:p.firstElementChild}u+="</li></"+d+">";var h=document.createElement("div");h.innerHTML=u;var v=h.firstElementChild;return v}(t,a),l=null;return(l=i?i.nextSibling:r.firstChild)?r.insertBefore(n,l):r.appendChild(n),!1}return f(t,a)}return t.nodeType!=Node.COMMENT_NODE||(y(t),!1)}),g(n,function(e){if(e.nodeType==Node.ELEMENT_NODE){var t=e.tagName;if(!e.innerHTML&&-1==["BR","IMG"].indexOf(t)){for(var r=e.parentNode;r&&(y(e),!(e=r).innerHTML);)r=e.parentNode;return!1}!function(e){var t=e.getAttribute("style");if(!t)return;(t=N(t))&&";"!=t.slice(-1)&&(t+=";");var r=t.match(/(^|\S+?):.+?;{1,1}/gi);if(!r)return;for(var i={},n=0;n<r.length;n++){var l=r[n],a=l.split(":");2==a.length&&("text-align"==a[0]&&"SPAN"==e.tagName||(i[a[0]]=a[1]))}var o="";for(var s in i)if(i.hasOwnProperty(s)){if("font-size"==s&&"pt;"==i[s].slice(-3)){var d=null;try{d=parseFloat(i[s].slice(0,-3),10)}catch(g){}d&&(d=Math.round(1.33*d),i[s]=d+"px;")}o+=s+":"+i[s]}o&&e.setAttribute("style",o)}(e)}return!0}),g(n,function(e){if(e&&"A"===e.nodeName&&""===e.href){for(var t=document.createDocumentFragment();e.firstChild;)t.appendChild(e.firstChild);e.parentNode.replaceChild(t,e)}return!0});var s=n.outerHTML,d=A.opts.htmlAllowedStyleProps;return A.opts.htmlAllowedStyleProps=A.opts.wordAllowedStyleProps,s=A.clean.html(s,A.opts.wordDeniedTags,A.opts.wordDeniedAttrs,!1),A.opts.htmlAllowedStyleProps=d,s}(i=i.replace(/<span[\n\r ]*style='mso-spacerun:yes'>([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var r="",i=0;i++<t.length;)r+=" ";return r}),A.paste.getRtfClipboard());var r=A.doc.createElement("DIV");r.innerHTML=i,A.html.cleanBlankSpaces(r),i=r.innerHTML,i=(i=A.paste.cleanEmptyTagsAndDivs(i)).replace(/\u200b/g,""),A.modals.hide(a),A.paste.clean(i,!0,!0),A.opts.wordAllowedStyleProps=t}function y(e){e.parentNode&&e.parentNode.removeChild(e)}function g(e,t){if(t(e))for(var r=e.firstChild;r;){var i=r,n=r.previousSibling;r=r.nextSibling,g(i,t),i.previousSibling||i.nextSibling||i.parentNode||!r||n==r.previousSibling||!r.parentNode?i.previousSibling||i.nextSibling||i.parentNode||!r||r.previousSibling||r.nextSibling||r.parentNode||(n?r=n.nextSibling?n.nextSibling.nextSibling:null:e.firstChild&&(r=e.firstChild.nextSibling)):r=n?n.nextSibling:e.firstChild}}function C(e){if(!e.getAttribute("style")||!/mso-list:[\s]*l/gi.test(e.getAttribute("style").replace(/\n/gi,"")))return!1;try{if(!e.querySelector('[style="mso-list:Ignore"]'))return!1}catch(t){return!1}return!0}function b(e){return e.getAttribute("style").replace(/\n/gi,"").replace(/.*level([0-9]+?).*/gi,"$1")}function E(e,t){var r=e.cloneNode(!0);if(-1!=["H1","H2","H3","H4","H5","H6"].indexOf(e.tagName)){var i=document.createElement(e.tagName.toLowerCase());i.setAttribute("style",e.getAttribute("style")),i.innerHTML=r.innerHTML,r.innerHTML=i.outerHTML}g(r,function(e){return e.nodeType==Node.ELEMENT_NODE&&("mso-list:Ignore"==e.getAttribute("style")&&e.parentNode.removeChild(e),f(e,t)),!0});var n=r.innerHTML;return n=n.replace(/<!--[\s\S]*?-->/gi,"")}function h(e,t){for(var r=document.createElement(t),i=0;i<e.attributes.length;i++){var n=e.attributes[i].name;r.setAttribute(n,e.getAttribute(n))}return r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e),r}function x(e){var t=e.getAttribute("align");t&&(e.style["text-align"]=t,e.removeAttribute("align"))}function N(e){return e.replace(/\n|\r|\n\r|"/g,"")}function w(e,t,r){if(t){var i=e.getAttribute("style");i&&";"!=i.slice(-1)&&(i+=";"),t&&";"!=t.slice(-1)&&(t+=";"),t=t.replace(/\n/gi,"");var n=null;n=r?(i||"")+t:t+(i||""),e.setAttribute("style",n)}}var p=null;function u(e,t,r){for(var i=e.split(r),n=1;n<i.length;n++){var l=i[n];if(1<(l=l.split("shplid")).length){l=l[1];for(var a="",o=0;o<l.length&&"\\"!=l[o]&&"{"!=l[o]&&" "!=l[o]&&"\r"!=l[o]&&"\n"!=l[o];)a+=l[o],o++;var s=l.split("bliptag");if(s&&s.length<2)continue;var d=null;if(-1!=s[0].indexOf("pngblip")?d="image/png":-1!=s[0].indexOf("jpegblip")&&(d="image/jpeg"),!d)continue;var g,u=s[1].split("}");if(u&&u.length<2)continue;if(2<u.length&&-1!=u[0].indexOf("blipuid"))g=u[1].split(" ");else{if((g=u[0].split(" "))&&g.length<2)continue;g.shift()}var f=g.join("");p[t+a]={image_hex:f,image_type:d}}}}function f(e,t){var r=e.tagName,i=r.toLowerCase();e.firstElementChild&&("I"==e.firstElementChild.tagName?h(e.firstElementChild,"em"):"B"==e.firstElementChild.tagName&&h(e.firstElementChild,"strong"));if(-1!=["SCRIPT","APPLET","EMBED","NOFRAMES","NOSCRIPT"].indexOf(r))return y(e),!1;var n=-1,l=["META","LINK","XML","ST1:","O:","W:","FONT"];for(n=0;n<l.length;n++)if(-1!=r.indexOf(l[n]))return e.innerHTML&&(e.outerHTML=e.innerHTML),y(e),!1;if("TD"!=r){var a=e.getAttribute("class");if(t&&a){var o=(a=N(a)).split(" ");for(n=0;n<o.length;n++){var s=[],d="."+o[n];s.push(d),d=i+d,s.push(d);for(var g=0;g<s.length;g++)t[s[g]]&&w(e,t[s[g]])}e.removeAttribute("class")}t&&t[i]&&w(e,t[i])}if(-1!=["P","H1","H2","H3","H4","H5","H6","PRE"].indexOf(r)){var u=e.getAttribute("class");if(u&&(t&&t[r.toLowerCase()+"."+u]&&w(e,t[r.toLowerCase()+"."+u]),-1!=u.toLowerCase().indexOf("mso"))){var f=N(u);(f=f.replace(/[0-9a-z-_]*mso[0-9a-z-_]*/gi,""))?e.setAttribute("class",f):e.removeAttribute("class")}var p=e.getAttribute("style");if(p){var c=p.match(/text-align:.+?[; "]{1,1}/gi);c&&c[c.length-1].replace(/(text-align:.+?[; "]{1,1})/gi,"$1")}x(e)}if("TR"==r&&function(e,t){A.node.clearAttributes(e);for(var r=e.firstElementChild,i=0,n=!1,l=null;r;){r.firstElementChild&&-1!=r.firstElementChild.tagName.indexOf("W:")&&(r.innerHTML=r.firstElementChild.innerHTML),(l=r.getAttribute("width"))||n||(n=!0),i+=parseInt(l,10),(!r.firstChild||r.firstChild&&r.firstChild.data==S.FE.UNICODE_NBSP)&&(r.firstChild&&y(r.firstChild),r.innerHTML="<br>");for(var a=r.firstElementChild,o=1==r.children.length;a;)"P"!=a.tagName||C(a)||o&&x(a),a=a.nextElementSibling;if(t){var s=r.getAttribute("class");if(s){var d=(s=N(s)).match(/xl[0-9]+/gi);if(d){var g="."+d[0];t[g]&&w(r,t[g])}}t.td&&w(r,t.td)}var u=r.getAttribute("style");u&&(u=N(u))&&";"!=u.slice(-1)&&(u+=";");var f=r.getAttribute("valign");if(!f&&u){var p=u.match(/vertical-align:.+?[; "]{1,1}/gi);p&&(f=p[p.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var c=null;if(u){var m=u.match(/text-align:.+?[; "]{1,1}/gi);m&&(c=m[m.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==c&&(c=null)}var h=null;if(u){var v=u.match(/background:.+?[; "]{1,1}/gi);v&&(h=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var b=r.getAttribute("colspan"),E=r.getAttribute("rowspan");b&&r.setAttribute("colspan",b),E&&r.setAttribute("rowspan",E),f&&(r.style["vertical-align"]=f),c&&(r.style["text-align"]=c),h&&(r.style["background-color"]=h),l&&r.setAttribute("width",l),r=r.nextElementSibling}for(r=e.firstElementChild;r;)l=r.getAttribute("width"),n?r.removeAttribute("width"):r.setAttribute("width",100*parseInt(l,10)/i+"%"),r=r.nextElementSibling}(e,t),"A"!=r||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"TD"!=r&&"TH"!=r||e.innerHTML||(e.innerHTML="<br>"),"TABLE"==r&&(e.style.width="100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var m=N(e.getAttribute("style"));(m=m.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",m):e.removeAttribute("style")}return!0}var c={};return{_init:function(){A.events.on("paste.wordPaste",function(e){return i=e,A.opts.wordPasteModal?function(){if(!l){var e='<h4><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 74.95 73.23" style="height: 25px; vertical-align: text-bottom; margin-right: 5px; display: inline-block"><defs><style>.a{fill:#2a5699;}.b{fill:#fff;}</style></defs><path class="a" d="M615.15,827.22h5.09V834c9.11.05,18.21-.09,27.32.05a2.93,2.93,0,0,1,3.29,3.25c.14,16.77,0,33.56.09,50.33-.09,1.72.17,3.63-.83,5.15-1.24.89-2.85.78-4.3.84-8.52,0-17,0-25.56,0v6.81h-5.32c-13-2.37-26-4.54-38.94-6.81q0-29.8,0-59.59c13.05-2.28,26.11-4.5,39.17-6.83Z" transform="translate(-575.97 -827.22)"/><path class="b" d="M620.24,836.59h28.1v54.49h-28.1v-6.81h22.14v-3.41H620.24v-4.26h22.14V873.2H620.24v-4.26h22.14v-3.41H620.24v-4.26h22.14v-3.41H620.24v-4.26h22.14v-3.41H620.24V846h22.14v-3.41H620.24Zm-26.67,15c1.62-.09,3.24-.16,4.85-.25,1.13,5.75,2.29,11.49,3.52,17.21,1-5.91,2-11.8,3.06-17.7,1.7-.06,3.41-.15,5.1-.26-1.92,8.25-3.61,16.57-5.71,24.77-1.42.74-3.55,0-5.24.09-1.13-5.64-2.45-11.24-3.47-16.9-1,5.5-2.29,10.95-3.43,16.42q-2.45-.13-4.92-.3c-1.41-7.49-3.07-14.93-4.39-22.44l4.38-.18c.88,5.42,1.87,10.82,2.64,16.25,1.2-5.57,2.43-11.14,3.62-16.71Z" transform="translate(-575.97 -827.22)"/></svg> '+A.language.translate("Word Paste Detected")+"</h4>",t=(n='<div class="fr-word-paste-modal" style="padding: 20px 20px 10px 20px;">',n+='<p style="text-align: left;">'+A.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"</p>",n+='<div style="text-align: right; margin-top: 50px;"><button class="fr-remove-word fr-command">'+A.language.translate("Clean")+'</button> <button class="fr-keep-word fr-command">'+A.language.translate("Keep")+"</button></div>",n+="</div>"),r=A.modals.create(a,e,t),i=r.$body;l=r.$modal,r.$modal.addClass("fr-middle"),A.events.bindClick(i,"button.fr-remove-word",function(){var e=l.data("instance")||A;e.wordPaste.clean()}),A.events.bindClick(i,"button.fr-keep-word",function(){var e=l.data("instance")||A;e.wordPaste.clean(!0)}),A.events.$on(S(A.o_win),"resize",function(){A.modals.resize(a)})}var n;A.modals.show(a),A.modals.resize(a)}():t(A.opts.wordPasteKeepFormatting),!1})},clean:t}}}); | ||
!function(r){"function"==typeof define&&define.amd?define(["jquery"],r):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),r(t)}:r(window.jQuery)}(function(w){w.extend(w.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent","border","border-.*","line-height"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),w.FE.PLUGINS.wordPaste=function(E){var a,i,l="word_paste";function t(e){var t=E.opts.wordAllowedStyleProps;e||(E.opts.wordAllowedStyleProps=[]),0===i.indexOf("<colgroup>")&&(i="<table>"+i+"</table>"),i=function(e,t){0<=e.indexOf("<html")&&(e=e.replace(/[.\s\S\w\W<>]*(<html[^>]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),r=1;r<t.length;r++){var i=t[r],n=i.split(' id="')[1];if(n&&1<n.length){n=n.split('"')[0];var a=i.split(' o:spid="')[1];a&&1<a.length&&(a=a.split('"')[0],c[n]=a)}}}(e);var r=(new DOMParser).parseFromString(e,"text/html"),i=r.head,n=r.body,o=function(e){var t={},r=e.getElementsByTagName("style");if(r.length){var i=r[0],n=i.innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);if(n)for(var a=0;a<n.length;a++){var l=n[a],o=l.replace(/([\S ]+\s+){[\s\S]+?}/gi,"$1"),s=l.replace(/[\S ]+\s+{([\s\S]+?)}/gi,"$1");o=o.replace(/^[\s]|[\s]$/gm,""),s=s.replace(/^[\s]|[\s]$/gm,""),o=o.replace(/\n|\r|\n\r/g,""),s=s.replace(/\n|\r|\n\r/g,"");for(var d=o.split(", "),f=0;f<d.length;f++)t[d[f]]=s}}return t}(i);f(n,function(e){if(e.nodeType==Node.TEXT_NODE&&/\n|\u00a0|\r/.test(e.data)){if(!/\S| /.test(e.data)&&!/[\u00a0]+/.test(e.data))return e.data==w.FE.UNICODE_NBSP?(e.data="\u200b",!0):1==e.data.length&&10==e.data.charCodeAt(0)?(e.data=" ",!0):(y(e),!1);e.data=e.data.replace(/\n|\r/gi," ")}return!0}),f(n,function(e){return e.nodeType!=Node.ELEMENT_NODE||"V:IMAGEDATA"!=e.tagName&&"IMG"!=e.tagName||function(e,t){if(!t)return;var r;if("IMG"==e.tagName){var i=e.getAttribute("src");if(!i||-1==i.indexOf("file://"))return;if(0===i.indexOf("file://")&&E.helpers.isURL(e.getAttribute("alt")))return e.setAttribute("src",e.getAttribute("alt"));(r=c[e.getAttribute("v:shapes")])||(r=e.getAttribute("v:shapes"),e.parentNode&&e.parentNode.parentNode&&0<=e.parentNode.parentNode.innerHTML.indexOf("msEquation")&&(r=null))}else r=e.parentNode.getAttribute("o:spid");if(e.removeAttribute("height"),!r)return;n=t,p={},u(n,"i","\\shppict"),u(n,"s","\\shp{");var n;var a=p[r.substring(7)];if(a){var l=function(e){for(var t=e.match(/[0-9a-f]{2}/gi),r=[],i=0;i<t.length;i++)r.push(String.fromCharCode(parseInt(t[i],16)));var n=r.join("");return btoa(n)}(a.image_hex),o="data:"+a.image_type+";base64,"+l;"IMG"===e.tagName?(e.src=o,e.setAttribute("data-fr-image-pasted",!0)):w(e.parentNode).before('<img data-fr-image-pasted="true" src="'+o+'" style="'+e.parentNode.getAttribute("style")+'">').remove()}}(e,t),!0});for(var a=n.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),l=a.length-1;0<=l;l--)a[l].previousElementSibling&&"LI"===a[l].previousElementSibling.tagName&&a[l].previousElementSibling.appendChild(a[l]);f(n,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/<br>(\n|\r)/gi,"<br>"),!1;if(t.nodeType==Node.ELEMENT_NODE){if(A(t)){var r=t.parentNode,i=t.previousSibling,n=function e(t,r,i){var n=/[0-9a-zA-Z]./gi;var a=!1;var l=t.querySelector('span[style="mso-list:Ignore"]');var o;var s;var d;var f;var u;l&&(a=a||n.test(l.textContent));var g=a?"ol":"ul";var p="<"+g+">";for(;t;){if(!A(t)){if(t.outerHTML&&0<t.outerHTML.indexOf("mso-bookmark")&&0==(t.textContent||"").length){t=t.nextElementSibling;continue}break}var c=t.getAttribute("style").replace(/\n/gi,"").replace(/.*level([0-9]+?).*/gi,"$1");if((i=i||c)<c)u=e(t,r,c),p+=u.el.outerHTML,t=u.currentNode;else{if(c<i)break;t.firstElementChild&&t.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstChild&&(n.lastIndex=0,s=n.test(t.firstElementChild.firstElementChild.firstChild.data||"")),o&&o.firstElementChild&&o.firstElementChild.firstElementChild&&o.firstElementChild.firstElementChild.firstChild&&(n.lastIndex=0,d=n.test(o.firstElementChild.firstElementChild.firstChild.data||"")),d===undefined||d===s?(f=b(t,r),p+="<li>"+f+"</li>"):(u=e(t,r,c),p+=u.el.outerHTML,t=u.currentNode);var m=t&&t.nextElementSibling;m&&(o=m.previousElementSibling),t&&t.parentNode&&t.parentNode.removeChild(t),t=m}}p+="</"+g+">";var h=document.createElement("div");h.innerHTML=p;var v=h.firstElementChild;return{el:v,currentNode:t}}(t,o).el,a=null;return(a=i?i.nextSibling:r.firstChild)?r.insertBefore(n,a):r.appendChild(n),!1}return"FONT"===t.tagName&&o["."+t.getAttribute("class")]&&(t=v(t,"span")),g(t,o)}if(t.nodeType==Node.COMMENT_NODE){if(-1<t.data.indexOf("[if !supportLineBreakNewLine]"))for(var l=t.nextSibling;l;)(l=t.nextSibling)&&y(l),l.data&&-1<l.data.indexOf("[endif]")&&(l=null);return y(t),!1}return!0}),f(n,function(e){if(e.nodeType==Node.ELEMENT_NODE){var t=e.tagName;if(!e.innerHTML&&-1==["BR","IMG"].indexOf(t)){for(var r=e.parentNode;r&&(y(e),!(e=r).innerHTML);)r=e.parentNode;return!1}!function(e){var t=e.getAttribute("style");if(!t)return;(t=C(t))&&";"!=t.slice(-1)&&(t+=";");var r=t.match(/(^|\S+?):.+?;{1,1}/gi);if(!r)return;for(var i={},n=0;n<r.length;n++){var a=r[n],l=a.split(":");2==l.length&&("text-align"==l[0]&&"SPAN"==e.tagName||(i[l[0]]=l[1]))}var o="";for(var s in i)if(i.hasOwnProperty(s)){if("font-size"==s&&"pt;"==i[s].slice(-3)){var d=null;try{d=parseFloat(i[s].slice(0,-3),10)}catch(f){}d&&(d=Math.round(1.33*d),i[s]=d+"px;")}o+=s+":"+i[s]}o&&e.setAttribute("style",o)}(e)}return!0}),f(n,function(e){if(e&&"A"===e.nodeName&&""===e.href){for(var t=document.createDocumentFragment();e.firstChild;)t.appendChild(e.firstChild);e.parentNode.replaceChild(t,e)}return!0});var s=n.outerHTML,d=E.opts.htmlAllowedStyleProps;return E.opts.htmlAllowedStyleProps=E.opts.wordAllowedStyleProps,s=E.clean.html(s,E.opts.wordDeniedTags,E.opts.wordDeniedAttrs,!1),E.opts.htmlAllowedStyleProps=d,s}(i=i.replace(/<span[\n\r ]*style='mso-spacerun:yes'>([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var r="",i=0;i++<t.length;)r+=" ";return r}),E.paste.getRtfClipboard());var r=E.doc.createElement("DIV");r.innerHTML=i,E.html.cleanBlankSpaces(r),i=r.innerHTML,i=(i=E.paste.cleanEmptyTagsAndDivs(i)).replace(/\u200b/g,""),E.modals.hide(l),E.paste.clean(i,!0,!0),E.opts.wordAllowedStyleProps=t}function y(e){e.parentNode&&e.parentNode.removeChild(e)}function f(e,t){if(t(e))for(var r=e.firstChild;r;){var i=r,n=r.previousSibling;r=r.nextSibling,f(i,t),i.previousSibling||i.nextSibling||i.parentNode||!r||n==r.previousSibling||!r.parentNode?i.previousSibling||i.nextSibling||i.parentNode||!r||r.previousSibling||r.nextSibling||r.parentNode||(n?r=n.nextSibling?n.nextSibling.nextSibling:null:e.firstChild&&(r=e.firstChild.nextSibling)):r=n?n.nextSibling:e.firstChild}}function A(e){if(!e.getAttribute("style")||!/mso-list:[\s]*l/gi.test(e.getAttribute("style").replace(/\n/gi,"")))return!1;try{if(!e.querySelector('[style="mso-list:Ignore"]'))return!!(e.outerHTML&&0<=e.outerHTML.indexOf("\x3c!--[if !supportLists]--\x3e"))}catch(t){return!1}return!0}function b(e,a){var l=e.cloneNode(!0);if(-1!=["H1","H2","H3","H4","H5","H6"].indexOf(e.tagName)){var t=document.createElement(e.tagName.toLowerCase());t.setAttribute("style",e.getAttribute("style")),t.innerHTML=l.innerHTML,l.innerHTML=t.outerHTML}f(l,function(e){if(e.nodeType==Node.COMMENT_NODE&&(E.browser.msie||E.browser.safari||E.browser.edge))try{if("[if !supportLists]"===e.data){for(e=e.nextSibling;e&&e.nodeType!==Node.COMMENT_NODE;){var t=e.nextSibling;e.parentNode.removeChild(e),e=t}e&&e.nodeType==Node.COMMENT_NODE&&e.parentNode.removeChild(e)}}catch(n){}var r,i;return e.nodeType==Node.ELEMENT_NODE&&("mso-list:Ignore"==e.getAttribute("style")&&e.parentNode.removeChild(e),e.setAttribute("style",(r="",i=l.getAttribute("style"),["line-height","font-family","font-size"].forEach(function(e){var t=i.match(new RegExp(e+":.*;"));t&&(r+=t[0]+";")}),r)),g(e,a)),!0});var r=l.innerHTML;return r=r.replace(/<!--[\s\S]*?-->/gi,"")}function v(e,t){for(var r=document.createElement(t),i=0;i<e.attributes.length;i++){var n=e.attributes[i].name;r.setAttribute(n,e.getAttribute(n))}return r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e),r}function x(e){var t=e.getAttribute("align");t&&(e.style["text-align"]=t,e.removeAttribute("align"))}function C(e){return e.replace(/\n|\r|\n\r|"/g,"")}function T(e,t,r){if(t){var i=e.getAttribute("style");i&&";"!=i.slice(-1)&&(i+=";"),t&&";"!=t.slice(-1)&&(t+=";"),t=t.replace(/\n/gi,"");var n=null;n=r?(i||"")+t:t+(i||""),e.setAttribute("style",n)}}var p=null;function u(e,t,r){for(var i=e.split(r),n=1;n<i.length;n++){var a=i[n];if(1<(a=a.split("shplid")).length){a=a[1];for(var l="",o=0;o<a.length&&"\\"!=a[o]&&"{"!=a[o]&&" "!=a[o]&&"\r"!=a[o]&&"\n"!=a[o];)l+=a[o],o++;var s=a.split("bliptag");if(s&&s.length<2)continue;var d=null;if(-1!=s[0].indexOf("pngblip")?d="image/png":-1!=s[0].indexOf("jpegblip")&&(d="image/jpeg"),!d)continue;var f,u=s[1].split("}");if(u&&u.length<2)continue;if(2<u.length&&-1!=u[0].indexOf("blipuid"))f=u[1].split(" ");else{if((f=u[0].split(" "))&&f.length<2)continue;f.shift()}var g=f.join("");p[t+l]={image_hex:g,image_type:d}}}}function g(e,t){var r=e.tagName,i=r.toLowerCase();e.firstElementChild&&("I"==e.firstElementChild.tagName?v(e.firstElementChild,"em"):"B"==e.firstElementChild.tagName&&v(e.firstElementChild,"strong"));if(-1!=["SCRIPT","APPLET","EMBED","NOFRAMES","NOSCRIPT"].indexOf(r))return y(e),!1;var n=-1,a=["META","LINK","XML","ST1:","O:","W:","FONT"];for(n=0;n<a.length;n++)if(-1!=r.indexOf(a[n]))return e.innerHTML&&(e.outerHTML=e.innerHTML),y(e),!1;if("TD"!=r){var l=e.getAttribute("class")||"MsoNormal";if(t&&l){var o=(l=C(l)).split(" ");for(n=0;n<o.length;n++){var s=[],d="."+o[n];s.push(d),d=i+d,s.push(d);for(var f=0;f<s.length;f++)t[s[f]]&&T(e,t[s[f]])}e.removeAttribute("class")}t&&t[i]&&T(e,t[i])}if(-1!=["P","H1","H2","H3","H4","H5","H6","PRE"].indexOf(r)){var u=e.getAttribute("class");if(u&&(t&&t[r.toLowerCase()+"."+u]&&T(e,t[r.toLowerCase()+"."+u]),-1!=u.toLowerCase().indexOf("mso"))){var g=C(u);(g=g.replace(/[0-9a-z-_]*mso[0-9a-z-_]*/gi,""))?e.setAttribute("class",g):e.removeAttribute("class")}var p=e.getAttribute("style");if(p){var c=p.match(/text-align:.+?[; "]{1,1}/gi);c&&c[c.length-1].replace(/(text-align:.+?[; "]{1,1})/gi,"$1")}x(e)}if("TR"==r&&function(e,t){E.node.clearAttributes(e);for(var r=e.firstElementChild,i=0,n=!1,a=null;r;){r.firstElementChild&&-1!=r.firstElementChild.tagName.indexOf("W:")&&(r.innerHTML=r.firstElementChild.innerHTML),(a=r.getAttribute("width"))||n||(n=!0),i+=parseInt(a,10),(!r.firstChild||r.firstChild&&r.firstChild.data==w.FE.UNICODE_NBSP)&&(r.firstChild&&y(r.firstChild),r.innerHTML="<br>");for(var l=r.firstElementChild,o=1==r.children.length;l;)"P"!=l.tagName||A(l)||o&&x(l),l=l.nextElementSibling;if(t){var s=r.getAttribute("class");if(s){var d=(s=C(s)).match(/xl[0-9]+/gi);if(d){var f="."+d[0];t[f]&&T(r,t[f])}}t.td&&T(r,t.td)}var u=r.getAttribute("style");u&&(u=C(u))&&";"!=u.slice(-1)&&(u+=";");var g=r.getAttribute("valign");if(!g&&u){var p=u.match(/vertical-align:.+?[; "]{1,1}/gi);p&&(g=p[p.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var c=null;if(u){var m=u.match(/text-align:.+?[; "]{1,1}/gi);m&&(c=m[m.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==c&&(c=null)}var h=null;if(u){var v=u.match(/background:.+?[; "]{1,1}/gi);v&&(h=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var b=r.getAttribute("colspan"),N=r.getAttribute("rowspan");b&&r.setAttribute("colspan",b),N&&r.setAttribute("rowspan",N),g&&(r.style["vertical-align"]=g),c&&(r.style["text-align"]=c),h&&(r.style["background-color"]=h),a&&r.setAttribute("width",a),r=r.nextElementSibling}for(r=e.firstElementChild;r;)a=r.getAttribute("width"),n?r.removeAttribute("width"):r.setAttribute("width",100*parseInt(a,10)/i+"%"),r=r.nextElementSibling}(e,t),"A"!=r||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"A"==r&&e.getAttribute("href")&&e.querySelector("img")){var m=e.querySelectorAll("span");for(n=0;n<m.length;n++)m[n].innerText||(m[n].outerHTML=m[n].innerHTML)}if("TD"!=r&&"TH"!=r||e.innerHTML||(e.innerHTML="<br>"),"TABLE"==r&&(e.style.width=e.style.width||"100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var h=C(e.getAttribute("style"));(h=h.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",h):e.removeAttribute("style")}return!0}var c={};return{_init:function(){E.events.on("paste.wordPaste",function(e){return i=e,E.opts.wordPasteModal?function(){if(!a){var e='<h4><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 74.95 73.23" style="height: 25px; vertical-align: text-bottom; margin-right: 5px; display: inline-block"><defs><style>.a{fill:#2a5699;}.b{fill:#fff;}</style></defs><path class="a" d="M615.15,827.22h5.09V834c9.11.05,18.21-.09,27.32.05a2.93,2.93,0,0,1,3.29,3.25c.14,16.77,0,33.56.09,50.33-.09,1.72.17,3.63-.83,5.15-1.24.89-2.85.78-4.3.84-8.52,0-17,0-25.56,0v6.81h-5.32c-13-2.37-26-4.54-38.94-6.81q0-29.8,0-59.59c13.05-2.28,26.11-4.5,39.17-6.83Z" transform="translate(-575.97 -827.22)"/><path class="b" d="M620.24,836.59h28.1v54.49h-28.1v-6.81h22.14v-3.41H620.24v-4.26h22.14V873.2H620.24v-4.26h22.14v-3.41H620.24v-4.26h22.14v-3.41H620.24v-4.26h22.14v-3.41H620.24V846h22.14v-3.41H620.24Zm-26.67,15c1.62-.09,3.24-.16,4.85-.25,1.13,5.75,2.29,11.49,3.52,17.21,1-5.91,2-11.8,3.06-17.7,1.7-.06,3.41-.15,5.1-.26-1.92,8.25-3.61,16.57-5.71,24.77-1.42.74-3.55,0-5.24.09-1.13-5.64-2.45-11.24-3.47-16.9-1,5.5-2.29,10.95-3.43,16.42q-2.45-.13-4.92-.3c-1.41-7.49-3.07-14.93-4.39-22.44l4.38-.18c.88,5.42,1.87,10.82,2.64,16.25,1.2-5.57,2.43-11.14,3.62-16.71Z" transform="translate(-575.97 -827.22)"/></svg> '+E.language.translate("Word Paste Detected")+"</h4>",t=(n='<div class="fr-word-paste-modal" style="padding: 20px 20px 10px 20px;">',n+='<p style="text-align: left;">'+E.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"</p>",n+='<div style="text-align: right; margin-top: 50px;"><button class="fr-remove-word fr-command">'+E.language.translate("Clean")+'</button> <button class="fr-keep-word fr-command">'+E.language.translate("Keep")+"</button></div>",n+="</div>"),r=E.modals.create(l,e,t),i=r.$body;a=r.$modal,r.$modal.addClass("fr-middle"),E.events.bindClick(i,"button.fr-remove-word",function(){var e=a.data("instance")||E;e.wordPaste.clean()}),E.events.bindClick(i,"button.fr-keep-word",function(){var e=a.data("instance")||E;e.wordPaste.clean(!0)}),E.events.$on(w(E.o_win),"resize",function(){E.modals.resize(l)})}var n;E.modals.show(l),E.modals.resize(l)}():t(E.opts.wordPasteKeepFormatting),!1})},clean:t}}}); |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (https://www.froala.com/wysiwyg-editor) | ||
* License https://froala.com/wysiwyg-editor/terms/ | ||
@@ -4,0 +4,0 @@ * Copyright 2014-2019 Froala Labs |
/*! | ||
* froala_editor v2.9.3 (https://www.froala.com/wysiwyg-editor) | ||
* froala_editor v2.9.4 (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": "2.9.3", | ||
"version": "2.9.4", | ||
"description": "A beautiful 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 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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
3974577
262
23701
2