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

如何实现监听内容变化? #961

Open
hejun-lyne opened this issue Jan 5, 2022 · 2 comments
Open

如何实现监听内容变化? #961

hejun-lyne opened this issue Jan 5, 2022 · 2 comments

Comments

@hejun-lyne
Copy link

  1. onChange回调太频繁了,而且包括了focus, blur, selection这些情况;
  2. 如果直接根据toHTML()判断内容也不行(特别是内容有base64图片的情况);

诉求:

  1. 能不能加一个类似onContentChange的回调;
  2. 能不能在onChange回调里面增加参数判断是什么原因导致的onChange;

感谢~

@margox
Copy link
Owner

margox commented Jan 7, 2022

可以试试通过DOM事件的方式监听一下input\keyup\pastes等这些事件,因为基本上内容变化都是通过按键操作来触发的,然后在给原来的onChange加一个节流来做补充

@hejun-lyne
Copy link
Author

感谢答复~
感觉额外实现监听所有事件去重组内容变化太重了,很容易出错~

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

2 participants