Fixing history rendering of expressions
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
3cd4ad6a20
commit
7e427e5bb9
2 changed files with 6 additions and 3 deletions
|
@ -42,7 +42,7 @@ class EditedProperty extends C.Action {
|
|||
this.newValue = newValue
|
||||
this.propertyType = Objects.types[targetType].properties()[targetProperty]
|
||||
if(valueIsExpressionNeedingImport) {
|
||||
if(this.propertyType == "Expression") {
|
||||
if(typeof this.propertyType == 'object' && this.propertyType.type == "Expression") {
|
||||
this.previousValue = new MathLib.Expression(this.previousValue);
|
||||
this.newValue = new MathLib.Expression(this.newValue);
|
||||
} else if(this.propertyType == "Domain") {
|
||||
|
@ -98,6 +98,10 @@ class EditedProperty extends C.Action {
|
|||
this.prevString = JSON.stringify(this.previousValue)
|
||||
this.nextString = JSON.stringify(this.newValue)
|
||||
break;
|
||||
case "Expression":
|
||||
this.prevString = this.previousValue == null ? "null" : this.previousValue.toString()
|
||||
this.nextString = this.newValue == null ? "null" : this.newValue.toString()
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.prevString = this.previousValue == null ? "null" : this.previousValue.toString()
|
||||
|
@ -106,7 +110,7 @@ class EditedProperty extends C.Action {
|
|||
// HTML
|
||||
this.prevHTML = '<tt style="background: rgba(128,128,128,0.1);"> '+this.prevString+' </tt>'
|
||||
this.nextHTML = '<tt style="background: rgba(128,128,128,0.1);"> '+this.nextString+' </tt>'
|
||||
if(Latex.enabled && this.propertyType == "Expression") {
|
||||
if(Latex.enabled && typeof this.propertyType == 'object' && this.propertyType.type == "Expression") {
|
||||
this.prevHTML= this.renderLatexAsHtml(this.previousValue.latexMarkup)
|
||||
this.nextHTML= this.renderLatexAsHtml(this.newValue.latexMarkup)
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ class Expression {
|
|||
return this.cachedValue
|
||||
}
|
||||
C.currentVars = Object.assign({'x': x}, C.currentObjectsByName)
|
||||
//console.log("Executing", this.expr, "with", JSON.stringify(C.currentVars))
|
||||
return this.calc.evaluate(C.currentVars)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue