success: function (json) {
const [{data}] = json;
$listmaps.empty();
- $("#modalBody").empty();
const $tbody = $("<tbody>");
$.each(data, (i, item) => {
}
const $tr = $("<tr>").append($td);
- const $span = $('<span class="map-link" data-bs-toggle="modal" data-bs-target="#modalDialog">' +
- item.uri + "</span>").data("item", item);
+ const $span = $('<span class="map-link">' + item.uri + "</span>").data("item", item);
$span.wrap("<td>").parent().appendTo($tr);
$("<td>" + item.description + "</td>").appendTo($tr);
$tr.appendTo($tbody);
let mode = "advanced";
// Modal form for maps
- $(document).on("click", "[data-bs-toggle=\"modal\"]", function () {
+ $(document).on("click", ".map-link", function () {
const item = $(this).data("item");
common.query("getmap", {
headers: {
// Highlighting a large amount of text is unresponsive
mode = (new Blob([data[0].data]).size > 5120) ? "basic" : $("input[name=editorMode]:checked").val();
+ $("#modalBody").empty();
$("<" + editor[mode].elt + ' id="editor" class="' + editor[mode].class + '" data-id="' + item.map +
'"></' + editor[mode].elt + ">").appendTo("#modalBody");
errorMessage: "Cannot receive maps data",
server: common.getServer()
});
- return false;
});
$("#modalDialog").on("hidden.bs.modal", () => {
- if (editor[mode].codejar) {
+ if (editor[mode].codejar && jar && typeof jar.destroy === "function") {
jar.destroy();
$(".codejar-wrap").remove();
} else {