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

Commit 6bbca98

Browse files
authored
Merge pull request #98 from ckeditor/i/353
Fix: Focus the editor before executing toolbar buttons' command. See ckeditor/ckeditor5#353.
2 parents bde751e + b385499 commit 6bbca98

File tree

7 files changed

+28
-7
lines changed

7 files changed

+28
-7
lines changed

src/bold/boldui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ export default class BoldUI extends Plugin {
4343
view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
4444

4545
// Execute command.
46-
this.listenTo( view, 'execute', () => editor.execute( BOLD ) );
46+
this.listenTo( view, 'execute', () => {
47+
editor.execute( BOLD );
48+
editor.editing.view.focus();
49+
} );
4750

4851
return view;
4952
} );

src/code/codeui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ export default class CodeUI extends Plugin {
4444
view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
4545

4646
// Execute command.
47-
this.listenTo( view, 'execute', () => editor.execute( CODE ) );
47+
this.listenTo( view, 'execute', () => {
48+
editor.execute( CODE );
49+
editor.editing.view.focus();
50+
} );
4851

4952
return view;
5053
} );

src/italic/italicui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ export default class ItalicUI extends Plugin {
4343
view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
4444

4545
// Execute command.
46-
this.listenTo( view, 'execute', () => editor.execute( ITALIC ) );
46+
this.listenTo( view, 'execute', () => {
47+
editor.execute( ITALIC );
48+
editor.editing.view.focus();
49+
} );
4750

4851
return view;
4952
} );

src/strikethrough/strikethroughui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ export default class StrikethroughUI extends Plugin {
4343
view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
4444

4545
// Execute command.
46-
this.listenTo( view, 'execute', () => editor.execute( STRIKETHROUGH ) );
46+
this.listenTo( view, 'execute', () => {
47+
editor.execute( STRIKETHROUGH );
48+
editor.editing.view.focus();
49+
} );
4750

4851
return view;
4952
} );

src/subscript/subscriptui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export default class SubscriptUI extends Plugin {
4242
view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
4343

4444
// Execute command.
45-
this.listenTo( view, 'execute', () => editor.execute( SUBSCRIPT ) );
45+
this.listenTo( view, 'execute', () => {
46+
editor.execute( SUBSCRIPT );
47+
editor.editing.view.focus();
48+
} );
4649

4750
return view;
4851
} );

src/superscript/superscriptui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export default class SuperscriptUI extends Plugin {
4242
view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
4343

4444
// Execute command.
45-
this.listenTo( view, 'execute', () => editor.execute( SUPERSCRIPT ) );
45+
this.listenTo( view, 'execute', () => {
46+
editor.execute( SUPERSCRIPT );
47+
editor.editing.view.focus();
48+
} );
4649

4750
return view;
4851
} );

src/underline/underlineui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ export default class UnderlineUI extends Plugin {
4343
view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
4444

4545
// Execute command.
46-
this.listenTo( view, 'execute', () => editor.execute( UNDERLINE ) );
46+
this.listenTo( view, 'execute', () => {
47+
editor.execute( UNDERLINE );
48+
editor.editing.view.focus();
49+
} );
4750

4851
return view;
4952
} );

0 commit comments

Comments
 (0)