Lazy load math library
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2a5d3f2498
commit
f3737f96bd
|
@ -26,8 +26,7 @@ import formulaFunctions from './formula'
|
||||||
|
|
||||||
moment.locale('nl')
|
moment.locale('nl')
|
||||||
|
|
||||||
const math = create(all)
|
let math;
|
||||||
math.import(formulaFunctions)
|
|
||||||
|
|
||||||
function isMultiline(input) {
|
function isMultiline(input) {
|
||||||
return input.value.startsWith("```", 0)
|
return input.value.startsWith("```", 0)
|
||||||
|
@ -181,8 +180,6 @@ function Editor(holder, input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function transformTable(editor, id, element) {
|
function transformTable(editor, id, element) {
|
||||||
Promise.any()
|
|
||||||
|
|
||||||
editor.treeForId(id).then(tree => {
|
editor.treeForId(id).then(tree => {
|
||||||
let header = _.find(tree[0].children, c => c.text === 'headers') || []
|
let header = _.find(tree[0].children, c => c.text === 'headers') || []
|
||||||
let rows = _.find(tree[0].children, c => c.text === 'rows') || []
|
let rows = _.find(tree[0].children, c => c.text === 'rows') || []
|
||||||
|
@ -233,6 +230,11 @@ function Editor(holder, input) {
|
||||||
|
|
||||||
function transformMathExpression(converted, scope) {
|
function transformMathExpression(converted, scope) {
|
||||||
try {
|
try {
|
||||||
|
if (math === undefined) {
|
||||||
|
math = create(all)
|
||||||
|
math.import(formulaFunctions)
|
||||||
|
}
|
||||||
|
|
||||||
let expr = converted.substring(1);
|
let expr = converted.substring(1);
|
||||||
let parsedExpr = math.parse(expr)
|
let parsedExpr = math.parse(expr)
|
||||||
let compiled = parsedExpr.compile()
|
let compiled = parsedExpr.compile()
|
||||||
|
|
|
@ -357,7 +357,7 @@ function editor(root, inputData, options) {
|
||||||
moves: function (el, container, handle, sibling) {
|
moves: function (el, container, handle, sibling) {
|
||||||
return handle.classList.contains('marker')
|
return handle.classList.contains('marker')
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
let start = -1;
|
let start = -1;
|
||||||
let startID = null;
|
let startID = null;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user