mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Update maybeContinueList
to avoid replacing the entire post (#29416)
Using execCommand to replace the entire contents of the textarea is very slow for larger posts (it seems the browser does a reflow after every 'virtual keypress').
This commit updates the `maybeContinueList()` function to be more surgical when removing the bullet. Now it only selects & removes the characters which actually need to be deleted
Similar to a7cd220704
This commit is contained in:
parent
5b7df76248
commit
3076b6e8d2
@ -619,11 +619,7 @@ export default class TextareaTextManipulation {
|
||||
} else {
|
||||
// Clear the new autocompleted list item if there is no other text.
|
||||
const offsetWithoutPrefix = offset - `\n${listPrefix}`.length;
|
||||
this.replaceText(
|
||||
text,
|
||||
text.substring(0, offsetWithoutPrefix) + text.substring(offset),
|
||||
{ skipNewSelection: true }
|
||||
);
|
||||
this._insertAt(offsetWithoutPrefix, offset, "");
|
||||
this.selectText(offsetWithoutPrefix, 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user