UNPKG

2.17 kBTypeScriptView Raw
1import { Match, MatchConfig } from "./match";
2import { MentionServices } from "../autolinker";
3/**
4 * @class Autolinker.match.Mention
5 * @extends Autolinker.match.Match
6 *
7 * Represents a Mention match found in an input string which should be Autolinked.
8 *
9 * See this class's superclass ({@link Autolinker.match.Match}) for more details.
10 */
11export declare class MentionMatch extends Match {
12 /**
13 * @cfg {String} serviceName
14 *
15 * The service to point mention matches to. See {@link Autolinker#mention}
16 * for available values.
17 */
18 private readonly serviceName;
19 /**
20 * @cfg {String} mention (required)
21 *
22 * The Mention that was matched, without the '@' character.
23 */
24 private readonly mention;
25 /**
26 * @method constructor
27 * @param {Object} cfg The configuration properties for the Match
28 * instance, specified in an Object (map).
29 */
30 constructor(cfg: MentionMatchConfig);
31 /**
32 * Returns a string name for the type of match that this class represents.
33 * For the case of MentionMatch, returns 'mention'.
34 *
35 * @return {String}
36 */
37 getType(): string;
38 /**
39 * Returns the mention, without the '@' character.
40 *
41 * @return {String}
42 */
43 getMention(): string;
44 /**
45 * Returns the configured {@link #serviceName} to point the mention to.
46 * Ex: 'instagram', 'twitter', 'soundcloud'.
47 *
48 * @return {String}
49 */
50 getServiceName(): MentionServices;
51 /**
52 * Returns the anchor href that should be generated for the match.
53 *
54 * @return {String}
55 */
56 getAnchorHref(): string;
57 /**
58 * Returns the anchor text that should be generated for the match.
59 *
60 * @return {String}
61 */
62 getAnchorText(): string;
63 /**
64 * Returns the CSS class suffixes that should be used on a tag built with
65 * the match. See {@link Autolinker.match.Match#getCssClassSuffixes} for
66 * details.
67 *
68 * @return {String[]}
69 */
70 getCssClassSuffixes(): string[];
71}
72export interface MentionMatchConfig extends MatchConfig {
73 serviceName: MentionServices;
74 mention: string;
75}