@ -8,7 +8,8 @@ import {FormControl} from "@angular/forms";
< div class = "editor-wrapper" [ class ] = " wrapperClasses " [ formGroup ] = " parentFormGroup " >
< angular - editor class = "full-width editor" [ ngClass ] = " editable ? ' ' : ' disabled ' " [ id ] = " id "
[ config ] = "editorConfig" [ formControlName ] = "controlName"
placeholder = "{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}" > < / a n g u l a r - e d i t o r >
placeholder = "{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}"
( paste ) = "pasteWithoutFormatting($event)" > < / a n g u l a r - e d i t o r >
< mat - icon * ngIf = "formInput.value" ( click ) = " formInput.patchValue ( ' ' ) " class = "clear" > close < / m a t - i c o n >
< / div >
` ,
@ -40,6 +41,14 @@ export class RichTextEditorComponent {
defaultFontSize : '' ,
sanitize : true ,
toolbarPosition : 'top' ,
customClasses : [
{ name : 'H1 header' , class : '' , tag : 'h1' } ,
{ name : 'H2 header' , class : '' , tag : 'h2' } ,
{ name : 'H3 header' , class : '' , tag : 'h3' } ,
{ name : 'H4 header' , class : '' , tag : 'h4' } ,
{ name : 'H5 header' , class : '' , tag : 'h5' } ,
{ name : 'H6 header' , class : '' , tag : 'h6' }
] ,
toolbarHiddenButtons : [
[
'heading' ,
@ -48,10 +57,10 @@ export class RichTextEditorComponent {
[
'fontSize' ,
'backgroundColor' ,
'customClasses' ,
// 'customClasses',
'insertImage' ,
'insertVideo' ,
'removeFormat' ,
// 'removeFormat',
'toggleEditorMode'
]
]
@ -64,4 +73,10 @@ export class RichTextEditorComponent {
ngAfterContentInit() {
this . editorConfig . editable = this . editable ;
}
pasteWithoutFormatting ( $event ) {
$event . preventDefault ( ) ;
const text = $event . clipboardData . getData ( "text/plain" ) ;
window . document . execCommand ( "insertText" , false , text ) ;
}
}