Bläddra i källkod

增加文件拖拽事件

master
unknown 4 år sedan
förälder
incheckning
6620011136
2 ändrade filer med 13 tillägg och 3 borttagningar
  1. Binär
      src/main/file_word.png
  2. +13
    -3
      src/main/index.js

Binär
src/main/file_word.png Visa fil

Före Efter
Bredd: 180  |  Höjd: 180  |  Storlek: 3.7 KiB

+ 13
- 3
src/main/index.js Visa fil

@@ -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,
});

})

Laddar…
Avbryt
Spara