Project

General

Profile

Actions

Defect #36580

closed

Fix code copying in common browsers

Added by Vitaly vit9696 almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

This patch resolves https://www.redmine.org/issues/3382 for:

  • Chrome-based browsers (empty lines do not get copied).
  • Safari (line numbers are inserted to the copied code, empty lines do not get copied, extra spaces are inserted before each line).
  • Firefox (empty lines are inserted to the copied code).

As for Chrome and Safari the only way to make them properly copy empty newlines is to insert a "br" element instead of "pre".

As for Safari, data marked as user-select none will still be copied, thus the content trick used in other SCM apps. It is additionally important to put "a" element right after "th", because otherwise there will be spaces in front of the line.

As for Firefox, there are multiple related issues in their bugtracker:

Files

redmine-4.2.3-codelines-2022-02-06-20-12.diff (4.81 KB) redmine-4.2.3-codelines-2022-02-06-20-12.diff Vitaly vit9696, 2022-02-06 18:16
safari-without-patch.png (23.6 KB) safari-without-patch.png Go MAEDA, 2022-02-07 08:27
safari-with-patch.png (25.1 KB) safari-with-patch.png Go MAEDA, 2022-02-07 08:27
Screenshot 2022-02-08 at 14.01.31.png (231 KB) Screenshot 2022-02-08 at 14.01.31.png Vitaly vit9696, 2022-02-08 12:01
Screenshot 2022-02-08 at 14.04.50.jpg (573 KB) Screenshot 2022-02-08 at 14.04.50.jpg Vitaly vit9696, 2022-02-08 12:05
36580-v2.patch (13 KB) 36580-v2.patch Go MAEDA, 2022-02-15 07:12
36580-v3.patch (13.9 KB) 36580-v3.patch Yuichi HARADA, 2022-02-17 07:03

Related issues

Related to Redmine - Feature #3382: Ability to select only source code without line numbersClosed2009-05-18

Actions
Actions

Also available in: Atom PDF