@banta/sdk 4.7.8 → 4.7.10

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.
@@ -312,7 +312,7 @@ class BantaMentionLinkerPipe {
312
312
  return text;
313
313
  }
314
314
  formatLink(link) {
315
- return `<a${link.external ? ` target="_blank" rel="noopener"` : ``} href="${link.link}">${link.text}</a>`;
315
+ return `<a${link.external ? ` target="_blank" rel="noopener"` : ``} class="mention" href="${link.link}">${link.text}</a>`;
316
316
  }
317
317
  /**
318
318
  * https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
@@ -386,15 +386,13 @@ class BantaAttachmentComponent {
386
386
  || !this.attachment.url);
387
387
  }
388
388
  get isImageAttachment() {
389
- if (this.attachment.type.startsWith('image/'))
390
- return true;
391
- return false;
389
+ return this.attachment?.type?.startsWith('image/');
392
390
  }
393
391
  get hasFrame() {
394
392
  if (!this.attachment)
395
393
  return false;
396
394
  return this.attachment.type === 'iframe' || (this.attachment.type === 'card'
397
- && this.attachment.card.player);
395
+ && this.attachment.card?.player);
398
396
  }
399
397
  get frameUrl() {
400
398
  if (!this.attachment)
@@ -473,11 +471,14 @@ class BantaAttachmentsComponent {
473
471
  .filter(x => x.type === 'image/png')
474
472
  .map(x => x.url));
475
473
  }
474
+ get validAttachments() {
475
+ return this.attachments.filter(x => x.type);
476
+ }
476
477
  get inlineAttachments() {
477
- return this.attachments.filter(x => x.type !== 'card' && (x.style === 'inline' || !x.style));
478
+ return this.validAttachments.filter(x => x.type !== 'card' && (x.style === 'inline' || !x.style));
478
479
  }
479
480
  get blockAttachments() {
480
- return this.attachments.filter(x => x.style === 'block' || x.type === 'card');
481
+ return this.validAttachments.filter(x => x.style === 'block' || x.type === 'card');
481
482
  }
482
483
  attachmentId(index, attachment) {
483
484
  return attachment.url;