ソースを参照

增加文件拖拽事件

master
unknown 4年前
コミット
6620011136
2個のファイルの変更13行の追加3行の削除
  1. バイナリ
      src/main/file_word.png
  2. +13
    -3
      src/main/index.js

バイナリ
src/main/file_word.png ファイルの表示

変更前 変更後
幅: 180  |  高さ: 180  |  サイズ: 3.7 KiB

+ 13
- 3
src/main/index.js ファイルの表示

@@ -1,8 +1,7 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, protocol, ipcMain, dialog } = require('electron')
const { app, BrowserWindow, protocol, ipcMain, dialog, nativeImage } = require('electron')
const path = require('path')


const gotTheLock = app.requestSingleInstanceLock();

if (!gotTheLock) {
@@ -76,4 +75,15 @@ ipcMain.handle('project-upload-file', async (event, args) => {
properties: ['openFile'],
});
return res;
});
});
const testIcon = nativeImage.createFromPath(path.resolve(__dirname, 'file_word.png'));

ipcMain.handle('project-file-dnd', (event, filePath) => {
console.log('receive file path: ', filePath)
event.sender.startDrag({
file: filePath, // path.resolve(__dirname, 'file_word.png'),
// icon: nativeImage.createFromNamedImage('NS')
icon: testIcon,
});

})

読み込み中…
キャンセル
保存