diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-01-21 09:12:35 -0500 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-01-21 09:12:35 -0500 |
commit | 4d1c1286f311de9d69158adccb02b60638a30e83 (patch) | |
tree | 5b5352b74bdf252cf35484adbb6c5b0f2703686d /src/new_fields/URLField.ts | |
parent | 9090808d81028fb7ed8796339524b5a0fa0893d5 (diff) |
added a ToString() method to fields so that rendering them as RichTextField won't make them unreadable
Diffstat (limited to 'src/new_fields/URLField.ts')
-rw-r--r-- | src/new_fields/URLField.ts | 5 |
1 files changed, 4 insertions, 1 deletions
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); |