No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to add MathQuill

    CLI
    3
    3
    1268
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      alfredclyim last edited by

      I tried to add MathQuill (https://www.npmjs.com/package/mathquill) to existing quasar project but can’t make it work. Do you have experience in adding similar module to quasar project?

      1 Reply Last reply Reply Quote 0
      • krsyoung
        krsyoung last edited by

        Any chance you can share the related code / the steps you took to try and add it? Is there a specific error happening?

        1 Reply Last reply Reply Quote 0
        • G
          genyded last edited by genyded

          JQuery plugin - yuk… but if you must. I haven’t actually tried this because I do not want to pollute any of my projects and I do not have a ton of time to invest in it. First it seems like you would need to npm (or yarn) install JQuery and add JQuery via a Quasar plugin. Not sure how MathQuill expects it, but something along the lines of:

          // Quasar plugin jquery.js 
          import jQuery from 'jquery'
          
          window.$ = window.jQuery = jQuery
          

          Then the same for MathQuill - npm install and Quasar plugin (you’ll have to look into the node_modules folder for where exactly the css is located and maybe use min version if provided. Also don’t forget to add the plugins to quasar.conf.js):

          // Quasar plugin mathquill.js 
          import '../../node_modules/mathquill/PATH_TO_CSS/mathquill.css'
          import MathQuill from 'mathquill'
          
          export default ({ Vue }) => {
            Object.defineProperty(Vue.prototype, '$mq', { value:  MathQuill.getInterface(2));
          }
          

          Then in any Vue component, you should be able to access it as this.$mq. As I said, I haven’t actually tried it and you may have some trial and error to get it working, but hopefully this helps get you going in the right direction.

          If you cannot get this working, you can try it with MathQuill on the window like the JQuery above, but the many JS gods frown on window variables. In this case though I think JQuery will have to be there for MathQuill to see it.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post