diff --git a/bower.json b/bower.json index 127eb37..9e56c09 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "clipboard", - "version": "1.5.4", + "version": "1.5.5", "description": "Modern copy to clipboard. No Flash. Just 2kb", "license": "MIT", "main": "dist/clipboard.js", diff --git a/dist/clipboard.js b/dist/clipboard.js index b79dfa2..b97fcd2 100644 --- a/dist/clipboard.js +++ b/dist/clipboard.js @@ -1,5 +1,5 @@ /*! - * clipboard.js v1.5.4 + * clipboard.js v1.5.5 * https://zenorocha.github.io/clipboard.js * * Licensed MIT © Zeno Rocha @@ -255,11 +255,16 @@ function select(element) { var selectedText; if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { - element.select(); + element.focus(); + element.setSelectionRange(0, element.value.length); selectedText = element.value; } else { + if (element.hasAttribute('contenteditable')) { + element.focus(); + } + var selection = window.getSelection(); var range = document.createRange(); diff --git a/dist/clipboard.min.js b/dist/clipboard.min.js index 417bf85..4e2a012 100644 --- a/dist/clipboard.min.js +++ b/dist/clipboard.min.js @@ -1,7 +1,7 @@ /*! - * clipboard.js v1.5.4 + * clipboard.js v1.5.5 * https://zenorocha.github.io/clipboard.js * * Licensed MIT © Zeno Rocha */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ar;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;nr;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;n