Render the percentage sign correctly in units in the frontend.

This commit is contained in:
Jan Böhmer 2025-07-06 00:20:02 +02:00
parent 8d410c8a57
commit 39b0e85028
2 changed files with 7 additions and 2 deletions

View file

@ -33,7 +33,10 @@ export default class extends Controller {
{
let value = "";
if (this.unitValue) {
value = "\\mathrm{" + this.inputTarget.value + "}";
//Escape percentage signs
value = this.inputTarget.value.replace(/%/g, '\\%');
value = "\\mathrm{" + value + "}";
} else {
value = this.inputTarget.value;
}