mirror of
https://github.com/redmine/redmine.git
synced 2025-10-27 00:06:15 +01:00
Patch by Mizuki ISHIKAWA (user:ishikawa999). git-svn-id: https://svn.redmine.org/redmine/trunk@23991 e93f8b46-1217-0410-a6f0-8f06a7374b81
22 lines
552 B
JavaScript
22 lines
552 B
JavaScript
import { Controller } from "@hotwired/stimulus";
|
|
|
|
export default class extends Controller {
|
|
static targets = ["apiKey"];
|
|
|
|
copy(event) {
|
|
event.preventDefault();
|
|
|
|
const apiKeyText = this.apiKeyTarget.textContent?.trim();
|
|
if (!apiKeyText) return;
|
|
|
|
const svgIcon = event.target.closest('.copy-api-key-link').querySelector('svg')
|
|
if (!svgIcon) return;
|
|
|
|
copyToClipboard(apiKeyText).then(() => {
|
|
updateSVGIcon(svgIcon, 'checked');
|
|
setTimeout(() => {
|
|
updateSVGIcon(svgIcon, 'copy');
|
|
}, 2000);
|
|
});
|
|
}
|
|
} |