Skip to content

Commit

Permalink
BUGFIX: don't show NodeToolbar for document nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaip committed Mar 7, 2018
1 parent e2fd121 commit 32e2028
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/neos-ui-guest-frame/src/InlineUI/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {$transform, $get, $contains} from 'plow-js';
import {actions, selectors} from '@neos-project/neos-ui-redux-store';
import {neos} from '@neos-project/neos-ui-decorators';

import NodeToolbar from './NodeToolbar/index';

import style from './style.css';

@neos(globalRegistry => ({
nodeTypesRegistry: globalRegistry.get('@neos-project/neos-ui-contentrepository')
}))
@connect($transform({
focused: $get('cr.nodes.focused'),
focusedNode: selectors.CR.Nodes.focusedSelector,
Expand All @@ -22,6 +26,7 @@ export default class InlineUI extends PureComponent {
static propTypes = {
focused: PropTypes.object,
focusedNode: PropTypes.object,
nodeTypesRegistry: PropTypes.object,
destructiveOperationsAreDisabled: PropTypes.bool.isRequired,
requestScrollIntoView: PropTypes.func.isRequired,
shouldScrollIntoView: PropTypes.bool.isRequired,
Expand All @@ -32,7 +37,12 @@ export default class InlineUI extends PureComponent {
render() {
const focused = this.props.focused.toJS();
const focusedNodeContextPath = focused.contextPath;
const {shouldScrollIntoView, requestScrollIntoView, destructiveOperationsAreDisabled, clipboardMode, clipboardNodeContextPath} = this.props;
const {nodeTypesRegistry, focusedNode, shouldScrollIntoView, requestScrollIntoView, destructiveOperationsAreDisabled, clipboardMode, clipboardNodeContextPath} = this.props;
const isDocument = nodeTypesRegistry.hasRole($get('nodeType', focusedNode), 'document');
// Don't render toolbar for the document nodes
if (isDocument) {
return null;
}
const isCut = focusedNodeContextPath === clipboardNodeContextPath && clipboardMode === 'Move';
const isCopied = focusedNodeContextPath === clipboardNodeContextPath && clipboardMode === 'Copy';
const canBeDeleted = $get('policy.canRemove', this.props.focusedNode);
Expand Down

0 comments on commit 32e2028

Please sign in to comment.