1448, add clipboard controller
This commit is contained in:
parent
ac3dc12ee3
commit
03d41ec8b1
|
@ -0,0 +1,14 @@
|
|||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
|
||||
static values = {
|
||||
copy: String
|
||||
}
|
||||
|
||||
declare readonly copyValue: string;
|
||||
|
||||
async copy(){
|
||||
await navigator.clipboard.writeText(this.copyValue)
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ import ToastController from "retrospring/controllers/toast_controller";
|
|||
import PwaBadgeController from "retrospring/controllers/pwa_badge_controller";
|
||||
import NavigationController from "retrospring/controllers/navigation_controller";
|
||||
import ShareController from "retrospring/controllers/share_controller";
|
||||
import ClipboardController from "retrospring/controllers/clipboard_controller";
|
||||
|
||||
/**
|
||||
* This module sets up Stimulus and our controllers
|
||||
|
@ -39,4 +40,5 @@ export default function (): void {
|
|||
window['Stimulus'].register('theme', ThemeController);
|
||||
window['Stimulus'].register('toast', ToastController);
|
||||
window['Stimulus'].register('share', ShareController);
|
||||
window['Stimulus'].register('clipboard', ClipboardController)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue