mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Compare commits
3 Commits
master
...
feat/suppo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca882fd16f | ||
|
|
abfb43cdb5 | ||
|
|
c16f99a0ee |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "clipboard",
|
||||
"version": "2.0.11",
|
||||
"version": "2.0.10",
|
||||
"description": "Modern copy to clipboard. No Flash. Just 3kb",
|
||||
"license": "MIT",
|
||||
"main": "dist/clipboard.js",
|
||||
|
||||
3
dist/clipboard.js
vendored
3
dist/clipboard.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* clipboard.js v2.0.11
|
||||
* clipboard.js v2.0.10
|
||||
* https://clipboardjs.com/
|
||||
*
|
||||
* Licensed MIT © Zeno Rocha
|
||||
@@ -319,6 +319,7 @@ var Clipboard = /*#__PURE__*/function (_Emitter) {
|
||||
trigger.focus();
|
||||
}
|
||||
|
||||
document.activeElement.blur();
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
});
|
||||
|
||||
4
dist/clipboard.min.js
vendored
4
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
1614
package-lock.json
generated
1614
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
Package.describe({
|
||||
name: 'zenorocha:clipboard',
|
||||
summary: 'Modern copy to clipboard. No Flash. Just 3kb.',
|
||||
version: '2.0.11',
|
||||
version: '2.0.10',
|
||||
git: 'https://github.com/zenorocha/clipboard.js',
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "clipboard",
|
||||
"version": "2.0.11",
|
||||
"version": "2.0.10",
|
||||
"description": "Modern copy to clipboard. No Flash. Just 2kb",
|
||||
"homepage": "https://clipboardjs.com",
|
||||
"repository": "zenorocha/clipboard.js",
|
||||
@@ -36,7 +36,7 @@
|
||||
"karma-sinon": "^1.0.4",
|
||||
"karma-webpack": "^5.0.0-alpha.5",
|
||||
"lint-staged": "^10.5.3",
|
||||
"mocha": "^10.1.0",
|
||||
"mocha": "^8.2.1",
|
||||
"prettier": "2.2.1",
|
||||
"sinon": "^9.2.3",
|
||||
"tsd": "^0.7.2",
|
||||
|
||||
2
src/clipboard.d.ts
vendored
2
src/clipboard.d.ts
vendored
@@ -39,7 +39,7 @@ declare class ClipboardJS {
|
||||
/**
|
||||
* Fires a copy action
|
||||
*/
|
||||
static copy(target: string | Element, options?: CopyActionOptions): string;
|
||||
static copy(target: string | Element, options: CopyActionOptions): string;
|
||||
|
||||
/**
|
||||
* Fires a cut action
|
||||
|
||||
@@ -86,6 +86,7 @@ class Clipboard extends Emitter {
|
||||
if (trigger) {
|
||||
trigger.focus();
|
||||
}
|
||||
document.activeElement.blur();
|
||||
window.getSelection().removeAllRanges();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -171,16 +171,16 @@ describe('Clipboard', () => {
|
||||
});
|
||||
|
||||
describe('#clearSelection', () => {
|
||||
it('should clear text selection without moving focus', (done) => {
|
||||
it('should remove focus from target and text selection', (done) => {
|
||||
let clipboard = new Clipboard('.btn');
|
||||
|
||||
clipboard.on('success', (e) => {
|
||||
e.clearSelection();
|
||||
|
||||
let selectedElem = document.activeElement;
|
||||
let selectedText = window.getSelection().toString();
|
||||
|
||||
assert.equal(selectedElem, e.trigger);
|
||||
e.clearSelection();
|
||||
|
||||
assert.equal(selectedElem, document.body);
|
||||
assert.equal(selectedText, '');
|
||||
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user