Commit 4e3d4d37 authored by Dan MacFarlane's avatar Dan MacFarlane Committed by GitHub
Browse files

Merge pull request #17 from taguan/formatSelection

added "mentionSelect" input to allow selection formatting
parents a0199080 dfc4f362
Loading
Loading
Loading
Loading
+3 −1
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");