2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

Fix issue with attach image component

This commit is contained in:
Piyush Singhania 2021-09-11 20:44:56 +05:30 committed by 18alantom
parent 655c1a0893
commit 9c24eeb6ea

View File

@ -54,23 +54,18 @@ export default {
};
},
methods: {
openFileSelector() {
remote.dialog.showOpenDialog(
remote.getCurrentWindow(),
{
title: frappe._('Select Image'),
properties: ['openFile'],
filters: [
{ name: 'Image', extensions: ['png', 'jpg', 'jpeg', 'webp'] }
]
},
async files => {
if (files && files[0]) {
let dataURL = await this.getDataURL(files[0]);
this.triggerChange(dataURL);
}
}
);
async openFileSelector() {
const options = {
title: frappe._('Select Image'),
properties: ['openFile'],
filters: [{ name: 'Image', extensions: ['png', 'jpg', 'jpeg', 'webp'] }]
};
const { filePaths } = await remote.dialog.showOpenDialog(options);
if (filePaths && filePaths[0]) {
let dataURL = await this.getDataURL(filePaths[0]);
this.triggerChange(dataURL);
}
},
getDataURL(filePath) {
let fs = require('fs');