我正在尝试在 React 组件中使用 Wiris 数学编辑器。我正在“componentDidMount”函数中初始化编辑器:
componentDidMount() {
var script = document.createElement("script");
script.src = "https://www.wiris.net/demo/editor/editor";
var callback = function() {
var editor = com.wiris.jsEditor.JsEditor.newInstance({
language: "en"
});
editor.insertInto(document.getElementById("editorContainer"));
};
script.onload = callback;
document.head.appendChild(script);
}
但是,当编辑器被渲染时,会出现许多符号丢失的问题。见下文:
我不确定是什么导致了这个问题。是因为我引用外部脚本的方式,还是 React 呈现内容的方式有问题?
我在这里的 CodePen 中重新创建了这个问题。
请注意,如果您在 Chrome(版本 59.0.3071.115(官方构建)(64 位))或 IE 11(11.0.14393.0)中打开该 CodePen,您将看到问题。然而,它似乎在 Firefox 54.0.1 中工作。