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