<type>api
/
~/

squire-rte-mention

0.0.1

esm/index.d.ts

Functions
  • createMentionUtils

    /**
     * Returns a set of utilities to help add mention functionality to squire-rte
     * @param editor
     * @returns
     */
    export declare function createMentionUtils(editor: Squire): {
        /**
         * Get the text after the `@` mention value nearest to the cursor position
         */
        getMentionText: () => string;
        /**
         * Get a web range object that selects the text before the cursor till the `@`
         */
        getMentionReplacementRange: (mentionText: string) => Range;
        /**
         * Get a web range object that selects the text before the cursor till the `@` and also grabs the text after the cursor
         * Can be used to replace the entire word to a mention tag instead of just the characters before the cursor.
         */
        unsafe_getMentionReplacementRange: (mentionText: string) => Range;
        /**
         * Insert the given html at the current mention's location
         * @param html
         * @returns
         */
        insertMention: (html: string) => void;
        /**
         * Insert the given html at the current mention's location while also replacing
         * the entire word surrounded by the cursor
         * @param html
         * @returns
         */
        unsafe_insertMention: (html: string) => void;
    };
All
import Squire from "squire-rte";
/**
 * Returns a set of utilities to help add mention functionality to squire-rte
 * @param editor
 * @returns
 */
export declare function createMentionUtils(editor: Squire): {
    /**
     * Get the text after the `@` mention value nearest to the cursor position
     */
    getMentionText: () => string;
    /**
     * Get a web range object that selects the text before the cursor till the `@`
     */
    getMentionReplacementRange: (mentionText: string) => Range;
    /**
     * Get a web range object that selects the text before the cursor till the `@` and also grabs the text after the cursor
     * Can be used to replace the entire word to a mention tag instead of just the characters before the cursor.
     */
    unsafe_getMentionReplacementRange: (mentionText: string) => Range;
    /**
     * Insert the given html at the current mention's location
     * @param html
     * @returns
     */
    insertMention: (html: string) => void;
    /**
     * Insert the given html at the current mention's location while also replacing
     * the entire word surrounded by the cursor
     * @param html
     * @returns
     */
    unsafe_insertMention: (html: string) => void;
};

esm/ui.d.ts

Types
  • FindUserMethod

    type FindUserMethod = (mentionText: string) => any[] | Promise<any[]>;
  • FormatMentionHTML

    type FormatMentionHTML = (html: string) => string;
Functions
  • addMentionUI

    export declare function addMentionUI(editor: Squire, { findUsers, formatMentionHTML, }: {
        findUsers: FindUserMethod;
        formatMentionHTML: FormatMentionHTML;
    }): void;
All
import Squire from "squire-rte";
type FindUserMethod = (mentionText: string) => any[] | Promise<any[]>;
type FormatMentionHTML = (html: string) => string;
export declare function addMentionUI(editor: Squire, { findUsers, formatMentionHTML, }: {
    findUsers: FindUserMethod;
    formatMentionHTML: FormatMentionHTML;
}): void;
export {};

dist/index.d.ts

Functions
  • createMentionUtils

    /**
     * Returns a set of utilities to help add mention functionality to squire-rte
     * @param editor
     * @returns
     */
    export declare function createMentionUtils(editor: Squire): {
        /**
         * Get the text after the `@` mention value nearest to the cursor position
         */
        getMentionText: () => string;
        /**
         * Get a web range object that selects the text before the cursor till the `@`
         */
        getMentionReplacementRange: (mentionText: string) => Range;
        /**
         * Get a web range object that selects the text before the cursor till the `@` and also grabs the text after the cursor
         * Can be used to replace the entire word to a mention tag instead of just the characters before the cursor.
         */
        unsafe_getMentionReplacementRange: (mentionText: string) => Range;
        /**
         * Insert the given html at the current mention's location
         * @param html
         * @returns
         */
        insertMention: (html: string) => void;
        /**
         * Insert the given html at the current mention's location while also replacing
         * the entire word surrounded by the cursor
         * @param html
         * @returns
         */
        unsafe_insertMention: (html: string) => void;
    };
All
import Squire from "squire-rte";
/**
 * Returns a set of utilities to help add mention functionality to squire-rte
 * @param editor
 * @returns
 */
export declare function createMentionUtils(editor: Squire): {
    /**
     * Get the text after the `@` mention value nearest to the cursor position
     */
    getMentionText: () => string;
    /**
     * Get a web range object that selects the text before the cursor till the `@`
     */
    getMentionReplacementRange: (mentionText: string) => Range;
    /**
     * Get a web range object that selects the text before the cursor till the `@` and also grabs the text after the cursor
     * Can be used to replace the entire word to a mention tag instead of just the characters before the cursor.
     */
    unsafe_getMentionReplacementRange: (mentionText: string) => Range;
    /**
     * Insert the given html at the current mention's location
     * @param html
     * @returns
     */
    insertMention: (html: string) => void;
    /**
     * Insert the given html at the current mention's location while also replacing
     * the entire word surrounded by the cursor
     * @param html
     * @returns
     */
    unsafe_insertMention: (html: string) => void;
};

dist/ui.d.ts

Types
  • FindUserMethod

    type FindUserMethod = (mentionText: string) => any[] | Promise<any[]>;
  • FormatMentionHTML

    type FormatMentionHTML = (html: string) => string;
Functions
  • addMentionUI

    export declare function addMentionUI(editor: Squire, { findUsers, formatMentionHTML, }: {
        findUsers: FindUserMethod;
        formatMentionHTML: FormatMentionHTML;
    }): void;
All
import Squire from "squire-rte";
type FindUserMethod = (mentionText: string) => any[] | Promise<any[]>;
type FormatMentionHTML = (html: string) => string;
export declare function addMentionUI(editor: Squire, { findUsers, formatMentionHTML, }: {
    findUsers: FindUserMethod;
    formatMentionHTML: FormatMentionHTML;
}): void;
export {};