Changeset - 422671dd32df
default
0
3
0
css: use pseudo-content trick to prevent diff line numbers from being pasted to text
When copy-pasting a diff from Chrome to a text editor, line numbers (on
separate lines) would be pasted as well. Even though 'user-select: none'
prevents text from being visually selected, in Chrome, the text still gets
copied to the clipboard when the user for example presses ctrl-c. (It worked in
Firefox.)
Instead, don't put the line numbers directly in the DOM, but put them in a data
attribute and render them as :before. That will give the same rendering as
before but prevent it from being copied.
(Firefox will however still add empty lines - that is how <pre> is hardcoded to
be rendered when pasting to text.)
When copy-pasting a diff from Chrome to a text editor, line numbers (on
separate lines) would be pasted as well. Even though 'user-select: none'
prevents text from being visually selected, in Chrome, the text still gets
copied to the clipboard when the user for example presses ctrl-c. (It worked in
Firefox.)
Instead, don't put the line numbers directly in the DOM, but put them in a data
attribute and render them as :before. That will give the same rendering as
before but prevent it from being copied.
(Firefox will however still add empty lines - that is how <pre> is hardcoded to
be rendered when pasting to text.)
3 files changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
0 comments (0 inline, 0 general)