-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Full Site Editing: Introduce a template edition mode inside the post …
…editor (#26355)
- Loading branch information
1 parent
1145d22
commit a250e9e
Showing
34 changed files
with
848 additions
and
258 deletions.
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 ) { | ||
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.