Skip to content

Commit

Permalink
Disable undo/redo buttons appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
1j01 committed Aug 8, 2018
1 parent d52d5d8 commit 21b3b3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ <h2>Interactive Fretboard</h2>
<h2>Tablature Editor</h2>
<div class="controls">
<!-- TODO: icon buttons -->
<!-- TODO: disabled state when not hasUndo/hasRedo -->
<button id="undo">Undo</button>
<button id="redo">Redo</button>
<!-- (((multi-(line/row/string)) / (staff/stave)) (selection/cursor) [mode]) -->
Expand Down
6 changes: 6 additions & 0 deletions src/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ redo_button.addEventListener "click", ->
tablature_editor.editor.redo()
return

tablature_editor.editor.on "input", ->
undo_manager = tablature_editor.editor.session.getUndoManager()
undo_button.disabled = not undo_manager.hasUndo()
redo_button.disabled = not undo_manager.hasRedo()


do update_multi_row_selection_mode = ->
tablature_editor.multi_row_selection_mode = multi_row_selection_mode_input.checked
return
Expand Down

0 comments on commit 21b3b3c

Please sign in to comment.