Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 95798ba

Browse files
authored
Merge pull request #54 from ckeditor/t/53
Fix: It should be possible to use `ClassicEditor.create()` in its child classes. Closes #53.
2 parents b3c066c + cc416bc commit 95798ba

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default class ClassicEditor extends StandardEditor {
8181
*/
8282
static create( element, config ) {
8383
return new Promise( ( resolve ) => {
84-
const editor = new ClassicEditor( element, config );
84+
const editor = new this( element, config );
8585

8686
resolve(
8787
editor.initPlugins()

tests/classic.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ describe( 'ClassicEditor', () => {
8787
it( 'loads data from the editor element', () => {
8888
expect( editor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
8989
} );
90+
91+
it( 'creates an instance of a ClassicEditor child class', () => {
92+
class CustomClassicEditor extends ClassicEditor {}
93+
94+
return CustomClassicEditor.create( editorElement, {
95+
plugins: [ Paragraph, Bold ]
96+
} )
97+
.then( newEditor => {
98+
editor = newEditor;
99+
100+
expect( newEditor ).to.be.instanceof( CustomClassicEditor );
101+
expect( newEditor ).to.be.instanceof( ClassicEditor );
102+
103+
expect( newEditor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
104+
} );
105+
} );
90106
} );
91107

92108
describe( 'create - events', () => {

0 commit comments

Comments
 (0)