Latex rendering for property edition history action!
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
c5851e6d95
commit
e98be96b0d
1 changed files with 23 additions and 17 deletions
|
@ -19,6 +19,7 @@
|
||||||
.pragma library
|
.pragma library
|
||||||
|
|
||||||
.import "../objects.js" as Objects
|
.import "../objects.js" as Objects
|
||||||
|
.import "../math/latex.js" as Latex
|
||||||
.import "../mathlib.js" as MathLib
|
.import "../mathlib.js" as MathLib
|
||||||
.import "../objs/common.js" as Common
|
.import "../objs/common.js" as Common
|
||||||
.import "common.js" as C
|
.import "common.js" as C
|
||||||
|
@ -77,30 +78,37 @@ class EditedProperty extends C.Action {
|
||||||
}
|
}
|
||||||
|
|
||||||
setReadableValues() {
|
setReadableValues() {
|
||||||
this.prev = "";
|
this.prevString = "";
|
||||||
this.next = "";
|
this.nextString = "";
|
||||||
if(this.propertyType instanceof Object) {
|
if(this.propertyType instanceof Object) {
|
||||||
switch(this.propertyType.type) {
|
switch(this.propertyType.type) {
|
||||||
case "Enum":
|
case "Enum":
|
||||||
this.prev = this.propertyType.translatedValues[this.propertyType.values.indexOf(this.previousValue)]
|
this.prevString = this.propertyType.translatedValues[this.propertyType.values.indexOf(this.previousValue)]
|
||||||
this.next = this.propertyType.translatedValues[this.propertyType.values.indexOf(this.newValue)]
|
this.nextString = this.propertyType.translatedValues[this.propertyType.values.indexOf(this.newValue)]
|
||||||
break;
|
break;
|
||||||
case "ObjectType":
|
case "ObjectType":
|
||||||
this.prev = this.previousValue == null ? "null" : this.previousValue.name
|
this.prevString = this.previousValue == null ? "null" : this.previousValue.name
|
||||||
this.next = this.newValue == null ? "null" : this.newValue.name
|
this.nextString = this.newValue == null ? "null" : this.newValue.name
|
||||||
break;
|
break;
|
||||||
case "List":
|
case "List":
|
||||||
this.prev = this.previousValue.join(",")
|
this.prevString = this.previousValue.join(",")
|
||||||
this.next = this.newValue.name.join(",")
|
this.nextString = this.newValue.name.join(",")
|
||||||
break;
|
break;
|
||||||
case "Dict":
|
case "Dict":
|
||||||
this.prev = JSON.stringify(this.previousValue)
|
this.prevString = JSON.stringify(this.previousValue)
|
||||||
this.next = JSON.stringify(this.newValue)
|
this.nextString = JSON.stringify(this.newValue)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.prev = this.previousValue == null ? "null" : this.previousValue.toString()
|
this.prevString = this.previousValue == null ? "null" : this.previousValue.toString()
|
||||||
this.next = this.newValue == null ? "null" : this.newValue.toString()
|
this.nextString = this.newValue == null ? "null" : this.newValue.toString()
|
||||||
|
}
|
||||||
|
// 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") {
|
||||||
|
this.prevHTML= this.renderLatexAsHtml(this.previousValue.latexMarkup)
|
||||||
|
this.nextHTML= this.renderLatexAsHtml(this.newValue.latexMarkup)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,16 +116,14 @@ class EditedProperty extends C.Action {
|
||||||
return qsTr('%1 of %2 %3 changed from "%4" to "%5".')
|
return qsTr('%1 of %2 %3 changed from "%4" to "%5".')
|
||||||
.arg(this.targetPropertyReadable)
|
.arg(this.targetPropertyReadable)
|
||||||
.arg(Objects.types[this.targetType].displayType())
|
.arg(Objects.types[this.targetType].displayType())
|
||||||
.arg(this.targetName).arg(this.prev).arg(this.next)
|
.arg(this.targetName).arg(this.prevString).arg(this.nextString)
|
||||||
}
|
}
|
||||||
|
|
||||||
getHTMLString() {
|
getHTMLString() {
|
||||||
return qsTr('%1 of %2 changed from %3 to %4.')
|
return qsTr('%1 of %2 changed from %3 to %4.')
|
||||||
.arg(this.targetPropertyReadable)
|
.arg(this.targetPropertyReadable)
|
||||||
.arg('<b style="font-size: 15px;"> ' + this.targetName + ' </b>')
|
.arg('<b style="font-size: 15px;"> ' + this.targetName + ' </b>')
|
||||||
.arg('<tt style="background: rgba(128,128,128,0.1);"> '+this.prev+' </tt>')
|
.arg(this.prevHTML)
|
||||||
.arg('<tt style="background: rgba(128,128,128,0.1);"> '+this.next+' </tt>')
|
.arg(this.nextHTML)
|
||||||
// .arg('<b style="font-size: 15px;">' + Objects.types[this.targetType].displayType())
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue