Skip to content

Commit

Permalink
Dist and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
arnog committed May 10, 2019
1 parent 30a8aff commit 6979ee7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/mathlive.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mathlive.mjs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/src/addons/outputLatex.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ function latexify(parent, value, expandMacro) {
'backgroundColor',
'fontFamily'
], value, expandMacro);
if (result.startsWith('{') && result.endsWith('}')) {
result = result.slice(1, result.length - 1);
}
// if (result.startsWith('{') && result.endsWith('}')) {
// result = result.slice(1, result.length - 1);
// }

} else if (typeof value === 'number' || typeof value === 'boolean') {
result = value.toString();
Expand Down
2 changes: 2 additions & 0 deletions dist/src/core/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ class Parser {
const result = new MathAtom(this.parseMode, 'group');
result.body = this.scanImplicitGroup(token => token.type === '}');
this.parseToken('}');
result.latexOpen = '{';
result.latexClose = '}';
return result;
}
scanSmartFence() {
Expand Down
8 changes: 5 additions & 3 deletions dist/src/editor/editor-editableMathlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ EditableMathlist.prototype.forEachSelected = function(cb, options) {
const lastOffset = this.endOffset() + 1;
if (options.recursive) {
for (let i = firstOffset; i < lastOffset; i++) {
if (siblings[i].type !== 'first') {
if (siblings[i] && siblings[i].type !== 'first') {
siblings[i].forEach(cb);
}
}
} else {
for (let i = firstOffset; i < lastOffset; i++) {
if (siblings[i].type !== 'first') {
if (siblings[i] && siblings[i].type !== 'first') {
cb(siblings[i])
}
}
Expand Down Expand Up @@ -1118,7 +1118,9 @@ EditableMathlist.prototype.commitCommandStringBeforeInsertionPoint = function()
const siblings = this.siblings();
const anchorOffset = this.anchorOffset() + 1;
for (let i = command.start; i < anchorOffset; i++) {
siblings[i].suggestion = false;
if (siblings[i]) {
siblings[i].suggestion = false;
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions dist/src/editor/editor-undo.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ class UndoManager {
* This does not affect the undo stack.
*/
restore(state, options) {
const wasSuppressing = this.mathlist.suppressChangeNotifications;
if (options.suppressChangeNotifications !== undefined) {
this.mathlist.suppressChangeNotifications = options.suppressChangeNotifications;
}

// Restore the content
this.mathlist.insert(state ? state.latex : '', {
mode: 'math',
Expand All @@ -161,8 +166,11 @@ class UndoManager {
format: 'latex',
...options
});

// Restore the selection
this.mathlist.setPath(state ? state.selection : [{relation: 'body', offset: 0}]);

this.mathlist.suppressChangeNotifications = wasSuppressing;
}
}

Expand Down

0 comments on commit 6979ee7

Please sign in to comment.