Prevent cursor state loss on empty nextValue (#7180)

This commit is contained in:
Mickael V
2026-02-19 12:53:05 +01:00
committed by GitHub
parent d35394c714
commit d060544da6

View File

@@ -172,7 +172,7 @@ class SingleLineEditor extends Component {
// TODO: temporary fix for keeping cursor state when auto save and new line insertion collide PR#7098
const nextValue = String(this.props.value ?? '');
const currentValue = this.editor.getValue();
if (this.editor.hasFocus?.() && currentValue !== nextValue) {
if (this.editor.hasFocus?.() && currentValue !== nextValue && nextValue !== '') {
this.cachedValue = currentValue;
} else {
const cursor = this.editor.getCursor();