I create a custom dropdown menu in quill. I use Parchment
var Parchment = Quill.import('parchment');
var lineHeightConfig = {
scope: Parchment.Scope.INLINE,
whitelist: [
'1.0',
'5.0',
'10.0'
]
};
var lineHeightClass = new Parchment.Attributor.Class('lineheight', 'ql-line-height', lineHeightConfig);
var lineHeightStyle = new Parchment.Attributor.Style('lineheight', 'line-height', lineHeightConfig);
Parchment.register(lineHeightClass);
Parchment.register(lineHeightStyle);
I defined my editor in the view:
<quill-editor #editor >
<div quill-editor-toolbar>
<!-- Basic buttons -->
<span class="ql-formats">
<button class="ql-bold" [title]="'Bold'"></button>
<button class="ql-italic" [title]="'Italic'"></button>
<button class="ql-underline" [title]="'Underline'"></button>
</span>
<span class="ql-formats">
<select class="ql-lineheight" [title]="'Line Height'">
<option selected></option>
<option value="1.0"></option>
<option value="5.0"></option>
<option value="10.0"></option>
</select>
</span>
</div>
</quill-editor>
And I add some css definition:
.ql-snow .ql-picker.ql-lineheight{
width: 58px;
}
.ql-snow .ql-picker.ql-lineheight .ql-picker-item[data-value="1.0"]::before {content: "1.0";}
.ql-snow .ql-picker.ql-lineheight .ql-picker-label[data-value='1.0']::before {content: '1.0' !important;}
.ql-snow .ql-picker.ql-lineheight .ql-picker-item[data-value='5.0']::before {content: '5.0';}
.ql-snow .ql-picker.ql-lineheight .ql-picker-label[data-value='5.0']::before {content: '5.0' !important;}
.ql-snow .ql-picker.ql-lineheight .ql-picker-item[data-value='10.0']::before {content: '10.0';}
.ql-snow .ql-picker.ql-lineheight .ql-picker-label[data-value='10.0']::before {content: '10.0' !important;}
The new dropdown is displayed and working, but the labels are still empty.
Here a stackblitz