UNPKG

matrix-react-sdk

Version:
39 lines (38 loc) 2.01 kB
import { AllowedMentionAttributes, MappedSuggestion } from "@vector-im/matrix-wysiwyg"; import { MatrixClient, Room } from "matrix-js-sdk/src/matrix"; import { ICompletion } from "../../../../../autocomplete/Autocompleter"; /** * Builds the query for the `<Autocomplete />` component from the rust suggestion. This * will change as we implement handling / commands. * * @param suggestion - represents if the rust model is tracking a potential mention * @returns an empty string if we can not generate a query, otherwise a query beginning * with @ for a user query, # for a room or space query */ export declare function buildQuery(suggestion: MappedSuggestion | null): string; /** * Find the room from the completion by looking it up using the client from the context * we are currently in * * @param completion - the completion from the autocomplete * @param client - the current client we are using * @returns a Room if one is found, null otherwise */ export declare function getRoomFromCompletion(completion: ICompletion, client: MatrixClient): Room | null; /** * Given an autocomplete suggestion, determine the text to display in the pill * * @param completion - the item selected from the autocomplete * @param client - the MatrixClient is required for us to look up the correct room mention text * @returns the text to display in the mention */ export declare function getMentionDisplayText(completion: ICompletion, client: MatrixClient): string; /** * For a given completion, the attributes will change depending on the completion type * * @param completion - the item selected from the autocomplete * @param client - the MatrixClient is required for us to look up the correct room mention text * @param room - the room the composer is currently in * @returns an object of attributes containing HTMLAnchor attributes or data-* attributes */ export declare function getMentionAttributes(completion: ICompletion, client: MatrixClient, room: Room): AllowedMentionAttributes;