You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to copy text which contains "\r\n". when using firefox, I found that the "\r\n" inside the copied text turned to be "\n\n".
After reading the source code, I found the problem is the use of Selection. (Maybe it's a bug of Firefox)
Yeah, I've found sindresorhus/copy-text-to-clipboard which use textarea, but I'm not sure if it will cause some other issues that you mentioned.
Also I've found there's a new api called navigator.clipboard that can be used in modern browsers.
I need to copy text which contains "\r\n". when using firefox, I found that the "\r\n" inside the copied text turned to be "\n\n".
After reading the source code, I found the problem is the use of
Selection
. (Maybe it's a bug of Firefox)Heres a simple example to explain the problem:
https://jsfiddle.net/LiuRhoRamen/mo1zfxvb/7/
Maybe It's better to create a
textarea
, call .select() method and do the copy?The text was updated successfully, but these errors were encountered: