mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-01-17 13:28:35 +01:00
avoid triggering error if hljs is not loaded (fixed #107)
This commit is contained in:
parent
d142729574
commit
57403a83fd
@ -47,14 +47,20 @@ if (typeof(PhpDebugBar) == 'undefined') {
|
||||
* @return {String}
|
||||
*/
|
||||
var highlight = PhpDebugBar.Widgets.highlight = function(code, lang) {
|
||||
if (typeof(code) == 'string') {
|
||||
if (typeof(code) === 'string') {
|
||||
if (!hljs) {
|
||||
return htmlize(code);
|
||||
}
|
||||
if (lang) {
|
||||
return hljs.highlight(lang, code).value;
|
||||
}
|
||||
return hljs.highlightAuto(code).value;
|
||||
}
|
||||
|
||||
code.each(function(i, e) { hljs.highlightBlock(e); });
|
||||
if (hljs) {
|
||||
code.each(function(i, e) { hljs.highlightBlock(e); });
|
||||
}
|
||||
return code;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user