mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-06-24 20:00:02 +02:00
fix: Remove 1ms delay before inserting list prefix, fix race condition in tests (#8207)
Fixed the race condition that made the existing E2E tests fail. There was a 1ms delay between inserting a newline and the line prefix to facilitate creation of two "undo" entries (so "ctrl+z" basically undoes the list continuation, but not the newline). Thus scripted text changes may have happened out of order. This only ever reliably worked in Firefox and seems to still work there even without a timeout. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8207 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Danko Aleksejevs <danko@very.lv> Co-committed-by: Danko Aleksejevs <danko@very.lv>
This commit is contained in:
parent
321561d315
commit
ae00a1d61b
1 changed files with 1 additions and 3 deletions
|
@ -587,9 +587,7 @@ class ComboMarkdownEditor {
|
|||
// Split the newline and prefix addition in two, so that it's two separate undo entries in Firefox
|
||||
// Chrome seems to bundle everything together more aggressively, even with prior text input.
|
||||
if (document.execCommand('insertText', false, '\n')) {
|
||||
setTimeout(() => {
|
||||
document.execCommand('insertText', false, text);
|
||||
}, 1);
|
||||
} else {
|
||||
this.textarea.setRangeText(`\n${text}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue