AFFiNE/packages/frontend/templates
2024-09-20 15:48:21 +08:00
..
edgeless-snapshot fix: note added with template should be edgeless only (#6122) 2024-03-15 12:51:03 +08:00
onboarding feat(core): use zip snapshot for onboarding page (#6495) 2024-04-15 02:16:08 +00:00
stickers feat(templates): add arrows stickers (#7518) 2024-07-19 06:25:30 +00:00
build-edgeless.mjs fix(core): template image assets missing (#7171) 2024-06-08 17:28:24 +00:00
build-stickers.mjs feat(templates): add arrows stickers (#7518) 2024-07-19 06:25:30 +00:00
edgeless-templates.gen.ts feat: move templates into AFFiNE (#5750) 2024-02-21 06:26:01 +00:00
package.json chore: bump base version to 0.17.0 2024-09-20 15:48:21 +08:00
README.md refactor(core): onboarding using new transformer api (#5412) 2023-12-28 13:59:21 +00:00
stickers-templates.gen.ts feat(templates): add arrows stickers (#7518) 2024-07-19 06:25:30 +00:00

@affine/templates

Manages template files for use in AFFiNE. For now we only support onboarding templates.

How to update

Before we offer a better solution, to update the onboarding templates:

  1. run AFFiNE core locally (dev mode)
  2. expose ZipTransformer to window. e.g., import {ZipTransformer} from '@blocksuite/blocks'; window.ZipTransformer = ZipTransformer;
  3. run the following script
    (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);
    })();
    
  4. unzip the file, replace the json files into onboarding folder (no need to include the assets)
  5. run yarn postinstall to update the templates.gen.ts file