From 4d1c1286f311de9d69158adccb02b60638a30e83 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Tue, 21 Jan 2020 09:12:35 -0500 Subject: added a ToString() method to fields so that rendering them as RichTextField won't make them unreadable --- src/new_fields/URLField.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/new_fields/URLField.ts') diff --git a/src/new_fields/URLField.ts b/src/new_fields/URLField.ts index 35ef6dd02..cfab36906 100644 --- a/src/new_fields/URLField.ts +++ b/src/new_fields/URLField.ts @@ -1,7 +1,7 @@ import { Deserializable } from "../client/util/SerializationHelper"; import { serializable, custom } from "serializr"; import { ObjectField } from "./ObjectField"; -import { ToScriptString, Copy } from "./FieldSymbols"; +import { ToScriptString, ToString, Copy } from "./FieldSymbols"; import { Scripting, scriptingGlobal } from "../client/util/Scripting"; function url() { @@ -32,6 +32,9 @@ export abstract class URLField extends ObjectField { [ToScriptString]() { return `new ${this.constructor.name}("${this.url.href}")`; } + [ToString]() { + return this.url.href; + } [Copy](): this { return new (this.constructor as any)(this.url); -- cgit v1.2.3-70-g09d2