mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-19 16:49:34 +00:00
Render the percentage sign correctly in units in the frontend.
This commit is contained in:
parent
8d410c8a57
commit
39b0e85028
2 changed files with 7 additions and 2 deletions
|
|
@ -33,7 +33,10 @@ export default class extends Controller {
|
||||||
{
|
{
|
||||||
let value = "";
|
let value = "";
|
||||||
if (this.unitValue) {
|
if (this.unitValue) {
|
||||||
value = "\\mathrm{" + this.inputTarget.value + "}";
|
//Escape percentage signs
|
||||||
|
value = this.inputTarget.value.replace(/%/g, '\\%');
|
||||||
|
|
||||||
|
value = "\\mathrm{" + value + "}";
|
||||||
} else {
|
} else {
|
||||||
value = this.inputTarget.value;
|
value = this.inputTarget.value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,9 @@ export default class extends Controller
|
||||||
tmp += '<span>' + katex.renderToString(data.symbol) + '</span>'
|
tmp += '<span>' + katex.renderToString(data.symbol) + '</span>'
|
||||||
}
|
}
|
||||||
if (data.unit) {
|
if (data.unit) {
|
||||||
tmp += '<span class="ms-2">' + katex.renderToString('[' + data.unit + ']') + '</span>'
|
let unit = data.unit.replace(/%/g, '\\%');
|
||||||
|
unit = "\\mathrm{" + unit + "}";
|
||||||
|
tmp += '<span class="ms-2">' + katex.renderToString('[' + unit + ']') + '</span>'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue