add useDivisionSymbol option
need this for the 4fn calculator
Pass options object to chToCmd
Add option to use multiplication symbol instead of cdot
diff --git a/src/commands/math.js b/src/commands/math.js
index 63341e3..82f5374 100644
--- a/src/commands/math.js
+++ b/src/commands/math.js
@@ -395,20 +395,24 @@
while (pageX < node.jQ.offset().left) node = node[L];
return node.seek(pageX, cursor);
};
- _.chToCmd = function(ch) {
+ _.chToCmd = function(ch, options) {
var cons;
// exclude f because it gets a dedicated command with more spacing
if (ch.match(/^[a-eg-zA-Z]$/))
return Letter(ch);
else if (/^\d$/.test(ch))
return Digit(ch);
+ else if (options && options.useDivisionSymbol && ch == '/')
+ return LatexCmds['÷'](ch);
+ else if (options && options.useMultiplicationSymbol && ch == '*')
+ return LatexCmds['×'](ch);
else if (cons = CharCmds[ch] || LatexCmds[ch])
return cons(ch);
else
return VanillaSymbol(ch);
};
_.write = function(cursor, ch) {
- var cmd = this.chToCmd(ch);
+ var cmd = this.chToCmd(ch, cursor.options);
if (cursor.selection) cmd.replaces(cursor.replaceSelection());
cmd.createLeftOf(cursor.show());
};
diff --git a/src/commands/math/commands.js b/src/commands/math/commands.js
index fdd3cf2..09c1f79 100644
--- a/src/commands/math/commands.js
+++ b/src/commands/math/commands.js
@@ -193,7 +193,7 @@
this.ends[L].write = function(cursor, ch) {
if (cursor.options.autoSubscriptNumerals && this === this.parent.sub) {
if (ch === '_') return;
- var cmd = this.chToCmd(ch);
+ var cmd = this.chToCmd(ch, cursor.options);
if (cmd instanceof Symbol) cursor.deleteSelection();
else cursor.clearSelection().insRightOf(this.parent);
return cmd.createLeftOf(cursor.show());