diff --git a/CHANGELOG.md b/CHANGELOG.md index f302954e3..2e5791766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [CalVer](https://calver.org/). +## [UNRELEASED] - 2022-5-5 +### Fixed +- When editing a raster tile layer the altered properties for the feature-info template is also send to the editor. So e.g. HTML tags for links and images are rendered in the editor form. Now an unaltered clone is send instead. + ## [2022.5.0] - 2022-5-5 ### Changed - In conflictSearch requests to the GC2 SQL API now happens concurrently. This is done by implementing a promise pool. The default size of the pool is 30, but this can be set in the build config. Note that this setting can't be changed in a run-time config. diff --git a/browser/modules/sqlQuery.js b/browser/modules/sqlQuery.js index 56c8ef3ce..32b6402fd 100644 --- a/browser/modules/sqlQuery.js +++ b/browser/modules/sqlQuery.js @@ -399,7 +399,7 @@ module.exports = { dashSelected: true }); if (!parsedMeta.info_element_selector) { - _table.object.on("openpopup" + "_" + _table.uid, function (e) { + _table.object.on("openpopup" + "_" + _table.uid, function (e, layersClone) { let popup = e.getPopup(); if (popup?._closeButton) { popup._closeButton.onclick = function () { @@ -421,7 +421,9 @@ module.exports = { }, 100); $(".popup-edit-btn").unbind("click.popup-edit-btn").bind("click.popup-edit-btn", function () { - editor.edit(e, _key_, qstore); + // We reset the query layer and use a unaltered layer for editor + layerObj.reset(); + editor.edit(layersClone, _key_, qstore); editingStarted = true; }); diff --git a/extensions/editor/browser/index.js b/extensions/editor/browser/index.js index af5564877..d17e7787d 100644 --- a/extensions/editor/browser/index.js +++ b/extensions/editor/browser/index.js @@ -709,6 +709,7 @@ module.exports = { break; default: + cloud.get().map.addLayer(e); let numberOfNodes = 0; const coors = editedFeature.feature.geometry.coordinates; const calculateCount = (arr) => { @@ -857,7 +858,7 @@ module.exports = { switchLayer.registerLayerDataAlternation(schemaQualifiedName); sqlQuery.reset(qstore); - me.stopEdit(); + me.stopEdit(editedFeature); // Reloading only vector layers, as uncommited changes can be displayed only for vector layers if (isVectorLayer) { @@ -910,7 +911,6 @@ module.exports = { _self.openAttributesDialog(); }; - let confirmMessage = __(`Application is offline, tiles will not be updated. Proceed?`); if (isVectorLayer) { editFeature(); @@ -1031,6 +1031,9 @@ module.exports = { if (editor) { cloud.get().map.removeLayer(editor); } + if (editedFeature) { + cloud.get().map.removeLayer(editedFeature); + } // If feature was edited, then reload the layer if (editedFeature) { diff --git a/public/js/gc2/gc2table.js b/public/js/gc2/gc2table.js index ee9c1d4fb..ca5c87fdf 100644 --- a/public/js/gc2/gc2table.js +++ b/public/js/gc2/gc2table.js @@ -96,6 +96,8 @@ var gc2table = (function () { var customOnLoad = false, destroy, assignEventListeners, clickedFlag = false; + let clonedLayers = {}; + $(el).parent("div").addClass("gc2map"); var originalLayers, filters, filterControls, uncheckedIds = []; @@ -135,7 +137,7 @@ var gc2table = (function () { try { m.map._layers[id].setStyle({ opacity: 1, - dashArray: dashSelected ? "5 8": false, + dashArray: dashSelected ? "5 8" : false, dashSpeed: 10, lineCap: "butt" }); @@ -180,7 +182,7 @@ var gc2table = (function () { if (onPopupClose) onPopupClose(id); }); - object.trigger("openpopup" + "_" + uid, m.map._layers[id]); + object.trigger("openpopup" + "_" + uid, m.map._layers[id], clonedLayers[id]); } }); @@ -386,6 +388,10 @@ var gc2table = (function () { loadDataInTable(); }; + $.each(store.layer._layers, function (i, v) { + const l = L.geoJson(JSON.parse(JSON.stringify(v.toGeoJSON())))._layers; + clonedLayers[i] = l[Object.keys(l)[0]]; + }) loadDataInTable = function (doNotCallCustomOnload = false, forceDataLoad = false) { data = []; $.each(store.layer._layers, function (i, v) { @@ -491,7 +497,7 @@ var gc2table = (function () { store: store, moveEndOff: moveEndOff, moveEndOn: moveEndOn, - bootStrapTable : $(el).bootstrapTable + bootStrapTable: $(el).bootstrapTable }; }; return {