Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid emitting change events for void operations #4195

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

luin
Copy link
Member

@luin luin commented May 10, 2024

Closes #4190

The cause is that when deleteText() doesn't do anything (either length is 0 or index is after the end), change passed to Editor#update() would be a delta that contains a void retain (e.g. new Delta().retain(10)), which causes editor-change/text-change to be emitted with that delta.

This PR fixed the issue by always calling chop() when the provided change will be used.

@luin luin force-pushed the zh-empty-operation branch from 33c6771 to c09ba98 Compare May 10, 2024 04:20
@luin luin requested a review from jhchen May 10, 2024 04:23
@luin luin force-pushed the zh-empty-operation branch from c09ba98 to 0d48759 Compare May 13, 2024 05:14
@luin luin force-pushed the main branch 2 times, most recently from fb1018a to de1afe1 Compare May 13, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant