mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-16 18:06:17 +02:00
Add composer api implementation
This commit is contained in:
parent
dde3731bf5
commit
72b2e2865c
23
apps/web/src/modules/ComposerApi.ts
Normal file
23
apps/web/src/modules/ComposerApi.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2026 Element Creations Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { type ComposerApi as ModuleComposerApi } from "@element-hq/element-web-module-api";
|
||||
|
||||
import defaultDispatcher from "../dispatcher/dispatcher";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
import type { ComposerInsertPayload } from "../dispatcher/payloads/ComposerInsertPayload";
|
||||
import { TimelineRenderingType } from "../contexts/RoomContext";
|
||||
|
||||
export class ComposerApi implements ModuleComposerApi {
|
||||
public insertTextIntoComposer(text: string): void {
|
||||
defaultDispatcher.dispatch({
|
||||
action: Action.ComposerInsert,
|
||||
text,
|
||||
timelineRenderingType: TimelineRenderingType.Room,
|
||||
} satisfies ComposerInsertPayload);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user