grim/port-authority

automatically select the tag then you click on it
develop
2015-04-08, Gary Kramlich
d97c2da13228
automatically select the tag then you click on it
--- a/html/window.html Thu Mar 19 17:49:53 2015 -0500
+++ b/html/window.html Wed Apr 08 14:57:50 2015 -0500
@@ -53,7 +53,7 @@
<div class="ui icon message yellow">
<div class="content">
<i class="icon copy"></i>
- {{clipboard}}
+ <span class="clipboard" ng-click="set_clipboard()">{{clipboard}}</span>
</div>
</div>
</div>
--- a/js/app.js Thu Mar 19 17:49:53 2015 -0500
+++ b/js/app.js Wed Apr 08 14:57:50 2015 -0500
@@ -204,4 +204,15 @@
$scope.clear_error = function() {
$scope.error = null;
};
+
+ $scope.set_clipboard = function() {
+ var element = document.querySelector(".clipboard");
+ var selection = window.getSelection();
+ var range = document.createRange();
+
+ range.selectNodeContents(element);
+
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
}