Quil js parchment error

I get an error when trying to use the formula module in quill.

Error:

"[Parchment] Unable to create formula blot" 

Following the error message in the Chrome website development tools, the following line is 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); } 

This happens when I try to insert a formula.

This happens when I use quill-rails5 , but also without using a gem. I removed the stone 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 ap br ul ol li), attributes: %w(href) %> </div> 
+5
source share
1 answer

Have you included katex.js and katex.css as described in the docs ?

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> 
+1
source

Source: https://habr.com/ru/post/1264756/


All Articles