diff options
| author | Stephen Blott | 2015-01-23 11:02:31 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-23 15:41:02 +0000 |
| commit | e1b7b0a963490b0991d72a0143f489e0bc1e8096 (patch) | |
| tree | dc10bf7994b1ccc259af65aea9c029908cccd7d3 /lib | |
| parent | 256beee031efef70f4ee750044d9e697d66868bd (diff) | |
| download | vimium-e1b7b0a963490b0991d72a0143f489e0bc1e8096.tar.bz2 | |
Visual/edit modes: more (and better) commands.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/clipboard.coffee | 4 | ||||
| -rw-r--r-- | lib/dom_utils.coffee | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/clipboard.coffee b/lib/clipboard.coffee index 2b28df70..836b57e4 100644 --- a/lib/clipboard.coffee +++ b/lib/clipboard.coffee @@ -15,13 +15,15 @@ Clipboard = document.execCommand("Copy") document.body.removeChild(textArea) - paste: -> + paste: (refocusElement = null) -> textArea = @._createTextArea() document.body.appendChild(textArea) textArea.focus() document.execCommand("Paste") value = textArea.value document.body.removeChild(textArea) + # The caller wants this element refocused. + refocusElement.focus() if refocusElement value diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 477abef2..c1ce051f 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -231,6 +231,11 @@ DomUtils = @remove() false + simulateTextEntry: (element, text) -> + event = document.createEvent "TextEvent" + event.initTextEvent "textInput", true, true, null, text + element.dispatchEvent event + extend DomUtils, # From: https://github.com/component/textarea-caret-position/blob/master/index.js getCaretCoordinates: do -> |
