-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add forward and background arrows to canvas to undo/redo #419
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7e2bc65
Basic undo-redo buttons
OAGr a2a4e4e
Style enhancements for redo undo buttons
OAGr 0fdc5be
Merge branch 'master' into forward-backward-arrows
OAGr 126914f
Impoved style of undo-redo buttons so they could not be clicked when …
OAGr 87b7cad
Merge branch 'master' into forward-backward-arrows
OAGr 60d6d6b
Added tooltips for undo/redo functionality
OAGr 12960ef
Merge branch 'master' into forward-backward-arrows
OAGr 5b49fa4
Initialize checkpointMetadata with length 1 to remove flash
OAGr bf12098
Changed icon name to more relevant alias
OAGr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import Canvas from 'gComponents/spaces/canvas' | |
import {denormalizedSpaceSelector} from '../denormalized-space-selector.js' | ||
|
||
import * as spaceActions from 'gModules/spaces/actions.js' | ||
import {undo, redo} from 'gModules/checkpoints/actions' | ||
|
||
import e from 'gEngine/engine' | ||
|
||
|
@@ -67,31 +68,41 @@ export default class SpacesShow extends Component { | |
|
||
fetchData() { | ||
if (!this.state.attemptedFetch) { | ||
this.props.dispatch(spaceActions.fetchById(parseInt(this.props.spaceId))) | ||
this.props.dispatch(spaceActions.fetchById(this._id())) | ||
this.setState({attemptedFetch: true}) | ||
} | ||
} | ||
|
||
onSave() { | ||
this.props.dispatch(spaceActions.update(parseInt(this.props.spaceId))) | ||
this.props.dispatch(spaceActions.update(this._id())) | ||
} | ||
|
||
onRedo() { | ||
this.props.dispatch(redo(this._id())) | ||
} | ||
|
||
onUndo() { | ||
this.props.dispatch(undo(this._id())) | ||
} | ||
|
||
destroy() { | ||
this.props.dispatch(spaceActions.destroy(this.props.denormalizedSpace)) | ||
} | ||
|
||
onPublicSelect() { | ||
this.props.dispatch(spaceActions.generalUpdate(parseInt(this.props.spaceId), {is_private: false})) | ||
this.props.dispatch(spaceActions.generalUpdate(this._id(), {is_private: false})) | ||
} | ||
|
||
onPrivateSelect() { | ||
this.props.dispatch(spaceActions.generalUpdate(parseInt(this.props.spaceId), {is_private: true})) | ||
this.props.dispatch(spaceActions.generalUpdate(this._id(), {is_private: true})) | ||
} | ||
|
||
onSaveName(name) { | ||
this.props.dispatch(spaceActions.update(parseInt(this.props.spaceId), {name})) | ||
this.props.dispatch(spaceActions.update(this._id(), {name})) | ||
} | ||
|
||
onSaveDescription(description) { | ||
this.props.dispatch(spaceActions.update(parseInt(this.props.spaceId), {description})) | ||
this.props.dispatch(spaceActions.update(this._id(), {description})) | ||
} | ||
|
||
hideSidebar() { | ||
|
@@ -102,7 +113,11 @@ export default class SpacesShow extends Component { | |
} | ||
|
||
_handleCopy() { | ||
this.props.dispatch(spaceActions.copy(parseInt(this.props.spaceId))) | ||
this.props.dispatch(spaceActions.copy()) | ||
} | ||
|
||
_id() { | ||
return parseInt(this.props.spaceId) | ||
} | ||
|
||
render() { | ||
|
@@ -170,7 +185,11 @@ export default class SpacesShow extends Component { | |
actionState={space.canvasState.actionState} | ||
canBePrivate={canBePrivate} | ||
onPublicSelect={this.onPublicSelect.bind(this)} | ||
onPrivateSelect={this.onPrivateSelect.bind(this)} | ||
onPrivateSelecundot={this.onPrivateSelect.bind(this)} | ||
onUndo={this.onUndo.bind(this)} | ||
onRedo={this.onRedo.bind(this)} | ||
canUndo={space.checkpointMetadata.head !== space.checkpointMetadata.length - 1} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your null state in the selector (head: 0, length: 0) sets canUndo to true. Maybe null state should be head: 0 length: 1? As a result, the button ever so briefly flashes as updated before the first checkpoint is registered on a hard refresh of the page. |
||
canRedo={space.checkpointMetadata.head !== 0} | ||
/> | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this defensivity here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need it for at least one of the IDs, I forgot which.