Skip to content

Commit

Permalink
fix(FilePicker): Legacy filepicker is broken because the default type…
Browse files Browse the repository at this point in the history
… was unset

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Sep 20, 2023
1 parent 424c21e commit b1e0736
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/legacy.ts
Expand Up @@ -89,7 +89,7 @@ const spawnDialog = (dialog: Component | AsyncComponent, props: any, onClose: ()
* @param {Object} [options] additonal options that need to be set
* @param {Function} [options.filter] filter function for advanced filtering
*/
export async function filepicker(title: string, callback: (s: string | string[], type: FilePickerType) => void, multiselect = false, mimetype?: string | string[], _modal?: boolean, type?: FilePickerType, path?: string, options?: any) {
export async function filepicker(title: string, callback: (s: string | string[], type: FilePickerType) => void, multiselect = false, mimetype?: string | string[], _modal?: boolean, type: FilePickerType = FilePickerType.Choose, path?: string, options?: any) {

/**
* Create legacy callback wrapper to support old filepicker syntax
Expand Down Expand Up @@ -145,6 +145,7 @@ export async function filepicker(title: string, callback: (s: string | string[],
})
} else {
buttonFn = (nodes, path) => {
console.warn('CCAALLEEDD', type)
const buttons: IFilePickerButton[] = []
const node = nodes?.[0]?.attributes?.displayName || nodes?.[0]?.basename
const target = node || basename(path)
Expand Down Expand Up @@ -173,6 +174,7 @@ export async function filepicker(title: string, callback: (s: string | string[],
icon: IconMove,
})
}
console.warn(buttons)
return buttons
}
}
Expand Down

0 comments on commit b1e0736

Please sign in to comment.