FIX: when replacing text in composer maintain history (#28537)

Replacing value in the composer will not maintain history, this migrates
us to the new pattern used throughout this file
This commit is contained in:
Sam 2024-08-26 14:25:31 +10:00 committed by GitHub
parent 6832c7b7e7
commit e25578d702
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -152,10 +152,11 @@ export default Mixin.create({
i++;
return i === opts.index ? newVal : match;
});
this.set("value", newValue);
this._insertAt(0, val.length, newValue);
} else {
// Replace value (side effect: cursor at the end).
this.set("value", val.replace(oldVal, newVal));
const replacedValue = val.replace(oldVal, newVal);
this._insertAt(0, val.length, replacedValue);
}
if (