-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Full Site Editing: Introduce a template editing mode inside the post editor #26355
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
112d411
Replace the post title component with the post title block
youknowriad 3dbb834
Restore FSE block registration
youknowriad 2e74ccf
Add zoom-in/zoom-out to the template level
youknowriad 0751bb2
Move the findTemplate call to core-data
youknowriad d5e96fc
Move the template zoom-out button to the sidebar
youknowriad 47d4ebc
Show a title and a snackbar when editing the template
youknowriad c537394
Restore post check
youknowriad 87d363f
Add the Done button from to the template editing mode
youknowriad ba85f79
Update the template mode snackbar text
youknowriad a3df09a
Disable the template mode in non-FSE themes
youknowriad 7756adb
Remove useless comment
youknowriad aaeb879
Allow updating templates properly
youknowriad 1126bb9
Add e2e test to check the post editor template mode
youknowriad e31658e
Avoid fetching FSE templates for non-FSE themes
youknowriad ad56f8e
Hide the template mode from auto-drafts
youknowriad a75e9f7
Fix flows and e2e tests
youknowriad c5ce281
Add a cancel button
youknowriad 0031781
Restore removed files and apply isTertiary to the cancel button
youknowriad 9a58f45
Cleanup
youknowriad 4b31f3f
Avoid fetching the template for templates
youknowriad 46724a8
Fix inifinte loop
youknowriad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export function regularFetch( url ) { | ||
youknowriad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return { | ||
type: 'REGULAR_FETCH', | ||
url, | ||
}; | ||
} | ||
const controls = { | ||
async REGULAR_FETCH( { url } ) { | ||
const { data } = await window | ||
.fetch( url ) | ||
.then( ( res ) => res.json() ); | ||
|
||
return data; | ||
}, | ||
}; | ||
|
||
export default controls; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { last } from 'lodash'; | ||
|
||
/** @typedef {import('puppeteer').Page} Page */ | ||
|
||
/** | ||
* Opens the preview page of an edited post. | ||
* | ||
* @param {Page} editorPage puppeteer editor page. | ||
* @return {Page} preview page. | ||
*/ | ||
export async function openPreviewPage( editorPage = page ) { | ||
let openTabs = await browser.pages(); | ||
const expectedTabsCount = openTabs.length + 1; | ||
await editorPage.click( '.block-editor-post-preview__button-toggle' ); | ||
await editorPage.waitFor( '.edit-post-header-preview__button-external' ); | ||
await editorPage.click( '.edit-post-header-preview__button-external' ); | ||
|
||
// Wait for the new tab to open. | ||
while ( openTabs.length < expectedTabsCount ) { | ||
await editorPage.waitFor( 1 ); | ||
openTabs = await browser.pages(); | ||
} | ||
|
||
const previewPage = last( openTabs ); | ||
return previewPage; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
This reverts #24010 cc @Addison-Stavlo
It seems the checks were not good enough IMO. It relies on something that doesn't give us semantic information about the context but it was more an implementation detail.
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.
Yeah, I agree that these original checks were not great, but there simply wasn't another way to do it with the information available at the time. There didn't seem to be a super clear way to add the necessary information to the context either... The problem is really, given a global context with a postID, how do you prevent nested context consumers from rendering recursively infinitely?
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.
It seems we need a context value to indicate the post content id we're currently rendering (and not just the "post id").
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.
It's not fixed entirely, but the important breakage in the template editor is fixed by 46724a8