Commit 07be4a19 authored by Tom Hudson's avatar Tom Hudson
Browse files

Revert of CHanged to add triggering KeyCode.

parent b0bc4246
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ The following optional configuration items can be used.
| Option             | Default  | Description |
| ---                | ---      | ---         |
| triggerChar        | @        | The character that will trigger the menu behavior. |
| triggerCharKeyCode |          | The key code that can trigger the menu behavior - use [keycode.info](http://keycode.info/) to help you find the correct key code |
| maxItems           |          | Limit the number of items shown in the pop-up menu. The default is no limit. |
| mentionSelect      |          | An optional function to format the selected item before inserting the text. |
| labelKey           | label    | The field to be used as the item label (when the items are objects). |
+1 −5
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ export class MentionDirective implements OnInit, OnChanges {

  @Input() set mentionConfig(config:any) {
    this.triggerChar = config.triggerChar || this.triggerChar;
    this.triggerCharKeyCode = config.triggerCharKeyCode;
    this.labelKey = config.labelKey || this.labelKey;
    this.disableSearch = config.disableSearch || this.disableSearch;
    this.maxItems = config.maxItems || this.maxItems;
@@ -53,9 +52,6 @@ export class MentionDirective implements OnInit, OnChanges {
  // the character that will trigger the menu behavior
  private triggerChar: string = "@";

  // the character keycode which can also trigger the menu behavior
  private triggerCharKeyCode: string;

  // option to specify the field in the objects to be used as the item label
  private labelKey:string = 'label';

@@ -155,7 +151,7 @@ export class MentionDirective implements OnInit, OnChanges {
      setCaretPosition(this.startNode, pos, this.iframe);
    }
    //console.log("keyHandler", this.startPos, pos, val, charPressed, event);
    if ((!this.triggerCharKeyCode && charPressed == this.triggerChar) || charPressedKeyCode == this.triggerCharKeyCode) {
    if (charPressed == this.triggerChar) {
      this.startPos = pos;
      this.startNode = (this.iframe ? this.iframe.contentWindow.getSelection() : window.getSelection()).anchorNode;
      this.stopSearch = false;