Commit 28600f7d authored by gxkai's avatar gxkai

fix: 添加默认目录

parent cb79f7bf
......@@ -235,12 +235,12 @@ const saveAs = (blob, name) => {
}
}, 0) // 40s
}
export const downloadFile = async (folder?: string ) => {
export const downloadFile = async (folder?: string) => {
try {
tooltip('preparing files for download, please wait..')
const fileProviders = globalRegistry.get('fileproviders').api
const zip = new JSZip()
await fileProviders.browser.copyFolderToJson(`/`, ({ path, content }) => {
await fileProviders.browser.copyFolderToJson('/', ({ path, content }) => {
const path$ = path.replace(/\/([^\/]*)\//, '')
if (path$.startsWith(folder)) {
zip.file(path$, content)
......
......@@ -244,7 +244,7 @@ export async function getMimeTypeOfFile (blob) {
return res ? res.mime : 'Unknown filetype'
}
export const unZipFile = async (file, root) => {
export const unZipFile = async (file, root = null) => {
const unzipData = await zip.loadAsync(file)
const arr = []
for (const zobj of Object.values(unzipData.files)) {
......
......@@ -85,7 +85,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
if (canPaste) {
addMenuItems([{
id: 'paste',
name: 'Paste',
name: '黏贴',
type: ['folder', 'file'],
path: [],
extension: [],
......@@ -96,7 +96,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
} else {
removeMenuItems([{
id: 'paste',
name: 'Paste',
name: '黏贴',
type: ['folder', 'file'],
path: [],
extension: [],
......@@ -317,7 +317,6 @@ export const FileExplorer = (props: FileExplorerProps) => {
const editModeOff = async (content: string) => {
if (typeof content === 'string') content = content.trim()
const parentFolder = extractParentFromKey(state.focusEdit.element)
if (!content || (content.trim() === '')) {
if (state.focusEdit.isNew) {
props.dispatchRemoveInputField(parentFolder)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment