Do not clear text on mobile devices - fix #26

This commit is contained in:
Mahdi Dibaiee 2015-10-02 20:11:28 +03:30
parent a4c8bc5bf0
commit 82bf1b93a4
3 changed files with 71 additions and 61 deletions

6
dist/clipboard.js vendored
View File

@ -371,6 +371,12 @@ var ClipboardAction = (function () {
*/
ClipboardAction.prototype.clearSelection = function clearSelection() {
var force = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
if (!force && navigator.userAgent.indexOf('Mobile') > -1) {
return;
}
if (this.target) {
this.target.blur();
}

File diff suppressed because one or more lines are too long

View File

@ -143,7 +143,11 @@ class ClipboardAction {
/**
* Removes current selection and focus from `target` element.
*/
clearSelection() {
clearSelection(force = false) {
if (!force && navigator.userAgent.indexOf('Mobile') > -1) {
return;
}
if (this.target) {
this.target.blur();
}