Как включить плагин Wiris в редакторе Froala с помощью Webpack?
Я успешно установил и настроил Froala WYSIWYG Editor с помощью Webpack. Но я изо всех сил пытаюсь включить плагин 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
Я понимаю, что делаю что-то не так, но пока не смог определить, что это может быть.
Любые предложения будут приветствоваться.