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

Commit

Permalink
Used EditorUI#update instead of ViewDocument#render to pin panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarwrobel committed Jun 26, 2018
1 parent 7ee4b1a commit 73e6666
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/inlineeditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class InlineEditorUI extends EditorUI {
}

// https://github.com/ckeditor/ckeditor5-editor-inline/issues/4
view.listenTo( editor.editing.view, 'render', () => {
view.listenTo( editor.ui, 'update', () => {
// Don't pin if the panel is not already visible. It prevents the panel
// showing up when there's no focus in the UI.
if ( view.panel.isVisible ) {
Expand Down
6 changes: 3 additions & 3 deletions tests/inlineeditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ describe( 'InlineEditorUI', () => {
} );

// https://github.com/ckeditor/ckeditor5-editor-inline/issues/4
it( 'pin() is called on editor.editable.view#render', () => {
it( 'pin() is called on editor.ui#update', () => {
const spy = sinon.stub( view.panel, 'pin' );

view.panel.hide();

editor.editing.view.render();
editor.ui.fire( 'update' );
sinon.assert.notCalled( spy );

view.panel.show();

editor.editing.view.render();
editor.ui.fire( 'update' );
sinon.assert.calledOnce( spy );
sinon.assert.calledWithExactly( spy, {
target: view.editableElement,
Expand Down

0 comments on commit 73e6666

Please sign in to comment.