From 55aa83008ec4640a5d408454e092476eaba5f363 Mon Sep 17 00:00:00 2001 From: Lorenzo Natali Date: Tue, 18 Apr 2017 17:27:26 +0200 Subject: [PATCH] Fix #1738. Made optional share api and showTOC (#1739) With this options you can remove via configuration the API share tool and the showTOC checkbox. --- web/client/components/share/ShareEmbed.jsx | 25 +++++++++++++------ web/client/components/share/SharePanel.jsx | 8 ++++-- .../share/__tests__/ShareEmbed-test.jsx | 9 ++++++- .../share/__tests__/SharePanel-test.jsx | 12 +++++++-- web/client/plugins/Share.jsx | 3 +++ 5 files changed, 44 insertions(+), 13 deletions(-) diff --git a/web/client/components/share/ShareEmbed.jsx b/web/client/components/share/ShareEmbed.jsx index 5ee585fb4a..8ea237836b 100644 --- a/web/client/components/share/ShareEmbed.jsx +++ b/web/client/components/share/ShareEmbed.jsx @@ -24,10 +24,23 @@ require('./share.css'); const ShareEmbed = React.createClass({ propTypes: { - shareUrl: React.PropTypes.string + shareUrl: React.PropTypes.string, + showTOCToggle: React.PropTypes.bool }, - getInitialState() { - return {copied: false, forceDrawer: false}; + getInitialState() { + return {copied: false, forceDrawer: false}; + }, + getDefaultProps() { + return { + showTOCToggle: true + }; + }, + renderTools() { + if (this.props.showTOCToggle) { + return ( this.setState({forceDrawer: !this.state.forceDrawer})}> + + ); + } }, render() { @@ -44,16 +57,12 @@ const ShareEmbed = React.createClass({ ); return (
- -

- this.setState({forceDrawer: !this.state.forceDrawer})}> - - + {this.renderTools()}