O'Reilly logo

Cross-platform Desktop Application Development: Electron, Node, NW.js, and React by Dmitry Sheiko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Transferring text

In order to examine text transferring with the clipboard, we modify the method copy of FileService:

copy( file ){     this.copiedFile = this.dir.getFile( file );     const clipboard = nw.Clipboard.get(); 

    clipboard.set( this.copiedFile, "text" ); }

What does it do? As soon as we obtain the file full path, we create an instance of nw.Clipboard and save the file path there as text. So now, after copying a file within the File Explorer, we can switch to an external program (for example, a text editor) and paste the copied path from the clipboard:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required