mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 11:32:38 +02:00
wip: uncreated map should always appear as dirty
This commit is contained in:
parent
d0fb85d552
commit
a2e864ad73
3 changed files with 5 additions and 2 deletions
|
@ -73,7 +73,7 @@ export class SyncEngine {
|
|||
this.websocketConnected = false
|
||||
this.closeRequested = false
|
||||
this.peerId = Utils.generateId()
|
||||
this._undoManager = new UndoManager(this.updaters, this)
|
||||
this._undoManager = new UndoManager(umap, this.updaters, this)
|
||||
}
|
||||
|
||||
get isOpen() {
|
||||
|
|
|
@ -2,7 +2,8 @@ import * as Utils from '../utils.js'
|
|||
import { DataLayerUpdater, FeatureUpdater, MapUpdater } from './updaters.js'
|
||||
|
||||
export class UndoManager {
|
||||
constructor(updaters, syncEngine) {
|
||||
constructor(umap, updaters, syncEngine) {
|
||||
this._umap = umap
|
||||
this._syncEngine = syncEngine
|
||||
this.updaters = updaters
|
||||
this._undoStack = []
|
||||
|
@ -25,6 +26,7 @@ export class UndoManager {
|
|||
}
|
||||
|
||||
isDirty() {
|
||||
if (!this._umap.id) return true
|
||||
for (const stage of this._undoStack) {
|
||||
if (stage.operation.dirty) return true
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ export class TopBar extends WithTemplate {
|
|||
this.elements.view.disabled = this._umap.sync._undoManager.isDirty()
|
||||
this.elements.saveLabel.hidden = this._umap.permissions.isDraft()
|
||||
this.elements.saveDraftLabel.hidden = !this._umap.permissions.isDraft()
|
||||
this._umap.sync._undoManager.toggleState()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue