Skip to content
Snippets Groups Projects
Commit 2af7ba41 authored by Chris Beer's avatar Chris Beer
Browse files

Use a unique prop for allowing new windows to be created

parent 0795f3d5
Branches
Tags
No related merge requests found
......@@ -123,13 +123,13 @@ describe('Workspace', () => {
expect(addWindow).toHaveBeenCalledWith({ canvasId, manifest: manifestJson, manifestId });
});
it('is a no-op if isWorkspaceControlPanelVisible is off', () => {
it('is a no-op if allowNewWindows is off', () => {
const canvasId = 'canvasId';
const manifestId = 'manifest.json';
const manifestJson = { data: '123' };
const addWindow = jest.fn();
const wrapper = createWrapper({ addWindow, isWorkspaceControlPanelVisible: false });
const wrapper = createWrapper({ addWindow, allowNewWindows: false });
wrapper.find(IIIFDropTarget).simulate('drop', { canvasId, manifestId, manifestJson });
expect(addWindow).not.toHaveBeenCalled();
......
......@@ -24,9 +24,9 @@ export class Workspace extends React.Component {
/** */
handleDrop({ canvasId, manifestId, manifestJson }, props, monitor) {
const { addWindow, isWorkspaceControlPanelVisible } = this.props;
const { addWindow, allowNewWindows } = this.props;
if (!isWorkspaceControlPanelVisible) return;
if (!allowNewWindows) return;
addWindow({ canvasId, manifest: manifestJson, manifestId });
}
......@@ -131,6 +131,7 @@ export class Workspace extends React.Component {
Workspace.propTypes = {
addWindow: PropTypes.func,
allowNewWindows: PropTypes.bool,
classes: PropTypes.objectOf(PropTypes.string).isRequired,
isWorkspaceControlPanelVisible: PropTypes.bool.isRequired,
maximizedWindowIds: PropTypes.arrayOf(PropTypes.string),
......@@ -142,6 +143,7 @@ Workspace.propTypes = {
Workspace.defaultProps = {
addWindow: () => {},
allowNewWindows: true,
maximizedWindowIds: [],
windowIds: [],
};
......@@ -295,6 +295,7 @@ export default {
},
workspace: {
draggingEnabled: true,
allowNewWindows: true,
id: uuid(),
exposeModeOn: false, // unused?
height: 5000, // height of the elastic mode's virtual canvas
......
......@@ -14,6 +14,7 @@ import * as actions from '../state/actions';
*/
const mapStateToProps = state => (
{
allowNewWindows: state.config.workspace.allowNewWindows,
isWorkspaceControlPanelVisible: state.config.workspaceControlPanel.enabled,
maximizedWindowIds: getMaximizedWindowsIds(state),
windowIds: getWindowIds(state),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment