/*! * froala_editor v3.0.3 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2019 Froala Labs */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(p){"use strict";p=p&&p.hasOwnProperty("default")?p["default"]:p,Object.assign(p.DEFAULTS,{quickInsertButtons:["image","video","embedly","table","ul","ol","hr"],quickInsertTags:["p","div","h1","h2","h3","h4","h5","h6","pre","blockquote"],quickInsertEnabled:!0}),p.QUICK_INSERT_BUTTONS={},p.DefineIcon("quickInsert",{SVG_KEY:"add",template:"svg"}),p.RegisterQuickInsertButton=function(e,t){p.QUICK_INSERT_BUTTONS[e]=Object.assign({undo:!0},t)},p.RegisterQuickInsertButton("image",{icon:"insertImage",requiredPlugin:"image",title:"Insert Image",undo:!1,callback:function(){var e=this,t=e.$;e.shared.$qi_image_input||(e.shared.$qi_image_input=t(document.createElement("input")).attr("accept","image/"+e.opts.imageAllowedTypes.join(", image/").toLowerCase()).attr("name","quickInsertImage"+this.id).attr("style","display: none;").attr("type","file"),t("body").first().append(e.shared.$qi_image_input),e.events.$on(e.shared.$qi_image_input,"change",function(){var e=t(this).data("inst");this.files&&(e.quickInsert.hide(),e.image.upload(this.files)),t(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)[0].click()}}),p.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)}}),p.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)}}),p.RegisterQuickInsertButton("table",{icon:"insertTable",requiredPlugin:"table",title:"Insert Table",callback:function(){this.table.insert(2,2)}}),p.RegisterQuickInsertButton("ol",{icon:"formatOL",requiredPlugin:"lists",title:"Ordered List",callback:function(){this.lists.format("OL")}}),p.RegisterQuickInsertButton("ul",{icon:"formatUL",requiredPlugin:"lists",title:"Unordered List",callback:function(){this.lists.format("UL")}}),p.RegisterQuickInsertButton("hr",{icon:"insertHR",title:"Insert Horizontal Line",callback:function(){this.commands.insertHR()}}),p.PLUGINS.quickInsert=function(o){var a,l,u=o.$;function n(e){var t,n,i;(t=e.offset().top-o.$box.offset().top,n=(o.$iframe&&o.$iframe.offset().left||0)+e.offset().left'+o.icon.create("quickInsert")+""));a=o.shared.$quick_insert,o.tooltip.bind(o.$box,".fr-quick-insert > a.fr-floating-btn"),o.events.on("destroy",function(){u("body").first().append(a.removeClass("fr-on")).css("left",-9999).css("top",-9999),l&&(c(),u("body").first().append(l))},!0),o.events.on("shared.destroy",function(){a.html("").removeData().remove(),a=null,l&&(l.html("").removeData().remove(),l=null)},!0),o.events.on("commands.before",r),o.events.on("commands.after",function(){o.popups.areVisible()||i()}),o.events.bindClick(o.$box,".fr-quick-insert > a",d),o.events.bindClick(o.$box,".fr-qi-helper > a.fr-btn",function(e){var t=u(e.currentTarget).data("cmd");if(!1===o.events.trigger("quickInsert.commands.before",[t]))return!1;p.QUICK_INSERT_BUTTONS[t].callback.apply(o,[e.currentTarget]),p.QUICK_INSERT_BUTTONS[t].undo&&o.undo.saveStep(),o.events.trigger("quickInsert.commands.after",[t]),o.quickInsert.hide()}),o.events.$on(o.$wp,"scroll",f),o.events.$on(o.$tb,"transitionend",".fr-more-toolbar",f)}(),a.hasClass("fr-on")&&c(),o.$box.append(a),n(e),a.data("tag",e),a.addClass("fr-visible")}function i(){if(o.core.hasFocus()){var e=o.selection.element();if(o.opts.enter==p.ENTER_BR||o.node.isBlock(e)||(e=o.node.blockParent(e)),o.opts.enter==p.ENTER_BR&&!o.node.isBlock(e)){var t=o.node.deepestParent(e);t&&(e=t)}var n=function n(){return o.opts.enter!=p.ENTER_BR&&o.node.isEmpty(e)&&0<=o.opts.quickInsertTags.indexOf(e.tagName.toLowerCase())},i=function i(){return o.opts.enter==p.ENTER_BR&&("BR"==e.tagName&&(!e.previousSibling||"BR"==e.previousSibling.tagName||o.node.isBlock(e.previousSibling))||o.node.isEmpty(e)&&(!e.previousSibling||"BR"==e.previousSibling.tagName||o.node.isBlock(e.previousSibling))&&(!e.nextSibling||"BR"==e.nextSibling.tagName||o.node.isBlock(e.nextSibling)))};e&&(n()||i())?a&&a.data("tag").is(u(e))&&a.hasClass("fr-on")?c():o.selection.isCollapsed()&&s(u(e)):r()}}function r(){a&&(a.hasClass("fr-on")&&c(),a.removeClass("fr-visible fr-on"),a.css("left",-9999).css("top",-9999))}function d(e){if(e&&e.preventDefault(),a.hasClass("fr-on")&&!a.hasClass("fr-hidden"))c();else{if(!o.shared.$qi_helper){for(var t=o.opts.quickInsertButtons,n='
',i=0,s=0;s'+o.icon.create(r.icon)+"")}n+="
",o.shared.$qi_helper=u(n),o.tooltip.bind(o.shared.$qi_helper,"a.fr-btn"),o.events.$on(o.shared.$qi_helper,"mousedown",function(e){e.preventDefault()},!0)}l=o.shared.$qi_helper,o.$box.append(l),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 c(){var n=o.$box.find(".fr-qi-helper");n.length&&function(){for(var t=n.find("a"),e=0;e