Commit fd8586b9 authored by dmacfarlane's avatar dmacfarlane
Browse files

Fire input event so bindings are updated.

parent f6b7b9b9
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -25,10 +25,7 @@ export class TinyMCE {
  @Input() htmlContent;
  @ViewChild(Mention) mention: Mention;
  protected items:string [] = COMMON_NAMES;
  private zone:NgZone;
  constructor(private _elementRef: ElementRef) {
    this.zone = new NgZone({enableLongStackTrace: false});
  }
  constructor(private _elementRef: ElementRef, private _zone: NgZone) {}
  ngAfterViewInit()
  {
    tinymce.init({
@@ -52,7 +49,7 @@ export class TinyMCE {
    ed.on('keydown', function(e) {
      let frame = <any>window.frames[ed.iframeElement.id];
      let contentEditable = frame.contentDocument.getElementById('tinymce');
      comp.zone.run(() => {
      comp._zone.run(() => {
        comp.mention.keyHandler(e, contentEditable);
      });
    });
+8 −2
Original line number Diff line number Diff line
@@ -88,8 +88,14 @@ export class Mention {
          if (event.keyCode === KEY_TAB || event.keyCode === KEY_ENTER) {
            this.stopEvent(event);
            this.searchList.hidden = true;
            insertValue(nativeElement,
              this.mentionStart, pos, "@"+this.searchList.activeItem+" ", this.iframe);
            insertValue(nativeElement, this.mentionStart, pos,
                        "@"+this.searchList.activeItem+" ", this.iframe);
            // fire input event so angular bindings are updated
            if ("createEvent" in document) {
              var evt = document.createEvent("HTMLEvents");
              evt.initEvent("input", false, true);
              nativeElement.dispatchEvent(evt);
            }
            this.mentionStart = -1;
            return false;
          }