This commit is contained in:
Half-Shot 2026-04-24 09:36:10 +01:00
parent 681cd15ad9
commit c0011589e6
4 changed files with 7 additions and 7 deletions

View File

@ -14,10 +14,10 @@ import type { ComposerInsertPayload } from "../dispatcher/payloads/ComposerInser
export class ComposerApi implements ModuleComposerApi {
public constructor(private readonly dispatcher: MatrixDispatcher) {}
public insertTextIntoComposer(text: string): void {
public insertPlaintextIntoComposer(plaintext: string): void {
this.dispatcher.dispatch({
action: Action.ComposerInsert,
text,
text: plaintext,
} satisfies ComposerInsertPayload);
}
}

View File

@ -15,7 +15,7 @@ describe("ComposerApi", () => {
dispatch: jest.fn(),
} as unknown as MatrixDispatcher;
const api = new ComposerApi(dispatcher);
api.insertTextIntoComposer("Hello world");
api.insertPlaintextIntoComposer("Hello world");
expect(dispatcher.dispatch).toHaveBeenCalledWith({
action: Action.ComposerInsert,
text: "Hello world",

View File

@ -101,7 +101,7 @@ export interface ComponentVisibilityCustomisations {
// @alpha
export interface ComposerApi {
insertTextIntoComposer(text: string): void;
insertPlaintextIntoComposer(plaintext: string): void;
}
// @public

View File

@ -6,15 +6,15 @@ Please see LICENSE files in the repository root for full details.
*/
/**
* API to alter the message composer.
* API to interact with the message composer.
* @alpha Likely to change
*/
export interface ComposerApi {
/**
* Insert plaintext into the current composer.
* @param text - The plain text to insert
* @param plaintext - The plain text to insert
* @returns Returns immediately, does not await action.
* @alpha Likely to change
*/
insertTextIntoComposer(text: string): void;
insertPlaintextIntoComposer(plaintext: string): void;
}