UNPKG

13.8 kBJavaScriptView Raw
1!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("@tinymce/tinymce-angular",["exports","@angular/core","@angular/common","@angular/forms"],e):e(((t=t||self).tinymce=t.tinymce||{},t.tinymce["tinymce-angular"]={}),t.ng.core,t.ng.common,t.ng.forms)}(this,(function(t,e,n,o){"use strict";
2/*! *****************************************************************************
3 Copyright (c) Microsoft Corporation. All rights reserved.
4 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5 this file except in compliance with the License. You may obtain a copy of the
6 License at http://www.apache.org/licenses/LICENSE-2.0
7
8 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11 MERCHANTABLITY OR NON-INFRINGEMENT.
12
13 See the Apache Version 2.0 License for specific language governing permissions
14 and limitations under the License.
15 ***************************************************************************** */var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var r=function(){return(r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function u(t,e,n,o){var i,r=arguments.length,u=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,n,o);else for(var p=t.length-1;p>=0;p--)(i=t[p])&&(u=(r<3?i(u):r>3?i(e,n,u):i(e,n))||u);return r>3&&u&&Object.defineProperty(e,n,u),u}function p(t,e){return function(n,o){e(n,o,t)}}var s=function(){var t="undefined"!=typeof window?window:void 0;return t&&t.tinymce?t.tinymce:null},d=function(){function t(){this.onBeforePaste=new e.EventEmitter,this.onBlur=new e.EventEmitter,this.onClick=new e.EventEmitter,this.onContextMenu=new e.EventEmitter,this.onCopy=new e.EventEmitter,this.onCut=new e.EventEmitter,this.onDblclick=new e.EventEmitter,this.onDrag=new e.EventEmitter,this.onDragDrop=new e.EventEmitter,this.onDragEnd=new e.EventEmitter,this.onDragGesture=new e.EventEmitter,this.onDragOver=new e.EventEmitter,this.onDrop=new e.EventEmitter,this.onFocus=new e.EventEmitter,this.onFocusIn=new e.EventEmitter,this.onFocusOut=new e.EventEmitter,this.onKeyDown=new e.EventEmitter,this.onKeyPress=new e.EventEmitter,this.onKeyUp=new e.EventEmitter,this.onMouseDown=new e.EventEmitter,this.onMouseEnter=new e.EventEmitter,this.onMouseLeave=new e.EventEmitter,this.onMouseMove=new e.EventEmitter,this.onMouseOut=new e.EventEmitter,this.onMouseOver=new e.EventEmitter,this.onMouseUp=new e.EventEmitter,this.onPaste=new e.EventEmitter,this.onSelectionChange=new e.EventEmitter,this.onActivate=new e.EventEmitter,this.onAddUndo=new e.EventEmitter,this.onBeforeAddUndo=new e.EventEmitter,this.onBeforeExecCommand=new e.EventEmitter,this.onBeforeGetContent=new e.EventEmitter,this.onBeforeRenderUI=new e.EventEmitter,this.onBeforeSetContent=new e.EventEmitter,this.onChange=new e.EventEmitter,this.onClearUndos=new e.EventEmitter,this.onDeactivate=new e.EventEmitter,this.onDirty=new e.EventEmitter,this.onExecCommand=new e.EventEmitter,this.onGetContent=new e.EventEmitter,this.onHide=new e.EventEmitter,this.onInit=new e.EventEmitter,this.onLoadContent=new e.EventEmitter,this.onNodeChange=new e.EventEmitter,this.onPostProcess=new e.EventEmitter,this.onPostRender=new e.EventEmitter,this.onPreInit=new e.EventEmitter,this.onPreProcess=new e.EventEmitter,this.onProgressState=new e.EventEmitter,this.onRedo=new e.EventEmitter,this.onRemove=new e.EventEmitter,this.onReset=new e.EventEmitter,this.onSaveContent=new e.EventEmitter,this.onSetAttrib=new e.EventEmitter,this.onObjectResizeStart=new e.EventEmitter,this.onObjectResized=new e.EventEmitter,this.onObjectSelected=new e.EventEmitter,this.onSetContent=new e.EventEmitter,this.onShow=new e.EventEmitter,this.onSubmit=new e.EventEmitter,this.onUndo=new e.EventEmitter,this.onVisualAid=new e.EventEmitter}return u([e.Output()],t.prototype,"onBeforePaste",void 0),u([e.Output()],t.prototype,"onBlur",void 0),u([e.Output()],t.prototype,"onClick",void 0),u([e.Output()],t.prototype,"onContextMenu",void 0),u([e.Output()],t.prototype,"onCopy",void 0),u([e.Output()],t.prototype,"onCut",void 0),u([e.Output()],t.prototype,"onDblclick",void 0),u([e.Output()],t.prototype,"onDrag",void 0),u([e.Output()],t.prototype,"onDragDrop",void 0),u([e.Output()],t.prototype,"onDragEnd",void 0),u([e.Output()],t.prototype,"onDragGesture",void 0),u([e.Output()],t.prototype,"onDragOver",void 0),u([e.Output()],t.prototype,"onDrop",void 0),u([e.Output()],t.prototype,"onFocus",void 0),u([e.Output()],t.prototype,"onFocusIn",void 0),u([e.Output()],t.prototype,"onFocusOut",void 0),u([e.Output()],t.prototype,"onKeyDown",void 0),u([e.Output()],t.prototype,"onKeyPress",void 0),u([e.Output()],t.prototype,"onKeyUp",void 0),u([e.Output()],t.prototype,"onMouseDown",void 0),u([e.Output()],t.prototype,"onMouseEnter",void 0),u([e.Output()],t.prototype,"onMouseLeave",void 0),u([e.Output()],t.prototype,"onMouseMove",void 0),u([e.Output()],t.prototype,"onMouseOut",void 0),u([e.Output()],t.prototype,"onMouseOver",void 0),u([e.Output()],t.prototype,"onMouseUp",void 0),u([e.Output()],t.prototype,"onPaste",void 0),u([e.Output()],t.prototype,"onSelectionChange",void 0),u([e.Output()],t.prototype,"onActivate",void 0),u([e.Output()],t.prototype,"onAddUndo",void 0),u([e.Output()],t.prototype,"onBeforeAddUndo",void 0),u([e.Output()],t.prototype,"onBeforeExecCommand",void 0),u([e.Output()],t.prototype,"onBeforeGetContent",void 0),u([e.Output()],t.prototype,"onBeforeRenderUI",void 0),u([e.Output()],t.prototype,"onBeforeSetContent",void 0),u([e.Output()],t.prototype,"onChange",void 0),u([e.Output()],t.prototype,"onClearUndos",void 0),u([e.Output()],t.prototype,"onDeactivate",void 0),u([e.Output()],t.prototype,"onDirty",void 0),u([e.Output()],t.prototype,"onExecCommand",void 0),u([e.Output()],t.prototype,"onGetContent",void 0),u([e.Output()],t.prototype,"onHide",void 0),u([e.Output()],t.prototype,"onInit",void 0),u([e.Output()],t.prototype,"onLoadContent",void 0),u([e.Output()],t.prototype,"onNodeChange",void 0),u([e.Output()],t.prototype,"onPostProcess",void 0),u([e.Output()],t.prototype,"onPostRender",void 0),u([e.Output()],t.prototype,"onPreInit",void 0),u([e.Output()],t.prototype,"onPreProcess",void 0),u([e.Output()],t.prototype,"onProgressState",void 0),u([e.Output()],t.prototype,"onRedo",void 0),u([e.Output()],t.prototype,"onRemove",void 0),u([e.Output()],t.prototype,"onReset",void 0),u([e.Output()],t.prototype,"onSaveContent",void 0),u([e.Output()],t.prototype,"onSetAttrib",void 0),u([e.Output()],t.prototype,"onObjectResizeStart",void 0),u([e.Output()],t.prototype,"onObjectResized",void 0),u([e.Output()],t.prototype,"onObjectSelected",void 0),u([e.Output()],t.prototype,"onSetContent",void 0),u([e.Output()],t.prototype,"onShow",void 0),u([e.Output()],t.prototype,"onSubmit",void 0),u([e.Output()],t.prototype,"onUndo",void 0),u([e.Output()],t.prototype,"onVisualAid",void 0),t}(),a=["onActivate","onAddUndo","onBeforeAddUndo","onBeforeExecCommand","onBeforeGetContent","onBeforeRenderUI","onBeforeSetContent","onBeforePaste","onBlur","onChange","onClearUndos","onClick","onContextMenu","onCopy","onCut","onDblclick","onDeactivate","onDirty","onDrag","onDragDrop","onDragEnd","onDragGesture","onDragOver","onDrop","onExecCommand","onFocus","onFocusIn","onFocusOut","onGetContent","onHide","onInit","onKeyDown","onKeyPress","onKeyUp","onLoadContent","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onNodeChange","onObjectResizeStart","onObjectResized","onObjectSelected","onPaste","onPostProcess","onPostRender","onPreProcess","onProgressState","onRedo","onRemove","onReset","onSaveContent","onSelectionChange","onSetAttrib","onSetContent","onShow","onSubmit","onUndo","onVisualAid"],c=function(t,e,n){a.forEach((function(o){var i=t[o];"onInit"===o?t.ngZone.run((function(){return i.emit({event:n,editor:e})})):e.on(o.substring(2),(function(n){return t.ngZone.run((function(){return i.emit({event:n,editor:e})}))}))}))},v=0,l=function(t){var e=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++v+String(e)},h=function(t){return void 0!==t&&"textarea"===t.tagName.toLowerCase()},y=function(t){return void 0===t||""===t?[]:Array.isArray(t)?t:t.split(" ")},m=function(t,e){return y(t).concat(y(e))},E=function(){},f=function(t){return null==t},O=function(){return{listeners:[],scriptId:l("tiny-script"),scriptLoaded:!1}},g=function(){var t=O();return{load:function(e,n,o){t.scriptLoaded?o():(t.listeners.push(o),e.getElementById(t.scriptId)||function(t,e,n,o){var i=e.createElement("script");i.referrerPolicy="origin",i.type="application/javascript",i.id=t,i.src=n;var r=function(){i.removeEventListener("load",r),o()};i.addEventListener("load",r),e.head&&e.head.appendChild(i)}(t.scriptId,e,n,(function(){t.listeners.forEach((function(t){return t()})),t.scriptLoaded=!0})))},reinitialize:function(){t=O()}}},w=g(),C=new e.InjectionToken("TINYMCE_SCRIPT_SRC"),b={provide:o.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return S})),multi:!0},S=function(t){function o(e,n,o,i){var r=t.call(this)||this;return r.platformId=o,r.tinymceScriptSrc=i,r.cloudChannel="5",r.apiKey="no-api-key",r.id="",r.onTouchedCallback=E,r.onChangeCallback=E,r._elementRef=e,r.ngZone=n,r.initialise=r.initialise.bind(r),r}return function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(o,t),Object.defineProperty(o.prototype,"disabled",{get:function(){return this._disabled},set:function(t){this._disabled=t,this._editor&&this._editor.initialized&&this._editor.setMode(t?"readonly":"design")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"editor",{get:function(){return this._editor},enumerable:!0,configurable:!0}),o.prototype.writeValue=function(t){this._editor&&this._editor.initialized?this._editor.setContent(f(t)?"":t):this.initialValue=null===t?void 0:t},o.prototype.registerOnChange=function(t){this.onChangeCallback=t},o.prototype.registerOnTouched=function(t){this.onTouchedCallback=t},o.prototype.setDisabledState=function(t){this._editor?this._editor.setMode(t?"readonly":"design"):t&&(this.init=r({},this.init,{readonly:!0}))},o.prototype.ngAfterViewInit=function(){n.isPlatformBrowser(this.platformId)&&(this.id=this.id||l("tiny-angular"),this.inline=void 0!==this.inline?"boolean"!=typeof this.inline||this.inline:this.init&&this.init.inline,this.createElement(),null!==s()?this.initialise():this._element&&this._element.ownerDocument&&w.load(this._element.ownerDocument,this.getScriptSrc(),this.initialise))},o.prototype.ngOnDestroy=function(){null!==s()&&s().remove(this._editor)},o.prototype.createElement=function(){var t="string"==typeof this.tagName?this.tagName:"div";this._element=document.createElement(this.inline?t:"textarea"),this._element&&(this._element.id=this.id,h(this._element)&&(this._element.style.visibility="hidden"),this._elementRef.nativeElement.appendChild(this._element))},o.prototype.initialise=function(){var t=this,e=r({},this.init,{target:this._element,inline:this.inline,readonly:this.disabled,plugins:m(this.init&&this.init.plugins,this.plugins),toolbar:this.toolbar||this.init&&this.init.toolbar,setup:function(e){t._editor=e,e.on("init",(function(n){t.initEditor(n,e)})),t.init&&"function"==typeof t.init.setup&&t.init.setup(e)}});h(this._element)&&(this._element.style.visibility=""),this.ngZone.runOutsideAngular((function(){s().init(e)}))},o.prototype.getScriptSrc=function(){return f(this.tinymceScriptSrc)?"https://cdn.tiny.cloud/1/"+this.apiKey+"/tinymce/"+this.cloudChannel+"/tinymce.min.js":this.tinymceScriptSrc},o.prototype.initEditor=function(t,e){var n=this;"string"==typeof this.initialValue&&this.ngZone.run((function(){return e.setContent(n.initialValue)})),e.on("blur",(function(){return n.ngZone.run((function(){return n.onTouchedCallback()}))})),e.on("change keyup undo redo",(function(){n.ngZone.run((function(){return n.onChangeCallback(e.getContent({format:n.outputFormat}))}))})),c(this,e,t)},o.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone},{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]},{type:String,decorators:[{type:e.Optional},{type:e.Inject,args:[C]}]}]},u([e.Input()],o.prototype,"disabled",null),u([e.Input()],o.prototype,"cloudChannel",void 0),u([e.Input()],o.prototype,"apiKey",void 0),u([e.Input()],o.prototype,"init",void 0),u([e.Input()],o.prototype,"id",void 0),u([e.Input()],o.prototype,"initialValue",void 0),u([e.Input()],o.prototype,"outputFormat",void 0),u([e.Input()],o.prototype,"inline",void 0),u([e.Input()],o.prototype,"tagName",void 0),u([e.Input()],o.prototype,"plugins",void 0),u([e.Input()],o.prototype,"toolbar",void 0),o=u([e.Component({selector:"editor",template:"<ng-template></ng-template>",providers:[b],styles:[":host { display: block; }"]}),p(2,e.Inject(e.PLATFORM_ID)),p(3,e.Optional()),p(3,e.Inject(C))],o)}(d),_=function(){function t(){}return t=u([e.NgModule({imports:[n.CommonModule,o.FormsModule],declarations:[S],exports:[S]})],t)}();t.EditorComponent=S,t.EditorModule=_,t.TINYMCE_SCRIPT_SRC=C,t.ɵa=d,Object.defineProperty(t,"__esModule",{value:!0})}));
16//# sourceMappingURL=tinymce-tinymce-angular.umd.min.js.map
\No newline at end of file