2 lines
232 KiB
JavaScript
2 lines
232 KiB
JavaScript
|
/*! For license information please see field-text-editor.beed4e76.js.LICENSE.txt */
|
||
|
(()=>{var t={6035:function(t){var e;e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e){function n(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var r=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.form=e,this.isDirty=!1,this.initialValues={},this.fields=[].concat(n(this.form.elements),n(this.form.querySelectorAll("trix-editor"))),this.message=i.message||"You have unsaved changes!",this.setupFields(),this.setFormHandlers()}var e,r,o;return e=t,(r=[{key:"setupFields",value:function(){var t=this;this.fields.forEach((function(e){e.name&&"submit"!=e.type&&"button"!=e.type&&"hidden"!=e.type&&(t.initialValues[e.name]=e.value,"TRIX-EDITOR"==e.nodeName?e.addEventListener("trix-change",t.checkValue.bind(t)):(e.addEventListener("change",t.checkValue.bind(t)),e.addEventListener("input",t.checkValue.bind(t))))}))}},{key:"setFormHandlers",value:function(){var t=this;window.addEventListener("submit",this.handleSubmit.bind(this)),this.form.addEventListener("submit",this.handleSubmit.bind(this)),window.onbeforeunload=function(){if(t.isDirty)return t.message},"undefined"!=typeof Turbolinks&&document.addEventListener("turbolinks:before-visit",(function(e){t.isDirty&&!confirm(t.message)?e.preventDefault():t.isDirty=!1}))}},{key:"checkValue",value:function(t){var e=t.target;this.initialValues[e.name]!=e.value&&(this.isDirty=!0)}},{key:"handleSubmit",value:function(){this.isDirty=!1}}])&&i(e.prototype,r),o&&i(e,o),t}();t.exports=r}])},t.exports=e()},728:(t,e,n)=>{"use strict";n.r(e)},6250:function(t,e,n){var i,r;(function(){}).call(this),function(){null==window.Set&&(window.Set=function(){function t(){this.clear()}return t.prototype.clear=function(){return this.values=[]},t.prototype.has=function(t){return-1!==this.values.indexOf(t)},t.prototype.add=function(t){return this.has(t)||this.values.push(t),this},t.prototype.delete=function(t){var e;return-1!==(e=this.values.indexOf(t))&&(this.values.splice(e,1),!0)},t.prototype.forEach=function(){var t;return(t=this.values).forEach.apply(t,arguments)},t}())}.call(this),function(e){function n(){}function i(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(t,this)}function r(t,e){for(;3===t._state;)t=t._value;return 0===t._state?void t._deferreds.push(e):(t._handled=!0,void h((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var i;try{i=n(t._value)}catch(t){return void s(e.promise,t)}o(e.promise,i)}else(1===t._state?o:s)(e.promise,t._value)})
|