0

I want to add a security token in my image's src url. I created a custom block

const BlockEmbed = Quill.import('blots/block/embed');

class CustomImage extends BlockEmbed {
    static create(d) {
        node.dataset.url = d.url;
        // How to get the quill instance here? so that I can get some config object and call a method
        const uid = this.quill.config.getUid();
        node.setAttribute('src', d.url + uid);
        ...
    }
}

Is there any way to get the quill instance for which this create() method was called?

coure2011
  • 40,286
  • 83
  • 216
  • 349

1 Answers1

0

You mean something like this:

class RedCapBlot extends BlockEmbed { 
    static create(value) {
      var node = super.create(value);
      node.setAttribute('class', 'dropcap bg-danger-soft text-danger px-2 rounded');
      node.innerHTML = value;
      return node;
    }
  };