aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/InkingCanvas.tsx2
-rw-r--r--src/fields/Document.ts7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/client/views/InkingCanvas.tsx b/src/client/views/InkingCanvas.tsx
index d7b8bf3c3..8d0121035 100644
--- a/src/client/views/InkingCanvas.tsx
+++ b/src/client/views/InkingCanvas.tsx
@@ -46,7 +46,7 @@ export class InkingCanvas extends React.Component<InkCanvasProps> {
}
set inkData(value: StrokeMap) {
- this.props.Document.SetOnPrototype(KeyStore.Ink, new InkField(value));
+ this.props.Document.SetDataOnPrototype(KeyStore.Ink, value, InkField);
}
componentDidMount() {
diff --git a/src/fields/Document.ts b/src/fields/Document.ts
index be0137128..b6439364a 100644
--- a/src/fields/Document.ts
+++ b/src/fields/Document.ts
@@ -249,6 +249,13 @@ export class Document extends Field {
}
@action
+ SetDataOnPrototype<T, U extends Field & { Data: T }>(key: Key, value: T, ctor: { new(): U }, replaceWrongType = true) {
+ this.GetAsync(KeyStore.Prototype, (f: Field) => {
+ (f as Document).SetData(key, value, ctor)
+ })
+ }
+
+ @action
SetData<T, U extends Field & { Data: T }>(key: Key, value: T, ctor: { new(): U }, replaceWrongType = true) {
let field = this.Get(key, true);