ngx-mathquill
Version:
A thin typescript wrapper around mathquill
88 lines (67 loc) • 1.62 kB
Markdown
Still in development, check back in a few weeks to find
a more stable and useful release.
Thin typescript wrapper around Mathquill (from matrix branch). It
offers types (of course) and an easier installation
than the original mathquill library if you're
using `npm`.
## Installation
Step 1)
Get jquery
You need to have jquery "globally" installed for this
library to work (like most jquery-dependent libraries).
For example you can add it in `<head>` of your html.
Or in webpack write configure something like this:
Work is in progress to fork Mathquill and remove this dependency
```
var webpack = require("webpack");
...
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
]
```
Or in `.angular.json`:
```
{
...
"apps": [
{
...
"scripts": [
"../node_modules/jquery/dist/jquery.js"
],
...
```
Step 2)
```
npm install ngx-mathquill
```
```
import {MathQuillLoader} from 'ngx-mathquill';
MathQuillLoader.loadMathQuill(mathquill => {
// do what you want here
// for example:
console.log(mathquill.getInterface(2));
});
```
If you call the loader multiple times, it will just return
the already initialized `window.MathQuill` object.
```
"assets": [
"src/assets",
"src/favicon.ico",
{
"glob": "**/*",
"input": "./node_modules/ngx-mathquill/mathquill/",
"output": "./mathquill/"
}
],
```
Thanks to [JayendharPrakash/mathquill-typescript](https://github.com/JayendharPrakash/mathquill-typescript)