Merge conflict
Gerrit cannot merge this change. It needs a rebase onto main.
98323[TASK] Add one frame component for the preview frames of the backend
Commit message
This patch adds an internal API for the frames of the backend that
show frontend pages. It has two parts: the PHP class
PreviewFrameFactory and the TypeScript module
@typo3/backend/preview/preview-frame. The new PHP classes are marked
@internal. Later patches for #110664 use the component:
* "[BUGFIX] Renew the preview token of the frame" adds the frame with
a preview token to PreviewFrameFactory::create() and the token mode
to PreviewFrame, for the frame of ViewModuleController.
* "[BUGFIX] Open the backend preview page for sites without backend
cookie" shows the frame of PreviewPageController::showAction()
through PreviewFrameFactory::create() and PreviewFrame in
preview-page.ts.
* "[BUGFIX] Use preview tokens in the frames of the workspace preview"
adds the frames with a preview token to the workspace
PreviewController.
97700 "[BUGFIX] Allow workspace preview frames on other site hosts"
(#110312) is merged. It added the origins of the workspace preview
frames to `frame-src`. This patch moves that code into
PreviewFrameFactory.
It is chained on top of "[BUGFIX] Preview hidden pages across site
domains". The frame of ViewModuleController keeps the address with
the preview token of that patch. Without a token, it gets its
settings from PreviewFrameFactory::create(). Merge the patches below
it in the chain first, then this patch.
The module "Content > Preview" and the workspace preview show frontend
pages in frames. Each controller built the address of its frame and
its rule for `frame-src` in its own way. 97700 gives the workspace
preview a copy of this code.
The new class PreviewFrameFactory is the one entry point for these
frames. It returns the typed settings of a frame and allows the origin
of the page in `frame-src` of the current response. The TypeScript
module @typo3/backend/preview/preview-frame reads these settings,
loads the frame and loads it again on request. The Preview module and
the workspace preview now use both parts. The behaviour of the frames
does not change.
The script of the Preview module also had a click handler for a
refresh button that does not exist since #108008. The handler looked
for a frame with a wrong id. This change removes the handler. The
reload button of the module header reloads the module and its frame,
as before.
The templates of both frames change. A frame gets its address from
the attribute `data-preview-settings` and no longer from `src`. The
template of the Preview module no longer gets the variable `{url}`.
The template of the workspace preview no longer gets `{wsUrl}`. A
template that overrides one of them with the page TSconfig option
`templates` must take over this change. The core does not treat
backend templates as API, see the changelog entry of #96812. Thus
this patch has no changelog entry. The later patches "[BUGFIX] Renew
the preview token of the frame" and "[BUGFIX] Use preview tokens in
the frames of the workspace preview" describe the two templates in
the changelog entry of #110664.
Show more Show less
Resolves: #TBD Related: #110664 Releases: main, 14.3 Change-Id: I2eeae994dc85a59b5d9d891322ac04678424cab5
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 1
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/23/98323/1 && git checkout FETCH_HEAD
- Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/23/98323/1 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V 0 Needs a vote
- core-ci +1 CI
Relation chain 16
- 98329[BUGFIX] Use preview tokens in the frames of the workspace preview
- 98328[TASK] Add a live view kind of preview token
- 98327[BUGFIX] Follow the page of the preview frame in the backend
- 98326[BUGFIX] Keep the preview token in navigations that scripts start
- 98325[BUGFIX] Keep the preview token in links, forms and redirects
- 98324[BUGFIX] Renew the preview token of the frame
-
98323 [TASK] Add one frame component for the preview frames of the backend This change
- 97235[BUGFIX] Preview hidden pages across site domains
- 98322[TASK] Accept preview tokens in the frontend
- 98321[TASK] Issue preview tokens in the backend
- 98320[TASK] Check where a request with a preview token comes from
- 98319[BUGFIX] Handle query parameters of links in one place
- 98318[TASK] Resolve the sites and hosts a backend user may preview
- 98317[TASK] Sign and verify preview tokens
- 98316[TASK] Add typed claims for preview tokens
-
98315[TASK] Add a read-only backend user for one workspace
The chain has patch set 1 of 2, the changes above it need a rebase.
Issues 1
Files 17
- Build/Sources/TypeScript/backend/preview/preview-frame.tsnew+44 −0
- Build/Sources/TypeScript/backend/tests/preview/preview-frame-test.tsnew+78 −0
- Build/Sources/TypeScript/viewpage/main.ts+2 −8
- Build/Sources/TypeScript/workspaces/tests/preview-test.tsnew+125 −0
- Build/Sources/TypeScript/workspaces/preview.ts+16 −4
- typo3/sysext/backend/Classes/Preview/PreviewFrameFactory.phpnew+64 −0
- typo3/sysext/backend/Classes/Preview/PreviewFrameSettings.phpnew+42 −0
- typo3/sysext/backend/Resources/Public/JavaScript/preview/preview-frame.jsnew+13 −0
- typo3/sysext/backend/Tests/Unit/Preview/PreviewFrameFactoryTest.phpnew+104 −0
- typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php+9 −17
- typo3/sysext/viewpage/Resources/Private/Templates/Show.fluid.html+1 −1
- typo3/sysext/viewpage/Resources/Public/JavaScript/main.js+1 −1
- typo3/sysext/viewpage/Tests/Functional/Controller/ViewModuleControllerTest.php+23 −2
- typo3/sysext/workspaces/Classes/Controller/PreviewController.php+6 −26
- typo3/sysext/workspaces/Resources/Private/Templates/Preview/Index.fluid.html+2 −2
- typo3/sysext/workspaces/Resources/Public/JavaScript/preview.js+1 −1
- typo3/sysext/workspaces/Tests/Functional/Controller/PreviewControllerTest.php+13 −6
Review log 23
-
Matthias Vogel uploaded patch set 1 12/04/26, 09:02
-
core-ci voted on patch set 1 V +1 12/04/26, 09:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/116308
-
Matthias Vogel wrote 12/04/26, 10:25
Topic set to cross-domain-preview