|
@@ -0,0 +1,13 @@
|
|
|
+const { ipcMain } = require('electron');
|
|
|
+const path = require('path');
|
|
|
+const file = require('../../helper/file');
|
|
|
+
|
|
|
+ipcMain.on('ondragstart', (event, data) => {
|
|
|
+ const filepath = `./data/${data.id}/${data.title}.json`;
|
|
|
+ file.makedir(filepath, true);
|
|
|
+ file.put(filepath, JSON.stringify(data, undefined, 4));
|
|
|
+ event.sender.startDrag({
|
|
|
+ file: path.join(__dirname, '../.' + filepath),
|
|
|
+ icon: path.join(__dirname, '/asset/file.png')
|
|
|
+ });
|
|
|
+});
|