Froala 3.1.1 + Angular 9 个插件未加载

Froala 3.1.1 + Angular 9 Plugins not Loading

根据在 (https://github.com/froala/angular-froala-wysiwyg) 找到的文档,安装过程很简单,基本编辑器运行良好。

不幸的是,none 的插件已加载或正在运行。

据我所知,需要将以下导入添加到 app.module.ts 并且应该导入所有可用的插件。

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

我还可以看到默认的 toolbarButtons 选项在更改时受到尊重,但是 "moreRich" 选项中的 none 显示在编辑器中。

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
        }

如果您有 Froala 3.1.1 + Angular 9 使用插件(例如 table、insertImage),请分享您的见解。

谢谢。

似乎是组件的问题。我找到了解决方法:

导入组件文件即可:

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";

您可以像往常一样激活插件:

...
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"
    ],
...

使用 ^3.1.0 版本解决了问题:

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

https://github.com/froala/angular-froala-wysiwyg/issues/399#issuecomment-641843910

现在尽量避免使用 ^ 符号,因为它指的是最新版本(3.1.1-1 与 3.1.1-2)。确保您使用相同版本的编辑器和 angular 包装器:

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

3.1.1 和 3.1.0 之间的区别 - 全屏命令错误和损坏的 html 字体大小和字体系列的输出已在 v3.1.1 中修复。干杯