Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix] http에서 클립보드 api 사용 못해서 발생하는 버그 수정 #66

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

minani-0621
Copy link
Contributor

✅ 구현사항

  • Clipboard api를 https와 local 환경에서만 사용할 수 있어서 document Element를 생성해서 구현
let textArea = document.createElement("textarea");
textArea.value = {복사할 요소};

textArea.style.position = "fixed";
textArea.style.left = "-9999px";
textArea.style.top = "-9999px";

document.body.appendChild(textArea);
textArea.select();

return new Promise((res, rej) => {
    if (document.execCommand('copy')) {
        res({복사할 요소})
    }else {
        rej();
    }
    textArea.remove();
})

@minani-0621 minani-0621 added the Hotfix hotfix label Aug 23, 2024
@minani-0621 minani-0621 merged commit 9eef881 into develop Aug 23, 2024
1 check passed
@minani-0621 minani-0621 deleted the hotfix/clipboard branch August 23, 2024 04:48
@minani-0621 minani-0621 restored the hotfix/clipboard branch August 23, 2024 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hotfix hotfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant