Froala 3.1.1 + Angular 9 Plugins not Loading

Viewed 1820

According to the documentation found at (https://github.com/froala/angular-froala-wysiwyg) the installation process is straight forward and the basic editor works well.

Unfortunately none of the plugins are loaded or working.

From what I can see the following import needs to be added to app.module.ts and should import all available plugins.

// Import all Froala Editor plugins.
import 'froala-editor/js/plugins.pkgd.min.js';

I can also see the default toolbarButtons option is honoured when changing it, however none of the "moreRich" options show up in the editor.

toolbarButtons: {
        'moreText': {
          'buttons': ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize', 'textColor', 'backgroundColor', 'inlineClass', 'inlineStyle', 'clearFormatting']
        },
        'moreParagraph': {
          'buttons': ['alignLeft', 'alignCenter', 'formatOLSimple', 'alignRight', 'alignJustify', 'formatOL', 'formatUL', 'paragraphFormat', 'paragraphStyle', 'lineHeight', 'outdent', 'indent', 'quote']
        },
        'moreRich': {
          'buttons': ['insertLink', 'insertImage', 'insertVideo', 'insertTable', 'emoticons', 'fontAwesome', 'specialCharacters', 'embedly', 'insertFile', 'insertHR']
        },
        'moreMisc': {
          'buttons': ['undo', 'redo', 'fullscreen', 'print', 'getPDF', 'spellChecker', 'selectAll', 'html', 'help'],
          'align': 'right',
          'buttonsVisible': 2
        }

If you have Froala 3.1.1 + Angular 9 working with plugins (e.g. table, insertImage) please do share your insights.

Thank you.

3 Answers

Seems like an issue of the component. I found a workaround:

Just import into the component file:

import "froala-editor/js/plugins/align.min.js";
import "froala-editor/js/plugins/char_counter.min.js";
import "froala-editor/js/plugins/code_beautifier.min.js";
import "froala-editor/js/plugins/code_view.min.js";
import "froala-editor/js/plugins/draggable.min.js";
import "froala-editor/js/plugins/emoticons.min.js";
import "froala-editor/js/plugins/file.min.js";
import "froala-editor/js/plugins/font_size.min.js";
import "froala-editor/js/plugins/fullscreen.min.js";
import "froala-editor/js/plugins/image.min.js";
import "froala-editor/js/plugins/image_manager.min.js";
import "froala-editor/js/third_party/image_tui.min.js";
import "froala-editor/js/plugins/inline_class.min.js";
import "froala-editor/js/plugins/line_breaker.min.js";
import "froala-editor/js/plugins/link.min.js";
import "froala-editor/js/plugins/lists.min.js";
import "froala-editor/js/plugins/paragraph_style.min.js";
import "froala-editor/js/plugins/paragraph_format.min.js"
import "froala-editor/js/plugins/print.min.js";
import "froala-editor/js/plugins/quick_insert.min.js";
import "froala-editor/js/plugins/quote.min.js";
import "froala-editor/js/plugins/table.min.js";
import "froala-editor/js/plugins/url.min.js";
import "froala-editor/js/plugins/video.min.js";
import "froala-editor/js/plugins/word_paste.min.js";
import "src/assets/js/html2pdf.bundle.min.js";

and you can activate plugins as usual:

...
froalaOptions = {
    heightMin: this.minWinHeight,
    charCounterMax: 1000000,
    dragInline: false,
    listAdvancedTypes: true,
    pastePlain: true,
    placeholderText: 'Write something, anything...',
    videoResponsive: true,
    events: {},

    pluginsEnabled: [
      "align", "charCounter", "codeBeautifier", "codeView", "draggable", "emoticons", "file",   "fontSize", 
      "fullscreen", "image", "imageTUI", "imageManager", "inlineClass", "lineBreaker", "link", "lists", 
      "paragraphStyle", "quickInsert", "quote", "table", "url", "video", "wordPaste", 
      "paragraphFormat"
    ],
...

Try to avoid ^ notation for now as it refers to the latest version (3.1.1-1 vs 3.1.1-2). Make sure you use the same version of the editor and the angular wrapper:

"angular-froala-wysiwyg": "^3.1.1",
"froala-editor": "^3.1.1"

Difference between 3.1.1 and 3.1.0 - fullscreen command error and broken html output for font-size and the font-family was fixed in v3.1.1. Cheers

Related