@banta/sdk 4.6.15 → 4.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/banta-sdk.umd.js +35 -34
- package/bundles/banta-sdk.umd.js.map +1 -1
- package/bundles/banta-sdk.umd.min.js +1 -1
- package/bundles/banta-sdk.umd.min.js.map +1 -1
- package/esm2015/lib/common/index.js +2 -1
- package/esm2015/lib/index.js +1 -2
- package/fesm2015/banta-sdk.js +31 -31
- package/fesm2015/banta-sdk.js.map +1 -1
- package/lib/common/index.d.ts +1 -0
- package/lib/index.d.ts +0 -1
- package/package.json +10 -10
package/bundles/banta-sdk.umd.js
CHANGED
|
@@ -245,6 +245,40 @@
|
|
|
245
245
|
{ type: platformBrowser.DomSanitizer }
|
|
246
246
|
]; };
|
|
247
247
|
|
|
248
|
+
var BantaMentionLinkerPipe = /** @class */ (function () {
|
|
249
|
+
function BantaMentionLinkerPipe() {
|
|
250
|
+
}
|
|
251
|
+
BantaMentionLinkerPipe.prototype.transform = function (value, links) {
|
|
252
|
+
var _this = this;
|
|
253
|
+
if (!value)
|
|
254
|
+
return '';
|
|
255
|
+
if (!links)
|
|
256
|
+
return value;
|
|
257
|
+
var text = value;
|
|
258
|
+
for (var i = 0, max = links.length; i < max; ++i) {
|
|
259
|
+
var mention = links[i];
|
|
260
|
+
text = text.replace(new RegExp("" + this.escapeRegExp(mention.text), "gi"), "@{" + (i + 1) + "}");
|
|
261
|
+
}
|
|
262
|
+
text = text.replace(/@\{(\d+)\}/g, function (text, i) { return links[i - 1] ? _this.formatLink(links[i - 1]) : text; });
|
|
263
|
+
return text;
|
|
264
|
+
};
|
|
265
|
+
BantaMentionLinkerPipe.prototype.formatLink = function (link) {
|
|
266
|
+
return "<a" + (link.external ? " target=\"_blank\" rel=\"noopener\"" : "") + " href=\"" + link.link + "\">" + link.text + "</a>";
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
|
270
|
+
*/
|
|
271
|
+
BantaMentionLinkerPipe.prototype.escapeRegExp = function (string) {
|
|
272
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
273
|
+
};
|
|
274
|
+
return BantaMentionLinkerPipe;
|
|
275
|
+
}());
|
|
276
|
+
BantaMentionLinkerPipe.decorators = [
|
|
277
|
+
{ type: core.Pipe, args: [{
|
|
278
|
+
name: 'mentionLinker'
|
|
279
|
+
},] }
|
|
280
|
+
];
|
|
281
|
+
|
|
248
282
|
var BantaAttachmentComponent = /** @class */ (function () {
|
|
249
283
|
function BantaAttachmentComponent(elementRef) {
|
|
250
284
|
this.elementRef = elementRef;
|
|
@@ -455,40 +489,6 @@
|
|
|
455
489
|
loaded: [{ type: core.Output }]
|
|
456
490
|
};
|
|
457
491
|
|
|
458
|
-
var BantaMentionLinkerPipe = /** @class */ (function () {
|
|
459
|
-
function BantaMentionLinkerPipe() {
|
|
460
|
-
}
|
|
461
|
-
BantaMentionLinkerPipe.prototype.transform = function (value, links) {
|
|
462
|
-
var _this = this;
|
|
463
|
-
if (!value)
|
|
464
|
-
return '';
|
|
465
|
-
if (!links)
|
|
466
|
-
return value;
|
|
467
|
-
var text = value;
|
|
468
|
-
for (var i = 0, max = links.length; i < max; ++i) {
|
|
469
|
-
var mention = links[i];
|
|
470
|
-
text = text.replace(new RegExp("" + this.escapeRegExp(mention.text), "gi"), "@{" + (i + 1) + "}");
|
|
471
|
-
}
|
|
472
|
-
text = text.replace(/@\{(\d+)\}/g, function (text, i) { return links[i - 1] ? _this.formatLink(links[i - 1]) : text; });
|
|
473
|
-
return text;
|
|
474
|
-
};
|
|
475
|
-
BantaMentionLinkerPipe.prototype.formatLink = function (link) {
|
|
476
|
-
return "<a" + (link.external ? " target=\"_blank\" rel=\"noopener\"" : "") + " href=\"" + link.link + "\">" + link.text + "</a>";
|
|
477
|
-
};
|
|
478
|
-
/**
|
|
479
|
-
* https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
|
480
|
-
*/
|
|
481
|
-
BantaMentionLinkerPipe.prototype.escapeRegExp = function (string) {
|
|
482
|
-
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
483
|
-
};
|
|
484
|
-
return BantaMentionLinkerPipe;
|
|
485
|
-
}());
|
|
486
|
-
BantaMentionLinkerPipe.decorators = [
|
|
487
|
-
{ type: core.Pipe, args: [{
|
|
488
|
-
name: 'mentionLinker'
|
|
489
|
-
},] }
|
|
490
|
-
];
|
|
491
|
-
|
|
492
492
|
var COMPONENTS = [
|
|
493
493
|
TimestampComponent,
|
|
494
494
|
LightboxComponent,
|
|
@@ -11798,6 +11798,7 @@
|
|
|
11798
11798
|
exports.BantaComponent = BantaComponent;
|
|
11799
11799
|
exports.BantaLogoComponent = BantaLogoComponent;
|
|
11800
11800
|
exports.BantaMarkdownToHtmlPipe = BantaMarkdownToHtmlPipe;
|
|
11801
|
+
exports.BantaMentionLinkerPipe = BantaMentionLinkerPipe;
|
|
11801
11802
|
exports.BantaReplySendOptionsDirective = BantaReplySendOptionsDirective;
|
|
11802
11803
|
exports.BantaSdkModule = BantaSdkModule;
|
|
11803
11804
|
exports.BantaTrustResourceUrlPipe = BantaTrustResourceUrlPipe;
|