kopia lustrzana https://github.com/FacilMap/facilmap
Add buttons to copy pad URLs
rodzic
38171400f7
commit
482568042b
|
@ -14,6 +14,7 @@ var FacilPad = {
|
|||
|
||||
fp.app.constant("L", L);
|
||||
fp.app.constant("linkifyStr", linkifyStr);
|
||||
fp.app.constant("Clipboard", Clipboard);
|
||||
|
||||
// Dereferrer
|
||||
$(document).on("click", "a", function(e) {
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
<div class="input-group">
|
||||
<span class="input-group-addon">{{urlPrefix}}</span>
|
||||
<input id="pad-link-input" ng-model="writeId" class="form-control" />
|
||||
<span class="input-group-btn" ng-if="!create">
|
||||
<button class="btn btn-default" ng-click="copy(urlPrefix + writeId)">Copy</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -22,6 +25,9 @@
|
|||
<div class="input-group">
|
||||
<span class="input-group-addon">{{urlPrefix}}</span>
|
||||
<input id="pad-rolink-input" ng-model="readId" class="form-control" />
|
||||
<span class="input-group-btn" ng-if="!create">
|
||||
<button class="btn btn-default" ng-click="copy(urlPrefix + readId)">Copy</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -88,6 +88,10 @@
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.copy = function(text) {
|
||||
fpUtils.copyToClipboard(text);
|
||||
}
|
||||
});
|
||||
|
||||
})(FacilPad, jQuery, angular);
|
|
@ -1,6 +1,6 @@
|
|||
(function(fp, $, ng, undefined) {
|
||||
|
||||
fp.app.factory("fpUtils", function($parse, L) {
|
||||
fp.app.factory("fpUtils", function($parse, L, Clipboard) {
|
||||
|
||||
var fpUtils = { };
|
||||
|
||||
|
@ -197,6 +197,17 @@
|
|||
return idxs.length;
|
||||
};
|
||||
|
||||
fpUtils.copyToClipboard = function(text) {
|
||||
var el = $("<button></button>").css("display", "none").appendTo("body");
|
||||
var c = new Clipboard(el[0], {
|
||||
text: function() {
|
||||
return text;
|
||||
}
|
||||
});
|
||||
el.click().remove();
|
||||
c.destroy();
|
||||
};
|
||||
|
||||
return fpUtils;
|
||||
});
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
"leaflet-geometry-util": "https://github.com/makinacorpus/Leaflet.GeometryUtil/raw/master/src/leaflet.geometryutil.js",
|
||||
"leaflet-almostover": "https://github.com/makinacorpus/Leaflet.AlmostOver/raw/gh-pages/src/leaflet.almostover.js",
|
||||
"linkifyjs": "^2.1.3",
|
||||
"leaflet.locatecontrol": "^0.55.0"
|
||||
"leaflet.locatecontrol": "^0.55.0",
|
||||
"clipboard": "^1.5.12"
|
||||
},
|
||||
"overrides": {
|
||||
"bootstrap": {
|
||||
|
|
Ładowanie…
Reference in New Issue