You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-03 00:33:22 +03:00 
			
		
		
		
	Use key binding for cancelling a message reply
This commit is contained in:
		@@ -22,7 +22,7 @@ export enum KeyAction {
 | 
				
			|||||||
    /** Start editing the user's next sent message */
 | 
					    /** Start editing the user's next sent message */
 | 
				
			||||||
    EditNextMessage = 'EditNextMessage',
 | 
					    EditNextMessage = 'EditNextMessage',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Cancel editing a message */
 | 
					    /** Cancel editing a message or cancel replying to a message */
 | 
				
			||||||
    CancelEditing = 'CancelEditing',
 | 
					    CancelEditing = 'CancelEditing',
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,6 @@ import * as sdk from '../../../index';
 | 
				
			|||||||
import Modal from '../../../Modal';
 | 
					import Modal from '../../../Modal';
 | 
				
			||||||
import {_t, _td} from '../../../languageHandler';
 | 
					import {_t, _td} from '../../../languageHandler';
 | 
				
			||||||
import ContentMessages from '../../../ContentMessages';
 | 
					import ContentMessages from '../../../ContentMessages';
 | 
				
			||||||
import {Key} from "../../../Keyboard";
 | 
					 | 
				
			||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
 | 
					import MatrixClientContext from "../../../contexts/MatrixClientContext";
 | 
				
			||||||
import RateLimitedFunc from '../../../ratelimitedfunc';
 | 
					import RateLimitedFunc from '../../../ratelimitedfunc';
 | 
				
			||||||
import {Action} from "../../../dispatcher/actions";
 | 
					import {Action} from "../../../dispatcher/actions";
 | 
				
			||||||
@@ -174,13 +173,14 @@ export default class SendMessageComposer extends React.Component {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            case KeyAction.CancelEditing:
 | 
				
			||||||
 | 
					                dis.dispatch({
 | 
				
			||||||
 | 
					                    action: 'reply_to_event',
 | 
				
			||||||
 | 
					                    event: null,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                if (event.key === Key.ESCAPE) {
 | 
					                if (this._prepareToEncrypt) {
 | 
				
			||||||
                    dis.dispatch({
 | 
					 | 
				
			||||||
                        action: 'reply_to_event',
 | 
					 | 
				
			||||||
                        event: null,
 | 
					 | 
				
			||||||
                    });
 | 
					 | 
				
			||||||
                } else if (this._prepareToEncrypt) {
 | 
					 | 
				
			||||||
                    // This needs to be last!
 | 
					                    // This needs to be last!
 | 
				
			||||||
                    this._prepareToEncrypt();
 | 
					                    this._prepareToEncrypt();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user