Loading README.md +1 −0 Original line number Original line Diff line number Diff line Loading @@ -64,6 +64,7 @@ The following optional configuration items can be used. | dropUp | false | Show the menu above the cursor instead of below. | | dropUp | false | Show the menu above the cursor instead of below. | | maxItems | ∞ | Limit the number of items shown in the text. The default is no limit. | | maxItems | ∞ | Limit the number of items shown in the text. The default is no limit. | | mentionSelect | | An optional function to format the selected item before inserting the text. | | mentionSelect | | An optional function to format the selected item before inserting the text. | | allowSpace | false | An optional paremeter which decides whether to allow space while mentioning or not | For Example: For Example: Loading projects/angular-mentions/README.md +1 −0 Original line number Original line Diff line number Diff line Loading @@ -64,6 +64,7 @@ The following optional configuration items can be used. | dropUp | false | Show the menu above the cursor instead of below. | | dropUp | false | Show the menu above the cursor instead of below. | | maxItems | ∞ | Limit the number of items shown in the text. The default is no limit. | | maxItems | ∞ | Limit the number of items shown in the text. The default is no limit. | | mentionSelect | | An optional function to format the selected item before inserting the text. | | mentionSelect | | An optional function to format the selected item before inserting the text. | | allowSpace | false | An optional paremeter which decides whether to allow space while mentioning or not | For Example: For Example: Loading projects/angular-mentions/src/lib/mention-config.ts +3 −0 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,9 @@ export interface Mentions { // display menu above text instead of below // display menu above text instead of below dropUp?:boolean; dropUp?:boolean; // whether to allow space while mentioning or not allowSpace?: boolean; // optional function to format the selected item before inserting the text // optional function to format the selected item before inserting the text mentionSelect?:(item: any) => (string); mentionSelect?:(item: any) => (string); } } No newline at end of file projects/angular-mentions/src/lib/mention.directive.ts +2 −1 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,7 @@ export class MentionDirective implements OnChanges { triggerChar: '@', triggerChar: '@', labelKey: 'label', labelKey: 'label', maxItems: -1, maxItems: -1, allowSpace: false, mentionSelect: (item: any) => this.activeConfig.triggerChar + item[this.activeConfig.labelKey] mentionSelect: (item: any) => this.activeConfig.triggerChar + item[this.activeConfig.labelKey] } } Loading Loading @@ -209,7 +210,7 @@ export class MentionDirective implements OnChanges { !event.ctrlKey && !event.ctrlKey && pos > this.startPos pos > this.startPos ) { ) { if (event.keyCode === KEY_SPACE) { if (!this.activeConfig.allowSpace && event.keyCode === KEY_SPACE) { this.startPos = -1; this.startPos = -1; } } else if (event.keyCode === KEY_BACKSPACE && pos > 0) { else if (event.keyCode === KEY_BACKSPACE && pos > 0) { Loading Loading
README.md +1 −0 Original line number Original line Diff line number Diff line Loading @@ -64,6 +64,7 @@ The following optional configuration items can be used. | dropUp | false | Show the menu above the cursor instead of below. | | dropUp | false | Show the menu above the cursor instead of below. | | maxItems | ∞ | Limit the number of items shown in the text. The default is no limit. | | maxItems | ∞ | Limit the number of items shown in the text. The default is no limit. | | mentionSelect | | An optional function to format the selected item before inserting the text. | | mentionSelect | | An optional function to format the selected item before inserting the text. | | allowSpace | false | An optional paremeter which decides whether to allow space while mentioning or not | For Example: For Example: Loading
projects/angular-mentions/README.md +1 −0 Original line number Original line Diff line number Diff line Loading @@ -64,6 +64,7 @@ The following optional configuration items can be used. | dropUp | false | Show the menu above the cursor instead of below. | | dropUp | false | Show the menu above the cursor instead of below. | | maxItems | ∞ | Limit the number of items shown in the text. The default is no limit. | | maxItems | ∞ | Limit the number of items shown in the text. The default is no limit. | | mentionSelect | | An optional function to format the selected item before inserting the text. | | mentionSelect | | An optional function to format the selected item before inserting the text. | | allowSpace | false | An optional paremeter which decides whether to allow space while mentioning or not | For Example: For Example: Loading
projects/angular-mentions/src/lib/mention-config.ts +3 −0 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,9 @@ export interface Mentions { // display menu above text instead of below // display menu above text instead of below dropUp?:boolean; dropUp?:boolean; // whether to allow space while mentioning or not allowSpace?: boolean; // optional function to format the selected item before inserting the text // optional function to format the selected item before inserting the text mentionSelect?:(item: any) => (string); mentionSelect?:(item: any) => (string); } } No newline at end of file
projects/angular-mentions/src/lib/mention.directive.ts +2 −1 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,7 @@ export class MentionDirective implements OnChanges { triggerChar: '@', triggerChar: '@', labelKey: 'label', labelKey: 'label', maxItems: -1, maxItems: -1, allowSpace: false, mentionSelect: (item: any) => this.activeConfig.triggerChar + item[this.activeConfig.labelKey] mentionSelect: (item: any) => this.activeConfig.triggerChar + item[this.activeConfig.labelKey] } } Loading Loading @@ -209,7 +210,7 @@ export class MentionDirective implements OnChanges { !event.ctrlKey && !event.ctrlKey && pos > this.startPos pos > this.startPos ) { ) { if (event.keyCode === KEY_SPACE) { if (!this.activeConfig.allowSpace && event.keyCode === KEY_SPACE) { this.startPos = -1; this.startPos = -1; } } else if (event.keyCode === KEY_BACKSPACE && pos > 0) { else if (event.keyCode === KEY_BACKSPACE && pos > 0) { Loading