ngx-quill: Handlers for Toolbar in Different Container

471 Views Asked by At

I'm trying to create a custom toolbar using ngx-quill in a different container, but while the toolbar looks right, I'm not sure how to make the buttons maintain default functionality.

This is the editor:

 <quill-editor 
[(ngModel)]="test" 
[readOnly]="false" 
[format]="'object'" 
[modules]="{'toolbar': '#toolbar'}"
></quill-editor>

The toolbar (for now, I'm just trying one feature to start):

<div id="toolbar" class="ql-toolbar">
    <button class="ql-bold">Bold</button>
</div>

The toolbar seems to have only one-way databinding. When I click the button, nothing happens, but if I type ctrl+b, the button will light up. I want the button to call the same callback function the bold button does when it's connected to the editor, but I'm not sure how to set that up. I was able to setup a dummy callback function by adding a handler to the declaration on quill-editor, but I'd rather avoid rewriting the function for each option I add to the toolbar.

0

There are 0 best solutions below