Commit 0c902da1 authored by Douwe Maan's avatar Douwe Maan

Add .code to all tables holding diffs

We need this to be able to distinguish between Markdown tables and diff
tables.
parent 63792707
...@@ -13,7 +13,7 @@ export class CopyAsGFM { ...@@ -13,7 +13,7 @@ export class CopyAsGFM {
$(document).on('copy', '.md', e => { $(document).on('copy', '.md', e => {
CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection); CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection);
}); });
$(document).on('copy', 'pre.code.highlight, .diff-content .line_content', e => { $(document).on('copy', 'pre.code.highlight, table.code td.line_content', e => {
CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection); CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection);
}); });
$(document).on('paste', '.js-gfm-input', CopyAsGFM.pasteGFM); $(document).on('paste', '.js-gfm-input', CopyAsGFM.pasteGFM);
......
...@@ -38,12 +38,11 @@ export default { ...@@ -38,12 +38,11 @@ export default {
</script> </script>
<template> <template>
<div <table
:class="$options.userColorScheme" :class="$options.userColorScheme"
:data-commit-id="commitId" :data-commit-id="commitId"
class="code diff-wrap-lines js-syntax-highlight text-file" class="code diff-wrap-lines js-syntax-highlight text-file"
> >
<table>
<tbody> <tbody>
<template v-for="(line, index) in diffLines"> <template v-for="(line, index) in diffLines">
<parallel-diff-table-row <parallel-diff-table-row
...@@ -69,5 +68,4 @@ export default { ...@@ -69,5 +68,4 @@ export default {
</template> </template>
</tbody> </tbody>
</table> </table>
</div>
</template> </template>
...@@ -16,7 +16,7 @@ import utilsMixin from '../mixins/line_conflict_utils'; ...@@ -16,7 +16,7 @@ import utilsMixin from '../mixins/line_conflict_utils';
}, },
}, },
template: ` template: `
<table> <table class="diff-wrap-lines code js-syntax-highlight">
<tr class="line_holder parallel" v-for="section in file.parallelLines"> <tr class="line_holder parallel" v-for="section in file.parallelLines">
<template v-for="line in section"> <template v-for="line in section">
<td class="diff-line-num header" :class="lineCssClass(line)" v-if="line.isHeader"></td> <td class="diff-line-num header" :class="lineCssClass(line)" v-if="line.isHeader"></td>
......
...@@ -72,8 +72,8 @@ export default { ...@@ -72,8 +72,8 @@ export default {
:can-current-user-fork="false" :can-current-user-fork="false"
:expanded="!discussion.diff_file.viewer.collapsed" :expanded="!discussion.diff_file.viewer.collapsed"
/> />
<div v-if="isTextFile" :class="$options.userColorSchemeClass" class="diff-content code"> <div v-if="isTextFile" class="diff-content">
<table> <table class="code js-syntax-highlight" :class="$options.userColorSchemeClass">
<template v-if="hasTruncatedDiffLines"> <template v-if="hasTruncatedDiffLines">
<tr <tr
v-for="line in discussion.truncated_diff_lines" v-for="line in discussion.truncated_diff_lines"
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
= render "projects/diffs/file_header", diff_file: diff_file, url: discussion_path(discussion), show_toggle: false = render "projects/diffs/file_header", diff_file: diff_file, url: discussion_path(discussion), show_toggle: false
- if diff_file.text? - if diff_file.text?
.diff-content.code.js-syntax-highlight .diff-content
%table %table.code.js-syntax-highlight
- if expanded - if expanded
- discussions = { discussion.original_line_code => [discussion] } - discussions = { discussion.original_line_code => [discussion] }
= render partial: "projects/diffs/line", = render partial: "projects/diffs/line",
......
.diff-file.file-holder - if markup?(@blob.name)
.diff-content
- if markup?(@blob.name)
.file-content.md.md-file{ class: ('use-csslab' if Feature.enabled?(:csslab)) } .file-content.md.md-file{ class: ('use-csslab' if Feature.enabled?(:csslab)) }
= markup(@blob.name, @content) = markup(@blob.name, @content)
- else - else
.file-content.code.js-syntax-highlight .diff-file
.diff-content
- unless @diff_lines.empty? - unless @diff_lines.empty?
%table.text-file %table.text-file.code.js-syntax-highlight
- @diff_lines.each do |line| - @diff_lines.each do |line|
%tr.line_holder{ class: "#{line.type}" } %tr.line_holder{ class: "#{line.type}" }
- if line.type == "match" - if line.type == "match"
......
/ Side-by-side diff view / Side-by-side diff view
.text-file.diff-wrap-lines.code.js-syntax-highlight{ data: diff_view_data } .text-file{ data: diff_view_data }
%table %table.diff-wrap-lines.code.js-syntax-highlight
- diff_file.parallel_diff_lines.each do |line| - diff_file.parallel_diff_lines.each do |line|
- left = line[:left] - left = line[:left]
- right = line[:right] - right = line[:right]
......
%inline-conflict-lines{ "inline-template" => "true", ":file" => "file" } %inline-conflict-lines{ "inline-template" => "true", ":file" => "file" }
%table %table.diff-wrap-lines.code.js-syntax-highlight
%tr.line_holder.diff-inline{ "v-for" => "line in file.inlineLines" } %tr.line_holder.diff-inline{ "v-for" => "line in file.inlineLines" }
%td.diff-line-num.new_line{ ":class" => "lineCssClass(line)", "v-if" => "!line.isHeader" } %td.diff-line-num.new_line{ ":class" => "lineCssClass(line)", "v-if" => "!line.isHeader" }
%a {{line.new_line}} %a {{line.new_line}}
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
%strong {{file.filePath}} %strong {{file.filePath}}
= render partial: 'projects/merge_requests/conflicts/file_actions' = render partial: 'projects/merge_requests/conflicts/file_actions'
.diff-content.diff-wrap-lines .diff-content.diff-wrap-lines
.diff-wrap-lines.code.file-content.js-syntax-highlight{ "v-show" => "!isParallel && file.resolveMode === 'interactive' && file.type === 'text'" } .file-content{ "v-show" => "!isParallel && file.resolveMode === 'interactive' && file.type === 'text'" }
= render partial: "projects/merge_requests/conflicts/components/inline_conflict_lines" = render partial: "projects/merge_requests/conflicts/components/inline_conflict_lines"
.diff-wrap-lines.code.file-content.js-syntax-highlight{ "v-show" => "isParallel && file.resolveMode === 'interactive' && file.type === 'text'" } .file-content{ "v-show" => "isParallel && file.resolveMode === 'interactive' && file.type === 'text'" }
%parallel-conflict-lines{ ":file" => "file" } %parallel-conflict-lines{ ":file" => "file" }
%div{ "v-show" => "file.resolveMode === 'edit' || file.type === 'text-editor'" } %div{ "v-show" => "file.resolveMode === 'edit' || file.type === 'text-editor'" }
= render partial: "projects/merge_requests/conflicts/components/diff_file_editor" = render partial: "projects/merge_requests/conflicts/components/diff_file_editor"
......
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