Copying and pasting doesn't grab line numbers or +/-

This commit is contained in:
Annabel Dunstone 2016-04-08 14:43:21 -07:00
parent 64776ab2b4
commit 7030ffb0e0
4 changed files with 27 additions and 6 deletions

View file

@ -67,6 +67,14 @@
line-height: $code_line_height;
font-size: $code_font_size;
&.noteable_line.old:before {
content: '-';
}
&.noteable_line.new:before {
content: '+';
}
span {
white-space: pre;
}
@ -391,3 +399,15 @@
margin-bottom: 0;
}
}
.diff-line-num:not(.js-unfold-bottom) {
a {
&:before {
content: attr(data-linenumber);
}
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
}

View file

@ -44,6 +44,7 @@ module DiffHelper
if line.blank?
"  ".html_safe
else
line[0] = ''
line
end
end

View file

@ -9,9 +9,9 @@
- line_old = line_new - @form.offset
%tr.line_holder
%td.old_line.diff-line-num{data: {linenumber: line_old}}
= link_to raw(line_old), "#"
%td.new_line.diff-line-num
= link_to raw(line_new) , "#"
/ = link_to raw(line_old), "#"
%td.new_line.diff-line-num{data: {linenumber: line_old}}
/ = link_to raw(line_new) , "#"
%td.line_content.noteable_line==#{' ' * @form.indent}#{line}
- if @form.unfold? && @form.bottom? && @form.to < @blob.loc

View file

@ -9,12 +9,12 @@
%td.new_line.diff-line-num
%td.line_content.match= line.text
- else
%td.old_line.diff-line-num{class: type}
%td.old_line.diff-line-num{class: type, data: {linenumber: line.new_pos}}
- link_text = raw(type == "new" ? "&nbsp;" : line.old_pos)
- if defined?(plain) && plain
= link_text
- else
= link_to link_text, "##{line_code}", id: line_code
= link_to "", "##{line_code}", id: line_code, data: { linenumber: link_text }
- if @comments_allowed && can?(current_user, :create_note, @project)
= link_to_new_diff_note(line_code)
%td.new_line.diff-line-num{class: type, data: {linenumber: line.new_pos}}
@ -22,5 +22,5 @@
- if defined?(plain) && plain
= link_text
- else
= link_to link_text, "##{line_code}", id: line_code
= link_to "", "##{line_code}", id: line_code, data: { linenumber: link_text }
%td.line_content{class: "noteable_line #{type} #{line_code}", data: { line_code: line_code }}= diff_line_content(line.text)