Commit 28600f7d authored by gxkai's avatar gxkai

fix: 添加默认目录

parent cb79f7bf
...@@ -235,12 +235,12 @@ const saveAs = (blob, name) => { ...@@ -235,12 +235,12 @@ const saveAs = (blob, name) => {
} }
}, 0) // 40s }, 0) // 40s
} }
export const downloadFile = async (folder?: string ) => { export const downloadFile = async (folder?: string) => {
try { try {
tooltip('preparing files for download, please wait..') tooltip('preparing files for download, please wait..')
const fileProviders = globalRegistry.get('fileproviders').api const fileProviders = globalRegistry.get('fileproviders').api
const zip = new JSZip() const zip = new JSZip()
await fileProviders.browser.copyFolderToJson(`/`, ({ path, content }) => { await fileProviders.browser.copyFolderToJson('/', ({ path, content }) => {
const path$ = path.replace(/\/([^\/]*)\//, '') const path$ = path.replace(/\/([^\/]*)\//, '')
if (path$.startsWith(folder)) { if (path$.startsWith(folder)) {
zip.file(path$, content) zip.file(path$, content)
......
...@@ -244,7 +244,7 @@ export async function getMimeTypeOfFile (blob) { ...@@ -244,7 +244,7 @@ export async function getMimeTypeOfFile (blob) {
return res ? res.mime : 'Unknown filetype' 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 unzipData = await zip.loadAsync(file)
const arr = [] const arr = []
for (const zobj of Object.values(unzipData.files)) { for (const zobj of Object.values(unzipData.files)) {
......
...@@ -85,7 +85,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -85,7 +85,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
if (canPaste) { if (canPaste) {
addMenuItems([{ addMenuItems([{
id: 'paste', id: 'paste',
name: 'Paste', name: '黏贴',
type: ['folder', 'file'], type: ['folder', 'file'],
path: [], path: [],
extension: [], extension: [],
...@@ -96,7 +96,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -96,7 +96,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
} else { } else {
removeMenuItems([{ removeMenuItems([{
id: 'paste', id: 'paste',
name: 'Paste', name: '黏贴',
type: ['folder', 'file'], type: ['folder', 'file'],
path: [], path: [],
extension: [], extension: [],
...@@ -317,7 +317,6 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -317,7 +317,6 @@ export const FileExplorer = (props: FileExplorerProps) => {
const editModeOff = async (content: string) => { const editModeOff = async (content: string) => {
if (typeof content === 'string') content = content.trim() if (typeof content === 'string') content = content.trim()
const parentFolder = extractParentFromKey(state.focusEdit.element) const parentFolder = extractParentFromKey(state.focusEdit.element)
if (!content || (content.trim() === '')) { if (!content || (content.trim() === '')) {
if (state.focusEdit.isNew) { if (state.focusEdit.isNew) {
props.dispatchRemoveInputField(parentFolder) 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