Skip to content

Commit

Permalink
Fix second filepicker not working on select
Browse files Browse the repository at this point in the history
  • Loading branch information
aldrinjenson committed Jun 12, 2022
1 parent f12d415 commit 8708f5a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CameraModal extends Modal {
});
filePicker2.accept = "image/*";
filePicker2.capture = "camera"; // back camera by default for mobile screens
filePicker2.style.display = 'none'
// filePicker2.style.display = 'none'


const chosenFolderPath = "attachments/snaps";
Expand Down Expand Up @@ -89,13 +89,13 @@ class CameraModal extends Modal {
filePicker2.style.display = 'block'
}

const handleImageSelectChange = async () => {
const chosenFile = filePicker.files[0];
const handleImageSelectChange = async (file: File) => {
const chosenFile = file;
const bufferFile = await chosenFile.arrayBuffer();
saveFile(bufferFile, false, chosenFile.name.split(' ').join('-'));
};
filePicker.onchange = handleImageSelectChange
filePicker2.onchange = handleImageSelectChange
filePicker.onchange = () => handleImageSelectChange(filePicker.files[0])
filePicker2.onchange = () => handleImageSelectChange(filePicker2.files[0])


const view = this.app.workspace.getActiveViewOfType(MarkdownView);
Expand Down

0 comments on commit 8708f5a

Please sign in to comment.