- md5
- 1a7e58d4d9392ab48426724b83fc7740
- sha1
- ad0abcce92dade6913e1a1cde866fe8e51e3d628
- sha256
- 6f57a814fc98e97b7a7ad2c9df2d5e4647bf9d1d72e82d90365c76dcea214e50
"use strict";function _typeof(a){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}function _possibleConstructorReturn(a,b){return b&&("object"===_typeof(b)||"function"==typeof b)?b:_assertThisInitialized(a)}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&_setPrototypeOf(a,b)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _wrapNativeSuper(a){var b="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(a){function c(){return _construct(a,arguments,_getPrototypeOf(this).constructor)}if(null===a||!_isNativeFunction(a))return a;if("function"!=typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof b){if(b.has(a))return b.get(a);b.set(a,c)}return c.prototype=Object.create(a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(c,a)},_wrapNativeSuper(a)}function isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}function _construct(){return _construct=isNativeReflectConstruct()?Reflect.construct:function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeFunction(a){return-1!==Function.toString.call(a).indexOf("[native code]")}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}customElements.define("joomla-editor-codemirror",function(a){function b(){var a;if(_classCallCheck(this,b),a=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this)),a.instance="",a.cm="",a.host=window.location.origin,a.element=a.querySelector("textarea"),a.refresh=a.refresh.bind(_assertThisInitialized(_assertThisInitialized(a))),a.toggleFullScreen=a.toggleFullScreen.bind(_assertThisInitialized(_assertThisInitialized(a))),a.closeFullScreen=a.closeFullScreen.bind(_assertThisInitialized(_assertThisInitialized(a))),!document.head.querySelector("#cm-editor")){var c=a.getAttribute("editor"),d=document.createElement("script");d.src="".concat(a.host,"/").concat(c),d.id="cm-editor",d.setAttribute("async",!1),document.head.insertBefore(d,a.file)}return a}return _inherits(b,a),_createClass(b,[{key:"attributeChangedCallback",value:function d(a,b,c){switch(a){case"options":b&&c!==b&&this.refresh(this.element);break;default:}}},{key:"connectedCallback",value:function c(){var a=this,b=this;this.checkElement("CodeMirror").then(function(){if(!document.head.querySelector("#cm-addons")){var c=a.getAttribute("addons"),d=document.createElement("script");d.src="".concat(a.host,"/").concat(c),d.id="cm-addons",d.setAttribute("async",!1),document.head.insertBefore(d,a.file)}a.checkElement("CodeMirror","findModeByName").then(function(){window.CodeMirror.modeURL=a.getAttribute("mod-path"),window.CodeMirror.defineInitHook(function(c){var d,e=window.CodeMirror.findModeByName(c.options.mode||"")||window.CodeMirror.findModeByName(c.options.mode||"")||window.CodeMirror.findModeByExtension(c.options.mode||"");window.CodeMirror.autoLoadMode(c,e?e.mode:c.options.mode),e&&c.setOption("mode",e.mode);var f=(d={"Ctrl-Q":b.toggleFullScreen},_defineProperty(d,b.getAttribute("fs-combo"),b.toggleFullScreen),_defineProperty(d,"Esc",b.closeFullScreen),d);c.addKeyMap(f),c.on("gutterClick",function(b,c,d){if("CodeMirror-markergutter"===d){var e=b.lineInfo(c),f=!!e.gutterMarkers&&!!e.gutterMarkers["CodeMirror-markergutter"];b.setGutterMarker(c,"CodeMirror-markergutter",f?null:a.makeMarker())}}),"fieldset"===a.parentNode.tagName.toLowerCase()&&(a.parentNode.style.minWidth=0)}),a.instance=window.CodeMirror.fromTextArea(a.element,a.options),Joomla.editors.instances[a.element.id]=a.instance})})}},{key:"disconnectedCallback",value:function a(){delete Joomla.editors.instances[this.element.id]}},{key:"refresh",value:function b(a){this.instance=window.CodeMirror.fromTextArea(a,this.options)}},{key:"rafAsync",value:function a(){return new Promise(function(a){return requestAnimationFrame(a)})}},{key:"checkElement",value:function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b,c){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!c){a.next=8;break}case 1:if("function"==typeof window[b][c]){a.next=6;break}return a.next=4,this.rafAsync();case 4:a.next=1;break;case 6:a.next=13;break;case 8:if("function"==typeof window[b]){a.next=13;break}return a.next=11,this.rafAsync();case 11:a.next=8;break;case 13:return a.abrupt("return",!0);case 14:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}()},{key:"toggleFullScreen",value:function a(){this.instance.setOption("fullScreen",!this.instance.getOption("fullScreen"))}},{key:"closeFullScreen",value:function a(){this.instance.getOption("fullScreen"),this.instance.setOption("fullScreen",!1)}},{key:"options",get:function a(){return JSON.parse(this.getAttribute("options"))},set:function b(a){this.setAttribute("options",a)}}],[{key:"makeMarker",value:function b(){var a=document.createElement("div");return a.className="CodeMirror-markergutter-mark",a}},{key:"observedAttributes",get:function a(){return["options"]}}]),b}(_wrapNativeSuper(HTMLElement)));
No other release has this exact content. See every version of this file.