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:
parent
655c1a0893
commit
9c24eeb6ea
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user