From fad182c5f3f98b134451d0e4d372d146b10b7776 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 23 Apr 2025 10:19:19 +0200 Subject: [PATCH] fix: make rules reordering syncable, savable and undoable --- umap/static/umap/js/modules/rules.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/umap/static/umap/js/modules/rules.js b/umap/static/umap/js/modules/rules.js index 4b7fc3a2..3298ee2e 100644 --- a/umap/static/umap/js/modules/rules.js +++ b/umap/static/umap/js/modules/rules.js @@ -194,6 +194,7 @@ export default class Rules { } onReorder(src, dst, initialIndex, finalIndex) { + const oldRules = Utils.CopyJSON(this._umap.properties.rules || {}) const moved = this.rules.find((rule) => stamp(rule) === +src.dataset.id) const reference = this.rules.find((rule) => stamp(rule) === +dst.dataset.id) const movedIdx = this.rules.indexOf(moved) @@ -209,6 +210,7 @@ export default class Rules { this.rules.splice(newIdx, 0, moved) this._umap.render(['rules']) this.commit() + this._umap.sync.update('properties.rules', this._umap.properties.rules, oldRules) } edit(container) {