Lazy load math library
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-11-05 20:51:12 +01:00
parent 2a5d3f2498
commit f3737f96bd
2 changed files with 7 additions and 5 deletions

View File

@ -26,8 +26,7 @@ import formulaFunctions from './formula'
moment.locale('nl')
const math = create(all)
math.import(formulaFunctions)
let math;
function isMultiline(input) {
return input.value.startsWith("```", 0)
@ -181,8 +180,6 @@ function Editor(holder, input) {
}
function transformTable(editor, id, element) {
Promise.any()
editor.treeForId(id).then(tree => {
let header = _.find(tree[0].children, c => c.text === 'headers') || []
let rows = _.find(tree[0].children, c => c.text === 'rows') || []
@ -233,6 +230,11 @@ function Editor(holder, input) {
function transformMathExpression(converted, scope) {
try {
if (math === undefined) {
math = create(all)
math.import(formulaFunctions)
}
let expr = converted.substring(1);
let parsedExpr = math.parse(expr)
let compiled = parsedExpr.compile()

View File

@ -357,7 +357,7 @@ function editor(root, inputData, options) {
moves: function (el, container, handle, sibling) {
return handle.classList.contains('marker')
}
});
})
let start = -1;
let startID = null;