CoreFiles by mySites.guru
joomla-editor-codemirror-es5.min.js1 lines, 7,499 bytes, from Joomla_4.0.0-beta1-Beta-Full_Package.zip
Raw History Compare with 3.9.0-beta4
md5
87937a0710cac70afbbc6bdf696c70ea
sha1
3b01557c70c08016c049c0a3b925a6c6d9a11b87
sha256
8eb44d3ff6bddf4574510994f5589ccc9ec51a4be15074f10073c86406d598be
"use strict";function _typeof(a){"@babel/helpers - typeof";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 _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 _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){return b&&("object"===_typeof(b)||"function"==typeof b)?b:_assertThisInitialized(a)}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 _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 _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 _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=c.call(this),a.instance="",a.cm="",a.host=window.location.origin,a.element=a.querySelector("textarea"),a.refresh=a.refresh.bind(_assertThisInitialized(a)),a.toggleFullScreen=a.toggleFullScreen.bind(_assertThisInitialized(a)),a.closeFullScreen=a.closeFullScreen.bind(_assertThisInitialized(a)),!document.head.querySelector("#cm-editor")){var d=a.getAttribute("editor"),e=document.createElement("script");e.src="".concat(a.host,"/").concat(d),e.id="cm-editor",e.setAttribute("async",!1),document.head.insertBefore(e,a.file)}return a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"attributeChangedCallback",value:function attributeChangedCallback(a,b,c){switch(a){case"options":b&&c!==b&&this.refresh(this.element);break;default:}}},{key:"connectedCallback",value:function connectedCallback(){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&&e.mime&&c.setOption("mode",e.mime);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.constructor.makeMarker())}}),"fieldset"===a.parentNode.tagName.toLowerCase()&&(a.parentNode.style.minWidth=0)}),a.instance=window.CodeMirror.fromTextArea(a.element,a.options),a.instance.disable=function(b){return a.instance.setOption("readOnly",!!b&&"nocursor")},Joomla.editors.instances[a.element.id]=a.instance})})}},{key:"disconnectedCallback",value:function disconnectedCallback(){delete Joomla.editors.instances[this.element.id]}},{key:"refresh",value:function refresh(a){this.instance=window.CodeMirror.fromTextArea(a,this.options)}},{key:"rafAsync",value:function rafAsync(){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 checkElement(){return a.apply(this,arguments)}}()},{key:"toggleFullScreen",value:function toggleFullScreen(){this.instance.setOption("fullScreen",!this.instance.getOption("fullScreen"));var a=document.getElementById("header");a&&a.classList.toggle("hidden")}},{key:"closeFullScreen",value:function closeFullScreen(){this.instance.getOption("fullScreen"),this.instance.setOption("fullScreen",!1);var a=document.getElementById("header");a&&a.classList.remove("hidden")}},{key:"options",get:function get(){return JSON.parse(this.getAttribute("options"))},set:function set(a){this.setAttribute("options",a)}}],[{key:"makeMarker",value:function makeMarker(){var a=document.createElement("div");return a.className="CodeMirror-markergutter-mark",a}},{key:"observedAttributes",get:function get(){return["options"]}}]),b}(_wrapNativeSuper(HTMLElement)));

The same content is in 3 releases, Joomla 4.0.0-beta to 4.0.0-beta3. See them all, or every version of this file.