From de0a1a003eb43b545c682e41388e30a476e33b68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mathias=20Maa=C3=9F?= <mathias.maass@uni-leipzig.de>
Date: Wed, 13 Mar 2019 15:03:45 +0100
Subject: [PATCH] Remove plugin related stuff as prerequisite for #2098.

---
 __tests__/integration/mirador/plugins.html    | 138 ------------------
 __tests__/integration/mirador/plugins.test.js |  31 ----
 .../components/CompanionWindowFactory.test.js |   2 +-
 .../src/components/WindowSideBar.test.js      |   2 +-
 .../components/WorkspaceControlPanel.test.js  |   2 +-
 __tests__/src/lib/componentPlugins.test.js    |  30 ----
 src/containers/CompanionWindow.js             |   2 -
 src/containers/OpenSeadragonViewer.js         |   2 -
 src/containers/PrimaryWindow.js               |   2 -
 src/containers/ThumbnailNavigation.js         |   2 -
 src/containers/ViewerNavigation.js            |   2 -
 src/containers/WindowSideBar.js               |   2 -
 src/containers/WindowSideBarButtons.js        |   2 -
 src/containers/WindowSideBarInfoPanel.js      |   2 -
 src/containers/WindowThumbnailSettings.js     |   2 -
 src/containers/WindowTopBar.js                |   2 -
 src/containers/WindowTopBarButtons.js         |   3 +-
 src/containers/WindowTopMenu.js               |   2 -
 src/containers/WindowTopMenuButton.js         |   2 -
 src/containers/WindowViewSettings.js          |   2 -
 src/containers/WindowViewer.js                |   2 -
 src/containers/WorkspaceAddButton.js          |   2 -
 .../WorkspaceControlPanelButtons.js           |   3 +-
 src/containers/WorkspaceExport.js             |   2 -
 src/containers/WorkspaceFullScreenButton.js   |   2 -
 src/containers/WorkspaceMenu.js               |   2 -
 src/containers/WorkspaceMenuButton.js         |   2 -
 src/lib/componentPlugins.js                   |  14 --
 src/lib/miradorWithPlugins.js                 |  70 ---------
 29 files changed, 5 insertions(+), 328 deletions(-)
 delete mode 100644 __tests__/integration/mirador/plugins.html
 delete mode 100644 __tests__/integration/mirador/plugins.test.js
 delete mode 100644 __tests__/src/lib/componentPlugins.test.js
 delete mode 100644 src/lib/componentPlugins.js
 delete mode 100644 src/lib/miradorWithPlugins.js

