From 8079b8fcb68477bf5465c9d93d7ee2fd938ca478 Mon Sep 17 00:00:00 2001 From: panr Date: Mon, 13 Jan 2020 14:47:03 +0100 Subject: [PATCH] Fix: Focus the editor before executing a command --- src/imagestyle/imagestyleui.js | 5 ++++- src/imagetextalternative/imagetextalternativeui.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/imagestyle/imagestyleui.js b/src/imagestyle/imagestyleui.js index 434c85e3..dafb0075 100644 --- a/src/imagestyle/imagestyleui.js +++ b/src/imagestyle/imagestyleui.js @@ -92,7 +92,10 @@ export default class ImageStyleUI extends Plugin { view.bind( 'isEnabled' ).to( command, 'isEnabled' ); view.bind( 'isOn' ).to( command, 'value', value => value === style.name ); - this.listenTo( view, 'execute', () => editor.execute( 'imageStyle', { value: style.name } ) ); + this.listenTo( view, 'execute', () => { + editor.execute( 'imageStyle', { value: style.name } ); + editor.editing.view.focus(); + } ); return view; } ); diff --git a/src/imagetextalternative/imagetextalternativeui.js b/src/imagetextalternative/imagetextalternativeui.js index 8ad87525..bf2012d6 100644 --- a/src/imagetextalternative/imagetextalternativeui.js +++ b/src/imagetextalternative/imagetextalternativeui.js @@ -78,7 +78,9 @@ export default class ImageTextAlternativeUI extends Plugin { view.bind( 'isEnabled' ).to( command, 'isEnabled' ); - this.listenTo( view, 'execute', () => this._showForm() ); + this.listenTo( view, 'execute', () => { + this._showForm(); + } ); return view; } );