mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 11:32:38 +02:00
fix: make rules reordering syncable, savable and undoable
This commit is contained in:
parent
3f5d282477
commit
fad182c5f3
1 changed files with 2 additions and 0 deletions
|
@ -194,6 +194,7 @@ export default class Rules {
|
||||||
}
|
}
|
||||||
|
|
||||||
onReorder(src, dst, initialIndex, finalIndex) {
|
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 moved = this.rules.find((rule) => stamp(rule) === +src.dataset.id)
|
||||||
const reference = this.rules.find((rule) => stamp(rule) === +dst.dataset.id)
|
const reference = this.rules.find((rule) => stamp(rule) === +dst.dataset.id)
|
||||||
const movedIdx = this.rules.indexOf(moved)
|
const movedIdx = this.rules.indexOf(moved)
|
||||||
|
@ -209,6 +210,7 @@ export default class Rules {
|
||||||
this.rules.splice(newIdx, 0, moved)
|
this.rules.splice(newIdx, 0, moved)
|
||||||
this._umap.render(['rules'])
|
this._umap.render(['rules'])
|
||||||
this.commit()
|
this.commit()
|
||||||
|
this._umap.sync.update('properties.rules', this._umap.properties.rules, oldRules)
|
||||||
}
|
}
|
||||||
|
|
||||||
edit(container) {
|
edit(container) {
|
||||||
|
|
Loading…
Reference in a new issue