diff --git a/__tests__/integration/mirador/plugins.html b/__tests__/integration/mirador/plugins.html
deleted file mode 100644
index 3310af53b..000000000
--- a/__tests__/integration/mirador/plugins.html
+++ /dev/null
@@ -1,138 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <meta name="theme-color" content="#000000">
-    <title>Mirador</title>
-  </head>
-  <body>
-    <div id="mirador" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;"></div>
-    <script src="../../../node_modules/react/umd/react.development.js"></script>
-    <!-- Request from CDN if unavailable locally -->
-    <script type="text/javascript">
-      if (!window.React) {
-        var script = document.createElement('script'); script.src = "https://unpkg.com/react@16/umd/react.development.js"; script.crossorigin = true; document.head.appendChild(script)
-      }
-    </script>
-    <script src="../../../node_modules/react-dom/umd/react-dom.development.js"></script>
-    <!-- Request from CDN if unavailable locally -->
-    <script type="text/javascript">
-      if (!window.ReactDOM) {
-        var script = document.createElement('script'); script.src = "https://unpkg.com/react-dom@16/umd/react-dom.development.js"; script.crossorigin = true; document.head.appendChild(script)
-      }
-    </script>
-    <script>document.write("<script type='text/javascript' src='../../../dist/mirador.min.js?v=" + Date.now() + "'><\/script>");</script>
-    <script type="text/javascript">
-      class MiradorShareButton extends React.Component {
-        constructor(props) {
-          super(props);
-
-          this.handleClick = this.handleClick.bind(this);
-        }
-        handleClick() {
-          alert('Share this stuff')
-        }
-        render() {
-          return React.createElement('button', { className: 'share', onClick: this.handleClick}, 'Share');
-        }
-      }
-      const miradorShareButton = {
-        name: 'miradorShareButton',
-        component: MiradorShareButton,
-        parent: 'WindowTopBarButtons',
-      }
-      Mirador.plugins.miradorShareButton = miradorShareButton;
-      class MiradorRuler extends React.Component {
-        constructor(props) {
-          super(props);
-          this._isMounted = false;
-          this.state = {
-            zooming: false,
-          }
-          this.zoomToColor = this.zoomToColor.bind(this);
-        }
-        componentDidMount() {
-          this._isMounted = true;
-          const that = this;
-          this.props.pluginParent().viewer.addHandler('zoom', (e) => {
-            if (that._isMounted) {
-              that.props.setZooming('123', true);
-              that.setState({
-                zooming: true
-              })
-            }
-          })
-          // Super hacky don't do this for real
-          function resetStyle() {
-            if (that._isMounted) {
-              that.props.setZooming('123', false);
-              that.setState({
-                zooming: false
-              })
-            }
-            setTimeout(resetStyle, 750)
-          }
-          resetStyle();
-        }
-        componentWillUnmount() {
-          this._isMounted = false;
-          if (this.props.pluginParent()) {
-            this.props.pluginParent().viewer.removeHandler('zoom');
-          }
-        }
-        zoomToColor(zooming) {
-          if (zooming) {
-            return 'red'
-          }
-          return 'black'
-        }
-        render() {
-          return React.createElement('div', {className: 'mirador-ruler', style: { position: 'absolute', bottom: 0, color: this.zoomToColor(this.state.zooming)}}, 'I am a ruler')
-        }
-      }
-
-      const zoomReducer = (state = {}, action) => {
-        switch (action.type) {
-          case 'SET_ZOOMING':
-            return action.zooming;
-          default:
-            return state;
-        }
-      };
-
-      const setZooming = (windowId, zooming) => {
-        return { type: 'SET_ZOOMING', windowId, zooming };
-      }
-
-      const miradorRuler = {
-        name: 'miradorRuler',
-        component: MiradorRuler,
-        parent: 'OpenSeadragonViewer',
-        reducers: {
-          zooming: zoomReducer
-        },
-        actions: {
-          setZooming: setZooming
-        },
-        mapStateToProps: ({ manifests }, props) => {
-          return {
-            manifests // return the part of the state I need here.
-          }
-        },
-        mapDispatchToProps: (dispatch) => {
-          return {
-            setZooming: (windowId, level) => (
-              dispatch(setZooming(windowId, level))
-            ),
-          }
-        },
-      }
-      Mirador.plugins.miradorRuler = miradorRuler;
-      var miradorInstance = Mirador.viewer({
-        id: 'mirador',
-        plugins: ['miradorShareButton', 'miradorRuler']
-      });
-    </script>
-  </body>
-</html>
diff --git a/__tests__/integration/mirador/plugins.test.js b/__tests__/integration/mirador/plugins.test.js
deleted file mode 100644
index 8816fc2fa..000000000
--- a/__tests__/integration/mirador/plugins.test.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* global miradorInstance */
-
-describe('Mirador plugin use', () => {
-  beforeAll(async () => {
-    await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins.html');
-    await expect(page).toClick('#addBtn');
-    await expect(page).toClick('.mirador-add-resource-button');
-    await expect(page).toFill('#manifestURL', 'http://localhost:5000/api/sn904cj3439');
-    await expect(page).toClick('#fetchBtn');
-
-    await expect(page).toMatchElement('[data-manifestid="http://localhost:5000/api/sn904cj3439"] button');
-    await expect(page).toClick('[data-manifestid="http://localhost:5000/api/sn904cj3439"] button');
-  });
-  it('displays "Share Button" plugin', async () => {
-    await expect(page).toMatchElement('button', { text: 'Share' });
-    page.on('dialog', async (dialog) => {
-      expect(dialog.message()).toBe('Share this stuff');
-      await dialog.dismiss();
-    });
-    await expect(page).toClick('button.share');
-  });
-  it('displays "Ruler" plugin', async () => {
-    await expect(page).toMatchElement('.mirador-ruler');
-    // await page.waitFor(1000);
-    // Test that composed reducer and actions are working.
-    const zooming = await page.evaluate(() => (
-      miradorInstance.store.getState().zooming
-    ));
-    await expect(zooming).toBe(false);
-  });
-});
diff --git a/__tests__/src/components/CompanionWindowFactory.test.js b/__tests__/src/components/CompanionWindowFactory.test.js
index 1230c71a6..7e5638020 100644
--- a/__tests__/src/components/CompanionWindowFactory.test.js
+++ b/__tests__/src/components/CompanionWindowFactory.test.js
@@ -23,7 +23,7 @@ describe('CompanionWindowFactory', () => {
         content: 'info',
       });
 
