question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use formula in vue-quill-editor?

See original GitHub issue

I’m trying to use vue-quill-editor in my project, which is a webpack project. After I mount it as a component, everything looks well, but the formula button is not shown. I checked the document of quill, it said:

Formula - formula (requires KaTex)

So I import KaTex in a vue file like this:

import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";

import { quillEditor } from "vue-quill-editor";
import "katex/dist/katex.js";

However, it still not work.

I try add “formula” option like this:

      editorOption: {
        modules: {
          toolbar: [
            ["bold", "italic", "underline", "strike"],
            [{ list: "ordered" }, { list: "bullet" }],
            [{ color: [] }, { background: [] }],
            [{ align: [] }],
            ["image"],
            ["formula"]
          ]
        }
      },

The button of formula is shown, but it isn’t work correctly. And the error report:

Uncaught TypeError: Cannot read property 'render' of undefined
    at Function.create (quill.js:10926)
    at Object.create (quill.js:183)
    at Block.ContainerBlot.insertAt (quill.js:3407)
    at BlockBlot.insertAt (quill.js:7406)
    at Block.insertAt (quill.js:855)
    at Scroll.ContainerBlot.insertAt (quill.js:3404)
    at ScrollBlot.insertAt (quill.js:7145)
    at Scroll.insertAt (quill.js:4252)
    at Editor.insertEmbed (quill.js:2606)
    at quill.js:1379

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10

github_iconTop GitHub Comments

19reactions
ChikuwaJBcommented, May 18, 2019

I found solution about this issue.

Add few lines to import katex module to component file.

import katex from 'katex';
import 'katex/dist/katex.min.css';

And add below lines to ‘mounted’ methods.

mounted() {
  window.katex = katex;
}
3reactions
gsern1commented, May 21, 2019

I found solution about this issue.

Add few lines to import katex module to component file.

import katex from 'katex';
import 'katex/dist/katex.min.css';

And add below lines to ‘mounted’ methods.

mounted() {
  window.katex = katex;
}

Thanks, it works perfectly!

Read more comments on GitHub >

github_iconTop Results From Across the Web

API - Quill Rich Text Editor
Quill is a free, open source WYSIWYG editor built for the modern web. Completely customize it for any need with its modular architecture...
Read more >
vue-quill-editor | Homepage
Think of headless browsers as a browser that you can run from the command line that can retrieve and traverse web pages. The...
Read more >
How to use Quill text editor as a component in Vue.js
Even though you tagged the question as a Vue 2 question, I am going to guess you are using Vue 3 because otherwise,...
Read more >
A text editor using Vue.js and Quill
Props ; id, String, quill-container, Set the id (necessary if multiple editors in the same view) ; v-model, String, -, Set v-model to...
Read more >
MathQuill: Easily type math into your webapp
You Use MathQuill? Partner with us so we can work more closely with you! About. MathQuill is an open source formula editor for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found