vendor/assets/javascripts/clipboard.js in clipboard-rails-1.4.1 vs vendor/assets/javascripts/clipboard.js in clipboard-rails-1.4.2
- old
+ new
@@ -292,11 +292,11 @@
this.copyText();
};
/**
* Only removes the fake element after another click event, that way
- * an user can hit `Ctrl+C` to copy because selection still exists.
+ * a user can hit `Ctrl+C` to copy because selection still exists.
*/
ClipboardAction.prototype.removeFake = function removeFake() {
if (this.fakeHandler) {
document.body.removeEventListener('click');
@@ -319,9 +319,10 @@
this.selectedText = this.target.value;
} else {
var range = document.createRange();
var selection = window.getSelection();
+ selection.removeAllRanges();
range.selectNodeContents(this.target);
selection.addRange(range);
this.selectedText = selection.toString();
}
\ No newline at end of file