Skip to content

Commit

Permalink
upd: don't show "Open Folder" on fs polyfill browsers
Browse files Browse the repository at this point in the history
closes #571
  • Loading branch information
Joelant05 committed Aug 19, 2022
1 parent 3af63ec commit 13a2880
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions src/components/Toolbar/Category/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,31 @@ export function setupFileCategory(app: App) {
},
})
)
file.addItem(
app.actionManager.create({
id: 'bridge.action.openFolder',
icon: 'mdi-folder-open-outline',
name: 'actions.openFolder.name',
description: 'actions.openFolder.description',
keyBinding: 'Ctrl + Shift + O',
onTrigger: async () => {
const app = await App.getApp()
let directoryHandle: AnyDirectoryHandle
try {
directoryHandle = await window.showDirectoryPicker({
multiple: false,
mode: 'readwrite',
})
} catch {
return
}
// Doesn't make sense to show this option fs polyfill browsers
if (!isUsingFileSystemPolyfill.value)
file.addItem(
app.actionManager.create({
id: 'bridge.action.openFolder',
icon: 'mdi-folder-open-outline',
name: 'actions.openFolder.name',
description: 'actions.openFolder.description',
keyBinding: 'Ctrl + Shift + O',
onTrigger: async () => {
const app = await App.getApp()
let directoryHandle: AnyDirectoryHandle
try {
directoryHandle = await window.showDirectoryPicker({
multiple: false,
mode: 'readwrite',
})
} catch {
return
}

await app.fileDropper.importFolder(directoryHandle)
},
})
)
await app.fileDropper.importFolder(directoryHandle)
},
})
)
file.addItem(
app.actionManager.create({
id: 'bridge.action.searchFile',
Expand Down Expand Up @@ -121,18 +123,16 @@ export function setupFileCategory(app: App) {
const currentTab = app.project.tabSystem?.selectedTab
if (!(currentTab instanceof FileTab)) return

const [
_,
compiled,
] = await app.project.compilerService.compileFile(
currentTab.getPath(),
await currentTab
.getFile()
.then(
async (file) =>
new Uint8Array(await file.arrayBuffer())
)
)
const [_, compiled] =
await app.project.compilerService.compileFile(
currentTab.getPath(),
await currentTab
.getFile()
.then(
async (file) =>
new Uint8Array(await file.arrayBuffer())
)
)

let uint8arr: Uint8Array
if (typeof compiled === 'string')
Expand Down

0 comments on commit 13a2880

Please sign in to comment.