Commit dfc4f362 authored by Benoit Denis's avatar Benoit Denis
Browse files

added "mentionSelect" input to allow selection formatting

parent 42c79f6e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ export class MentionDirective {
    this.items = items.sort();
  }

  @Input() mentionSelect: (selection: string) => (string) = (selection: string) => selection;

  setIframe(iframe: HTMLIFrameElement) {
    this.iframe = iframe;
  }
@@ -117,7 +119,7 @@ export class MentionDirective {
            // value is inserted without a trailing space for consistency
            // between element types (div and iframe do not preserve the space)
            insertValue(nativeElement, this.startPos, pos,
              this.triggerChar + this.searchList.activeItem, this.iframe);
              this.mentionSelect(this.triggerChar + this.searchList.activeItem), this.iframe);
            // fire input event so angular bindings are updated
            if ("createEvent" in document) {
              var evt = document.createEvent("HTMLEvents");