diff options
| author | mrmr1993 | 2017-11-24 20:26:30 +0000 |
|---|---|---|
| committer | mrmr1993 | 2017-11-24 20:26:30 +0000 |
| commit | c8a395481eeb950c8725e3d6e0fa58510cb407aa (patch) | |
| tree | 2debad52abe6160bb3433e47ae1698dba36d01f4 | |
| parent | ec95cc2573526355c336f0f11b45ee608470a78b (diff) | |
| download | vimium-c8a395481eeb950c8725e3d6e0fa58510cb407aa.tar.bz2 | |
FF: Use a contenteditable <div> for Clipboard.paste
This adds support for pasting rich text from the clipboard
| -rw-r--r-- | lib/clipboard.coffee | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/clipboard.coffee b/lib/clipboard.coffee index b37caf72..a9e2e82e 100644 --- a/lib/clipboard.coffee +++ b/lib/clipboard.coffee @@ -1,6 +1,6 @@ Clipboard = - _createTextArea: -> - textArea = document.createElement "textarea" + _createTextArea: (tagName = "textarea") -> + textArea = document.createElement tagName textArea.style.position = "absolute" textArea.style.left = "-100%" textArea.contentEditable = "true" @@ -17,11 +17,11 @@ Clipboard = document.body.removeChild(textArea) paste: -> - textArea = @_createTextArea() + textArea = @_createTextArea "div" # Use a <div> so Firefox pastes rich text. document.body.appendChild(textArea) textArea.focus() document.execCommand("Paste") - value = textArea.value + value = textArea.innerText document.body.removeChild(textArea) value |
