Commit 1e202a16 authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Preserve line breaks on copy command

I have tested successfully on the latest version of Chrome, Safari and
Firefox. I also tested successfully on an Android and iOS devices.

I couldn't tested more exhaustively on other desktop/mobile browser
versions because SauceLabs didn't allowed me to retrieve the pasted
text.

Closes https://github.com/hypothesis/product-backlog/issues/1180
parent 23a84ffa
......@@ -10,7 +10,7 @@
* @param {string} text
*/
export function copyText(text) {
const temp = document.createElement('input');
const temp = document.createElement('textarea'); // use textarea instead of input to preserve line breaks
temp.value = text;
temp.setAttribute('data-testid', 'copy-text');
// Recipe from https://stackoverflow.com/a/34046084/14463679
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment