diff options
author | Go MAEDA <maeda@farend.jp> | 2022-02-19 07:36:40 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2022-02-19 07:36:40 +0000 |
commit | 6a46743cd389aeefc20348445fee2135a8e4c35c (patch) | |
tree | 8c504de5f36e05db870cd2f8f70eb7d4e15fb712 /app/views | |
parent | 9f822657820fb87675698d9e6151e7dc650e099f (diff) | |
download | redmine-6a46743cd389aeefc20348445fee2135a8e4c35c.tar.gz redmine-6a46743cd389aeefc20348445fee2135a8e4c35c.zip |
Fix code copying in common browsers (#36580).
Patch by Vitaly vit9696.
git-svn-id: http://svn.redmine.org/redmine/trunk@21415 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/common/_diff.html.erb | 20 | ||||
-rw-r--r-- | app/views/common/_file.html.erb | 10 | ||||
-rw-r--r-- | app/views/repositories/annotate.html.erb | 8 |
3 files changed, 22 insertions, 16 deletions
diff --git a/app/views/common/_diff.html.erb b/app/views/common/_diff.html.erb index 35dfdea28..f54bdfa4c 100644 --- a/app/views/common/_diff.html.erb +++ b/app/views/common/_diff.html.erb @@ -6,7 +6,7 @@ <% diff.each do |table_file| -%> <div class="autoscroll"> <% if diff.diff_type == 'sbs' -%> -<table class="filecontent"> +<table class="filecontent diffcontent"> <thead> <tr> <th colspan="4" class="filename"> @@ -21,17 +21,17 @@ <% table_file.each_line do |spacing, line| -%> <% if spacing -%> <tr class="spacing"> - <th class="line-num">...</th><td></td><th class="line-num">...</th><td></td> + <th class="line-num" data-txt="..."></th><td></td><th class="line-num" data-txt="..."></th><td></td> </tr> <% end -%> <tr> - <th class="line-num"><%= line.nb_line_left %></th> + <th class="line-num" data-txt="<%= line.nb_line_left %>"></th> <td class="line-code <%= line.type_diff_left %>"> - <pre><%= line.html_line_left.html_safe %></pre> + <div><%= line.html_line_left.html_safe %></div> </td> - <th class="line-num"><%= line.nb_line_right %></th> + <th class="line-num" data-txt="<%= line.nb_line_right %>"></th> <td class="line-code <%= line.type_diff_right %>"> - <pre><%= line.html_line_right.html_safe %></pre> + <div><%= line.html_line_right.html_safe %></div> </td> </tr> <% end -%> @@ -39,7 +39,7 @@ </table> <% else -%> -<table class="filecontent"> +<table class="filecontent diffcontent"> <thead> <tr> <th colspan="3" class="filename"> @@ -58,10 +58,10 @@ </tr> <% end -%> <tr> - <th class="line-num"><%= line.nb_line_left %></th> - <th class="line-num"><%= line.nb_line_right %></th> + <th class="line-num" data-txt="<%= line.nb_line_left %>"></th> + <th class="line-num" data-txt="<%= line.nb_line_right %>"></th> <td class="line-code <%= line.type_diff %>"> - <pre><%= line.html_line.html_safe %></pre> + <div><%= line.html_line.html_safe %></div> </td> </tr> <% end -%> diff --git a/app/views/common/_file.html.erb b/app/views/common/_file.html.erb index 95e0fb998..b0610f6ac 100644 --- a/app/views/common/_file.html.erb +++ b/app/views/common/_file.html.erb @@ -4,11 +4,13 @@ <% line_num = 1 %> <% syntax_highlight_lines(filename, Redmine::CodesetUtil.to_utf8_by_setting(content)).each do |line| %> <tr id="L<%= line_num %>"> - <th class="line-num"> - <a href="#L<%= line_num %>"><%= line_num %></a> - </th> + <th class="line-num"><a href="#L<%= line_num %>" data-txt="<%= line_num %>"></a></th> <td class="line-code"> - <pre><%= line.html_safe %></pre> + <% if line == "\n" or line == "\r\n" %> + <br> + <% else %> + <div><%= line.html_safe %></div> + <% end %> </td> </tr> <% line_num += 1 %> diff --git a/app/views/repositories/annotate.html.erb b/app/views/repositories/annotate.html.erb index 829090af6..de30e7c00 100644 --- a/app/views/repositories/annotate.html.erb +++ b/app/views/repositories/annotate.html.erb @@ -17,7 +17,7 @@ <% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %> <% revision = @annotate.revisions[line_num - 1] %> <tr id="L<%= line_num %>" class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %> <%= previous_revision && revision && revision != previous_revision ? 'bloc-change' : nil%>"> - <th class="line-num"><a href="#L<%= line_num %>"><%= line_num %></a></th> + <th class="line-num"><a href="#L<%= line_num %>" data-txt="<%= line_num %>"></a></th> <td class="revision"> <% if revision && revision != previous_revision %> <%= revision.identifier ? @@ -31,7 +31,11 @@ <%= author.split('<').first %> <% end %> </td> - <td class="line-code"><pre><%= line.html_safe %></pre></td> + <% if line == "\n" or line == "\r\n" %> + <td class="line-code"><br></td> + <% else %> + <td class="line-code"><div><%= line.html_safe %></div></td> + <% end %> </tr> <% line_num += 1; previous_revision = revision %> <% end %> |