Nw.js: Document.execCommand("paste") is not working but Document.execCommand("cut") and Document.execCommand("copy") works fine.

Created on 30 Oct 2018  路  11Comments  路  Source: nwjs/nw.js

NWJS Version : 0.32.4
Operating System : Windows 10 & Windows 7

Expected behavior

Paste using execCommand("paste") should work as expected and user should able to paste the data.

Actual behavior

Cut or copy any data and try to paste the data using execCommand("paste") nothing works.

stale

All 11 comments

Unable to reproduce. Used this code:

Cut/Copy/Pasted worked fine in 0.32.4_64-sdk and 0.34.2_64-sdk on Win 10 64.

nwjs: nwjs-sdk-v0.35.4-osx-x64
os: mac 10.14.2

document.execCommand("paste") Not Work!

I think paste should be a method of clipboard.
like:

nw.Clipboard.get().paste()

Electron use webContents to do this

(new BrowserWindow({//...})).webContents.paste()

@abhijitca ,Have you fix this issue?

@xland

No not yet But I will try all the method mention above and let you know.

Thanks for the solution.

@abhijitca @xland

This code will work in any version of NW.js:

@TheJaredWilcurt
document.onkeydown is a listener of key press event.
We don't want to listen that event.
We want to execute the paste action manually.

How about this issue's progress?
@rogerwang

Document.execCommand('paste') works for me, programmatically not requiring user event in a nw frame in 0.35.5

There is also the nw clipboard api:
http://docs.nwjs.io/en/latest/References/Clipboard/

@bluthen

Thanks, I'll test this on 0.36.0(the current version) a few days later.

@bluthen

No, It's not working for me

nwjs: nwjs-sdk-v0.36.1-osx-x64
os: mac 10.14.2

@rogerwang

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings