diff options
author | Eleanor Eng <eleanoreng@eleanors-mbp.devices.brown.edu> | 2019-02-25 18:58:45 -0500 |
---|---|---|
committer | Eleanor Eng <eleanoreng@eleanors-mbp.devices.brown.edu> | 2019-02-25 18:58:45 -0500 |
commit | 8d3ebd1eb393baf37932d021d6da79d46ef96a03 (patch) | |
tree | f6e0ef0cce9041525bcd5f6e0a37eee9226a9896 /src/fields/HtmlField.ts | |
parent | fa2be8b245e4ed69b771e70a98e65176785751eb (diff) | |
parent | 292ff1a8d75f8b15f9388d2c577e09a13836d5dc (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into contextMenu
Diffstat (limited to 'src/fields/HtmlField.ts')
-rw-r--r-- | src/fields/HtmlField.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/fields/HtmlField.ts b/src/fields/HtmlField.ts new file mode 100644 index 000000000..a07326095 --- /dev/null +++ b/src/fields/HtmlField.ts @@ -0,0 +1,25 @@ +import { BasicField } from "./BasicField"; +import { Types } from "../server/Message"; +import { FieldId } from "./Field"; + +export class HtmlField extends BasicField<string> { + constructor(data: string = "<html></html>", id?: FieldId, save: boolean = true) { + super(data, save, id); + } + + ToScriptString(): string { + return `new HtmlField("${this.Data}")`; + } + + Copy() { + return new HtmlField(this.Data); + } + + ToJson(): { _id: string; type: Types; data: any; } { + return { + type: Types.Html, + data: this.Data, + _id: this.Id, + } + } +}
\ No newline at end of file |