Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3A5BA200CF6 for ; Mon, 4 Sep 2017 02:43:56 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 38FC9163AC6; Mon, 4 Sep 2017 00:43:56 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 86E2B163AC3 for ; Mon, 4 Sep 2017 02:43:55 +0200 (CEST) Received: (qmail 46141 invoked by uid 500); 4 Sep 2017 00:43:53 -0000 Mailing-List: contact commits-help@guacamole.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@guacamole.incubator.apache.org Delivered-To: mailing list commits@guacamole.incubator.apache.org Received: (qmail 46132 invoked by uid 99); 4 Sep 2017 00:43:53 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Sep 2017 00:43:53 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 0BF0ED2BF8 for ; Mon, 4 Sep 2017 00:43:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.222 X-Spam-Level: X-Spam-Status: No, score=-4.222 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id OEscOSxIpBYj for ; Mon, 4 Sep 2017 00:43:47 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 47A2861067 for ; Mon, 4 Sep 2017 00:43:47 +0000 (UTC) Received: (qmail 46112 invoked by uid 99); 4 Sep 2017 00:43:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Sep 2017 00:43:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 22E98F560A; Mon, 4 Sep 2017 00:43:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vnick@apache.org To: commits@guacamole.incubator.apache.org Date: Mon, 04 Sep 2017 00:43:45 -0000 Message-Id: <76c0c7937d5443a3a0d45285af5849a9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/5] incubator-guacamole-client git commit: GUACAMOLE-310: Use input element select() function when available. archived-at: Mon, 04 Sep 2017 00:43:56 -0000 Repository: incubator-guacamole-client Updated Branches: refs/heads/master 96e9318db -> ab88eb2ff GUACAMOLE-310: Use input element select() function when available. Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/7e0cdd2a Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/7e0cdd2a Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/7e0cdd2a Branch: refs/heads/master Commit: 7e0cdd2adf156b6aa15ddf96a7e78a41c8f47c9a Parents: 47acaf5 Author: Michael Jumper Authored: Sun Sep 3 17:07:24 2017 -0700 Committer: Michael Jumper Committed: Sun Sep 3 17:08:34 2017 -0700 ---------------------------------------------------------------------- .../app/clipboard/services/clipboardService.js | 24 ++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/7e0cdd2a/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js b/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js index 311dbc0..07091f3 100644 --- a/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js +++ b/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js @@ -135,14 +135,23 @@ angular.module('clipboard').factory('clipboardService', ['$injector', */ var selectAll = function selectAll(element) { - // Generate a range which selects all nodes within the given element - var range = document.createRange(); - range.selectNodeContents(element); + // Use the select() function defined for input elements, if available + if (element.select) + element.select(); - // Replace any current selection with the generated range - var selection = $window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); + // Fallback to manual manipulation of the selection + else { + + // Generate a range which selects all nodes within the given element + var range = document.createRange(); + range.selectNodeContents(element); + + // Replace any current selection with the generated range + var selection = $window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + + } }; @@ -175,6 +184,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector', } // Select all data within the clipboard target + clipboardContent.focus(); selectAll(clipboardContent); // Attempt to copy data from clipboard element into local clipboard