소스 검색

Fix: Focus the editor before executing a command

panr 6 년 전
부모
커밋
880b7f3820

+ 4 - 1
packages/ckeditor5-basic-styles/src/bold/boldui.js

@@ -43,7 +43,10 @@ export default class BoldUI extends Plugin {
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( BOLD ) );
+			this.listenTo( view, 'execute', () => {
+				editor.execute( BOLD );
+				editor.editing.view.focus();
+			} );
 
 			return view;
 		} );

+ 4 - 1
packages/ckeditor5-basic-styles/src/code/codeui.js

@@ -44,7 +44,10 @@ export default class CodeUI extends Plugin {
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( CODE ) );
+			this.listenTo( view, 'execute', () => {
+				editor.execute( CODE );
+				editor.editing.view.focus();
+			} );
 
 			return view;
 		} );

+ 4 - 1
packages/ckeditor5-basic-styles/src/italic/italicui.js

@@ -43,7 +43,10 @@ export default class ItalicUI extends Plugin {
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( ITALIC ) );
+			this.listenTo( view, 'execute', () => {
+				editor.execute( ITALIC );
+				editor.editing.view.focus();
+			} );
 
 			return view;
 		} );

+ 4 - 1
packages/ckeditor5-basic-styles/src/strikethrough/strikethroughui.js

@@ -43,7 +43,10 @@ export default class StrikethroughUI extends Plugin {
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( STRIKETHROUGH ) );
+			this.listenTo( view, 'execute', () => {
+				editor.execute( STRIKETHROUGH );
+				editor.editing.view.focus();
+			} );
 
 			return view;
 		} );

+ 4 - 1
packages/ckeditor5-basic-styles/src/subscript/subscriptui.js

@@ -42,7 +42,10 @@ export default class SubscriptUI extends Plugin {
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( SUBSCRIPT ) );
+			this.listenTo( view, 'execute', () => {
+				editor.execute( SUBSCRIPT );
+				editor.editing.view.focus();
+			} );
 
 			return view;
 		} );

+ 4 - 1
packages/ckeditor5-basic-styles/src/superscript/superscriptui.js

@@ -42,7 +42,10 @@ export default class SuperscriptUI extends Plugin {
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( SUPERSCRIPT ) );
+			this.listenTo( view, 'execute', () => {
+				editor.execute( SUPERSCRIPT );
+				editor.editing.view.focus();
+			} );
 
 			return view;
 		} );

+ 4 - 1
packages/ckeditor5-basic-styles/src/underline/underlineui.js

@@ -43,7 +43,10 @@ export default class UnderlineUI extends Plugin {
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( UNDERLINE ) );
+			this.listenTo( view, 'execute', () => {
+				editor.execute( UNDERLINE );
+				editor.editing.view.focus();
+			} );
 
 			return view;
 		} );