Fix autocomplete not resetting properly on message send (#10741)

This commit is contained in:
Michael Telatynski
2023-04-28 13:31:02 +00:00
committed by GitHub
parent 0d1020c66f
commit f819853cad
3 changed files with 49 additions and 13 deletions
+4 -4
View File
@@ -99,10 +99,10 @@ export default class EditorModel {
private insertPart(index: number, part: Part): void {
this._parts.splice(index, 0, part);
if (this.activePartIdx && this.activePartIdx >= index) {
if (this.activePartIdx !== null && this.activePartIdx >= index) {
++this.activePartIdx;
}
if (this.autoCompletePartIdx && this.autoCompletePartIdx >= index) {
if (this.autoCompletePartIdx !== null && this.autoCompletePartIdx >= index) {
++this.autoCompletePartIdx;
}
}
@@ -111,12 +111,12 @@ export default class EditorModel {
this._parts.splice(index, 1);
if (index === this.activePartIdx) {
this.activePartIdx = null;
} else if (this.activePartIdx && this.activePartIdx > index) {
} else if (this.activePartIdx !== null && this.activePartIdx > index) {
--this.activePartIdx;
}
if (index === this.autoCompletePartIdx) {
this.autoCompletePartIdx = null;
} else if (this.autoCompletePartIdx && this.autoCompletePartIdx > index) {
} else if (this.autoCompletePartIdx !== null && this.autoCompletePartIdx > index) {
--this.autoCompletePartIdx;
}
}