I get a an error when trying to use a formula module in quill.
The error is:
"[Parchment] Unable to create formula blot"
Following the error message in chrome web development tools leads to the following line in 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);
}
It happens when I try to insert a formula.
This happens when I am using the quill-rails5
but also without using the gem. I removed the gem to simplify the problem. Here is my code:
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'
});
my editor container
<div id="editor">
<%= raw sanitize @post.description, tags: %w(strong em div a p br ul ol li), attributes: %w(href) %>
</div>
Did you include katex.js and katex.css as explained in the docs?
A working 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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With