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

Change event #90

Closed
redone80 opened this issue May 3, 2019 · 4 comments
Closed

Change event #90

redone80 opened this issue May 3, 2019 · 4 comments

Comments

@redone80
Copy link

redone80 commented May 3, 2019

Hi JiHong88,

Can you add onchange event for auto update content?
onKeyUp event only track when I type. But I click toolbar button it can not track.

@DeZZar
Copy link

DeZZar commented May 3, 2019

Hi @redone80 ,

Due to the nature of WYSIWIG implementations you are not dealing with form fields which natively have an onChange event that can be used to monitor for change. This is a content editable page division therefore the keyUp event (fired after content is updated) is currently the best way to watch for change. You would need to do something like fire the .getContents() function on the editor after each keyUp and compare it to the last saved contents to determine if change has occured - if you detect change then trigger the save event or any other event you want.

JiHong88 may have other advice to give.

DG

@JiHong88
Copy link
Owner

JiHong88 commented May 3, 2019

Hi @redone80 , @DeZZar is right.

Due to the nature of the "contenteditable" implementation, the "onchange" event does not occur.

Instead, will be able to implement the "onChange" event by detecting the history stack changes in the editor.

I will include it in the version to be updated today.

Thank you.

@redone80
Copy link
Author

redone80 commented May 3, 2019

Hi @JiHong88, @DeZZar.

Thank for updating.
I think onChange event is important. Sometimes we just only use mouse. So onKeyUp event does not fire.

@redone80 redone80 closed this as completed May 3, 2019
@JiHong88
Copy link
Owner

JiHong88 commented May 3, 2019

Hi @redone80 ,

Yes, the onChange event is also important.

Added in v2.14.0.

Thank you : )

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

3 participants