diff options
author | Fawn <fangrui_tong@brown.edu> | 2019-06-19 22:27:21 -0400 |
---|---|---|
committer | Fawn <fangrui_tong@brown.edu> | 2019-06-19 22:27:21 -0400 |
commit | c5e401cb0a7fec2279ceecbc8d1429dcdd2f04b9 (patch) | |
tree | d7e3b77890c3c4f3be0dca1da9c4aae71ecaead7 /src/new_fields/LinkButtonField.ts | |
parent | f362dbfc237536c6c4a8c6d088c3dc818080f7c2 (diff) |
buttons on cut links functional except for when dragged from link menu
Diffstat (limited to 'src/new_fields/LinkButtonField.ts')
-rw-r--r-- | src/new_fields/LinkButtonField.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/new_fields/LinkButtonField.ts b/src/new_fields/LinkButtonField.ts new file mode 100644 index 000000000..92e1ed922 --- /dev/null +++ b/src/new_fields/LinkButtonField.ts @@ -0,0 +1,35 @@ +import { Deserializable } from "../client/util/SerializationHelper"; +import { serializable, primitive, createSimpleSchema, object } from "serializr"; +import { ObjectField } from "./ObjectField"; +import { Copy, ToScriptString } from "./FieldSymbols"; +import { Doc } from "./Doc"; +import { DocumentView } from "../client/views/nodes/DocumentView"; + +export type LinkButtonData = { + sourceViewId: string, + targetViewId: string +}; + +const LinkButtonSchema = createSimpleSchema({ + sourceViewId: true, + targetViewId: true +}); + +@Deserializable("linkButton") +export class LinkButtonField extends ObjectField { + @serializable(object(LinkButtonSchema)) + readonly data: LinkButtonData; + + constructor(data: LinkButtonData) { + super(); + this.data = data; + } + + [Copy]() { + return new LinkButtonField(this.data); + } + + [ToScriptString]() { + return "invalid"; + } +} |