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

Commit 9536767

Browse files
author
Piotr Jasiun
authored
Merge pull request #46 from ckeditor/t/ckeditor5/1477
Other: Adjustments to new editor initialization events. BREAKING CHANGE: The `editor#dataReady` event was removed. The `editor.data#ready` event has been introduced and should be used instead. BREAKING CHANGE: The `editor#pluginsReady` event was removed. Use plugin `afterInit()` method instead.
2 parents 4108ddc + b8615c9 commit 9536767

File tree

3 files changed

+5
-31
lines changed

3 files changed

+5
-31
lines changed

src/inlineeditor.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,7 @@ export default class InlineEditor extends Editor {
180180

181181
return editor.data.init( initialData );
182182
} )
183-
.then( () => {
184-
editor.fire( 'dataReady' );
185-
editor.fire( 'ready' );
186-
} )
183+
.then( () => editor.fire( 'ready' ) )
187184
.then( () => editor )
188185
);
189186
} );

tests/inlineeditor.js

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,13 @@ describe( 'InlineEditor', () => {
192192
const fired = [];
193193

194194
function spy( evt ) {
195-
fired.push( evt.name );
195+
fired.push( `${ evt.name }-${ evt.source.constructor.name.toLowerCase() }` );
196196
}
197197

198198
class EventWatcher extends Plugin {
199199
init() {
200-
this.editor.on( 'pluginsReady', spy );
201200
this.editor.ui.on( 'ready', spy );
202-
this.editor.on( 'dataReady', spy );
201+
this.editor.data.on( 'ready', spy );
203202
this.editor.on( 'ready', spy );
204203
}
205204
}
@@ -209,29 +208,8 @@ describe( 'InlineEditor', () => {
209208
plugins: [ EventWatcher ]
210209
} )
211210
.then( newEditor => {
212-
expect( fired ).to.deep.equal( [ 'pluginsReady', 'ready', 'dataReady', 'ready' ] );
213-
214-
editor = newEditor;
215-
} );
216-
} );
217-
218-
it( 'fires dataReady once data is loaded', () => {
219-
let data;
220-
221-
class EventWatcher extends Plugin {
222-
init() {
223-
this.editor.on( 'dataReady', () => {
224-
data = this.editor.getData();
225-
} );
226-
}
227-
}
228-
229-
return InlineEditor
230-
.create( editorElement, {
231-
plugins: [ EventWatcher, Paragraph, Bold ]
232-
} )
233-
.then( newEditor => {
234-
expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
211+
expect( fired ).to.deep.equal( [
212+
'ready-inlineeditorui', 'ready-datacontroller', 'ready-inlineeditor' ] );
235213

236214
editor = newEditor;
237215
} );

tests/inlineeditorui.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ class VirtualInlineTestEditor extends VirtualTestEditor {
257257
editor.initPlugins()
258258
.then( () => {
259259
editor.ui.init();
260-
editor.fire( 'dataReady' );
261260
editor.fire( 'ready' );
262261
} )
263262
.then( () => editor )

0 commit comments

Comments
 (0)