-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bildungsurlaub): Fix copy to clipboard
- Loading branch information
1 parent
c3db248
commit 970c1fa
Showing
2 changed files
with
32 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
import Controller from '@ember/controller'; | ||
|
||
export default class HomeController extends Controller { | ||
get onSuccess() { | ||
return 'Copied to clipboard'; | ||
} | ||
|
||
get onError() { | ||
return 'An error occurred, please try again'; | ||
} | ||
|
||
get copyContent() { | ||
let text = document.getElementById('copyTextToClipboard').innerHTML; | ||
const copy = async () => { | ||
// REMINDER: copy to clipboard only works on HTTPS | ||
async copyContent(targetText) { | ||
let text = document.getElementById(targetText).innerHTML; | ||
try { | ||
await navigator.clipboard.writeText(text); | ||
await | ||
navigator.clipboard.writeText(text); | ||
alert('Content copied to clipboard'); | ||
} catch (err) { | ||
alert.error('Failed to copy: ', err); | ||
alert('Failed to copy: ', err); | ||
} | ||
} | ||
// } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters