phpmyadmin/resources/js/transformations/xml.ts
Maurício Meneghini Fauth 0d843e68fe
Replace var with let or const in TypeScript files
Most of the changes were done by PhpStorm.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2026-04-09 20:48:22 -03:00

22 lines
736 B
TypeScript

import $ from 'jquery';
import { AJAX } from '../modules/ajax.ts';
/**
* XML syntax highlighting transformation plugin
*/
AJAX.registerOnload('transformations/xml.js', function () {
const $elm = $('#page_content').find('code.xml');
$elm.each(function () {
const $json = $(this);
const $pre = $json.closest('pre');
/* We only care about visible elements to avoid double processing */
if ($json.is(':visible')) {
const $highlight = $('<div class="xml-highlight cm-s-default"></div>');
$pre.append($highlight);
// @ts-ignore
window.CodeMirror.runMode($json.text(), 'application/xml', $highlight[0]);
$json.hide();
}
});
});