Skip to content
Snippets Groups Projects
Commit 07215d3b authored by Jack Reed's avatar Jack Reed
Browse files

Always make sure the annotation side bar button is present

parent 022bb083
No related branches found
No related tags found
No related merge requests found
...@@ -2,10 +2,12 @@ import miradorAnnotationPlugin from './plugins/miradorAnnotationPlugin'; ...@@ -2,10 +2,12 @@ import miradorAnnotationPlugin from './plugins/miradorAnnotationPlugin';
import externalStorageAnnotationPlugin from './plugins/externalStorageAnnotationPlugin'; import externalStorageAnnotationPlugin from './plugins/externalStorageAnnotationPlugin';
import canvasAnnotationsPlugin from './plugins/canvasAnnotationsPlugin'; import canvasAnnotationsPlugin from './plugins/canvasAnnotationsPlugin';
import annotationCreationCompanionWindow from './plugins/annotationCreationCompanionWindow'; import annotationCreationCompanionWindow from './plugins/annotationCreationCompanionWindow';
import windowSideBarButtonsPlugin from './plugins/windowSideBarButtonsPlugin';
export { export {
miradorAnnotationPlugin, externalStorageAnnotationPlugin, miradorAnnotationPlugin, externalStorageAnnotationPlugin,
canvasAnnotationsPlugin, annotationCreationCompanionWindow, canvasAnnotationsPlugin, annotationCreationCompanionWindow,
windowSideBarButtonsPlugin,
}; };
export default [ export default [
...@@ -13,4 +15,5 @@ export default [ ...@@ -13,4 +15,5 @@ export default [
externalStorageAnnotationPlugin, externalStorageAnnotationPlugin,
canvasAnnotationsPlugin, canvasAnnotationsPlugin,
annotationCreationCompanionWindow, annotationCreationCompanionWindow,
windowSideBarButtonsPlugin,
]; ];
import React, { Component } from 'react';
import PropTypes from 'prop-types';
/**
* A wrapper plugin that sets hasAnyAnnotations to true so that the annotation
* companion window button is present
*/
class WindowSideBarButtonWrapper extends Component {
/** */
render() {
const { PluginComponents, TargetComponent, targetProps } = this.props;
targetProps.hasAnyAnnotations = true;
return (
<TargetComponent
{...targetProps} // eslint-disable-line react/jsx-props-no-spreading
PluginComponents={PluginComponents}
/>
);
}
}
WindowSideBarButtonWrapper.propTypes = {
PluginComponents: PropTypes.array, // eslint-disable-line react/forbid-prop-types
TargetComponent: PropTypes.oneOfType([
PropTypes.func,
PropTypes.node,
]).isRequired,
targetProps: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
};
WindowSideBarButtonWrapper.defaultProps = {
PluginComponents: [],
};
export default {
component: WindowSideBarButtonWrapper,
mode: 'wrap',
target: 'WindowSideBarButtons',
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment