lambdalisue / jupyter-vim-binding

Jupyter meets Vim. Vimmer will fall in love.
2.1k stars 136 forks source link

Workaround to enable Copy/Paste with yy/p #23

Open lambdalisue opened 8 years ago

lambdalisue commented 8 years ago

Copy and paste via yy and p is desired feature. However, most of modern browser disallow javascript to access system clipboard.

I need some workaround to enable this while Jupyter usually started on locally so it should be able to tell browser to allow clipboard accessing.

Ref: https://github.com/lambdalisue/jupyter-vim-binding/issues/4

lambdalisue commented 8 years ago

I found a solution. Use ffclipboard which expose clipboard object from Firefox SDK.

However, it seems that ffclipboard expose clipboard object to any website and that is too risky... So probably I should make a new Firefox addon such as

lambdalisue commented 8 years ago

I'm trying https://github.com/lambdalisue/firefox-ciipboard

ianhi commented 4 years ago

4 years on I think there is greater browser support for filling the clipboard. In both firefox and chrome when on localhost the ability to write to the clipboard is enabled by default. Using this I patched the codemirror.Vim yank function to allow yanking to system clipboard with these line: https://github.com/ianhi/jupyterlab_vim-system-clipboard-support/blob/78f0dba8f447e092e9cf97016e96eadc92e50e63/src/yank.ts#L34-L39 in a jupyterlab extension. I imagine that a similar thing could be done here. Feel free to borrow from my approach.

Paste is more difficult/impossible due to permissions restrictions in firefox