Skip to content

Commit

Permalink
Merge 6d1b8db into 55400b9
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2ciek committed Apr 13, 2019
2 parents 55400b9 + 6d1b8db commit 7677e43
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"@angular/cli": "^7.0.3",
"@angular/compiler-cli": "^7.0.1",
"@angular/language-service": "^7.0.1",
"@ckeditor/ckeditor5-build-classic": "^11.1.1",
"@ckeditor/ckeditor5-dev-env": "^13.0.0",
"@ckeditor/ckeditor5-dev-utils": "^11.0.0",
"@ckeditor/ckeditor5-build-classic": "^12.1.0",
"@ckeditor/ckeditor5-dev-env": "^14.1.1",
"@ckeditor/ckeditor5-dev-utils": "^12.0.1",
"@types/jasmine": "^3.3.8",
"@types/jasminewd2": "^2.0.3",
"codelyzer": "^4.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/app/demo-form/demo-form.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe( 'DemoFormComponent', () => {

fixture.detectChanges();

expect( component.formDataPreview ).toEqual( '{"name":null,"surname":null,"description":"<p>&nbsp;</p>"}' );
expect( component.formDataPreview ).toEqual( '{"name":null,"surname":null,"description":""}' );

done();
} );
Expand Down
2 changes: 1 addition & 1 deletion src/ckeditor/ckeditor.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe( 'CKEditorComponent', () => {

return wait().then( () => {
expect( component.data ).toEqual( '' );
expect( component.editorInstance!.getData() ).toEqual( '<p>&nbsp;</p>' );
expect( component.editorInstance!.getData() ).toEqual( '' );
} );
} );

Expand Down
17 changes: 10 additions & 7 deletions src/ckeditor/ckeditor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,23 @@ export class CKEditorComponent implements AfterViewInit, OnDestroy, ControlValue
}

/**
* Creates the editor instance, sets initial editor data,
* then integrates the editor with the Angular component.
* Creates the editor instance, sets initial editor data, then integrates
* the editor with the Angular component. This method does not use the `editor.setData()`
* because of the issue in the collaboration mode (#6).
*/
private createEditor(): Promise<any> {
private createEditor(): Promise<void> {
const element = document.createElement( this.tagName );
this.editorElement = element;

// Do not use the `editor.setData()` here because of the issue in the collaboration mode (#6).
// Instead set data to the element on which the editor will be later initialized.
element.innerHTML = this.data;
let config = this.config;

if ( this.data ) {
config = { ...config, initialData: this.data };
}

this.elementRef.nativeElement.appendChild( element );

return this.editor!.create( element, this.config )
return this.editor!.create( element, config )
.then( editor => {
this.editorInstance = editor;

Expand Down

0 comments on commit 7677e43

Please sign in to comment.