/*! * froala_editor v2.9.6 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * 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(l){l.extend(l.FE.DEFAULTS,{saveInterval:1e4,saveURL:null,saveParams:{},saveParam:"body",saveMethod:"POST"}),l.FE.PLUGINS.save=function(i){var e=null,u=null,t=!1,v=1,f=2,n={};function d(e,t){i.events.trigger("save.error",[{code:e,message:n[e]},t])}function s(e){void 0===e&&(e=i.html.get());var t=e,n=i.events.trigger("save.before",[e]);if(!1===n)return!1;if("string"==typeof n&&(e=n),i.opts.saveURL){var s={};for(var o in i.opts.saveParams)if(i.opts.saveParams.hasOwnProperty(o)){var a=i.opts.saveParams[o];s[o]="function"==typeof a?a.call(this):a}var r={};r[i.opts.saveParam]=e,l.ajax({type:i.opts.saveMethod,url:i.opts.saveURL,data:l.extend(r,s),crossDomain:i.opts.requestWithCORS,xhrFields:{withCredentials:i.opts.requestWithCredentials},headers:i.opts.requestHeaders}).done(function(e){u=t,i.events.trigger("save.after",[e])}).fail(function(e){d(f,e.response||e.responseText)})}else d(v)}function o(){clearTimeout(e),e=setTimeout(function(){var e=i.html.get();(u!=e||t)&&(t=!1,s(u=e))},i.opts.saveInterval)}return n[v]="Missing saveURL option.",n[f]="Something went wrong during save.",{_init:function(){i.opts.saveInterval&&(u=i.html.get(),i.events.on("contentChanged",o),i.events.on("keydown destroy",function(){clearTimeout(e)}))},save:s,reset:function(){o(),t=!1},force:function(){t=!0}}},l.FE.DefineIcon("save",{NAME:"floppy-o",FA5NAME:"save"}),l.FE.RegisterCommand("save",{title:"Save",undo:!1,focus:!1,refreshAfterCallback:!1,callback:function(){this.save.save()},plugin:"save"})});