aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-06-27 21:06:44 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-06-27 21:06:44 -0400
commitb340defb4a4b8c5b7604099e7b0fb5b6846f70aa (patch)
tree48f6fb7be2aa9f5d7652797901deecab6651e2ce /src
parente8bac5f5e41524e1258d83a98fb440732190fda8 (diff)
fixed safe mode & reverted to apply ontly to freeform and schema collections.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/Main.tsx2
-rw-r--r--src/client/views/collections/CollectionView.tsx10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 6878658a8..77e37834d 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -6,12 +6,14 @@ import * as React from 'react';
import { DocServer } from "../DocServer";
import { AssignAllExtensions } from "../../extensions/General/Extensions";
import { Networking } from "../Network";
+import { CollectionView } from "./collections/CollectionView";
AssignAllExtensions();
export let resolvedPorts: { server: number, socket: number };
(async () => {
+ window.location.search.includes("safe") && CollectionView.SetSafeMode(true);
const info = await CurrentUserUtils.loadCurrentUser();
resolvedPorts = JSON.parse(await Networking.FetchFromServer("/resolvedPorts"));
DocServer.init(window.location.protocol, window.location.hostname, resolvedPorts.socket, info.email);
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 5e3026979..5f6e8c4a7 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -105,7 +105,15 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
get collectionViewType(): CollectionViewType | undefined {
const viewField = StrCast(this.props.Document._viewType);
- return CollectionView._safeMode ? CollectionViewType.Tree : viewField as any as CollectionViewType;
+ if (CollectionView._safeMode) {
+ if (viewField === CollectionViewType.Freeform || viewField === CollectionViewType.Schema) {
+ return CollectionViewType.Tree;
+ }
+ if (viewField === CollectionViewType.Invalid) {
+ return CollectionViewType.Freeform;
+ }
+ }
+ return viewField as any as CollectionViewType;
}
active = (outsideReaction?: boolean) => (this.props.isSelected(outsideReaction) || this.props.rootSelected(outsideReaction) || this.props.Document.forceActive || this._isChildActive || this.props.renderDepth === 0) ? true : false;