Last active
December 26, 2023 10:12
-
-
Save pengx17/ef92c305ac23123803a1a6a20e31f822 to your computer and use it in GitHub Desktop.
export current workspace snapshot in affine
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
(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); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment