aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocComponent.tsx
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-13 13:02:10 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-13 13:02:10 -0500
commite5a23f3d3966db9b57a1919f8d9bfff9fdfedf1e (patch)
treef51374cf0b551737728849fb8cc1b9d9eff0005f /src/client/views/DocComponent.tsx
parentd075dbb4b1d2289a47e929c1e7378f341c2a9c35 (diff)
parent0636d49885f4d420a3d6cdc5f33d2bfda40e3db7 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into anika_schema_view
Diffstat (limited to 'src/client/views/DocComponent.tsx')
-rw-r--r--src/client/views/DocComponent.tsx14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 3af570f1e..9b9a28f0f 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -1,4 +1,4 @@
-import { Doc, Opt, DataSym, DocListCast } from '../../fields/Doc';
+import { Doc, Opt, DataSym, DocListCast, AclSym, AclReadonly, AclAddonly } from '../../fields/Doc';
import { Touchable } from './Touchable';
import { computed, action, observable } from 'mobx';
import { Cast, BoolCast, ScriptCast } from '../../fields/Types';
@@ -138,9 +138,15 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps, T
const docList = DocListCast(targetDataDoc[this.annotationKey]);
const added = docs.filter(d => !docList.includes(d));
if (added.length) {
- added.map(doc => doc.context = this.props.Document);
- targetDataDoc[this.annotationKey] = new List<Doc>([...docList, ...added]);
- targetDataDoc[this.annotationKey + "-lastModified"] = new DateField(new Date(Date.now()));
+ if (this.dataDoc[AclSym] === AclReadonly) {
+ return false;
+ } else if (this.dataDoc[AclSym] === AclAddonly) {
+ added.map(doc => Doc.AddDocToList(targetDataDoc, this.annotationKey, doc));
+ } else {
+ added.map(doc => doc.context = this.props.Document);
+ targetDataDoc[this.annotationKey] = new List<Doc>([...docList, ...added]);
+ targetDataDoc[this.annotationKey + "-lastModified"] = new DateField(new Date(Date.now()));
+ }
}
return true;
}