packages/frontend/templates/README.md
Manages template files for use in AFFiNE. For now we only support onboarding templates.
Before we offer a better solution, to update the onboarding templates:
ZipTransformer to window. e.g., import {ZipTransformer} from '@blocksuite/affine/blocks/root'; window.ZipTransformer = ZipTransformer;(async () => {
// make sure ZipTransformer is imported and attached to window
const { ZipTransformer } = window;
await Promise.all([...currentWorkspace.blockSuiteWorkspace.pages.values()].map(p => p.load()));
// wait for a few more seconds
await new Promise(resolve => setTimeout(resolve, 5000));
const zipblob = await ZipTransformer.exportPages(currentWorkspace.blockSuiteWorkspace, [...currentWorkspace.blockSuiteWorkspace.pages.values()]);
const url = URL.createObjectURL(zipblob);
const a = document.createElement('a');
a.setAttribute('href', url);
a.setAttribute('download', `${currentWorkspace.id}.affine.zip`);
a.click();
a.remove();
URL.revokeObjectURL(url);
})();
assets)yarn postinstall to update the templates.gen.ts file