在尝试使用quill中的公式模块时,我遇到一个错误。
错误是:
"[Parchment] Unable to create formula blot"跟随chrome web开发工具中的错误消息可在registry.ts (webpack:///./~/parchment/src/registry.ts)中找到以下行
function create(input, value) {
var match = query(input);
if (match == null) {
throw new ParchmentError("Unable to create " + input + " blot");
}
var BlotClass = match;
var node = input instanceof Node ? input : BlotClass.create(value);
return new BlotClass(node, value);
}当我尝试插入一个公式时,就会发生这种情况。
当我使用quill-rails5,但没有使用gem时,就会发生这种情况。我删除了gem以简化问题。下面是我的代码:
var quill = new Quill('#editor', {
modules: {
formula: true,
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['image', 'code-block'],
['formula'],
]
},
placeholder: 'Compose a solution...',
theme: 'snow' // or 'bubble'
});我的编辑器容器
<div id="editor">
<%= raw sanitize @post.description, tags: %w(strong em div a p br ul ol li), attributes: %w(href) %>
</div>发布于 2017-03-01 09:50:30
您是否包括了docs中解释的katex.js和katex.css?
一个有效的example
<!-- Include KaTeX stylesheet -->
<link href="katex.css" rel="stylesheet">
<!-- Include KaTeX library -->
<script href="katex.js" type="text/javascript"></script>
<script type="text/javascript">
var quill = new Quill('#editor', {
modules: {
formula: true, // Include formula module
toolbar: [['formula']] // Include button in toolbar
},
theme: 'snow'
});
</script>https://stackoverflow.com/questions/42472024
复制相似问题