aboutsummaryrefslogtreecommitdiff
path: root/src/fields/RichTextField.ts
blob: a7ea1f2ce8ac390e982212f76825606160556b12 (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
import { BasicField } from "./BasicField";
import { Types } from "../server/Message";
import { FIELD_ID } from "./Field";
import { ObjectID } from "bson";

export class RichTextField extends BasicField<string> {
    constructor(data: string = "", id: FIELD_ID = undefined) {
        super(data, id);
    }

    ToScriptString(): string {
        return `new RichTextField(${this.Data})`;
    }

    Copy() {
        return new RichTextField(this.Data);
    }

    ToJson(): { type: Types, data: string, _id: ObjectID } {
        return {
            type: Types.RichText,
            data: this.Data,
            _id: new ObjectID(this.Id)
        }
    }

}