kolkov / angular-editor

A simple native WYSIWYG editor component for Angular 6 -14+
https://angular-editor.kolkov.ru
MIT License
678 stars 360 forks source link

Can't change font Angualar 14 #499

Open ClaudiuHuludet opened 1 year ago

ClaudiuHuludet commented 1 year ago

We've encountered the same issue as a few other people, can't change font. We tried several solutions found on other issues opened, but nothing worked for us. It look like everything else works just fine, only the font is not working.

This are our configurations:

editorConfig: AngularEditorConfig = {

    editable: true,
    spellcheck: true,
    minHeight: '0',
    maxHeight: 'auto',
    width: 'auto',
    minWidth: '0',
    translate: 'no',
    defaultParagraphSeparator: 'p',
    enableToolbar: true,
    showToolbar: true,
    uploadWithCredentials: false,
    sanitize: false,
    toolbarPosition: 'top',
    defaultFontName: 'Arial'
}

package.json: "@angular/core": "^14.0.2", "@kolkov/angular-editor": "^2.0.0", "typescript": "^4.7.4", "zone.js": "~0.11.4"

angular.json: "assets": [ "src/favicon.ico", "src/assets", "src/config", "src/config/config.dev.json", "src/config/config.prod.json", { "glob": "*/", "input": "./node_modules/@kolkov/angular-editor/assets/", "output": "./assets/fonts/" }, { "glob": "*/", "input": "node_modules/ngx-monaco-editor/assets/monaco", "output": "/assets/monaco/" } ]

Please help, we stucked!!

litsoni004 commented 1 year ago

any update on this one?

xblader commented 1 year ago

Same problem here. I am using Angular 15.

angiefrancop commented 1 year ago

the library doesn't work in angular 15

srikarthikjoy commented 1 year ago

Hi, I've found a solution for using a custom template to recreate the font selection box and hide the existing font selection box that wasn't functioning correctly.

To hide the existing font editorConfig: AngularEditorConfig = { toolbarHiddenButtons: [ [ 'fontName' ]]}

Add the custom font selection box `<angular-editor autofocus="true" [(ngModel)]="mailText" [config]="editorConfig"> <ng-template #customButtons let-executeCommandFn="executeCommandFn">

{{list.name}}
                    </ng-template>
                </angular-editor>`

It accepts commands from execCommand.

In ts file add this variable fontFamilyName: any = this.editorConfig.defaultFontName;