Fix RTE focus behaviour in threads
parent
a0a419a3b8
commit
1da78fa6bc
|
@ -336,7 +336,10 @@ export class MessageComposer extends React.Component<IProps, IState> {
|
||||||
const { permalinkCreator, relation, replyToEvent } = this.props;
|
const { permalinkCreator, relation, replyToEvent } = this.props;
|
||||||
const composerContent = this.state.composerContent;
|
const composerContent = this.state.composerContent;
|
||||||
this.setState({ composerContent: "", initialComposerContent: "" });
|
this.setState({ composerContent: "", initialComposerContent: "" });
|
||||||
dis.dispatch({ action: Action.ClearAndFocusSendMessageComposer });
|
dis.dispatch({
|
||||||
|
action: Action.ClearAndFocusSendMessageComposer,
|
||||||
|
timelineRenderingType: this.context.timelineRenderingType,
|
||||||
|
});
|
||||||
await sendMessage(composerContent, this.state.isRichTextEnabled, {
|
await sendMessage(composerContent, this.state.isRichTextEnabled, {
|
||||||
mxClient: this.props.mxClient,
|
mxClient: this.props.mxClient,
|
||||||
roomContext: this.context,
|
roomContext: this.context,
|
||||||
|
|
|
@ -50,6 +50,9 @@ export function useWysiwygSendActionHandler(
|
||||||
focusComposer(composerElement, context, roomContext, timeoutId);
|
focusComposer(composerElement, context, roomContext, timeoutId);
|
||||||
break;
|
break;
|
||||||
case Action.ClearAndFocusSendMessageComposer:
|
case Action.ClearAndFocusSendMessageComposer:
|
||||||
|
// When a thread is opened, prevent the main composer to steal the thread composer focus
|
||||||
|
if (payload.timelineRenderingType !== roomContext.timelineRenderingType) break;
|
||||||
|
|
||||||
composerFunctions.clear();
|
composerFunctions.clear();
|
||||||
focusComposer(composerElement, context, roomContext, timeoutId);
|
focusComposer(composerElement, context, roomContext, timeoutId);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -153,7 +153,7 @@ describe("SendWysiwygComposer", () => {
|
||||||
// When we send the right action
|
// When we send the right action
|
||||||
defaultDispatcher.dispatch({
|
defaultDispatcher.dispatch({
|
||||||
action: Action.ClearAndFocusSendMessageComposer,
|
action: Action.ClearAndFocusSendMessageComposer,
|
||||||
context: null,
|
timelineRenderingType: defaultRoomContext.timelineRenderingType,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Then the component gets the focus
|
// Then the component gets the focus
|
||||||
|
|
Loading…
Reference in New Issue