Skip to content

Commit

Permalink
dont require katex unless using formula
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Mar 13, 2017
1 parent e4387d1 commit 674ca72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion _develop/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = function(config) {
port: process.env.npm_package_config_ports_karma,

files: [
{ pattern: 'http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js' },
{ pattern: 'dist/quill.snow.css', nocache: true },
{ pattern: 'dist/unit.js', nocache: true },
{ pattern: 'dist/*.map', included: false, served: true, nocache: true },
Expand Down
9 changes: 7 additions & 2 deletions modules/formula.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Embed from '../blots/embed';
import Quill from '../core/quill';
import Module from '../core/module';


class FormulaBlot extends Embed {
Expand All @@ -26,12 +27,16 @@ FormulaBlot.className = 'ql-formula';
FormulaBlot.tagName = 'SPAN';


class Formula {
class Formula extends Module {
static register() {
Quill.register(FormulaBlot, true);
}

constructor() {
super();
if (window.katex == null) {
throw new Error('Formula module requires KaTeX.');
}
Quill.register(FormulaBlot, true);
}
}

Expand Down

0 comments on commit 674ca72

Please sign in to comment.