@@ -91,6 +91,7 @@ export class CommitBox extends React.Component<
9191 title = "Enter a commit message description"
9292 value = { this . state . description }
9393 onChange = { this . _onDescriptionChange }
94+ onKeyPress = { this . _onDescriptionKeyPress }
9495 />
9596 < input
9697 className = { commitButtonClass }
@@ -106,8 +107,6 @@ export class CommitBox extends React.Component<
106107
107108 /**
108109 * Callback invoked upon clicking a commit message submit button.
109- *
110- * @param event - event object
111110 */
112111 private _onCommitClick = ( ) : void => {
113112 const msg = this . state . summary + '\n\n' + this . state . description + '\n' ;
@@ -145,14 +144,33 @@ export class CommitBox extends React.Component<
145144 * ## Notes
146145 *
147146 * - Prevents triggering a `'submit'` action when hitting the `ENTER` key while entering a commit message summary.
147+ * - Triggers the `'submit'` action when hitting `Ctrl` + `ENTER`
148148 *
149149 * @param event - event object
150150 */
151- private _onSummaryKeyPress ( event : any ) : void {
152- if ( event . which === 13 ) {
151+ private _onSummaryKeyPress = ( event : React . KeyboardEvent ) : void => {
152+ if ( event . key === 'Enter' ) {
153153 event . preventDefault ( ) ;
154+ if ( event . getModifierState ( 'Control' ) ) {
155+ this . _onCommitClick ( ) ;
156+ }
154157 }
155- }
158+ } ;
159+
160+ /**
161+ * Callback invoked upon a `'keypress'` event when entering a commit message description.
162+ *
163+ * ## Notes
164+ *
165+ * - Triggers the `'submit'` action when hitting `Ctrl` + `ENTER`
166+ *
167+ * @param event - event object
168+ */
169+ private _onDescriptionKeyPress = ( event : React . KeyboardEvent ) : void => {
170+ if ( event . key === 'Enter' && event . getModifierState ( 'Control' ) ) {
171+ this . _onCommitClick ( ) ;
172+ }
173+ } ;
156174
157175 /**
158176 * Resets component state (e.g., in order to re-initialize the commit message input box).
0 commit comments