@ckeditor/ckeditor5-angular
Version:
Official Angular 2+ component for CKEditor 5 – the best browser-based rich text editor.
2 lines • 3.67 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("@ckeditor/ckeditor5-angular",["exports","@angular/core","@angular/common","@angular/forms"],e):e((t.ckeditor=t.ckeditor||{},t.ckeditor["ckeditor5-angular"]={}),t.ng.core,t.ng.common,t.ng.forms)}(this,function(t,n,e,i){"use strict";var o=function(){return(o=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},r=function(){function t(t,e){this.config={},this.data="",this.tagName="div",this.ready=new n.EventEmitter,this.change=new n.EventEmitter,this.blur=new n.EventEmitter,this.focus=new n.EventEmitter,this.editorInstance=null,this.initialIsDisabled=!1,this.ngZone=e,this.elementRef=t}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this.editorInstance?this.editorInstance.isReadOnly:this.initialIsDisabled},set:function(t){this.setDisabledState(t)},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){var t=this;this.ngZone.runOutsideAngular(function(){t.createEditor()})},t.prototype.ngOnDestroy=function(){this.editorInstance&&(this.editorInstance.destroy(),this.editorInstance=null)},t.prototype.writeValue=function(t){null===t&&(t=""),this.editorInstance?this.editorInstance.setData(t):(this.data=t,this.editorElement&&(this.editorElement.innerHTML=this.data))},t.prototype.registerOnChange=function(t){this.cvaOnChange=t},t.prototype.registerOnTouched=function(t){this.cvaOnTouched=t},t.prototype.setDisabledState=function(t){this.editorInstance?this.editorInstance.isReadOnly=t:this.initialIsDisabled=t},t.prototype.createEditor=function(){var e=this,t=document.createElement(this.tagName);if(this.editorElement=t,this.data&&this.config.initialData)throw new Error("Editor data should be provided either using `config.initialData` or `data` properties.");var n=o({},this.config,{initialData:this.config.initialData||this.data||""});return this.elementRef.nativeElement.appendChild(t),this.editor.create(t,n).then(function(t){e.editorInstance=t,e.initialIsDisabled&&(t.isReadOnly=e.initialIsDisabled),e.ngZone.run(function(){e.ready.emit(t)}),e.setUpEditorEvents(t)})["catch"](function(t){console.error(t.stack)})},t.prototype.setUpEditorEvents=function(n){var i=this,t=n.model.document,e=n.editing.view.document;t.on("change:data",function(e){i.ngZone.run(function(){if(i.cvaOnChange){var t=n.getData();i.cvaOnChange(t)}i.change.emit({event:e,editor:n})})}),e.on("focus",function(t){i.ngZone.run(function(){i.focus.emit({event:t,editor:n})})}),e.on("blur",function(t){i.ngZone.run(function(){i.cvaOnTouched&&i.cvaOnTouched(),i.blur.emit({event:t,editor:n})})})},t.decorators=[{type:n.Component,args:[{selector:"ckeditor",template:"<ng-template></ng-template>",providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:n.forwardRef(function(){return t}),multi:!0}]}]}],t.ctorParameters=function(){return[{type:n.ElementRef},{type:n.NgZone}]},t.propDecorators={editor:[{type:n.Input}],config:[{type:n.Input}],data:[{type:n.Input}],tagName:[{type:n.Input}],disabled:[{type:n.Input}],ready:[{type:n.Output}],change:[{type:n.Output}],blur:[{type:n.Output}],focus:[{type:n.Output}]},t}(),a=function(){function t(){}return t.decorators=[{type:n.NgModule,args:[{imports:[i.FormsModule,e.CommonModule],declarations:[r],exports:[r]}]}],t}();t.CKEditorComponent=r,t.CKEditorModule=a,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ckeditor-ckeditor5-angular.umd.min.js.map