diff --git a/src/DebugBar/Resources/widgets.css b/src/DebugBar/Resources/widgets.css index defc897..beed395 100644 --- a/src/DebugBar/Resources/widgets.css +++ b/src/DebugBar/Resources/widgets.css @@ -11,17 +11,19 @@ pre.phpdebugbar-widgets-code-block { pre.phpdebugbar-widgets-code-block code.phpdebugbar-widgets-numbered-code { padding: 5px; } - pre.phpdebugbar-widgets-code-block code span.phpdebugbar-widgets-highlighted-line { - background: #800000; - color: #fff; - display: inline-block; - min-width: 100%; - } - pre.phpdebugbar-widgets-code-block code span.phpdebugbar-widgets-highlighted-line span { - background: none !important; - color: inherit !important; - } + pre.phpdebugbar-widgets-code-block ul li.phpdebugbar-widgets-highlighted-line { + font-weight: bolder; + text-decoration: underline; + } + pre.phpdebugbar-widgets-code-block ul li.phpdebugbar-widgets-highlighted-line span { + position: absolute; + background: #800000; + min-width: calc(100% - 85px); + margin-left: 10px; + opacity: 0.15; + } pre.phpdebugbar-widgets-code-block ul { + position: static; float: left; padding: 5px; background: #cacaca; diff --git a/src/DebugBar/Resources/widgets.js b/src/DebugBar/Resources/widgets.js index 88d3c82..cca780a 100644 --- a/src/DebugBar/Resources/widgets.js +++ b/src/DebugBar/Resources/widgets.js @@ -81,29 +81,11 @@ if (typeof(PhpDebugBar) == 'undefined') { // incorrectly positioned - most noticeable when line numbers are shown. var codeElement = $('').text(code + '\n').appendTo(pre); - // Add a span with a special class if we are supposed to highlight a line. highlight.js will - // still correctly format code even with existing markup in it. - if ($.isNumeric(highlightedLine)) { - if ($.isNumeric(firstLineNumber)) { - highlightedLine = highlightedLine - firstLineNumber + 1; - } - codeElement.html(function (index, html) { - var currentLine = 1; - return html.replace(/^.*$/gm, function(line) { - if (currentLine++ == highlightedLine) { - return '' + line + ''; - } else { - return line; - } - }); - }); - } - // Format the code if (lang) { - pre.addClass("language-" + lang); + codeElement.addClass("language-" + lang); } - highlight(pre); + highlight(codeElement).removeClass('hljs'); // Show line numbers in a list if ($.isNumeric(firstLineNumber)) { @@ -111,7 +93,12 @@ if (typeof(PhpDebugBar) == 'undefined') { var $lineNumbers = $('