aboutsummaryrefslogtreecommitdiff
path: root/src/client/views
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-07-10 11:54:49 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-07-10 11:54:49 -0400
commit982dbab4306008e30cf74eea1d3155d39912a513 (patch)
treec6274f1f4352ad3075d0353b47f12567d7ac5246 /src/client/views
parentce39600f0c7b9013c7c8ec8c74eb54d2d5e4c50e (diff)
Added readonly mode to documents
Diffstat (limited to 'src/client/views')
-rw-r--r--src/client/views/MainView.tsx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index da126fb74..204503d7f 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -13,7 +13,7 @@ import { Id } from '../../new_fields/FieldSymbols';
import { InkTool } from '../../new_fields/InkField';
import { List } from '../../new_fields/List';
import { listSpec } from '../../new_fields/Schema';
-import { Cast, FieldValue, NumCast } from '../../new_fields/Types';
+import { Cast, FieldValue, NumCast, BoolCast } from '../../new_fields/Types';
import { CurrentUserUtils } from '../../server/authentication/models/current_user_utils';
import { RouteStore } from '../../server/RouteStore';
import { emptyFunction, returnOne, returnTrue } from '../../Utils';
@@ -194,6 +194,11 @@ export class MainView extends React.Component {
openWorkspace = async (doc: Doc, fromHistory = false) => {
CurrentUserUtils.MainDocId = doc[Id];
this.mainContainer = doc;
+ if (BoolCast(doc.readOnly)) {
+ DocServer.makeReadOnly();
+ } else {
+ DocServer.makeEditable();
+ }
fromHistory || HistoryUtil.pushState({ type: "doc", docId: doc[Id], initializers: {} });
const col = await Cast(CurrentUserUtils.UserDocument.optionalRightCollection, Doc);
// if there is a pending doc, and it has new data, show it (syip: we use a timeout to prevent collection docking view from being uninitialized)