Escape html special characters in properties.
This commit is contained in:
parent
dc60397102
commit
6f54184dc6
@ -27,3 +27,8 @@ export function IsObjectEmpty (obj)
|
|||||||
{
|
{
|
||||||
return Object.keys (obj).length === 0;
|
return Object.keys (obj).length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function EscapeHtmlChars (str)
|
||||||
|
{
|
||||||
|
return str.replaceAll ('<', '<').replaceAll ('>', '>');
|
||||||
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { IsDefined, ValueOrDefault, CopyObjectAttributes, IsObjectEmpty } from './core/core.js';
|
import { IsDefined, ValueOrDefault, CopyObjectAttributes, IsObjectEmpty, EscapeHtmlChars } from './core/core.js';
|
||||||
import { TaskRunner, RunTaskAsync, RunTasks, RunTasksBatch, WaitWhile } from './core/taskrunner.js';
|
import { TaskRunner, RunTaskAsync, RunTasks, RunTasksBatch, WaitWhile } from './core/taskrunner.js';
|
||||||
import { Exporter } from './export/exporter.js';
|
import { Exporter } from './export/exporter.js';
|
||||||
import { Exporter3dm } from './export/exporter3dm.js';
|
import { Exporter3dm } from './export/exporter3dm.js';
|
||||||
@ -75,6 +75,7 @@ export {
|
|||||||
ValueOrDefault,
|
ValueOrDefault,
|
||||||
CopyObjectAttributes,
|
CopyObjectAttributes,
|
||||||
IsObjectEmpty,
|
IsObjectEmpty,
|
||||||
|
EscapeHtmlChars,
|
||||||
TaskRunner,
|
TaskRunner,
|
||||||
RunTaskAsync,
|
RunTaskAsync,
|
||||||
RunTasks,
|
RunTasks,
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { EscapeHtmlChars } from '../core/core.js';
|
||||||
import { ColorToHexString } from './color.js';
|
import { ColorToHexString } from './color.js';
|
||||||
|
|
||||||
export const PropertyType =
|
export const PropertyType =
|
||||||
@ -66,7 +67,7 @@ export class PropertyGroup
|
|||||||
export function PropertyToString (property)
|
export function PropertyToString (property)
|
||||||
{
|
{
|
||||||
if (property.type === PropertyType.Text) {
|
if (property.type === PropertyType.Text) {
|
||||||
return property.value;
|
return EscapeHtmlChars (property.value);
|
||||||
} else if (property.type === PropertyType.Integer) {
|
} else if (property.type === PropertyType.Integer) {
|
||||||
return property.value.toLocaleString ();
|
return property.value.toLocaleString ();
|
||||||
} else if (property.type === PropertyType.Number) {
|
} else if (property.type === PropertyType.Number) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user