From 47421608d959e8acb9d6963bf9691affa36b12ef Mon Sep 17 00:00:00 2001 From: Jordan Humphreys Date: Fri, 1 Jul 2016 08:43:56 -0700 Subject: [PATCH] Disable Tribute on delete. (#14) --- dist/tribute.js | 7 ++++++- js/tribute.js | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dist/tribute.js b/dist/tribute.js index c36e1bfb..a705c543 100644 --- a/dist/tribute.js +++ b/dist/tribute.js @@ -528,6 +528,11 @@ if (!Array.prototype.find) { _this6.setActiveLi(); } } + }, + delete: function _delete(e, el) { + if (_this6.tribute.isActive && _this6.tribute.current.mentionText.length < 1) { + _this6.tribute.hideMenu(); + } } }; } @@ -549,7 +554,7 @@ if (!Array.prototype.find) { }], [{ key: 'keys', value: function keys() { - return [{ key: 9, value: 'TAB' }, { key: 13, value: 'ENTER' }, { key: 27, value: 'ESCAPE' }, { key: 38, value: 'UP' }, { key: 40, value: 'DOWN' }]; + return [{ key: 9, value: 'TAB' }, { key: 8, value: 'DELETE' }, { key: 13, value: 'ENTER' }, { key: 27, value: 'ESCAPE' }, { key: 38, value: 'UP' }, { key: 40, value: 'DOWN' }]; } }]); diff --git a/js/tribute.js b/js/tribute.js index a589ff19..3bde825b 100644 --- a/js/tribute.js +++ b/js/tribute.js @@ -281,6 +281,7 @@ if (!Array.prototype.find) { static keys() { return [ {key: 9, value: 'TAB'}, + {key: 8, value: 'DELETE'}, {key: 13, value: 'ENTER'}, {key: 27, value: 'ESCAPE'}, {key: 38, value: 'UP'}, @@ -460,6 +461,11 @@ if (!Array.prototype.find) { this.setActiveLi() } } + }, + delete: (e, el) => { + if (this.tribute.isActive && this.tribute.current.mentionText.length < 1) { + this.tribute.hideMenu(); + } } } }