Fix blob multiline highlight

Signed-off-by: NDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
上级 78b2fb5d
......@@ -64,7 +64,7 @@ class BlobView
nodes.attr("id", hash)
# 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
highlightBlobLines()
......
......@@ -4,6 +4,7 @@ $ ->
class Dispatcher
constructor: () ->
@initSearch()
@initHighlight()
@initPageScripts()
initPageScripts: ->
......@@ -53,3 +54,10 @@ class Dispatcher
project_ref = opts.data('autocomplete-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)
document.addEventListener("page:change", stopSpinner)
$ ->
$('pre code').each (i, e) ->
hljs.highlightBlock(e)
# Click a .one_click_select field, select the contents
$(".one_click_select").on 'click', -> $(@).select()
......
......@@ -16,6 +16,11 @@
code {
white-space: pre;
word-wrap: normal;
padding: 0;
.line {
display: inline;
}
}
}
......
.dark {
background-color: #232323;
.line.hll {
background: #558;
}
.highlight{
border-left: 1px solid #444;
}
......@@ -15,7 +19,6 @@
.hljs {
display: block;
padding: 0.5em;
background: #232323;
color: #E6E1DC;
}
......
......@@ -5,6 +5,10 @@
border-left: 1px solid #444;
}
.line.hll {
background: #558;
}
.line-numbers a {
color: #666;
}
......@@ -15,7 +19,7 @@
}
.hljs {
display: block; padding: 0.5em;
display: block;
background: #272822;
}
......
......@@ -5,6 +5,10 @@
border-left: 1px solid #113b46;
}
.line.hll {
background: #000;
}
pre {
background-color: #002B36;
color: #eee;
......@@ -16,7 +20,6 @@
.hljs {
display: block;
padding: 0.5em;
background: #002b36;
color: #839496;
}
......
.white {
background-color: #fff;
.line.hll {
background: #FFA;
}
.highlight{
border-left: 1px solid #eee;
}
......@@ -19,7 +23,7 @@
}
.hljs {
display: block; padding: 0.5em;
display: block;
background: #fff; color: black;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册