/*! * froala_editor v3.0.0-beta.2-1 (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(f){"use strict";f=f&&f.hasOwnProperty("default")?f["default"]:f,Object.assign(f.DEFAULTS,{quickInsertButtons:["image","video","embedly","table","ul","ol","hr"],quickInsertTags:["p","div","h1","h2","h3","h4","h5","h6","pre","blockquote"],quickInsertEnabled:!0}),f.QUICK_INSERT_BUTTONS={},f.DefineIcon("quickInsert",{SVG_KEY:"add",template:"svg"}),f.RegisterQuickInsertButton=function(e,t){f.QUICK_INSERT_BUTTONS[e]=Object.assign({undo:!0},t)},f.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()}}),f.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)}}),f.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)}}),f.RegisterQuickInsertButton("table",{icon:"insertTable",requiredPlugin:"table",title:"Insert Table",callback:function(){this.table.insert(2,2)}}),f.RegisterQuickInsertButton("ol",{icon:"formatOL",requiredPlugin:"lists",title:"Ordered List",callback:function(){this.lists.format("OL")}}),f.RegisterQuickInsertButton("ul",{icon:"formatUL",requiredPlugin:"lists",title:"Unordered List",callback:function(){this.lists.format("UL")}}),f.RegisterQuickInsertButton("hr",{icon:"insertHR",title:"Insert Horizontal Line",callback:function(){this.commands.insertHR()}}),f.PLUGINS.quickInsert=function(r){var a,l,u=r.$;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'+r.icon.create("quickInsert")+""));a=r.shared.$quick_insert,r.tooltip.bind(r.$box,".fr-quick-insert > a.fr-floating-btn"),r.events.on("destroy",function(){u("body").first().append(a.removeClass("fr-on")).css("left",-9999).css("top",-9999),l&&(d(),u("body").first().append(l))},!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=u(e.currentTarget).data("cmd");if(!1===r.events.trigger("quickInsert.commands.before",[t]))return!1;f.QUICK_INSERT_BUTTONS[t].callback.apply(r,[e.currentTarget]),f.QUICK_INSERT_BUTTONS[t].undo&&r.undo.saveStep(),r.events.trigger("quickInsert.commands.after",[t]),r.quickInsert.hide()}),r.events.$on(r.$wp,"scroll",c),r.events.$on(r.$tb,"transitionend",".fr-more-toolbar",c)}(),a.hasClass("fr-on")&&d(),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==f.ENTER_BR||r.node.isBlock(e)||(e=r.node.blockParent(e)),r.opts.enter==f.ENTER_BR&&!r.node.isBlock(e)){var t=r.node.deepestParent(e);t&&(e=t)}e&&(r.opts.enter!=f.ENTER_BR&&r.node.isEmpty(e)&&0<=r.opts.quickInsertTags.indexOf(e.tagName.toLowerCase())||r.opts.enter==f.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(u(e))&&a.hasClass("fr-on")?d():r.selection.isCollapsed()&&i(u(e)):s()}}function s(){a&&(a.hasClass("fr-on")&&d(),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"))d();else{if(!r.shared.$qi_helper){for(var t=r.opts.quickInsertButtons,i='
',n=0,s=0;s'+r.icon.create(o.icon)+"")}i+="
",r.shared.$qi_helper=u(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,r.$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 d(){var i=r.$box.find(".fr-qi-helper");i.length&&function(){for(var t=i.find("a"),e=0;e