1 | import { __extends } from "tslib";
|
---|
2 | import { Match } from './match';
|
---|
3 | /**
|
---|
4 | * @class Autolinker.match.Email
|
---|
5 | * @extends Autolinker.match.Match
|
---|
6 | *
|
---|
7 | * Represents a Email 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 | */
|
---|
11 | var EmailMatch = /** @class */ (function (_super) {
|
---|
12 | __extends(EmailMatch, _super);
|
---|
13 | /**
|
---|
14 | * @method constructor
|
---|
15 | * @param {Object} cfg The configuration properties for the Match
|
---|
16 | * instance, specified in an Object (map).
|
---|
17 | */
|
---|
18 | function EmailMatch(cfg) {
|
---|
19 | var _this = _super.call(this, cfg) || this;
|
---|
20 | /**
|
---|
21 | * @cfg {String} email (required)
|
---|
22 | *
|
---|
23 | * The email address that was matched.
|
---|
24 | */
|
---|
25 | _this.email = ''; // default value just to get the above doc comment in the ES5 output and documentation generator
|
---|
26 | _this.email = cfg.email;
|
---|
27 | return _this;
|
---|
28 | }
|
---|
29 | /**
|
---|
30 | * Returns a string name for the type of match that this class represents.
|
---|
31 | * For the case of EmailMatch, returns 'email'.
|
---|
32 | *
|
---|
33 | * @return {String}
|
---|
34 | */
|
---|
35 | EmailMatch.prototype.getType = function () {
|
---|
36 | return 'email';
|
---|
37 | };
|
---|
38 | /**
|
---|
39 | * Returns the email address that was matched.
|
---|
40 | *
|
---|
41 | * @return {String}
|
---|
42 | */
|
---|
43 | EmailMatch.prototype.getEmail = function () {
|
---|
44 | return this.email;
|
---|
45 | };
|
---|
46 | /**
|
---|
47 | * Returns the anchor href that should be generated for the match.
|
---|
48 | *
|
---|
49 | * @return {String}
|
---|
50 | */
|
---|
51 | EmailMatch.prototype.getAnchorHref = function () {
|
---|
52 | return 'mailto:' + this.email;
|
---|
53 | };
|
---|
54 | /**
|
---|
55 | * Returns the anchor text that should be generated for the match.
|
---|
56 | *
|
---|
57 | * @return {String}
|
---|
58 | */
|
---|
59 | EmailMatch.prototype.getAnchorText = function () {
|
---|
60 | return this.email;
|
---|
61 | };
|
---|
62 | return EmailMatch;
|
---|
63 | }(Match));
|
---|
64 | export { EmailMatch };
|
---|
65 | //# sourceMappingURL=email-match.js.map |
---|