You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-04 11:51:45 +03:00 
			
		
		
		
	FocusComposer -> FocusSendMessageComposer
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
		@@ -569,7 +569,7 @@ export default class ContentMessages {
 | 
				
			|||||||
        dis.dispatch<UploadStartedPayload>({ action: Action.UploadStarted, upload });
 | 
					        dis.dispatch<UploadStartedPayload>({ action: Action.UploadStarted, upload });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Focus the composer view
 | 
					        // Focus the composer view
 | 
				
			||||||
        dis.fire(Action.FocusComposer);
 | 
					        dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        function onProgress(ev) {
 | 
					        function onProgress(ev) {
 | 
				
			||||||
            upload.total = ev.total;
 | 
					            upload.total = ev.total;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -398,7 +398,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
				
			|||||||
            // refocusing during a paste event will make the
 | 
					            // refocusing during a paste event will make the
 | 
				
			||||||
            // paste end up in the newly focused element,
 | 
					            // paste end up in the newly focused element,
 | 
				
			||||||
            // so dispatch synchronously before paste happens
 | 
					            // so dispatch synchronously before paste happens
 | 
				
			||||||
            dis.fire(Action.FocusComposer, true);
 | 
					            dis.fire(Action.FocusSendMessageComposer, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -552,7 +552,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (!isClickShortcut && ev.key !== Key.TAB && !canElementReceiveInput(ev.target)) {
 | 
					            if (!isClickShortcut && ev.key !== Key.TAB && !canElementReceiveInput(ev.target)) {
 | 
				
			||||||
                // synchronous dispatch so we focus before key generates input
 | 
					                // synchronous dispatch so we focus before key generates input
 | 
				
			||||||
                dis.fire(Action.FocusComposer, true);
 | 
					                dis.fire(Action.FocusSendMessageComposer, true);
 | 
				
			||||||
                ev.stopPropagation();
 | 
					                ev.stopPropagation();
 | 
				
			||||||
                // we should *not* preventDefault() here as
 | 
					                // we should *not* preventDefault() here as
 | 
				
			||||||
                // that would prevent typing in the now-focussed composer
 | 
					                // that would prevent typing in the now-focussed composer
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -443,7 +443,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
            CountlyAnalytics.instance.trackPageChange(durationMs);
 | 
					            CountlyAnalytics.instance.trackPageChange(durationMs);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (this.focusComposer) {
 | 
					        if (this.focusComposer) {
 | 
				
			||||||
            dis.fire(Action.FocusComposer);
 | 
					            dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
            this.focusComposer = false;
 | 
					            this.focusComposer = false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1427,7 +1427,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
                showNotificationsToast(false);
 | 
					                showNotificationsToast(false);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            dis.fire(Action.FocusComposer);
 | 
					            dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
            this.setState({
 | 
					            this.setState({
 | 
				
			||||||
                ready: true,
 | 
					                ready: true,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -131,7 +131,7 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
        switch (action) {
 | 
					        switch (action) {
 | 
				
			||||||
            case RoomListAction.ClearSearch:
 | 
					            case RoomListAction.ClearSearch:
 | 
				
			||||||
                this.clearInput();
 | 
					                this.clearInput();
 | 
				
			||||||
                defaultDispatcher.fire(Action.FocusComposer);
 | 
					                defaultDispatcher.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case RoomListAction.NextRoom:
 | 
					            case RoomListAction.NextRoom:
 | 
				
			||||||
            case RoomListAction.PrevRoom:
 | 
					            case RoomListAction.PrevRoom:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,12 +118,12 @@ export default class RoomStatusBar extends React.PureComponent {
 | 
				
			|||||||
            this.setState({ isResending: false });
 | 
					            this.setState({ isResending: false });
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        this.setState({ isResending: true });
 | 
					        this.setState({ isResending: true });
 | 
				
			||||||
        dis.fire(Action.FocusComposer);
 | 
					        dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _onCancelAllClick = () => {
 | 
					    _onCancelAllClick = () => {
 | 
				
			||||||
        Resend.cancelUnsentEvents(this.props.room);
 | 
					        Resend.cancelUnsentEvents(this.props.room);
 | 
				
			||||||
        dis.fire(Action.FocusComposer);
 | 
					        dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _onRoomLocalEchoUpdated = (event, room, oldEventId, oldStatus) => {
 | 
					    _onRoomLocalEchoUpdated = (event, room, oldEventId, oldStatus) => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -842,7 +842,7 @@ export default class RoomView extends React.Component<IProps, IState> {
 | 
				
			|||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    dis.dispatch({
 | 
					                    dis.dispatch({
 | 
				
			||||||
                        ...payload,
 | 
					                        ...payload,
 | 
				
			||||||
                        action: Action.FocusComposer,
 | 
					                        action: Action.FocusSendMessageComposer,
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -1262,7 +1262,7 @@ export default class RoomView extends React.Component<IProps, IState> {
 | 
				
			|||||||
        ContentMessages.sharedInstance().sendContentListToRoom(
 | 
					        ContentMessages.sharedInstance().sendContentListToRoom(
 | 
				
			||||||
            ev.dataTransfer.files, this.state.room.roomId, this.context,
 | 
					            ev.dataTransfer.files, this.state.room.roomId, this.context,
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        dis.fire(Action.FocusComposer);
 | 
					        dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.setState({
 | 
					        this.setState({
 | 
				
			||||||
            draggingFile: false,
 | 
					            draggingFile: false,
 | 
				
			||||||
@@ -1564,7 +1564,7 @@ export default class RoomView extends React.Component<IProps, IState> {
 | 
				
			|||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            // Otherwise we have to jump manually
 | 
					            // Otherwise we have to jump manually
 | 
				
			||||||
            this.messagePanel.jumpToLiveTimeline();
 | 
					            this.messagePanel.jumpToLiveTimeline();
 | 
				
			||||||
            dis.fire(Action.FocusComposer);
 | 
					            dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -334,7 +334,7 @@ export default class ReplyThread extends React.Component {
 | 
				
			|||||||
            events,
 | 
					            events,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dis.fire(Action.FocusComposer);
 | 
					        dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    render() {
 | 
					    render() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -181,7 +181,7 @@ export default class EditMessageComposer extends React.Component<IProps, IState>
 | 
				
			|||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    this.clearStoredEditorState();
 | 
					                    this.clearStoredEditorState();
 | 
				
			||||||
                    dis.dispatch({ action: 'edit_event', event: null });
 | 
					                    dis.dispatch({ action: 'edit_event', event: null });
 | 
				
			||||||
                    dis.fire(Action.FocusComposer);
 | 
					                    dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                event.preventDefault();
 | 
					                event.preventDefault();
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -200,7 +200,7 @@ export default class EditMessageComposer extends React.Component<IProps, IState>
 | 
				
			|||||||
    private cancelEdit = (): void => {
 | 
					    private cancelEdit = (): void => {
 | 
				
			||||||
        this.clearStoredEditorState();
 | 
					        this.clearStoredEditorState();
 | 
				
			||||||
        dis.dispatch({ action: "edit_event", event: null });
 | 
					        dis.dispatch({ action: "edit_event", event: null });
 | 
				
			||||||
        dis.fire(Action.FocusComposer);
 | 
					        dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private get shouldSaveStoredEditorState(): boolean {
 | 
					    private get shouldSaveStoredEditorState(): boolean {
 | 
				
			||||||
@@ -375,7 +375,7 @@ export default class EditMessageComposer extends React.Component<IProps, IState>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // close the event editing and focus composer
 | 
					        // close the event editing and focus composer
 | 
				
			||||||
        dis.dispatch({ action: "edit_event", event: null });
 | 
					        dis.dispatch({ action: "edit_event", event: null });
 | 
				
			||||||
        dis.fire(Action.FocusComposer);
 | 
					        dis.fire(Action.FocusSendMessageComposer);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private cancelPreviousPendingEdit(): void {
 | 
					    private cancelPreviousPendingEdit(): void {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -497,7 +497,7 @@ export default class SendMessageComposer extends React.Component<IProps> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        switch (payload.action) {
 | 
					        switch (payload.action) {
 | 
				
			||||||
            case 'reply_to_event':
 | 
					            case 'reply_to_event':
 | 
				
			||||||
            case Action.FocusComposer:
 | 
					            case Action.FocusSendMessageComposer:
 | 
				
			||||||
                this.editorRef.current?.focus();
 | 
					                this.editorRef.current?.focus();
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case "send_composer_insert":
 | 
					            case "send_composer_insert":
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,7 @@ export enum Action {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Focuses the user's cursor to the send message composer. No additional payload information required.
 | 
					     * Focuses the user's cursor to the send message composer. No additional payload information required.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    FocusComposer = "focus_composer",
 | 
					    FocusSendMessageComposer = "focus_composer",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Focuses the user's cursor to the edit message composer. No additional payload information required.
 | 
					     * Focuses the user's cursor to the edit message composer. No additional payload information required.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user