mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
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:
parent
6832c7b7e7
commit
e25578d702
|
@ -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 (
|
||||
|
|
Loading…
Reference in New Issue
Block a user