Skip to content

Commit 72b2e28

Browse files
committed
Add composer api implementation
1 parent dde3731 commit 72b2e28

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Copyright 2026 Element Creations Ltd.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
import { type ComposerApi as ModuleComposerApi } from "@element-hq/element-web-module-api";
9+
10+
import defaultDispatcher from "../dispatcher/dispatcher";
11+
import { Action } from "../dispatcher/actions";
12+
import type { ComposerInsertPayload } from "../dispatcher/payloads/ComposerInsertPayload";
13+
import { TimelineRenderingType } from "../contexts/RoomContext";
14+
15+
export class ComposerApi implements ModuleComposerApi {
16+
public insertTextIntoComposer(text: string): void {
17+
defaultDispatcher.dispatch({
18+
action: Action.ComposerInsert,
19+
text,
20+
timelineRenderingType: TimelineRenderingType.Room,
21+
} satisfies ComposerInsertPayload);
22+
}
23+
}

0 commit comments

Comments
 (0)