mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 13:41:28 -03:30
Updates onCopy functions to use navigator.clipboard instead of deprecated execCommand
This commit is contained in:
parent
121db42699
commit
03209fe2f2
@ -165,15 +165,9 @@ function ProjectDetail({ project }) {
|
||||
variant="inline-compact"
|
||||
clickTip={t`Successfully copied to clipboard!`}
|
||||
hoverTip={t`Copy full revision to clipboard.`}
|
||||
onCopy={event => {
|
||||
const clipboard = event.currentTarget.parentElement;
|
||||
const el = document.createElement('textarea');
|
||||
el.value = scm_revision.toString();
|
||||
clipboard.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand('copy');
|
||||
clipboard.removeChild(el);
|
||||
}}
|
||||
onCopy={() =>
|
||||
navigator.clipboard.writeText(scm_revision.toString())
|
||||
}
|
||||
>
|
||||
{scm_revision.substring(0, 7)}
|
||||
</ClipboardCopy>
|
||||
|
||||
@ -97,15 +97,9 @@ function ProjectListItem({
|
||||
variant="inline-compact"
|
||||
clickTip={t`Successfully copied to clipboard!`}
|
||||
hoverTip={t`Copy full revision to clipboard.`}
|
||||
onCopy={event => {
|
||||
const clipboard = event.currentTarget.parentElement;
|
||||
const el = document.createElement('textarea');
|
||||
el.value = project.scm_revision.toString();
|
||||
clipboard.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand('copy');
|
||||
clipboard.removeChild(el);
|
||||
}}
|
||||
onCopy={() =>
|
||||
navigator.clipboard.writeText(project.scm_revision.toString())
|
||||
}
|
||||
>
|
||||
{project.scm_revision.substring(0, 7)}
|
||||
</ClipboardCopy>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user