Merge whp-zip-export frontend (Refs #42)

# Conflicts:
#	craft/src/editor/CanvasOverlays.tsx
This commit is contained in:
shadowdao committed 2026-10-07 12:24:38 -07:00
commit e0c48fc9b6
4 files changed
+277

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import React from 'react';
import { useRegisterCommands } from '../../editor/commands';
import { useEditorConfig } from '../../state/EditorConfigContext';
import { useSiteExport } from '../../hooks/useSiteExport';
/**
* Registers `site.download-zip` ("Download site (.zip)") in WHP mode -- it then shows
* in the top-bar ⋯ menu and the Cmd+K palette. Renders nothing; mounted once in
* CanvasOverlays. Standalone mode registers nothing.
*/
export const ExportCommand: React.FC = () => {
const { isWHP } = useEditorConfig();
const { downloadZip } = useSiteExport();
useRegisterCommands(
isWHP
? [{
id: 'site.download-zip',
title: 'Download site (.zip)',
group: 'site',
keywords: ['export', 'zip', 'backup', 'download', 'archive'],
when: () => isWHP,
run: async () => { await downloadZip(); },
}]
: [],
[isWHP, downloadZip],
);
return null;
};