File tree Expand file tree Collapse file tree
core/app/components/walkthrough Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { useState } from 'react' ;
1+ import { useEffect , useState } from 'react' ;
22import {
33 changeTypeLabel ,
44 type CommitFile ,
@@ -284,6 +284,19 @@ export function CommitView({
284284 setStatus ( 'idle' ) ;
285285 } ;
286286
287+ useEffect ( ( ) => {
288+ const onKeyDown = ( event : KeyboardEvent ) => {
289+ if ( ( event . metaKey || event . ctrlKey ) && event . key === 'Enter' ) {
290+ event . preventDefault ( ) ;
291+ void submit ( ) ;
292+ }
293+ } ;
294+ window . addEventListener ( 'keydown' , onKeyDown ) ;
295+ return ( ) => window . removeEventListener ( 'keydown' , onKeyDown ) ;
296+ // https://github.com/react/react/issues/35499
297+ // eslint-disable-next-line react-hooks/exhaustive-deps
298+ } , [ submit ] ) ;
299+
287300 return (
288301 < div className = "wt-commit" >
289302 < div className = "wt-commit-bar" >
You can’t perform that action at this time.
0 commit comments