From 713205e0ab11f05eabffaae71face5d130ccb5b3 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 27 Aug 2019 16:10:11 +0200 Subject: [PATCH] close autocomplete when removing auto-completed part --- src/editor/model.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/editor/model.js b/src/editor/model.js index 9d129afa69..7f87bdea23 100644 --- a/src/editor/model.js +++ b/src/editor/model.js @@ -90,10 +90,14 @@ export default class EditorModel { _removePart(index) { this._parts.splice(index, 1); - if (this._activePartIdx >= index) { + if (index === this._activePartIdx) { + this._activePartIdx = null; + } else if (this._activePartIdx > index) { --this._activePartIdx; } - if (this._autoCompletePartIdx >= index) { + if (index === this._autoCompletePartIdx) { + this._autoCompletePartIdx = null; + } else if (this._autoCompletePartIdx > index) { --this._autoCompletePartIdx; } }