Quill: Which method called when blot changed?

401 Views Asked by At

I need to do something when text, wrapped with my own blot, changed.

From parchment documentation i got that method update will called when blot changes. I try to use it in code, but this method does't called when text, wrapped with my blot, changes.

May be I use this method incorrect? Or I should use another method?

1

There are 1 best solutions below

1
On

You should use text-change event:

this.quill.on('text-change', (range, oldRange, source) => {

 // Returns the leaf Blot at the specified index within the document
 let [leaf, offset] = this.quill.getLeaf(range.index); // Experimental API

  if(leaf.domNode.nodeName === 'yourBlotTag') {
    //Do something
  }

}