mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54efeb68e6 | ||
|
|
f56825bf73 | ||
|
|
9377659c9c | ||
|
|
5e43e84d91 | ||
|
|
6ca2ba514c | ||
|
|
b3ad81570e | ||
|
|
17aedf5221 | ||
|
|
e14d92e2f4 | ||
|
|
b7b2259dfb | ||
|
|
c5b416b108 |
@@ -17,3 +17,6 @@ insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{package.json,bower.json}]
|
||||
indent_size = 2
|
||||
|
||||
6
.npmignore
Normal file
6
.npmignore
Normal file
@@ -0,0 +1,6 @@
|
||||
/.*/
|
||||
/example/
|
||||
/test/
|
||||
/.*
|
||||
/bower.json
|
||||
/karma.conf.js
|
||||
10
bower.json
10
bower.json
@@ -1,9 +1,17 @@
|
||||
{
|
||||
"name": "clipboard",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.2",
|
||||
"description": "Modern copy to clipboard. No Flash. Just 2kb",
|
||||
"license": "MIT",
|
||||
"main": "dist/clipboard.js",
|
||||
"ignore": [
|
||||
"/.*/",
|
||||
"/example/",
|
||||
"/test/",
|
||||
"/.*",
|
||||
"/bower.json",
|
||||
"/karma.conf.js"
|
||||
],
|
||||
"keywords": [
|
||||
"clipboard",
|
||||
"copy",
|
||||
|
||||
5
dist/clipboard.js
vendored
5
dist/clipboard.js
vendored
@@ -281,7 +281,7 @@ var ClipboardAction = (function () {
|
||||
this.fakeElem = document.createElement('textarea');
|
||||
this.fakeElem.style.position = 'absolute';
|
||||
this.fakeElem.style.left = '-9999px';
|
||||
this.fakeElem.style.top = document.body.scrollTop + 'px';
|
||||
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
|
||||
this.fakeElem.setAttribute('readonly', '');
|
||||
this.fakeElem.value = this.text;
|
||||
this.selectedText = this.text;
|
||||
@@ -294,7 +294,7 @@ var ClipboardAction = (function () {
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
@@ -321,6 +321,7 @@ var ClipboardAction = (function () {
|
||||
var range = document.createRange();
|
||||
var selection = window.getSelection();
|
||||
|
||||
selection.removeAllRanges();
|
||||
range.selectNodeContents(this.target);
|
||||
selection.addRange(range);
|
||||
this.selectedText = selection.toString();
|
||||
|
||||
2
dist/clipboard.min.js
vendored
2
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "clipboard",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.2",
|
||||
"description": "Modern copy to clipboard. No Flash. Just 2kb",
|
||||
"repository": "zenorocha/clipboard.js",
|
||||
"license": "MIT",
|
||||
@@ -43,7 +43,7 @@
|
||||
"build": "npm run build-debug && npm run build-min",
|
||||
"build-debug": "browserify src/clipboard.js -s Clipboard -o dist/clipboard.js",
|
||||
"build-min": "uglify -s dist/clipboard.js -o dist/clipboard.min.js",
|
||||
"build-watch": "watchify src/clipboard.js -o dist/clipboard.js -v",
|
||||
"build-watch": "watchify src/clipboard.js -s Clipboard -o dist/clipboard.js -v",
|
||||
"test": "npm run test-browser && npm run test-server",
|
||||
"test-browser": "karma start --single-run",
|
||||
"test-server": "mocha test/module-systems.js"
|
||||
|
||||
@@ -56,7 +56,7 @@ class ClipboardAction {
|
||||
this.fakeElem = document.createElement('textarea');
|
||||
this.fakeElem.style.position = 'absolute';
|
||||
this.fakeElem.style.left = '-9999px';
|
||||
this.fakeElem.style.top = document.body.scrollTop + 'px';
|
||||
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
|
||||
this.fakeElem.setAttribute('readonly', '');
|
||||
this.fakeElem.value = this.text;
|
||||
this.selectedText = this.text;
|
||||
@@ -69,7 +69,7 @@ class ClipboardAction {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
removeFake() {
|
||||
if (this.fakeHandler) {
|
||||
@@ -95,6 +95,7 @@ class ClipboardAction {
|
||||
let range = document.createRange();
|
||||
let selection = window.getSelection();
|
||||
|
||||
selection.removeAllRanges();
|
||||
range.selectNodeContents(this.target);
|
||||
selection.addRange(range);
|
||||
this.selectedText = selection.toString();
|
||||
|
||||
Reference in New Issue
Block a user