-      expect(wrapper.find('WithStyles(Connect(Connect(miradorWithPlugins(WindowSideBarInfoPanel))))').length).toBe(1);
+      expect(wrapper.find('WithStyles(Connect(WindowSideBarInfoPanel))').length).toBe(1);
     });
   });
 
diff --git a/__tests__/src/components/WindowSideBar.test.js b/__tests__/src/components/WindowSideBar.test.js
index e7875cf23..6eda40963 100644
--- a/__tests__/src/components/WindowSideBar.test.js
+++ b/__tests__/src/components/WindowSideBar.test.js
@@ -10,6 +10,6 @@ describe('WindowSideBar', () => {
 
   it('renders without an error', () => {
     expect(wrapper.find('WithStyles(Drawer)').length).toBe(1);
-    expect(wrapper.find('WithStyles(Connect(Connect(miradorWithPlugins(WindowSideBarButtons))))').length).toBe(1);
+    expect(wrapper.find('WithStyles(Connect(WindowSideBarButtons))').length).toBe(1);
   });
 });
diff --git a/__tests__/src/components/WorkspaceControlPanel.test.js b/__tests__/src/components/WorkspaceControlPanel.test.js
index 6f6fd6ee0..855a74e2c 100644
--- a/__tests__/src/components/WorkspaceControlPanel.test.js
+++ b/__tests__/src/components/WorkspaceControlPanel.test.js
@@ -22,6 +22,6 @@ describe('WorkspaceControlPanel', () => {
 
   it('renders without an error', () => {
     expect(wrapper.find('WithStyles(AppBar)').length).toBe(1);
-    expect(wrapper.find('Connect(miradorWithPlugins(WorkspaceControlPanelButtons))').length).toBe(1);
+    expect(wrapper.find('WorkspaceControlPanelButtons').length).toBe(1);
   });
 });
