Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-android-ime-delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate-react': patch
---

fix: Fix Android IME delete not triggering onChange correctly. Previously, the first delete would not trigger onChange, and the second delete would trigger it twice.
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,12 @@

const userMarks = EDITOR_TO_USER_MARKS.get(editor)
EDITOR_TO_USER_MARKS.delete(editor)
if (userMarks !== undefined) {
if (userMarks !== undefined && userMarks !== editor.marks) {
editor.marks = userMarks
editor.onChange()
} else if (userMarks !== undefined) {
editor.marks = userMarks
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think removing this might have been unintentional?


const handleCompositionEnd = (
_event: React.CompositionEvent<HTMLDivElement>
Expand Down Expand Up @@ -301,20 +302,23 @@
}

updatePlaceholderVisibility()
scheduleFlush()
return
}

const merged = mergeStringDiffs(target.text, pendingDiffs[idx].diff, diff)
if (!merged) {
pendingDiffs.splice(idx, 1)
updatePlaceholderVisibility()
scheduleFlush()
return
}

pendingDiffs[idx] = {
...pendingDiffs[idx],
diff: merged,
}
scheduleFlush()
}

const scheduleAction = (
Expand Down Expand Up @@ -825,3 +829,3 @@
handleInput,
}
}
Loading