Add Module Composer API (#33284)
* Spec composer API * Add composer api implementation * Tests * Copyright * update sigs * cleanup * a snap * cleanup * linting * Tidy up * Adjust
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* API to interact with the message composer.
|
||||
* @alpha Likely to change
|
||||
*/
|
||||
export interface ComposerApi {
|
||||
/**
|
||||
* Insert plaintext into the current composer.
|
||||
* @param plaintext - The plain text to insert
|
||||
* @returns Returns immediately, does not await action.
|
||||
* @alpha Likely to change
|
||||
*/
|
||||
insertPlaintextIntoComposer(plaintext: string): void;
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import { type ClientApi } from "./client.ts";
|
||||
import { type WidgetLifecycleApi } from "./widget-lifecycle.ts";
|
||||
import { type WidgetApi } from "./widget.ts";
|
||||
import { type CustomisationsApi } from "./customisations.ts";
|
||||
import { type ComposerApi } from "./composer.ts";
|
||||
|
||||
/**
|
||||
* Module interface for modules to implement.
|
||||
@@ -159,6 +160,12 @@ export interface Api
|
||||
*/
|
||||
readonly customisations: CustomisationsApi;
|
||||
|
||||
/**
|
||||
* Allows modules to customise the message composer.
|
||||
* @alpha Subject to change.
|
||||
*/
|
||||
readonly composer: ComposerApi;
|
||||
|
||||
/**
|
||||
* Create a ReactDOM root for rendering React components.
|
||||
* Exposed to allow modules to avoid needing to bundle their own ReactDOM.
|
||||
|
||||
@@ -11,6 +11,7 @@ export type { Config, ConfigApi } from "./api/config";
|
||||
export type { I18nApi, Variables, Translations, SubstitutionValue, Tags } from "./api/i18n";
|
||||
export type * from "./models/event";
|
||||
export type * from "./models/Room";
|
||||
export type * from "./api/composer";
|
||||
export type * from "./api/custom-components";
|
||||
export type * from "./api/extras";
|
||||
export type * from "./api/legacy-modules";
|
||||
|
||||
Reference in New Issue
Block a user