1

I'm using PrimeNG’s p-editor component to create a rich text editor in my Angular app. So far, it works well with the default toolbar. Here's a simple example of how I use it:

<div class="card">
    <p-editor [(ngModel)]="text" [style]="{ height: '320px' }">
        <ng-template #header>
            <span class="ql-formats">
                <button type="button" class="ql-bold" aria-label="Bold"></button>
                <button type="button" class="ql-italic" aria-label="Italic"></button>
                <button type="button" class="ql-underline" aria-label="Underline"></button>
            </span>
        </ng-template>
    </p-editor>
</div>

Now, I want to customize the toolbar by adding a custom dropdown .

since PrimeNG’s p-editor already creates and manages its own Quill instance internally, I cannot create another instance myself this may leads to conflicts or unexpected behavior.

While researching, I found examples that create a new Quill instance manually and add custom modules or formats via Quill’s API, like this:

const quill = new Quill('#editor', {
modules: {
toolbar: {
container: [ ... ],
handlers: { ... }
     }
   }
 });

I found some resources like : github issue and JSFiddle

However, since PrimeNG’s p-editor already creates and manages its own Quill instance internally, I cannot create another instance myself this leads to conflicts or unexpected behavior.

My question is: What is the recommended way to add custom toolbar elements (like a select dropdown with special options) to PrimeNG’s p-editor without manually creating a new Quill instance?

Should I refactor and abandon p-editor to create and manage Quill myself for full control?

Or is there a way to extend/customize the toolbar and Quill instance via p-editor APIs to add custom formats, handlers, or dropdowns?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.