0
votes

I have implemented quill editor in Angular by creating new instance of quill and creating custom toolbar.

    this.quill = new Quill('#editor-container', {
        modules: {
            toolbar: '#toolbar-container'
        },
        theme: 'snow' // or 'bubble'
    });

I have a "update" button which would call the update API. I need to check if the contents of the Quill editor has changed. I am aware of quill.on('text-change'):

    this.quill.on('text-change', function(delta, oldDelta, source) {
        if (source == 'api') {
            console.log('An API call triggered this change.');
        } else if (source == 'user') {
            console.log('A user action triggered this change.');
        }
    });

However, I am not sure where do I place this? NgOnInit? NgAfterViewInit? I have created the quill instance in ngAfterViewInit. I know this could be a dumb question.

Any help appreciated! thanks! :)

1

1 Answers

-1
votes

You can put it in the constructor of the module/component.