Adding comment to disableLatex, allowing for symbols in content.
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Adsooi 2022-03-07 03:10:51 +01:00
parent b72bbeab4f
commit 4c9c9668bb
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160

View file

@ -21,6 +21,8 @@
.import "common.js" as Common .import "common.js" as Common
.import "../mathlib.js" as MathLib .import "../mathlib.js" as MathLib
.import "../parameters.js" as P .import "../parameters.js" as P
.import "../math/latex.js" as Latex
class Text extends Common.DrawableObject { class Text extends Common.DrawableObject {
@ -38,6 +40,10 @@ class Text extends Common.DrawableObject {
[QT_TRANSLATE_NOOP('prop','y')]: 'Expression', [QT_TRANSLATE_NOOP('prop','y')]: 'Expression',
[QT_TRANSLATE_NOOP('prop','labelPosition')]: P.Enum.Positioning, [QT_TRANSLATE_NOOP('prop','labelPosition')]: P.Enum.Positioning,
[QT_TRANSLATE_NOOP('prop','text')]: 'string', [QT_TRANSLATE_NOOP('prop','text')]: 'string',
'comment1': QT_TRANSLATE_NOOP(
'comment',
'If you have latex enabled, you can use use latex markup in between $$ to create equations.'
),
[QT_TRANSLATE_NOOP('prop','disableLatex')]: 'boolean' [QT_TRANSLATE_NOOP('prop','disableLatex')]: 'boolean'
}} }}
@ -60,7 +66,7 @@ class Text extends Common.DrawableObject {
} }
latexMarkupText() { latexMarkupText() {
let txt = this.text let txt = Latex.variable(this.text)
let i let i
for(i = 0; txt.includes('$$'); i++) for(i = 0; txt.includes('$$'); i++)
if(i & 0x01) // Every odd number if(i & 0x01) // Every odd number