Skip to content

Commit

Permalink
Merge pull request neos#1712 from neos/dimaip-fix-toolbar2
Browse files Browse the repository at this point in the history
BUGFIX: fix CKE toolbar for properties of documentNode
  • Loading branch information
dimaip authored Mar 22, 2018
2 parents 3397818 + 5d97e06 commit 122842e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/neos-ui-guest-frame/src/initializeGuestFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default ({globalRegistry, store}) => function * initializeGuestFrame() {
actions.CR.Nodes.focus(contextPath, fusionPath)
);
} else {
store.dispatch(actions.UI.ContentCanvas.setCurrentlyEditedPropertyName(''));
store.dispatch(
actions.CR.Nodes.unFocus()
);
Expand Down
10 changes: 9 additions & 1 deletion packages/neos-ui-redux-store/src/CR/Nodes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,15 @@ export const reducer = handleActions({
)
)),
),
[FOCUS]: ({contextPath, fusionPath}) => $set('cr.nodes.focused', new Map({contextPath, fusionPath})),
[FOCUS]: ({contextPath, fusionPath}) => state => $all(
$set('cr.nodes.focused', new Map({contextPath, fusionPath})),
// Set currentlyEditedPropertyName to currentlyEditedPropertyNameIntermediate and clear out currentlyEditedPropertyNameIntermediate
// This is needed because SET_CURRENTLY_EDITED_PROPERTY_NAME if fired before SET_FOCUS, but we still want to clear out currentlyEditedPropertyName
// when SET_FOCUS is triggered not from inline
$set('ui.contentCanvas.currentlyEditedPropertyName', $get('ui.contentCanvas.currentlyEditedPropertyNameIntermediate', state)),
$set('ui.contentCanvas.currentlyEditedPropertyNameIntermediate', ''),
state
),
[UNFOCUS]: () => $set('cr.nodes.focused', new Map({
contextPath: '',
fusionPath: ''
Expand Down
9 changes: 7 additions & 2 deletions packages/neos-ui-redux-store/src/UI/ContentCanvas/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {createAction} from 'redux-actions';
import {Map} from 'immutable';
import {$set, $get} from 'plow-js';
import {$set, $get, $all} from 'plow-js';

import {handleActions} from '@neos-project/utils-redux';

Expand Down Expand Up @@ -78,6 +78,7 @@ export const reducer = handleActions({
src: $get('ui.contentCanvas.src', state) || '',
formattingUnderCursor: new Map(),
currentlyEditedPropertyName: '',
currentlyEditedPropertyNameIntermediate: '',
isLoading: true,
focusedProperty: '',
backgroundColor: $get('ui.contentCanvas.backgroundColor', state),
Expand Down Expand Up @@ -108,7 +109,11 @@ export const reducer = handleActions({
[SET_PREVIEW_URL]: ({previewUrl}) => $set('ui.contentCanvas.previewUrl', previewUrl),
[SET_SRC]: ({src}) => $set('ui.contentCanvas.src', src),
[FORMATTING_UNDER_CURSOR]: ({formatting}) => $set('ui.contentCanvas.formattingUnderCursor', new Map(formatting)),
[SET_CURRENTLY_EDITED_PROPERTY_NAME]: ({propertyName}) => $set('ui.contentCanvas.currentlyEditedPropertyName', propertyName),
[SET_CURRENTLY_EDITED_PROPERTY_NAME]: ({propertyName}) => $all(
$set('ui.contentCanvas.currentlyEditedPropertyName', propertyName),
// See SET_FOCUS why it's needed
$set('ui.contentCanvas.currentlyEditedPropertyNameIntermediate', propertyName)
),
[STOP_LOADING]: () => $set('ui.contentCanvas.isLoading', false),
[START_LOADING]: () => $set('ui.contentCanvas.isLoading', true),
[REQUEST_SCROLL_INTO_VIEW]: activate => $set('ui.contentCanvas.shouldScrollIntoView', activate),
Expand Down
2 changes: 1 addition & 1 deletion packages/neos-ui/src/Containers/SecondaryToolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class SecondaryToolbar extends PureComponent {
const {containerRegistry, currentlyEditedPropertyName, hasFocusedContentNode} = this.props;
const DimensionSwitcher = containerRegistry.get('SecondaryToolbar/DimensionSwitcher');

if (!hasFocusedContentNode) {
if (!hasFocusedContentNode && !currentlyEditedPropertyName) {
return DimensionSwitcher;
}

Expand Down

0 comments on commit 122842e

Please sign in to comment.