mirror of
https://github.com/maputnik/editor.git
synced 2026-08-24 05:57:25 +00:00
Fixed undo/redo
This commit is contained in:
+16
-3
@@ -370,12 +370,23 @@ export default class App extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onUndo = () => {
|
onUndo = () => {
|
||||||
const activeStyle = this.revisionStore.undo()
|
let activeStyle;
|
||||||
|
|
||||||
|
// Check our dirty style state first, otherwise just undo to that state.
|
||||||
|
if (isEqual(this.state.mapStyle, this.state.hopefulMapStyle)) {
|
||||||
|
activeStyle = this.revisionStore.undo()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
activeStyle = this.state.mapStyle;
|
||||||
|
}
|
||||||
|
|
||||||
const messages = undoMessages(this.state.hopefulMapStyle, activeStyle)
|
const messages = undoMessages(this.state.hopefulMapStyle, activeStyle)
|
||||||
this.saveStyle(activeStyle)
|
this.saveStyle(activeStyle)
|
||||||
this.setState({
|
this.setState({
|
||||||
mapStyle: activeStyle,
|
|
||||||
infos: messages,
|
infos: messages,
|
||||||
|
mapStyle: activeStyle,
|
||||||
|
hopefulMapStyle: activeStyle,
|
||||||
|
errors: [],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,8 +395,10 @@ export default class App extends React.Component {
|
|||||||
const messages = redoMessages(this.state.hopefulMapStyle, activeStyle)
|
const messages = redoMessages(this.state.hopefulMapStyle, activeStyle)
|
||||||
this.saveStyle(activeStyle)
|
this.saveStyle(activeStyle)
|
||||||
this.setState({
|
this.setState({
|
||||||
mapStyle: activeStyle,
|
|
||||||
infos: messages,
|
infos: messages,
|
||||||
|
mapStyle: activeStyle,
|
||||||
|
hopefulMapStyle: activeStyle,
|
||||||
|
errors: [],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user