From 4bc687dcfac34edd4e2cd900ca4db1b59c8389f0 Mon Sep 17 00:00:00 2001
From: Chris Beer <cabeer@stanford.edu>
Date: Thu, 7 May 2020 10:16:43 -0700
Subject: [PATCH] Push the rest of the default mirador state into settings

---
 src/config/settings.js          | 4 ++++
 src/state/reducers/workspace.js | 9 ++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/config/settings.js b/src/config/settings.js
index 13f64480c..d67a98b56 100644
--- a/src/config/settings.js
+++ b/src/config/settings.js
@@ -1,3 +1,5 @@
+import uuid from 'uuid/v4';
+
 export default {
   canvasNavigation: { // Set the hight and width of canvas thumbnails in the  CanvasNavigation companion window
     height: 50,
@@ -258,6 +260,8 @@ export default {
     width: 100, // width of one canvas (doubled for book view) in ThumbnailNavigation area when position is "far-right"
   },
   workspace: {
+    draggingEnabled: true,
+    id: uuid(),
     exposeModeOn: false, // unused?
     height: 5000, // height of the elastic mode's virtual canvas
     showZoomControls: false, // Configure if zoom controls should be displayed by default
diff --git a/src/state/reducers/workspace.js b/src/state/reducers/workspace.js
index ffcdf1a5d..6f01403c9 100644
--- a/src/state/reducers/workspace.js
+++ b/src/state/reducers/workspace.js
@@ -1,4 +1,4 @@
-import uuid from 'uuid/v4';
+import settings from '../../config/settings';
 import ActionTypes from '../actions/action-types';
 
 /** Check if the viewport dimensions are fully specified */
@@ -21,10 +21,7 @@ function contains(container, containee) {
  * workspaceReducer
  */
 export const workspaceReducer = (
-  state = { // we'll need to abstract this more, methinks.
-    draggingEnabled: true,
-    id: uuid(),
-  },
+  state = settings.workspace,
   action,
 ) => {
   let newWorkspaceDimensions;
@@ -91,6 +88,8 @@ export const workspaceReducer = (
     case ActionTypes.TOGGLE_WORKSPACE_EXPOSE_MODE:
       return { ...state, exposeModeOn: !state.exposeModeOn };
     case ActionTypes.SET_CONFIG:
+    case ActionTypes.IMPORT_CONFIG:
+    case ActionTypes.UPDATE_CONFIG:
       return { ...state, ...action.config.workspace };
     case ActionTypes.IMPORT_MIRADOR_STATE:
       return action.state.workspace || {};
-- 
GitLab