aboutsummaryrefslogtreecommitdiff
path: root/src/fields/HtmlField.ts
blob: 536f5ce4c42759a59602b792be8218a849f62faf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { primitive, serializable } from 'serializr';
import { Deserializable } from '../client/util/SerializationHelper';
import { Copy, ToJavascriptString, ToScriptString, ToString } from './FieldSymbols';
import { ObjectField } from './ObjectField';

@Deserializable('html')
export class HtmlField extends ObjectField {
    @serializable(primitive())
    readonly html: string;

    constructor(html: string) {
        super();
        this.html = html;
    }

    [Copy]() {
        return new HtmlField(this.html);
    }

    [ToJavascriptString]() {
        return 'invalid';
    }
    [ToScriptString]() {
        return 'invalid';
    }
    [ToString]() {
        return this.html;
    }
}