Skip to content
Snippets Groups Projects
Unverified Commit 1519fcfc authored by Jessie Keck's avatar Jessie Keck Committed by GitHub
Browse files

Merge pull request #31 from ProjectMirador/show-anno-companionwindow

Always make sure the annotation side bar button is present
parents 022bb083 07215d3b
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,12 @@ import miradorAnnotationPlugin from './plugins/miradorAnnotationPlugin';
import externalStorageAnnotationPlugin from './plugins/externalStorageAnnotationPlugin';
import canvasAnnotationsPlugin from './plugins/canvasAnnotationsPlugin';
import annotationCreationCompanionWindow from './plugins/annotationCreationCompanionWindow';
import windowSideBarButtonsPlugin from './plugins/windowSideBarButtonsPlugin';
export {
miradorAnnotationPlugin, externalStorageAnnotationPlugin,
canvasAnnotationsPlugin, annotationCreationCompanionWindow,
windowSideBarButtonsPlugin,
};
export default [
......@@ -13,4 +15,5 @@ export default [
externalStorageAnnotationPlugin,
canvasAnnotationsPlugin,
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