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

Gather informations on content replaced by insertReplacementText or trigger a deleteByReplacement event? #133

Open
Sharcoux opened this issue Feb 12, 2022 · 0 comments

Comments

@Sharcoux
Copy link

Sharcoux commented Feb 12, 2022

Hi,

From everything I read so far, there is no way to get any information about what exactly happened when insertReplacementText event is triggered. We can easily know the new content that was added, but we have absolutely no way of knowing what was removed and where...

There are 2 ways that could solve this:

1. Provide extra data in the event: It could be considered that a replacement operation without information about what was replaced is kind of incomplete, and we could consider that this information is missing in the event itself

2. Trigger a deleteByReplacement event: Every operation that removes data from the editor triggers its own delete event but the replacement operation. Why is that?

In my opinion, only by listening to the events, a program should be able to tell exactly what happened to the editor without comparing the previous and the new content. That is exactly the logic behind event based programming. So, unless I'm missing something, there is something wrong here...

We are building a React rich text editor, and we succeeded to map all the changes made to the contentEditable component through input events (except the changes involved by insertReplacementText), into a custom model of ours, which make us able to add many features to the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant