1

我已经使用 Webpack 成功安装和配置了 Froala 所见即所得编辑器。但我正在努力启用Wiris MathType 插件。到目前为止,我已经安装了 Wiris:

yarn add @wiris/mathtype-froala

并尝试在我的脚本中要求它,该脚本也需要和配置 Froala:

import $ from 'jquery';
global.jQuery = $;

// Require Editor JS files.
import FroalaEditor from 'froala-editor/js/froala_editor.pkgd.min.js';

// Require Editor CSS files.
import 'froala-editor/css/froala_style.min.css';
import 'froala-editor/css/froala_editor.pkgd.min.css';

// Require Font Awesome.
import 'font-awesome/css/font-awesome.css';

// Require Wiris plugin
import WirisPlugin from '@wiris/mathtype-froala';
import '@wiris/mathtype-froala/core/styles.css';

$(document).ready(function() {
    $("texarea#froala-editor").froalaEditor({
        ...
        iframe: true,
        pluginsEnabled: ["wirisEditor", ....],
        toolbarButtons: ['undo', 'redo' , 'bold', '|', 'wirisEditor','clear', 'insert'],
        imageEditButtons: ['wirisEditor', 'imageDisplay', 'imageAlign', 'imageInfo', 'imageRemove'],
        htmlAllowedTags:  ['.*'],
        htmlAllowedAttrs: ['.*']
    });
});

但之后我在 Chrome 控制台中收到以下错误:

wiris.js:3 Uncaught TypeError: Cannot read property 'editorObject' of null
at s.e.FroalaEditor.COMMANDS.wirisEditor.refresh (wiris.js:3)
at Object.refresh (froala_editor.pkgd.min.js:7)
at froala_editor.pkgd.min.js:7

Firefox 显示另一个错误,但可能是由同一件事引起的。

TypeError: WirisPlugin.currentInstance is null wiris.js:3:5219 

我发现我做错了什么,但我还不能确定那可能是什么。

任何建议都将受到欢迎。

4

0 回答 0