diff --git a/__tests__/src/lib/componentPlugins.test.js b/__tests__/src/lib/componentPlugins.test.js
deleted file mode 100644
index dde13deb4..000000000
--- a/__tests__/src/lib/componentPlugins.test.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import componentPlugins from '../../../src/lib/componentPlugins';
-
-describe('componentPlugins', () => {
-  const originalMirador = window.Mirador;
-  beforeAll(() => {
-    window.Mirador = {
-      plugins: {
-        fooPlugin: {
-          name: 'fooPlugin',
-          parent: 'FooComponent',
-        },
-        barPlugin: {
-          name: 'barPlugin',
-          parent: 'FooComponent',
-        },
-      },
-    };
-  });
-  afterAll(() => {
-    window.Mirador = originalMirador;
-  });
-  it('only selects plugins that are defined in config', () => {
-    expect(componentPlugins('FooComponent', ['barPlugin'])[0].name).toEqual('barPlugin');
-    expect(componentPlugins('FooComponent', ['barPlugin']).length).toEqual(1);
-  });
-  it('only selects plugins that define component as parent', () => {
-    expect(componentPlugins('BarComponent', ['barPlugin'])).toEqual([]);
-    expect(componentPlugins('FooComponent', ['fooPlugin']).length).toEqual(1);
-  });
-});
diff --git a/src/containers/CompanionWindow.js b/src/containers/CompanionWindow.js
index ce99afa5d..6f5c59adb 100644
--- a/src/containers/CompanionWindow.js
+++ b/src/containers/CompanionWindow.js
@@ -3,7 +3,6 @@ import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core';
 import * as actions from '../state/actions';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { CompanionWindow } from '../components/CompanionWindow';
 
 /**
@@ -78,7 +77,6 @@ const enhance = compose(
   withTranslation(),
   withStyles(styles),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
 );
 
 export default enhance(CompanionWindow);
diff --git a/src/containers/OpenSeadragonViewer.js b/src/containers/OpenSeadragonViewer.js
index 4e12d11f0..176c92cc3 100644
--- a/src/containers/OpenSeadragonViewer.js
+++ b/src/containers/OpenSeadragonViewer.js
@@ -3,7 +3,6 @@ import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core';
 import { fade } from '@material-ui/core/styles/colorManipulator';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { OpenSeadragonViewer } from '../components/OpenSeadragonViewer';
 import * as actions from '../state/actions';
 import {
@@ -59,7 +58,6 @@ const enhance = compose(
   withStyles(styles),
   withTranslation(),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
   // further HOC go here
 );
 
diff --git a/src/containers/PrimaryWindow.js b/src/containers/PrimaryWindow.js
index e0786efdb..ccfd95853 100644
--- a/src/containers/PrimaryWindow.js
+++ b/src/containers/PrimaryWindow.js
@@ -1,10 +1,8 @@
 import { compose } from 'redux';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { PrimaryWindow } from '../components/PrimaryWindow';
 
 
 const enhance = compose(
-  miradorWithPlugins,
   // further HOC go here
 );
 
diff --git a/src/containers/ThumbnailNavigation.js b/src/containers/ThumbnailNavigation.js
index 1246f0695..a90db0ffb 100644
--- a/src/containers/ThumbnailNavigation.js
+++ b/src/containers/ThumbnailNavigation.js
@@ -2,7 +2,6 @@ import { compose } from 'redux';
 import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core/styles';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import CanvasGroupings from '../lib/CanvasGroupings';
 import * as actions from '../state/actions';
 import { ThumbnailNavigation } from '../components/ThumbnailNavigation';
@@ -42,7 +41,6 @@ const enhance = compose(
   withStyles(styles),
   withTranslation(),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
   // further HOC go here
 );
 
diff --git a/src/containers/ViewerNavigation.js b/src/containers/ViewerNavigation.js
index 18366fbb9..e098cf25d 100644
--- a/src/containers/ViewerNavigation.js
+++ b/src/containers/ViewerNavigation.js
@@ -1,7 +1,6 @@
 import { compose } from 'redux';
 import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import * as actions from '../state/actions';
 import { ViewerNavigation } from '../components/ViewerNavigation';
 
@@ -17,7 +16,6 @@ const mapDispatchToProps = {
 const enhance = compose(
   withTranslation(),
   connect(null, mapDispatchToProps),
-  miradorWithPlugins,
   // further HOC go here
 );
 
diff --git a/src/containers/WindowSideBar.js b/src/containers/WindowSideBar.js
index 259352223..6e8f60b93 100644
--- a/src/containers/WindowSideBar.js
+++ b/src/containers/WindowSideBar.js
@@ -1,7 +1,6 @@
 import { connect } from 'react-redux';
 import { compose } from 'redux';
 import { withStyles } from '@material-ui/core';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { WindowSideBar } from '../components/WindowSideBar';
 
 /**
@@ -43,7 +42,6 @@ const styles = theme => ({
 const enhance = compose(
   withStyles(styles),
   connect(mapStateToProps, null),
-  miradorWithPlugins,
 );
 
 export default enhance(WindowSideBar);
diff --git a/src/containers/WindowSideBarButtons.js b/src/containers/WindowSideBarButtons.js
index 96116259a..c768e1338 100644
--- a/src/containers/WindowSideBarButtons.js
+++ b/src/containers/WindowSideBarButtons.js
@@ -3,7 +3,6 @@ import { connect } from 'react-redux';
 import { withStyles } from '@material-ui/core';
 import { withTranslation } from 'react-i18next';
 import * as actions from '../state/actions';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import {
   getCompanionWindowForPosition,
   getSelectedCanvas,
@@ -60,7 +59,6 @@ const enhance = compose(
   withTranslation(),
   withStyles(style),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
 );
 
 export default enhance(WindowSideBarButtons);
diff --git a/src/containers/WindowSideBarInfoPanel.js b/src/containers/WindowSideBarInfoPanel.js
index 1ac53d65f..1c5e80bdf 100644
--- a/src/containers/WindowSideBarInfoPanel.js
+++ b/src/containers/WindowSideBarInfoPanel.js
@@ -2,7 +2,6 @@ import { compose } from 'redux';
 import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import {
   getDestructuredMetadata,
   getCanvasLabel,
@@ -44,7 +43,6 @@ const enhance = compose(
   withTranslation(),
   withStyles(styles),
   connect(mapStateToProps, null),
-  miradorWithPlugins,
 );
 
 export default enhance(WindowSideBarInfoPanel);
diff --git a/src/containers/WindowThumbnailSettings.js b/src/containers/WindowThumbnailSettings.js
index 14d15a397..c796e5868 100644
--- a/src/containers/WindowThumbnailSettings.js
+++ b/src/containers/WindowThumbnailSettings.js
@@ -1,7 +1,6 @@
 import { compose } from 'redux';
 import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import * as actions from '../state/actions';
 import { getThumbnailNavigationPosition } from '../state/selectors';
 import { WindowThumbnailSettings } from '../components/WindowThumbnailSettings';
@@ -27,7 +26,6 @@ const mapStateToProps = (state, props) => (
 const enhance = compose(
   withTranslation(),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
   // further HOC go here
 );
 
diff --git a/src/containers/WindowTopBar.js b/src/containers/WindowTopBar.js
index d63693b48..4da895501 100644
--- a/src/containers/WindowTopBar.js
+++ b/src/containers/WindowTopBar.js
@@ -3,7 +3,6 @@ import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core';
 import * as actions from '../state/actions';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { getWindowManifest, getManifestTitle } from '../state/selectors';
 import { WindowTopBar } from '../components/WindowTopBar';
 
@@ -46,7 +45,6 @@ const enhance = compose(
   withTranslation(),
   withStyles(styles),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
 );
 
 export default enhance(WindowTopBar);
diff --git a/src/containers/WindowTopBarButtons.js b/src/containers/WindowTopBarButtons.js
index fe70d52ef..b29722321 100644
--- a/src/containers/WindowTopBarButtons.js
+++ b/src/containers/WindowTopBarButtons.js
@@ -1,4 +1,3 @@
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { WindowTopBarButtons } from '../components/WindowTopBarButtons';
 
-export default miradorWithPlugins(WindowTopBarButtons);
+export default WindowTopBarButtons;
diff --git a/src/containers/WindowTopMenu.js b/src/containers/WindowTopMenu.js
index 1dedc34c1..cc8964c3a 100644
--- a/src/containers/WindowTopMenu.js
+++ b/src/containers/WindowTopMenu.js
@@ -1,6 +1,5 @@
 import { compose } from 'redux';
 import { connect } from 'react-redux';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { WindowTopMenu } from '../components/WindowTopMenu';
 
 /**
@@ -14,7 +13,6 @@ const mapStateToProps = state => ({
 
 const enhance = compose(
   connect(mapStateToProps, null),
-  miradorWithPlugins,
 );
 
 export default enhance(WindowTopMenu);
diff --git a/src/containers/WindowTopMenuButton.js b/src/containers/WindowTopMenuButton.js
index b77dd8099..bcef8e986 100644
--- a/src/containers/WindowTopMenuButton.js
+++ b/src/containers/WindowTopMenuButton.js
@@ -1,7 +1,6 @@
 import { compose } from 'redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { WindowTopMenuButton } from '../components/WindowTopMenuButton';
 
 /**
@@ -21,7 +20,6 @@ const styles = theme => ({
 const enhance = compose(
   withTranslation(),
   withStyles(styles),
-  miradorWithPlugins,
 );
 
 export default enhance(WindowTopMenuButton);
diff --git a/src/containers/WindowViewSettings.js b/src/containers/WindowViewSettings.js
index 940356b89..e2c12f72f 100644
--- a/src/containers/WindowViewSettings.js
+++ b/src/containers/WindowViewSettings.js
@@ -1,7 +1,6 @@
 import { compose } from 'redux';
 import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import * as actions from '../state/actions';
 import { getWindowViewType } from '../state/selectors';
 import { WindowViewSettings } from '../components/WindowViewSettings';
@@ -27,7 +26,6 @@ const mapStateToProps = (state, props) => (
 const enhance = compose(
   withTranslation(),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
 );
 
 export default enhance(WindowViewSettings);
diff --git a/src/containers/WindowViewer.js b/src/containers/WindowViewer.js
index 5c8b47026..a6582987d 100644
--- a/src/containers/WindowViewer.js
+++ b/src/containers/WindowViewer.js
@@ -1,7 +1,6 @@
 import { compose } from 'redux';
 import { connect } from 'react-redux';
 import * as actions from '../state/actions';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import {
   getCanvasLabel,
   getSelectedCanvas,
@@ -36,7 +35,6 @@ const mapDispatchToProps = {
 
 const enhance = compose(
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
   // further HOC go here
 );
 
diff --git a/src/containers/WorkspaceAddButton.js b/src/containers/WorkspaceAddButton.js
index 255d696e5..67f7c99cf 100644
--- a/src/containers/WorkspaceAddButton.js
+++ b/src/containers/WorkspaceAddButton.js
@@ -3,7 +3,6 @@ import { compose } from 'redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core';
 import * as actions from '../state/actions';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { WorkspaceAddButton } from '../components/WorkspaceAddButton';
 
 /**
@@ -40,7 +39,6 @@ const enhance = compose(
   withTranslation(),
   withStyles(styles),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
 );
 
 export default enhance(WorkspaceAddButton);
diff --git a/src/containers/WorkspaceControlPanelButtons.js b/src/containers/WorkspaceControlPanelButtons.js
index 1535ffb5c..5e20f4d58 100644
--- a/src/containers/WorkspaceControlPanelButtons.js
+++ b/src/containers/WorkspaceControlPanelButtons.js
@@ -1,5 +1,4 @@
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { WorkspaceControlPanelButtons }
   from '../components/WorkspaceControlPanelButtons';
 
-export default miradorWithPlugins(WorkspaceControlPanelButtons);
+export default WorkspaceControlPanelButtons;
diff --git a/src/containers/WorkspaceExport.js b/src/containers/WorkspaceExport.js
index 89bac46c3..9931f2a4d 100644
--- a/src/containers/WorkspaceExport.js
+++ b/src/containers/WorkspaceExport.js
@@ -1,7 +1,6 @@
 import { compose } from 'redux';
 import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { WorkspaceExport } from '../components/WorkspaceExport';
 
 /**
@@ -14,7 +13,6 @@ const mapStateToProps = state => ({ state });
 const enhance = compose(
   withTranslation(),
   connect(mapStateToProps, {}),
-  miradorWithPlugins,
 );
 
 export default enhance(WorkspaceExport);
diff --git a/src/containers/WorkspaceFullScreenButton.js b/src/containers/WorkspaceFullScreenButton.js
index 9301b3b99..adb534737 100644
--- a/src/containers/WorkspaceFullScreenButton.js
+++ b/src/containers/WorkspaceFullScreenButton.js
@@ -2,7 +2,6 @@ import { connect } from 'react-redux';
 import { compose } from 'redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import * as actions from '../state/actions';
 import { WorkspaceFullScreenButton }
   from '../components/WorkspaceFullScreenButton';
@@ -38,7 +37,6 @@ const enhance = compose(
   withTranslation(),
   withStyles(styles),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
 );
 
 export default enhance(WorkspaceFullScreenButton);
diff --git a/src/containers/WorkspaceMenu.js b/src/containers/WorkspaceMenu.js
index 749ba7795..5f17c008d 100644
--- a/src/containers/WorkspaceMenu.js
+++ b/src/containers/WorkspaceMenu.js
@@ -1,7 +1,6 @@
 import { compose } from 'redux';
 import { connect } from 'react-redux';
 import { withTranslation } from 'react-i18next';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import * as actions from '../state/actions';
 import { WorkspaceMenu } from '../components/WorkspaceMenu';
 
@@ -27,7 +26,6 @@ const mapStateToProps = state => ({
 const enhance = compose(
   withTranslation(),
   connect(mapStateToProps, mapDispatchToProps),
-  miradorWithPlugins,
 );
 
 export default enhance(WorkspaceMenu);
diff --git a/src/containers/WorkspaceMenuButton.js b/src/containers/WorkspaceMenuButton.js
index 6c2ddb92c..a7f928e67 100644
--- a/src/containers/WorkspaceMenuButton.js
+++ b/src/containers/WorkspaceMenuButton.js
@@ -1,7 +1,6 @@
 import { compose } from 'redux';
 import { withTranslation } from 'react-i18next';
 import { withStyles } from '@material-ui/core';
-import miradorWithPlugins from '../lib/miradorWithPlugins';
 import { WorkspaceMenuButton } from '../components/WorkspaceMenuButton';
 
 /**
@@ -21,7 +20,6 @@ const styles = theme => ({
 const enhance = compose(
   withTranslation(),
   withStyles(styles),
-  miradorWithPlugins,
   // further HOC
 );
 
diff --git a/src/lib/componentPlugins.js b/src/lib/componentPlugins.js
deleted file mode 100644
index a97841f2a..000000000
--- a/src/lib/componentPlugins.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * componentPlugins - gets window plugins based on a component parent
- */
-export default function componentPlugins(componentName, plugins = []) {
-  // TODO: Figure out how to handle when not running under window. Probably not
-  // a pressing priority, but relevant for tests
-  return plugins.map((pluginName) => {
-    if (window.Mirador.plugins[pluginName]
-        && window.Mirador.plugins[pluginName].parent === componentName) {
-      return window.Mirador.plugins[pluginName];
-    }
-    return null;
-  }).filter(plugin => (plugin !== (undefined || null)));
-}
diff --git a/src/lib/miradorWithPlugins.js b/src/lib/miradorWithPlugins.js
deleted file mode 100644
index ab24325b3..000000000
--- a/src/lib/miradorWithPlugins.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import React, { Component } from 'react';
-import { compose } from 'redux';
-import PropTypes from 'prop-types';
-import { connect } from 'react-redux';
-import componentPlugins from './componentPlugins';
-/**
- * miradorWithPlugins - renders and returns a component with provided plugins
- *
- * @param  {type} WrappedComponent
- */
-export default function miradorWithPlugins(WrappedComponent) {
-  /**
-   */
-  class ConnectedComponent extends Component {
-    /**
-     * constructor -
-     */
-    constructor(props) {
-      super(props);
-
-      this.getPluginParent = this.getPluginParent.bind(this);
-    }
-
-    /**
-     * pluginParent - access the plugin's "parent"
-     */
-    getPluginParent() {
-      return this.pluginParent;
-    }
-
-    /**
-     * render - renders the wrapped component with the plugins.
-     */
-    render() {
-      const { config } = this.props;
-      const { plugins } = config;
-      return (
-        <>
-          <WrappedComponent {...this.props} ref={(parent) => { this.pluginParent = parent; }} />
-          {componentPlugins(WrappedComponent.name, plugins)
-            .map(component => React.createElement(
-              connect(component.mapStateToProps, component.mapDispatchToProps)(component.component),
-              { key: component.name, ...this.props, pluginParent: this.getPluginParent },
-            ))
-          }
-        </>
-      );
-    }
-  }
-
-  const wrappedComponentName = WrappedComponent.name || 'Component';
-
-  ConnectedComponent.displayName = `miradorWithPlugins(${wrappedComponentName})`;
-
-  ConnectedComponent.propTypes = {
-    config: PropTypes.instanceOf(Object).isRequired,
-  };
-
-  /**
-   */
-  const mapStateToProps = state => ({ config: state.config });
-
-
-  const enhance = compose(
-    connect(mapStateToProps),
-    // further HOC go here
-  );
-
-  return enhance(ConnectedComponent);
-}
-- 
GitLab