quill do do do noce of text-change'

发布于 2025-02-11 19:34:20 字数 305 浏览 4 评论 0原文

this.editor.on('text-change', function (delta, oldDelta, source) {
...someCode 
if(some condition) {
const range  = this.editor.getSelection()}}

但是我可以看到这个错误无法读取未定义的属性(读取'getSelection')

this.editor等于 quill ,我可以使用它而不是quill,它在其他功能中起作用

this.editor.on('text-change', function (delta, oldDelta, source) {
...someCode 
if(some condition) {
const range  = this.editor.getSelection()}}

but i can see this error Cannot read properties of undefined (reading 'getSelection')

this.editor equals quill and i can use this instead of quill, it's worked in other function

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天气好吗我好吗 2025-02-18 19:34:20

这是因为范围,如果您提前声明变量并将编辑器放在那里,一切都很好

it was because of the scope, if you declare a variable in advance and put the editor there, everything is fine

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文