BUGFIX: Reset focused fusion path to null
whenever the edit-/preview-mode changes
#3337
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes: #3335
The Problem
When focusing a node inside the
<ContentCanvas/>
, the associatedfusionPath
of that content element will be saved to the redux store. When the current edit-/preview-mode is then changed, saidfusionPath
is no longer valid (because the content element will be rendered through an entirely different path).This confuses the
<InlineUI/>
component. It uses the storedfusionPath
to locate the DOM node inside the<ContentCanvas/>
that it attaches itself to. Since thefusionPath
is invalid after the switch, the DOM node can longer be found and the<InlineUI/>
becomes invisible.The solution
The code responsible for locating nodes inside the
<ContentCanvas/>
can be found here:neos-ui/packages/neos-ui-guest-frame/src/dom.js
Lines 73 to 77 in b424a7a
It anticipates situations in which no
fusionPath
is set (which is the case when selecting a node in the<ContentTree/>
component for example). Basically, if there's nofusionPath
it selects the first node that matches the focusedcontextPath
, which I found quite acceptable for switching between edit-/preview-modes.Therefore, I altered the
CR.Nodes
reducer to set the focusedfusionPath
tonull
whenever theUI.EditPreviewMode.SET
action occurs. With this, the<InlineUI/>
component no longer disappears when the edit-/preview-mode is switched.