ng2-mentions
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -24,4 +24,4 @@ import { ElementRef } from "@angular/core"; | ||
stopEvent(event: any): void; | ||
keyHandler(event: any, nativeElement?: any, wasClick?: boolean): boolean; | ||
keyHandler(event: any, nativeElement?: any): boolean; | ||
showSearchList(nativeElement: any): void; | ||
} |
@@ -50,9 +50,10 @@ "use strict"; | ||
Mention.prototype.stopEvent = function (event) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
event.stopImmediatePropagation(); | ||
if (!event.wasClick) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
event.stopImmediatePropagation(); | ||
} | ||
}; | ||
Mention.prototype.keyHandler = function (event, nativeElement, wasClick) { | ||
Mention.prototype.keyHandler = function (event, nativeElement) { | ||
if (nativeElement === void 0) { nativeElement = this._element.nativeElement; } | ||
if (wasClick === void 0) { wasClick = false; } | ||
var val = mention_utils_1.getValue(nativeElement); | ||
@@ -75,3 +76,3 @@ var pos = mention_utils_2.getCaretPosition(nativeElement, this.iframe); | ||
} | ||
if (event.keyCode == 13 && wasClick && pos < this.startPos) { | ||
if (event.keyCode == 13 && event.wasClick && pos < this.startPos) { | ||
// put caret back in position prior to contenteditable menu click | ||
@@ -157,4 +158,4 @@ pos = this.startNode.length; | ||
nativeElement.focus(); | ||
var fakeKeydown = new KeyboardEvent('keydown', { "keyCode": KEY_ENTER }); | ||
_this.keyHandler(fakeKeydown, nativeElement, true); | ||
var fakeKeydown = { "keyCode": KEY_ENTER, "wasClick": true }; | ||
_this.keyHandler(fakeKeydown, nativeElement); | ||
}); | ||
@@ -161,0 +162,0 @@ }); |
{ | ||
"name": "ng2-mentions", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Angular 2 mentions for text fields.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
596
65205