Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/edit-site/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- Offer the Export tool only while editing a template or a template part, the entities the exported theme is made of. The menu item now lives in the editor package ([#81992](https://github.com/WordPress/gutenberg/pull/81992)).

### Bug Fixes

- Seed the root `ThemeProvider` with the admin color scheme primary color so portaled popovers and modals receive the scheme's accent colors ([#81653](https://github.com/WordPress/gutenberg/pull/81653)).
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/more-menu/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { privateApis as editorPrivateApis } from '@wordpress/editor';
import SiteExport from './site-export';
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
import { unlock } from '../../lock-unlock';

const { ToolsMoreMenuGroup, PreferencesModal } = unlock( editorPrivateApis );
const { ToolsMoreMenuGroup, PreferencesModal, SiteExport } =
unlock( editorPrivateApis );

export default function MoreMenu() {
return (
Expand Down
4 changes: 4 additions & 0 deletions packages/editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### New Features

- Add a private `SiteExport` menu item, moved from `edit-site`. It offers downloading the theme with the user's changes, only while editing a template or a template part — the entities the exported theme is made of ([#81992](https://github.com/WordPress/gutenberg/pull/81992)).

### Enhancements

- Commands: Add a command palette entry that opens the current post on the front end once it is published, labelled with the post type's `view_item` label ([#66720](https://github.com/WordPress/gutenberg/pull/66720)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,33 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { downloadBlob } from '@wordpress/blob';
import { store as coreStore } from '@wordpress/core-data';
import { store as noticesStore } from '@wordpress/notices';
import { store as editorStore } from '../../store';
import {
TEMPLATE_POST_TYPE,
TEMPLATE_PART_POST_TYPE,
} from '../../store/constants';

/**
* Menu item offering to download the active theme, with the user's template
* and style changes, as a zip.
*
* Offered only while editing one of the entities the exported theme is made
* of — a template or a template part — and only to users the export endpoint
* accepts. The host places it in a menu group.
*
* @return {React.ReactNode} The menu item, or nothing where export does not
* apply.
*/
export default function SiteExport() {
const canExport = useSelect( ( select ) => {
const postType = select( editorStore ).getCurrentPostType();
if (
postType !== TEMPLATE_POST_TYPE &&
postType !== TEMPLATE_PART_POST_TYPE
) {
return false;
}

const targetHints =
select( coreStore ).getCurrentTheme()?._links?.[
'wp:export-theme'
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import PreferencesModal from './components/preferences-modal';
import { usePostActions } from './components/post-actions/actions';
import usePostFields from './components/post-fields';
import ToolsMoreMenuGroup from './components/more-menu/tools-more-menu-group';
import SiteExport from './components/site-export';
import ViewMoreMenuGroup from './components/more-menu/view-more-menu-group';
import ResizableEditor from './components/resizable-editor';
import { registerCoreBlockBindingsSources } from './bindings/api';
Expand All @@ -37,6 +38,7 @@ lock( privateApis, {
usePostActions,
usePostFields,
ToolsMoreMenuGroup,
SiteExport,
ViewMoreMenuGroup,
ResizableEditor,
UploadProgressSnackbar,
Expand Down
4 changes: 4 additions & 0 deletions packages/lazy-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### New Features

- Render the editor's Export tool, so a theme can be downloaded with the user's changes while editing a template or a template part ([#81992](https://github.com/WordPress/gutenberg/pull/81992)).

### Bug Fixes

- Add the styles a host passes to the theme's and the user's instead of replacing them, so an editor canvas keeps the CSS a theme registers with `add_editor_style` ([#81747](https://github.com/WordPress/gutenberg/pull/81747)).
Expand Down
9 changes: 9 additions & 0 deletions packages/lazy-editor/src/components/editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const {
Editor: PrivateEditor,
BackButton,
PreferencesModal,
ToolsMoreMenuGroup,
SiteExport,
} = unlock( editorPrivateApis );

interface EditorProps {
Expand Down Expand Up @@ -139,6 +141,13 @@ export function Editor( {
nothing until one of them opens it.
*/ }
<PreferencesModal />
{ /*
Self-gated: renders only while editing a template or template
part, the entities the exported theme is made of.
*/ }
<ToolsMoreMenuGroup>
<SiteExport />
</ToolsMoreMenuGroup>
</PrivateEditor>
);
}
Loading