Commit f304f975 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix blob multiline highlight

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 78b2fb5d
...@@ -64,7 +64,7 @@ class BlobView ...@@ -64,7 +64,7 @@ class BlobView
nodes.attr("id", hash) nodes.attr("id", hash)
# initialize multi-line select # initialize multi-line select
$("#tree-content-holder .line_numbers a[id^=L]").on("click", handleMultiSelect) $("#tree-content-holder .line-numbers a[id^=L]").on("click", handleMultiSelect)
# Highlight the correct lines on load # Highlight the correct lines on load
highlightBlobLines() highlightBlobLines()
......
...@@ -4,6 +4,7 @@ $ -> ...@@ -4,6 +4,7 @@ $ ->
class Dispatcher class Dispatcher
constructor: () -> constructor: () ->
@initSearch() @initSearch()
@initHighlight()
@initPageScripts() @initPageScripts()
initPageScripts: -> initPageScripts: ->
...@@ -53,3 +54,10 @@ class Dispatcher ...@@ -53,3 +54,10 @@ class Dispatcher
project_ref = opts.data('autocomplete-project-ref') project_ref = opts.data('autocomplete-project-ref')
new SearchAutocomplete(path, project_id, project_ref) new SearchAutocomplete(path, project_id, project_ref)
initHighlight: ->
$('pre code').each (i, e) ->
hljs.highlightBlock(e)
$(e).html($.map($(e).html().split("\n"), (line, i) ->
"<div class='line' id='LC" + (i + 1) + "'>" + line + "</div>"
).join("\n"))
...@@ -56,9 +56,6 @@ document.addEventListener("page:fetch", unbindEvents) ...@@ -56,9 +56,6 @@ document.addEventListener("page:fetch", unbindEvents)
document.addEventListener("page:change", stopSpinner) document.addEventListener("page:change", stopSpinner)
$ -> $ ->
$('pre code').each (i, e) ->
hljs.highlightBlock(e)
# Click a .one_click_select field, select the contents # Click a .one_click_select field, select the contents
$(".one_click_select").on 'click', -> $(@).select() $(".one_click_select").on 'click', -> $(@).select()
......
...@@ -16,6 +16,11 @@ ...@@ -16,6 +16,11 @@
code { code {
white-space: pre; white-space: pre;
word-wrap: normal; word-wrap: normal;
padding: 0;
.line {
display: inline;
}
} }
} }
......
.dark { .dark {
background-color: #232323; background-color: #232323;
.line.hll {
background: #558;
}
.highlight{ .highlight{
border-left: 1px solid #444; border-left: 1px solid #444;
} }
...@@ -15,7 +19,6 @@ ...@@ -15,7 +19,6 @@
.hljs { .hljs {
display: block; display: block;
padding: 0.5em;
background: #232323; background: #232323;
color: #E6E1DC; color: #E6E1DC;
} }
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
border-left: 1px solid #444; border-left: 1px solid #444;
} }
.line.hll {
background: #558;
}
.line-numbers a { .line-numbers a {
color: #666; color: #666;
} }
...@@ -15,7 +19,7 @@ ...@@ -15,7 +19,7 @@
} }
.hljs { .hljs {
display: block; padding: 0.5em; display: block;
background: #272822; background: #272822;
} }
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
border-left: 1px solid #113b46; border-left: 1px solid #113b46;
} }
.line.hll {
background: #000;
}
pre { pre {
background-color: #002B36; background-color: #002B36;
color: #eee; color: #eee;
...@@ -16,7 +20,6 @@ ...@@ -16,7 +20,6 @@
.hljs { .hljs {
display: block; display: block;
padding: 0.5em;
background: #002b36; background: #002b36;
color: #839496; color: #839496;
} }
......
.white { .white {
background-color: #fff; background-color: #fff;
.line.hll {
background: #FFA;
}
.highlight{ .highlight{
border-left: 1px solid #eee; border-left: 1px solid #eee;
} }
...@@ -19,7 +23,7 @@ ...@@ -19,7 +23,7 @@
} }
.hljs { .hljs {
display: block; padding: 0.5em; display: block;
background: #fff; color: black; background: #fff; color: black;
} }
......
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