gpt4 book ai didi

ruby-on-rails - quill js羊皮纸错误

转载 作者:行者123 更新时间:2023-12-04 06:32:41 32 4
gpt4 key购买 nike

尝试在 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>

最佳答案

您是否按照 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>

关于ruby-on-rails - quill js羊皮纸错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42472024/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com