Show sql-highlight div only if CodeMirror is enabled

Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
This commit is contained in:
Liviu-Mihail Concioiu 2026-02-21 03:00:15 +01:00
parent d7e4d3008b
commit 45968657cb

View File

@ -1718,9 +1718,9 @@ Functions.highlightSql = function ($base) {
var $pre = $sql.find('pre');
/* We only care about visible elements to avoid double processing */
if ($pre.is(':visible')) {
var $highlight = $('<div class="sql-highlight cm-s-default"></div>');
$sql.append($highlight);
if (typeof CodeMirror !== 'undefined') {
var $highlight = $('<div class="sql-highlight cm-s-default"></div>');
$sql.append($highlight);
CodeMirror.runMode($sql.text(), 'text/x-mysql', $highlight[0]);
$pre.hide();
$highlight.find('.cm-keyword').each(Functions.documentationKeyword);