mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 05:04:57 +08:00
Move mxClient to object in sendMessage
This commit is contained in:
parent
21677e67e8
commit
c7f912529d
@ -46,7 +46,7 @@ export function WysiwygComposer(
|
||||
} });
|
||||
|
||||
const memoizedSendMessage = useCallback(() => {
|
||||
sendMessage(content, mxClient, { roomContext, ...props });
|
||||
sendMessage(content, { mxClient, roomContext, ...props });
|
||||
wysiwyg.clear();
|
||||
ref.current?.focus();
|
||||
}, [content, mxClient, roomContext, wysiwyg, props, ref]);
|
||||
|
@ -32,6 +32,7 @@ import { IRoomState } from "../../../structures/RoomView";
|
||||
import dis from '../../../../dispatcher/dispatcher';
|
||||
|
||||
interface SendMessageParams {
|
||||
mxClient: MatrixClient;
|
||||
relation: IEventRelation;
|
||||
replyToEvent?: MatrixEvent;
|
||||
roomContext: IRoomState;
|
||||
@ -43,7 +44,7 @@ interface SendMessageParams {
|
||||
export function createMessageContent(
|
||||
message: string,
|
||||
{ relation, replyToEvent, permalinkCreator, includeReplyLegacyFallback = true }:
|
||||
Omit<SendMessageParams, 'roomContext'>,
|
||||
Omit<SendMessageParams, 'roomContext' | 'mxClient'>,
|
||||
): IContent {
|
||||
const isEmote = false;
|
||||
|
||||
@ -92,8 +93,7 @@ export function createMessageContent(
|
||||
|
||||
export function sendMessage(
|
||||
message: string,
|
||||
mxClient: MatrixClient,
|
||||
{ roomContext, ...params }: SendMessageParams,
|
||||
{ roomContext, mxClient, ...params }: SendMessageParams,
|
||||
) {
|
||||
const { relation, replyToEvent } = params;
|
||||
const { room } = roomContext;
|
||||
|
Loading…
Reference in New Issue
Block a user