-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat: add native copy method #1852
base: main
Are you sure you want to change the base?
Conversation
Preview is ready. |
Visual Tests Report is ready. |
0c4054d
to
8afb15d
Compare
@@ -0,0 +1,7 @@ | |||
export function copyText(text: string) { | |||
if (navigator.clipboard.writeText) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
navigator?.clipboard?.writeText
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if
is better for possible stackatrace investigation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it is possible that application will fail, if there's no clipboard
in navigator
proto. We don't use try ... catch
when using copyText
.
I suggested not removing if
, but add checks like if (navigator?.clipboard?.writeText) { ... }
cc4705e
to
d6bc68b
Compare
@@ -0,0 +1,7 @@ | |||
export function copyText(text: string) { | |||
if (navigator.clipboard.writeText) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it is possible that application will fail, if there's no clipboard
in navigator
proto. We don't use try ... catch
when using copyText
.
I suggested not removing if
, but add checks like if (navigator?.clipboard?.writeText) { ... }
Fixes #658