-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2523 from pulibrary/2429-clipboard-button
Add clipboard.js and use it for "copy to clipboard" button on auth_link
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Clipboard from 'clipboard' | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
let div = document.getElementById('clipboard-trigger-holder') | ||
div.innerHTML = '<button class="btn btn-primary" id="clipboard-trigger">Copy link to clipboard</button>' | ||
new Clipboard('#clipboard-trigger', { | ||
text: function (trigger) { | ||
let url = document.getElementById('authorized-link').children[0].getAttribute('href') | ||
return url | ||
} | ||
}) | ||
}) |
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
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
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