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/List.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/List.ts')
| -rw-r--r-- | src/new_fields/List.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/new_fields/List.ts b/src/new_fields/List.ts index bb48b1bb3..a43f11e82 100644 --- a/src/new_fields/List.ts +++ b/src/new_fields/List.ts @@ -6,7 +6,7 @@ import { observable, action } from "mobx"; import { ObjectField } from "./ObjectField"; import { RefField } from "./RefField"; import { ProxyField } from "./Proxy"; -import { Self, Update, Parent, OnUpdate, SelfProxy, ToScriptString, Copy } from "./FieldSymbols"; +import { Self, Update, Parent, OnUpdate, SelfProxy, ToScriptString, ToString, Copy } from "./FieldSymbols"; import { Scripting } from "../client/util/Scripting"; const listHandlers: any = { @@ -292,6 +292,9 @@ class ListImpl<T extends Field> extends ObjectField { [ToScriptString]() { return `new List([${(this as any).map((field: any) => Field.toScriptString(field))}])`; } + [ToString]() { + return "List"; + } } export type List<T extends Field> = ListImpl<T> & (T | (T extends RefField ? Promise<T> : never))[]; export const List: { new <T extends Field>(fields?: T[]): List<T> } = ListImpl as any; |
