Add copy lint name button
This commit is contained in:
parent
bf2e63104d
commit
27fec01fa8
@ -490,6 +490,9 @@ Otherwise, have a great day =^.^=
|
|||||||
<div class="panel-title-name">
|
<div class="panel-title-name">
|
||||||
<span>{{lint.id}}</span>
|
<span>{{lint.id}}</span>
|
||||||
<a href="#{{lint.id}}" class="anchor label label-default" ng-click="open[lint.id] = true; $event.stopPropagation()">¶</a>
|
<a href="#{{lint.id}}" class="anchor label label-default" ng-click="open[lint.id] = true; $event.stopPropagation()">¶</a>
|
||||||
|
<a href="" id="clipboard-{{lint.id}}" class="anchor label label-default" ng-click="copyToClipboard(lint); $event.stopPropagation()">
|
||||||
|
📋
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel-title-addons">
|
<div class="panel-title-addons">
|
||||||
|
@ -258,6 +258,27 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.copyToClipboard = function (lint) {
|
||||||
|
const clipboard = document.getElementById("clipboard-" + lint.id);
|
||||||
|
if (clipboard) {
|
||||||
|
let resetClipboardTimeout = null;
|
||||||
|
let resetClipboardIcon = clipboard.innerHTML;
|
||||||
|
|
||||||
|
function resetClipboard() {
|
||||||
|
resetClipboardTimeout = null;
|
||||||
|
clipboard.innerHTML = resetClipboardIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
navigator.clipboard.writeText("clippy::" + lint.id);
|
||||||
|
|
||||||
|
clipboard.textContent = "✓";
|
||||||
|
if (resetClipboardTimeout !== null) {
|
||||||
|
clearTimeout(resetClipboardTimeout);
|
||||||
|
}
|
||||||
|
resetClipboardTimeout = setTimeout(resetClipboard, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get data
|
// Get data
|
||||||
$scope.open = {};
|
$scope.open = {};
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user