-
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.
Add client side routing for Site Editor (#36488)
* Add client side router * Use saveEntityRecord to update the store * Fix updating state in unmounted components * Update titles when page navigates * Use slot/fill for NavigationSidebar * Announce title change * Inline all api requests * Fix php lint errors * Make title announcement assertive * Fix infinite loop in page navigation * Fix duplicate main roles * Fix not announcing same titles * Try to fix url query controller * Add UnsavedWarning to list page too * Add now displaying to use-title's speak
- Loading branch information
1 parent
9e1d551
commit c78c7ac
Showing
30 changed files
with
632 additions
and
539 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,47 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { SlotFillProvider } from '@wordpress/components'; | ||
import { UnsavedChangesWarning } from '@wordpress/editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { Routes } from '../routes'; | ||
import Editor from '../editor'; | ||
import List from '../list'; | ||
import NavigationSidebar from '../navigation-sidebar'; | ||
import getIsListPage from '../../utils/get-is-list-page'; | ||
|
||
export default function EditSiteApp( { reboot } ) { | ||
return ( | ||
<SlotFillProvider> | ||
<UnsavedChangesWarning /> | ||
|
||
<Routes> | ||
{ ( { params } ) => { | ||
const isListPage = getIsListPage( params ); | ||
|
||
return ( | ||
<> | ||
{ isListPage ? ( | ||
<List /> | ||
) : ( | ||
<Editor onError={ reboot } /> | ||
) } | ||
{ /* Keep the instance of the sidebar to ensure focus will not be lost | ||
* when navigating to other pages. */ } | ||
<NavigationSidebar | ||
// Open the navigation sidebar by default when in the list page. | ||
isDefaultOpen={ !! isListPage } | ||
activeTemplateType={ | ||
isListPage ? params.postType : undefined | ||
} | ||
/> | ||
</> | ||
); | ||
} } | ||
</Routes> | ||
</SlotFillProvider> | ||
); | ||
} |
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.