From 7c2177aecc8a021f4a413a425473e88e20e4d1ef Mon Sep 17 00:00:00 2001 From: Simon Babay Date: Thu, 1 Sep 2016 15:47:22 +0200 Subject: [PATCH] 1.0.7 (rc6 update) --- CKEditor.d.ts | 7 ++++++- README.md | 24 +++++++++++++++++++----- lib/CKEditor.js | 43 ++++++++++++++++++++++++++----------------- lib/CKEditor.js.map | 2 +- package.json | 2 +- src/CKEditor.es6 | 36 +++++++++++++++++++++++------------- 6 files changed, 76 insertions(+), 38 deletions(-) diff --git a/CKEditor.d.ts b/CKEditor.d.ts index 616ca92..5612623 100644 --- a/CKEditor.d.ts +++ b/CKEditor.d.ts @@ -8,7 +8,7 @@ import { ControlValueAccessor } from '@angular/forms'; /** * CKEditor component */ -export declare class CKEditor implements ControlValueAccessor { +export declare class CKEditorComponent implements ControlValueAccessor { value:String; instance:any; @@ -27,3 +27,8 @@ export declare class CKEditor implements ControlValueAccessor { registerOnTouched(fn:Function):void; } + +/** + * CKEditor module + */ +export declare class CKEditorModule {} diff --git a/README.md b/README.md index 83f4a64..2e6dd53 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Angular2 - CKEditor component Use the [CKEditor (4.x)](http://ckeditor.com/) wysiwyg in your Angular2 application. -(Works with new forms API / Angular rc4) +(Works with RC6) ### Installation @@ -13,13 +13,28 @@ Use the [CKEditor (4.x)](http://ckeditor.com/) wysiwyg in your Angular2 applicat ### Sample (ES2016+) +Include `CKEditorModule` in your main module : + +```javascript +import {CKEditorModule} from 'ng2-ckeditor'; + +@NgModule({ + // ... + imports: [ + CKEditorModule + ], + // ... +}) +export class AppModule { } +``` + +The use it in your component : + ```javascript import {Component} from '@angular/core'; -import {CKEditor} from 'ng2-ckeditor'; @Component({ selector: 'sample', - directives: [CKEditor], template: ` Configuration diff --git a/lib/CKEditor.js b/lib/CKEditor.js index bd6bcea..511f68f 100644 --- a/lib/CKEditor.js +++ b/lib/CKEditor.js @@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.CKEditor = undefined; +exports.CKEditorModule = exports.CKEditorComponent = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5; // Imports +var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _dec8, _class4; // Imports var _core = require('@angular/core'); @@ -59,30 +59,28 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } -// Control Value accessor provider -var CKEDITOR_CONTROL_VALUE_ACCESSOR = new _core.Provider(_forms.NG_VALUE_ACCESSOR, { - useExisting: (0, _core.forwardRef)(function () { - return CKEditor; - }), - multi: true -}); - /** * CKEditor component * Usage : * */ -var CKEditor = exports.CKEditor = (_dec = (0, _core.Component)({ +var CKEditorComponent = exports.CKEditorComponent = (_dec = (0, _core.Component)({ selector: 'ckeditor', - providers: [CKEDITOR_CONTROL_VALUE_ACCESSOR], + providers: [{ + provide: _forms.NG_VALUE_ACCESSOR, + useExisting: (0, _core.forwardRef)(function () { + return CKEditorComponent; + }), + multi: true + }], template: '' }), _dec2 = (0, _core.Input)(), _dec3 = (0, _core.Input)(), _dec4 = (0, _core.Output)(), _dec5 = (0, _core.Output)(), _dec6 = (0, _core.ViewChild)('host'), _dec7 = (0, _core.Input)(), _dec(_class = (_class2 = function () { /** * Constructor */ - function CKEditor(zone) { - _classCallCheck(this, CKEditor); + function CKEditorComponent(zone) { + _classCallCheck(this, CKEditorComponent); _initDefineProp(this, 'config', _descriptor, this); @@ -102,7 +100,7 @@ var CKEditor = exports.CKEditor = (_dec = (0, _core.Component)({ this.zone = zone; } - _createClass(CKEditor, [{ + _createClass(CKEditorComponent, [{ key: 'ngOnDestroy', @@ -237,7 +235,7 @@ var CKEditor = exports.CKEditor = (_dec = (0, _core.Component)({ } }]); - return CKEditor; + return CKEditorComponent; }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'config', [_dec2], { enumerable: true, initializer: function initializer() { @@ -264,5 +262,16 @@ var CKEditor = exports.CKEditor = (_dec = (0, _core.Component)({ return this.host; } }), _applyDecoratedDescriptor(_class2.prototype, 'value', [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, 'value'), _class2.prototype)), _class2)) || _class); -Reflect.defineMetadata('design:paramtypes', [_core.NgZone], CKEditor); + +/** + * CKEditorModule + */ + +Reflect.defineMetadata('design:paramtypes', [_core.NgZone], CKEditorComponent); +var CKEditorModule = exports.CKEditorModule = (_dec8 = (0, _core.NgModule)({ + declarations: [CKEditorComponent], + exports: [CKEditorComponent] +}), _dec8(_class4 = function CKEditorModule() { + _classCallCheck(this, CKEditorModule); +}) || _class4); //# sourceMappingURL=CKEditor.js.map diff --git a/lib/CKEditor.js.map b/lib/CKEditor.js.map index 0106f1a..26e0d65 100644 --- a/lib/CKEditor.js.map +++ b/lib/CKEditor.js.map @@ -1 +1 @@ -{"version":3,"sources":["CKEditor.es6"],"names":[],"mappings":";;;;;;;;;yJAAA;;;AACA;;AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA,IAAM,kCAAkC,6CAEtC;AACE,eAAa,sBAAW;AAAA,WAAM,QAAN;AAAA,GAAX,CADf;AAEE,SAAO;AAFT,CAFsC,CAAxC;;AAQA;;;;;IAUa,Q,WAAA,Q,WALZ,qBAAU;AACT,YAAU,UADD;AAET,aAAW,CAAC,+BAAD,CAFF;AAG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ACD,OAHD;;AAKA;AACA,WAAK,QAAL,CAAc,EAAd,CAAiB,QAAjB,EAA2B,YAAM;AAC/B,eAAK,SAAL;AACA,YAAI,QAAQ,OAAK,QAAL,CAAc,OAAd,EAAZ;;AAEA;AACA,YAAI,OAAK,QAAT,EAAmB;AACjB,cAAG,OAAK,eAAR,EAAyB,aAAa,OAAK,eAAlB;AACzB,iBAAK,eAAL,GAAuB,WAAW,YAAM;AACtC,mBAAK,WAAL,CAAiB,KAAjB;AACA,mBAAK,eAAL,GAAuB,IAAvB;AACD,WAHsB,EAGpB,SAAS,OAAK,QAAd,CAHoB,CAAvB;;AAKF;AACC,SARD,MAQK;AACH,iBAAK,WAAL,CAAiB,KAAjB;AACD;AACF,OAhBD;AAiBD;;AAED;;;;;;+BAGW,K,EAAM;AACf,WAAK,MAAL,GAAc,KAAd;AACA,UAAI,KAAK,QAAT,EACE,KAAK,QAAL,CAAc,OAAd,CAAsB,KAAtB;AACH;;;6BACQ,C,EAAE,CAAE;;;gCACF,CAAE;;;qCACI,E,EAAG;AAAC,WAAK,QAAL,GAAgB,EAAhB;AAAoB;;;sCACvB,E,EAAG;AAAC,WAAK,SAAL,GAAiB,EAAjB;AAAqB;;;wBAhG1B;AAAE,aAAO,KAAK,MAAZ;AAAqB,K;sBACrB,C,EAAG;AACpB,UAAI,MAAM,KAAK,MAAf,EAAuB;AACrB,aAAK,MAAL,GAAc,CAAd;AACA,aAAK,QAAL,CAAc,CAAd;AACD;AACF;;;;;;;gBAzBQ,M;;;;;gBACA,Q;;;;;WAEU,wB;;;;;WACD,wB;;;;;gBACC,I;;;4DAPR,Q","file":"CKEditor.js","sourcesContent":["// Imports\nimport {\n Component,\n Input,\n Output,\n ElementRef,\n ViewChild,\n Optional,\n EventEmitter,\n NgZone,\n Provider,\n forwardRef,\n Renderer\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\n// Control Value accessor provider\nconst CKEDITOR_CONTROL_VALUE_ACCESSOR = new Provider(\n NG_VALUE_ACCESSOR,\n {\n useExisting: forwardRef(() => CKEditor),\n multi: true\n }\n);\n\n/**\n * CKEditor component\n * Usage :\n * \n */\n@Component({\n selector: 'ckeditor',\n providers: [CKEDITOR_CONTROL_VALUE_ACCESSOR],\n template: ``,\n})\nexport class CKEditor {\n\n @Input() config;\n @Input() debounce;\n\n @Output() change = new EventEmitter();\n @Output() ready = new EventEmitter();\n @ViewChild('host') host;\n\n _value = '';\n instance;\n debounceTimeout;\n zone;\n\n /**\n * Constructor\n */\n constructor(zone:NgZone){\n this.zone = zone;\n }\n\n get value(): any { return this._value; };\n @Input() set value(v) {\n if (v !== this._value) {\n this._value = v;\n this.onChange(v);\n }\n }\n\n /**\n * On component destroy\n */\n ngOnDestroy(){\n if (this.instance) {\n setTimeout(() => {\n this.instance.removeAllListeners();\n this.instance.destroy();\n this.instance = null;\n });\n }\n }\n\n /**\n * On component view init\n */\n ngAfterViewInit(){\n // Configuration\n var config = this.config || {};\n this.ckeditorInit(config);\n }\n\n /**\n * Value update process\n */\n updateValue(value){\n this.zone.run(() => {\n this.value = value;\n\n this.onChange(value);\n\n this.onTouched();\n this.change.emit(value);\n });\n }\n\n /**\n * CKEditor init\n */\n ckeditorInit(config){\n if (!CKEDITOR) {\n console.error('Please include CKEditor in your page');\n return;\n }\n\n // CKEditor replace textarea\n this.instance = CKEDITOR.replace(this.host.nativeElement, config);\n\n // Set initial value\n this.instance.setData(this.value);\n\n // listen for instanceReady event\n this.instance.on('instanceReady', (evt) => {\n // send the evt to the EventEmitter\n this.ready.emit(evt);\n });\n\n // CKEditor change event\n this.instance.on('change', () => {\n this.onTouched();\n let value = this.instance.getData();\n\n // Debounce update\n if (this.debounce) {\n if(this.debounceTimeout) clearTimeout(this.debounceTimeout);\n this.debounceTimeout = setTimeout(() => {\n this.updateValue(value);\n this.debounceTimeout = null;\n }, parseInt(this.debounce));\n\n // Live update\n }else{\n this.updateValue(value);\n }\n });\n }\n\n /**\n * Implements ControlValueAccessor\n */\n writeValue(value){\n this._value = value;\n if (this.instance)\n this.instance.setData(value);\n }\n onChange(_){}\n onTouched(){}\n registerOnChange(fn){this.onChange = fn;}\n registerOnTouched(fn){this.onTouched = fn;}\n}\n"]} \ No newline at end of file +{"version":3,"sources":["CKEditor.es6"],"names":[],"mappings":";;;;;;;;;yKAAA;;;AACA;;AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;IAgBa,iB,WAAA,iB,WAXZ,qBAAU;AACT,YAAU,UADD;AAET,aAAW,CACT;AACE,qCADF;AAEE,iBAAa,sBAAW;AAAA,aAAM,iBAAN;AAAA,KAAX,CAFf;AAGE,WAAO;AAHT,GADS,CAFF;AAST;AATS,CAAV,C,UAaE,kB,UACA,kB,UAEA,mB,UACA,mB,UACA,qBAAU,MAAV,C,UAeA,kB;;AARD;;;AAGA,6BAAY,IAAZ,EAAwB;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,SARxB,MAQwB,GARf,EAQe;AAAA,SAPxB,QAOwB,QAPxB,QAOwB;AAAA,SANxB,eAMwB,QANxB,eAMwB;AAAA,SALxB,IAKwB,QALxB,IAKwB;;AACtB,SAAK,IAAL,GAAY,IAAZ;AACD;;;;;;AAUD;;;kCAGa;AAAA;;AACX,UAAI,KAAK,QAAT,EAAmB;AACjB,mBAAW,YAAM;AACf,gBAAK,QAAL,CAAc,kBAAd;AACA,gBAAK,QAAL,CAAc,OAAd;AACA,gBAAK,QAAL,GAAgB,IAAhB;AACD,SAJD;AAKD;AACF;;AAED;;;;;;sCAGiB;AACf;AACA,UAAI,SAAS,KAAK,MAAL,IAAe,EAA5B;AACA,WAAK,YAAL,CAAkB,MAAlB;AACD;;AAED;;;;;;gCAGY,K,EAAM;AAAA;;AAChB,WAAK,IAAL,CAAU,GAAV,CAAc,YAAM;AAClB,eAAK,KAAL,GAAa,KAAb;;AAEA,eAAK,QAAL,CAAc,KAAd;;AAEA,eAAK,SAA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;AAAqB,K;sBACrB,C,EAAG;AACpB,UAAI,MAAM,KAAK,MAAf,EAAuB;AACrB,aAAK,MAAL,GAAc,CAAd;AACA,aAAK,QAAL,CAAc,CAAd;AACD;AACF;;;;;;;gBAzBQ,M;;;;;gBACA,Q;;;;;WAEU,wB;;;;;WACD,wB;;;;;gBACC,I;;;;AAiHrB;;;;4DAxHa,iB;IAmIA,c,WAAA,c,YARZ,oBAAS;AACR,gBAAc,CACZ,iBADY,CADN;AAIR,WAAS,CACP,iBADO;AAJD,CAAT,C","file":"CKEditor.js","sourcesContent":["// Imports\nimport {\n Component,\n Input,\n Output,\n ElementRef,\n ViewChild,\n Optional,\n EventEmitter,\n NgZone,\n forwardRef,\n Renderer,\n NgModule,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\n/**\n * CKEditor component\n * Usage :\n * \n */\n@Component({\n selector: 'ckeditor',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => CKEditorComponent),\n multi: true\n }\n ],\n template: ``,\n})\nexport class CKEditorComponent {\n\n @Input() config;\n @Input() debounce;\n\n @Output() change = new EventEmitter();\n @Output() ready = new EventEmitter();\n @ViewChild('host') host;\n\n _value = '';\n instance;\n debounceTimeout;\n zone;\n\n /**\n * Constructor\n */\n constructor(zone:NgZone){\n this.zone = zone;\n }\n\n get value(): any { return this._value; };\n @Input() set value(v) {\n if (v !== this._value) {\n this._value = v;\n this.onChange(v);\n }\n }\n\n /**\n * On component destroy\n */\n ngOnDestroy(){\n if (this.instance) {\n setTimeout(() => {\n this.instance.removeAllListeners();\n this.instance.destroy();\n this.instance = null;\n });\n }\n }\n\n /**\n * On component view init\n */\n ngAfterViewInit(){\n // Configuration\n var config = this.config || {};\n this.ckeditorInit(config);\n }\n\n /**\n * Value update process\n */\n updateValue(value){\n this.zone.run(() => {\n this.value = value;\n\n this.onChange(value);\n\n this.onTouched();\n this.change.emit(value);\n });\n }\n\n /**\n * CKEditor init\n */\n ckeditorInit(config){\n if (!CKEDITOR) {\n console.error('Please include CKEditor in your page');\n return;\n }\n\n // CKEditor replace textarea\n this.instance = CKEDITOR.replace(this.host.nativeElement, config);\n\n // Set initial value\n this.instance.setData(this.value);\n\n // listen for instanceReady event\n this.instance.on('instanceReady', (evt) => {\n // send the evt to the EventEmitter\n this.ready.emit(evt);\n });\n\n // CKEditor change event\n this.instance.on('change', () => {\n this.onTouched();\n let value = this.instance.getData();\n\n // Debounce update\n if (this.debounce) {\n if(this.debounceTimeout) clearTimeout(this.debounceTimeout);\n this.debounceTimeout = setTimeout(() => {\n this.updateValue(value);\n this.debounceTimeout = null;\n }, parseInt(this.debounce));\n\n // Live update\n }else{\n this.updateValue(value);\n }\n });\n }\n\n /**\n * Implements ControlValueAccessor\n */\n writeValue(value){\n this._value = value;\n if (this.instance)\n this.instance.setData(value);\n }\n onChange(_){}\n onTouched(){}\n registerOnChange(fn){this.onChange = fn;}\n registerOnTouched(fn){this.onTouched = fn;}\n}\n\n/**\n * CKEditorModule\n */\n@NgModule({\n declarations: [\n CKEditorComponent,\n ],\n exports: [\n CKEditorComponent,\n ]\n})\nexport class CKEditorModule{}\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 7844b13..5ba9a20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng2-ckeditor", - "version": "1.0.6", + "version": "1.0.7", "description": "Angular2 CKEditor component", "main": "lib/CKEditor.js", "typings": "./CKEditor.d.ts", diff --git a/src/CKEditor.es6 b/src/CKEditor.es6 index b942231..3f57778 100644 --- a/src/CKEditor.es6 +++ b/src/CKEditor.es6 @@ -8,21 +8,12 @@ import { Optional, EventEmitter, NgZone, - Provider, forwardRef, - Renderer + Renderer, + NgModule, } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; -// Control Value accessor provider -const CKEDITOR_CONTROL_VALUE_ACCESSOR = new Provider( - NG_VALUE_ACCESSOR, - { - useExisting: forwardRef(() => CKEditor), - multi: true - } -); - /** * CKEditor component * Usage : @@ -30,10 +21,16 @@ const CKEDITOR_CONTROL_VALUE_ACCESSOR = new Provider( */ @Component({ selector: 'ckeditor', - providers: [CKEDITOR_CONTROL_VALUE_ACCESSOR], + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => CKEditorComponent), + multi: true + } + ], template: ``, }) -export class CKEditor { +export class CKEditorComponent { @Input() config; @Input() debounce; @@ -152,3 +149,16 @@ export class CKEditor { registerOnChange(fn){this.onChange = fn;} registerOnTouched(fn){this.onTouched = fn;} } + +/** + * CKEditorModule + */ +@NgModule({ + declarations: [ + CKEditorComponent, + ], + exports: [ + CKEditorComponent, + ] +}) +export class CKEditorModule{}