I am trying to customize my PrimeNG Editor
I'm having adding a select dropdown list with custom font sizes [12px, 14px, 16px...]
Here is the component HTML
<p-editor [(ngModel)]="value" (onTextChange)="onTextChanged($event)">
<p-header>
<span class="ql-formats">
...
<select class="ql-size">
<option value="12px">12</option>
<option value="14px">14</option>
<option value="16px">16</option>
</select>
</span>
...
</p-header>
</p-editor>
I can get the select list to show with all the font sizes
I'm not sure how to add the functionality to change the font size when selecting an option in the list. I don't see any examples in their docs for typescript. How can I make a select list of custom font sizes?
Here are the docs I followed
example
Firstly,put your component.ts
import { Editor } from 'primeng/editor';
declare var Quill: any;
and add this line in constructor
var fontSizeStyle = Quill.import('attributors/style/size');
fontSizeStyle.whitelist = ['24px', '48px', '100px', '200px'];
Quill.register(fontSizeStyle, true);
At the last,change your html
<span class="ql-formats">
<select class="ql-size">
<option value="24px">24</option>
<option value="48px">48</option>
<option value="100px">100</option>
<option value="200px">200</option>
</select>
</span>
Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With