We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
onChange
1 parent b07d08d commit 6e511faCopy full SHA for 6e511fa
src/lib/components/modes/textmode/TextMode.svelte
@@ -765,7 +765,13 @@
765
766
updateCanUndoRedo()
767
emitOnChange(content, previousContent)
768
- emitOnSelect()
+
769
+ // We emit OnSelect on the next tick to cater for the case where
770
+ // the user changes the content directly inside the OnChange callback.
771
+ // This change will be dispatched by Svelte on the next tick. Before
772
+ // that tick, emitOnSelect would be fired based on the "old" contents,
773
+ // which may be out of range when the replacement by the user is shorter.
774
+ tick().then(emitOnSelect)
775
}
776
777
function updateLinter(validator: Validator | null) {
0 commit comments