Ver Fonte

Fix: Focus the editor before executing a command

panr há 6 anos atrás
pai
commit
ac00a25c6a
1 ficheiros alterados com 4 adições e 1 exclusões
  1. 4 1
      docs/_snippets/framework/tutorials/block-widget.js

+ 4 - 1
docs/_snippets/framework/tutorials/block-widget.js

@@ -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;
 		} );