I want to add a uniq id
to each p block
of quill editor.
I have tried this piece of code but it only adds the same id
to each p block
.
const BlockBlot = Quill.import('blots/block');
class CustomBlockBlot extends BlockBlot {
static create(value) {
const node = super.create(value);
node.setAttribute('id', Math.random());
return node;
}
}
Quill.register('formats/block', CustomBlockBlot);
const quill = new Quill('#surface-render', {
theme: 'snow',
modules: {
toolbar: toolbarOptions
}
});
How would you do this?