Skip to content

Commit

Permalink
1.0.7 (rc6 update)
Browse files Browse the repository at this point in the history
  • Loading branch information
yabab-dev committed Sep 1, 2016
1 parent 3b88f12 commit 7c2177a
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 38 deletions.
7 changes: 6 additions & 1 deletion CKEditor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,3 +27,8 @@ export declare class CKEditor implements ControlValueAccessor {
registerOnTouched(fn:Function):void;

}

/**
* CKEditor module
*/
export declare class CKEditorModule {}
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

### <a name="install"></a>Installation

Expand All @@ -13,13 +13,28 @@ Use the [CKEditor (4.x)](http://ckeditor.com/) wysiwyg in your Angular2 applicat

### <a name="sample"></a>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: `
<ckeditor
[(ngModel)]="ckeditorContent"
Expand All @@ -40,8 +55,7 @@ export class Sample{
Other samples :
- ES2016 and JSPM : https://github.com/chymz/angular2-jspm-seed/tree/ng2-ckeditor
- TypeScript with cli : https://github.com/chymz/ng2-cli-ckeditor-sample
- Plunker sample : https://embed.plnkr.co/hnB0R3/
- TypeScript and Webpack : https://github.com/chymz/angular2-seed/tree/ng2-ckeditor **(Outdated)**
- Plunker sample : https://embed.plnkr.co/hnB0R3/

### <a name="config"></a>Configuration

Expand Down
43 changes: 26 additions & 17 deletions lib/CKEditor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/CKEditor.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
36 changes: 23 additions & 13 deletions src/CKEditor.es6
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,29 @@ 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 :
* <ckeditor [(ngModel)]="data" [config]="{...}" debounce="500"></ckeditor>
*/
@Component({
selector: 'ckeditor',
providers: [CKEDITOR_CONTROL_VALUE_ACCESSOR],
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => CKEditorComponent),
multi: true
}
],
template: `<textarea #host></textarea>`,
})
export class CKEditor {
export class CKEditorComponent {

@Input() config;
@Input() debounce;
Expand Down Expand Up @@ -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{}

0 comments on commit 7c2177a

Please sign in to comment.