Skip to content

Commit

Permalink
Merge pull request #6066 from ckeditor/i/353
Browse files Browse the repository at this point in the history
Fix: Focus the editor before executing toolbar buttons' command. Closes #353.
  • Loading branch information
Reinmar authored Jan 28, 2020
2 parents e346e9a + ac00a25 commit 0d0505f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/_snippets/framework/tutorials/block-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ class SimpleBoxUI extends Plugin {
buttonView.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );

// Execute the command when the button is clicked (executed).
this.listenTo( buttonView, 'execute', () => editor.execute( 'insertSimpleBox' ) );
this.listenTo( buttonView, 'execute', () => {
editor.execute( 'insertSimpleBox' );
editor.editing.view.focus();
} );

return buttonView;
} );
Expand Down

0 comments on commit 0d0505f

Please sign in to comment.