|
|
@ -1,6 +1,8 @@ |
|
|
|
import * as packageJson from '../../../../../../package.json' |
|
|
|
import * as packageJson from '../../../../../../package.json' |
|
|
|
import { ViewPlugin } from '@remixproject/engine-web' |
|
|
|
import { ViewPlugin } from '@remixproject/engine-web' |
|
|
|
import { migrateToWorkspace } from '../../../migrateFileSystem' |
|
|
|
import { migrateToWorkspace } from '../../../migrateFileSystem' |
|
|
|
|
|
|
|
import JSZip from "jszip" |
|
|
|
|
|
|
|
import { fips } from 'crypto' |
|
|
|
|
|
|
|
|
|
|
|
const yo = require('yo-yo') |
|
|
|
const yo = require('yo-yo') |
|
|
|
const csjs = require('csjs-inject') |
|
|
|
const csjs = require('csjs-inject') |
|
|
@ -301,13 +303,9 @@ export class LandingPage extends ViewPlugin { |
|
|
|
this.call('fileExplorers', 'createNewFile') |
|
|
|
this.call('fileExplorers', 'createNewFile') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const downloadFiles = async () => { |
|
|
|
const saveAs = (blob, name) => { |
|
|
|
try { |
|
|
|
|
|
|
|
const fileProviders = globalRegistry.get('fileproviders').api |
|
|
|
|
|
|
|
const json = await fileProviders.browser.copyFolderToJson('/') |
|
|
|
|
|
|
|
const blob = new Blob([JSON.stringify(json, null, '\t')], { type: 'text/plain;charset=utf-8' }) |
|
|
|
|
|
|
|
const node = document.createElement('a') |
|
|
|
const node = document.createElement('a') |
|
|
|
node.download = 'remix.json' |
|
|
|
node.download = name |
|
|
|
node.rel = 'noopener' |
|
|
|
node.rel = 'noopener' |
|
|
|
node.href = URL.createObjectURL(blob) |
|
|
|
node.href = URL.createObjectURL(blob) |
|
|
|
setTimeout(function () { URL.revokeObjectURL(node.href) }, 4E4) // 40s
|
|
|
|
setTimeout(function () { URL.revokeObjectURL(node.href) }, 4E4) // 40s
|
|
|
@ -316,10 +314,26 @@ export class LandingPage extends ViewPlugin { |
|
|
|
node.dispatchEvent(new MouseEvent('click')) |
|
|
|
node.dispatchEvent(new MouseEvent('click')) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
var evt = document.createEvent('MouseEvents') |
|
|
|
var evt = document.createEvent('MouseEvents') |
|
|
|
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null) |
|
|
|
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, |
|
|
|
|
|
|
|
20, false, false, false, false, 0, null) |
|
|
|
node.dispatchEvent(evt) |
|
|
|
node.dispatchEvent(evt) |
|
|
|
} |
|
|
|
} |
|
|
|
}, 0) // 40s
|
|
|
|
}, 0) // 40s
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const downloadFiles = async () => { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
const fileProviders = globalRegistry.get('fileproviders').api |
|
|
|
|
|
|
|
const zip = new JSZip() |
|
|
|
|
|
|
|
await fileProviders.browser.copyFolderToJson('/', ({ path, content }) => { |
|
|
|
|
|
|
|
zip.file(path, content) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
zip.generateAsync({type:"blob"}) |
|
|
|
|
|
|
|
.then(function (blob) { |
|
|
|
|
|
|
|
saveAs(blob, "remix.zip"); |
|
|
|
|
|
|
|
}).catch((e) => { |
|
|
|
|
|
|
|
tooltip(e.message) |
|
|
|
|
|
|
|
}) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
tooltip(e.message) |
|
|
|
tooltip(e.message) |
|
|
|
} |
|
|
|
} |
|
|
|