Move mxClient to object in sendMessage
parent
21677e67e8
commit
c7f912529d
|
@ -46,7 +46,7 @@ export function WysiwygComposer(
|
||||||
} });
|
} });
|
||||||
|
|
||||||
const memoizedSendMessage = useCallback(() => {
|
const memoizedSendMessage = useCallback(() => {
|
||||||
sendMessage(content, mxClient, { roomContext, ...props });
|
sendMessage(content, { mxClient, roomContext, ...props });
|
||||||
wysiwyg.clear();
|
wysiwyg.clear();
|
||||||
ref.current?.focus();
|
ref.current?.focus();
|
||||||
}, [content, mxClient, roomContext, wysiwyg, props, ref]);
|
}, [content, mxClient, roomContext, wysiwyg, props, ref]);
|
||||||
|
|
|
@ -32,6 +32,7 @@ import { IRoomState } from "../../../structures/RoomView";
|
||||||
import dis from '../../../../dispatcher/dispatcher';
|
import dis from '../../../../dispatcher/dispatcher';
|
||||||
|
|
||||||
interface SendMessageParams {
|
interface SendMessageParams {
|
||||||
|
mxClient: MatrixClient;
|
||||||
relation: IEventRelation;
|
relation: IEventRelation;
|
||||||
replyToEvent?: MatrixEvent;
|
replyToEvent?: MatrixEvent;
|
||||||
roomContext: IRoomState;
|
roomContext: IRoomState;
|
||||||
|
@ -43,7 +44,7 @@ interface SendMessageParams {
|
||||||
export function createMessageContent(
|
export function createMessageContent(
|
||||||
message: string,
|
message: string,
|
||||||
{ relation, replyToEvent, permalinkCreator, includeReplyLegacyFallback = true }:
|
{ relation, replyToEvent, permalinkCreator, includeReplyLegacyFallback = true }:
|
||||||
Omit<SendMessageParams, 'roomContext'>,
|
Omit<SendMessageParams, 'roomContext' | 'mxClient'>,
|
||||||
): IContent {
|
): IContent {
|
||||||
const isEmote = false;
|
const isEmote = false;
|
||||||
|
|
||||||
|
@ -92,8 +93,7 @@ export function createMessageContent(
|
||||||
|
|
||||||
export function sendMessage(
|
export function sendMessage(
|
||||||
message: string,
|
message: string,
|
||||||
mxClient: MatrixClient,
|
{ roomContext, mxClient, ...params }: SendMessageParams,
|
||||||
{ roomContext, ...params }: SendMessageParams,
|
|
||||||
) {
|
) {
|
||||||
const { relation, replyToEvent } = params;
|
const { relation, replyToEvent } = params;
|
||||||
const { room } = roomContext;
|
const { room } = roomContext;
|
||||||
|
|
Loading…
Reference in New Issue