2

My objective is to create a button in toolbar that add style to the default <p> tag where the cursor is. For example:

From <p>Example</p> to <p style="color: white;">Example</p> without nested format?

Now, my workaround is using a new custom blots which did pretty much the same thing like

<p><custom style="color: white;">Example</custom><p>

I literately have no idea how to do that as I'm new to quill. I've been spent few days studying quill/parchment documents but not 100% understand how it work. Any help is appreciated!

sumet123
  • 21
  • 1

1 Answers1

0

see the 「ttypic」comment:

And this is my code:

const Block = Quill.import('blots/block');
class MyBlock extends Block {
  static create() {
    const node = super.create();
    // Next, customize other functions
    node.setAttribute('style', 'margin: 0;');
    return node;
  }
}