-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
!!! FEATURE: Reimplement EditPreviewModes for Neos 9 #4505
Conversation
6b38f76
to
c9fcbbb
Compare
Since this falls back to UserInterfaceService->findUserInterfaceModeNameByCurrentUser it actually allows to switch the mode in the ui. 🎉 Still think that in the long run the uiMode should be passed to the previewAction (parameter is there) and that even editAction and previewAction should be separates. However both are not necessary to let Neos 9 run and can be added later. |
965cf6e
to
5439b86
Compare
A matter to discuss is how to name the properties of the edit preview mode and how they should be accessed. The pr is marked as draft to allow us the short but needed discussion possible options include:
We should discuss and decide this ideally once as this requires adjustments in a dozen fusion files. |
ca9a574
to
2a05eeb
Compare
Hi @mficzel thanks for your 3rd implementation ❤️ !!! About the naming, we did discuss a few options in the last weekly's (when your were on vacation) and i think most arguments are written down in this thread: https://neos-project.slack.com/archives/C3MCBK6S2/p1693988493145879 and in this issue: #4086 (comment) I want to suggest that we both have a little call to discuss all arguments on the table and then we pick the best solution? |
2a05eeb
to
690f52e
Compare
the migration previously adjusted the code to a now deprecated eel helper. In pr neos/neos-development-collection#4505 the userInterfaceMode is introduced as global fusionValue which made an adjustment in the rector necessary. `(node|documentNode|site).context.inBackend` is now migrated to `userInterfaceMode.isEdit` `(node|documentNode|site).context.live` is now migrated to `userInterfaceMode.isLive` In cases where it cannot be determined wether a node is affected by the `context` operation a comment is added as before.
the migration previously adjusted the code to a now deprecated eel helper. In pr neos/neos-development-collection#4505 the userInterfaceMode is introduced as global fusionValue which made an adjustment in the rector necessary. `(node|documentNode|site).context.inBackend` is now migrated to `userInterfaceMode.isEdit` `(node|documentNode|site).context.live` is now migrated to `userInterfaceMode.isLive` In cases where it cannot be determined wether a node is affected by the `context` operation a comment is added as before.
a2ce30e
to
1729616
Compare
Neos.Neos/Resources/Private/Fusion/Prototypes/ContentCollection.fusion
Outdated
Show resolved
Hide resolved
1729616
to
f0e2721
Compare
Rename:
|
ce17ea1
to
6d00b3e
Compare
@@ -120,8 +125,14 @@ class NodeController extends ActionController | |||
* with unsafe requests from widgets or plugins that are rendered on the node | |||
* - For those the CSRF token is validated on the sub-request, so it is safe to be skipped here | |||
*/ | |||
public function previewAction(string $node): void | |||
public function previewAction(string $node, string $renderingModeName = null): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, the ui will currently not use this parameter yet (it could via neos/neos-ui#3411)
But importantly this change allows us to open a page in a new tab independent of the session's value.
Although this would only work for this one page, successive links will currently not have that query param added - the linking service still needs to lear this, but this is out of scope of this pr.
…ted rendering mode
Otherwise, this feature would only work for this one page, successive links will currently not have that query param added - the linking service still needs to learn this, but we delay this for another time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found some nitpicks, and proposed a solution for those here: #4521
Works so far great inside the ui. I can also confirm that changing the mode via user preferences/ session works and all tabs get the new mode (basically this behavior, which we might want to fix at some point #965). But the linking seems a bit off in the ui, and when you open the iframe in a new tab (use the preview endpoint Isnt this that issue? #2347 so no new problem ... |
90/edit preview mode support v3 review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed some optional follow ups, but this pr is great as it is and can be merged!
As the solution was discussed more than 5 times in our weekly’s and additionally @mficzel and me spend time discussing it, i would say this is approach is reviewed/approved enough to be merged with one formal GitHub approval. |
It was deprecated in #4505 in favor of `${userInterfaceMode.isEdit}`. Since the ui is adjusted in neos/neos-ui#3618 it can now be removed.
It was deprecated in #4505 in favor of `${userInterfaceMode.isEdit}`. Since the ui is adjusted in neos/neos-ui#3618 it can now be removed.
The TypoScript context variable `editPreviewMode` was deprecated in favour of `${documentNode.context.currentRenderingMode.name}` With neos 9 that again was removed in favour of the fusion global `renderingMode`. neos#4505
The TypoScript context variable `editPreviewMode` was deprecated in favour of `${documentNode.context.currentRenderingMode.name}` With neos 9 that again was removed in favour of the fusion global `renderingMode`. neos#4505
The TypoScript context variable `editPreviewMode` was deprecated in favour of `${documentNode.context.currentRenderingMode.name}` With neos 9 that again was removed in favour of the fusion global `renderingMode`. neos#4505
The TypoScript context variable `editPreviewMode` was deprecated in favour of `${documentNode.context.currentRenderingMode.name}` With neos 9 that again was removed in favour of the fusion global `renderingMode`. neos/neos-development-collection#4505
Since nodes have no context in Neos 9 the edit preview mode cannot be decided by asking the node any more.
This change renovates the
UserInterfaceMode
and theUserInterfaceModeService
to use php 8 value objects now namedRenderingMode
andRenderingModeService
. TherenderingModeName
is added as argument to theNodeController::previewAction
that will pass this as an option to theNeos\Neos\FusionView
if no renderingModeName the RenderingModeService will determine the currently selected mode of the user.The
renderingMode
is then added to the fusionGlobals by theFusionView
and is used for checking in various places in fusion.Resolves: #4086
Resolves: #4396
Based on new Fusion globals: #4425
Upgrade instructions
The uses of the following fusion expressions have to be adjusted as follows:
node.context.live
-!renderingMode.isEdit
*node.context.inBackend
-renderingMode.isEdit
*node.context.currentRenderingMode.edit
-renderingMode.isEdit
node.context.currentRenderingMode.preview
-renderingMode.isPreview
node.context.currentRenderingMode.name
-renderingMode.name
* this condition should cover the usecase most of the time. For a more accurate representation of "inBackend" use
${renderingMode.isEdit || renderingMode.isPreview}
Review instructions
See #4396 for a full explanation about the decision to make the backend check node independent.
This is an newer approach to pr #4067
Follow up Todos:
renderingMode.isEdit
rector#22 adjusts the rector migrations to use the new renderingMode global. This one should be merged after this pr.Neos.Node.inBackend()
helper after the UI stopped using iteditPreviewModes
anddefaultEditPreviewMode
torenderingModes
anddefaultRenderingMode
in a separate prChecklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions