You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Handle focusing multiple composers
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -832,6 +832,22 @@ export default class RoomView extends React.Component<IProps, IState> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Action.FocusAComposer: {
|
||||||
|
// re-dispatch to the correct composer
|
||||||
|
if (this.state.editState) {
|
||||||
|
dis.dispatch({
|
||||||
|
...payload,
|
||||||
|
action: Action.FocusEditMessageComposer,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dis.dispatch({
|
||||||
|
...payload,
|
||||||
|
action: Action.FocusComposer,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "scroll_to_bottom":
|
case "scroll_to_bottom":
|
||||||
this.messagePanel?.jumpToLiveTimeline();
|
this.messagePanel?.jumpToLiveTimeline();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class ReactionPicker extends React.Component<IProps, IState> {
|
|||||||
this.props.mxEvent.getRoomId(),
|
this.props.mxEvent.getRoomId(),
|
||||||
myReactions[reaction],
|
myReactions[reaction],
|
||||||
);
|
);
|
||||||
dis.dispatch({ action: Action.FocusComposer });
|
dis.dispatch({ action: Action.FocusAComposer });
|
||||||
// Tell the emoji picker not to bump this in the more frequently used list.
|
// Tell the emoji picker not to bump this in the more frequently used list.
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -106,7 +106,7 @@ class ReactionPicker extends React.Component<IProps, IState> {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
dis.dispatch({ action: "message_sent" });
|
dis.dispatch({ action: "message_sent" });
|
||||||
dis.dispatch({ action: Action.FocusComposer });
|
dis.dispatch({ action: Action.FocusAComposer });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -452,6 +452,8 @@ export default class EditMessageComposer extends React.Component<IProps, IState>
|
|||||||
} else if (payload.text) {
|
} else if (payload.text) {
|
||||||
this.editorRef.current?.insertPlaintext(payload.text);
|
this.editorRef.current?.insertPlaintext(payload.text);
|
||||||
}
|
}
|
||||||
|
} else if (payload.action === Action.FocusEditMessageComposer && this.editorRef.current) {
|
||||||
|
this.editorRef.current.focus();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -56,10 +56,22 @@ export enum Action {
|
|||||||
CheckUpdates = "check_updates",
|
CheckUpdates = "check_updates",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focuses the user's cursor to the composer. No additional payload information required.
|
* Focuses the user's cursor to the send message composer. No additional payload information required.
|
||||||
*/
|
*/
|
||||||
FocusComposer = "focus_composer",
|
FocusComposer = "focus_composer",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Focuses the user's cursor to the edit message composer. No additional payload information required.
|
||||||
|
*/
|
||||||
|
FocusEditMessageComposer = "focus_edit_message_composer",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Focuses the user's cursor to the edit message composer or send message
|
||||||
|
* composer based on the current edit state. No additional payload
|
||||||
|
* information required.
|
||||||
|
*/
|
||||||
|
FocusAComposer = "focus_a_composer",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the user menu (previously known as the top left menu). No additional payload information required.
|
* Opens the user menu (previously known as the top left menu). No additional payload information required.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user