1 | import { HashtagService } from '../parser/hashtag-utils';
|
2 | import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
|
3 | /**
|
4 | * @class Autolinker.match.Hashtag
|
5 | * @extends Autolinker.match.AbstractMatch
|
6 | *
|
7 | * Represents a Hashtag match found in an input string which should be
|
8 | * Autolinked.
|
9 | *
|
10 | * See this class's superclass ({@link Autolinker.match.Match}) for more
|
11 | * details.
|
12 | */
|
13 | export declare class HashtagMatch extends AbstractMatch {
|
14 | /**
|
15 | * @public
|
16 | * @property {'hashtag'} type
|
17 | *
|
18 | * A string name for the type of match that this class represents. Can be
|
19 | * used in a TypeScript discriminating union to type-narrow from the
|
20 | * `Match` type.
|
21 | */
|
22 | readonly type: 'hashtag';
|
23 | /**
|
24 | * @cfg {String} serviceName
|
25 | *
|
26 | * The service to point hashtag matches to. See {@link Autolinker#hashtag}
|
27 | * for available values.
|
28 | */
|
29 | private readonly serviceName;
|
30 | /**
|
31 | * @cfg {String} hashtag (required)
|
32 | *
|
33 | * The HashtagMatch that was matched, without the '#'.
|
34 | */
|
35 | private readonly hashtag;
|
36 | /**
|
37 | * @method constructor
|
38 | * @param {Object} cfg The configuration properties for the Match
|
39 | * instance, specified in an Object (map).
|
40 | */
|
41 | constructor(cfg: HashtagMatchConfig);
|
42 | /**
|
43 | * Returns a string name for the type of match that this class represents.
|
44 | * For the case of HashtagMatch, returns 'hashtag'.
|
45 | *
|
46 | * @return {String}
|
47 | */
|
48 | getType(): 'hashtag';
|
49 | /**
|
50 | * Returns the configured {@link #serviceName} to point the HashtagMatch to.
|
51 | * Ex: 'facebook', 'twitter'.
|
52 | *
|
53 | * @return {String}
|
54 | */
|
55 | getServiceName(): HashtagService;
|
56 | /**
|
57 | * Returns the matched hashtag, without the '#' character.
|
58 | *
|
59 | * @return {String}
|
60 | */
|
61 | getHashtag(): string;
|
62 | /**
|
63 | * Returns the anchor href that should be generated for the match.
|
64 | *
|
65 | * @return {String}
|
66 | */
|
67 | getAnchorHref(): string;
|
68 | /**
|
69 | * Returns the anchor text that should be generated for the match.
|
70 | *
|
71 | * @return {String}
|
72 | */
|
73 | getAnchorText(): string;
|
74 | /**
|
75 | * Returns the CSS class suffixes that should be used on a tag built with
|
76 | * the match. See {@link Autolinker.match.Match#getCssClassSuffixes} for
|
77 | * details.
|
78 | *
|
79 | * @return {String[]}
|
80 | */
|
81 | getCssClassSuffixes(): string[];
|
82 | }
|
83 | export interface HashtagMatchConfig extends AbstractMatchConfig {
|
84 | serviceName: HashtagService;
|
85 | hashtag: string;
|
86 | }
|