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

Commit

Permalink
Code refactoring in InlineEditorUI class.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Oct 23, 2017
1 parent 8bd7993 commit 45ab8e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/inlineeditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ export default class InlineEditorUI {
* @private
*/
this._toolbarConfig = normalizeToolbarConfig( editor.config.get( 'toolbar' ) );
}

/**
* Initializes the UI.
*/
init() {
const editor = this.editor;
const view = this.view;

view.render();

// Set–up the view#panel.
view.panel.bind( 'isVisible' ).to( this.focusTracker, 'isFocused' );
Expand Down Expand Up @@ -82,16 +92,6 @@ export default class InlineEditorUI {
view.editable.name = editingRoot.rootName;

this.focusTracker.add( view.editableElement );
}

/**
* Initializes the UI.
*/
init() {
const editor = this.editor;
const view = this.view;

view.render();

if ( this._toolbarConfig ) {
view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );
Expand Down
4 changes: 4 additions & 0 deletions tests/inlineeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ describe( 'InlineEditor', () => {
} );

it( 'creates a single div editable root in the view', () => {
editor.ui.init();

expect( editor.editing.view.getRoot() ).to.have.property( 'name', 'div' );

editor.ui.destroy();
} );

it( 'creates a single document root', () => {
Expand Down

0 comments on commit 45ab8e5

Please sign in to comment.