mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-22 10:55:19 -04:00
Working to get undo/redo working again when manipulating ThangsTabView not using the Treema.
This commit is contained in:
parent
652d47fb81
commit
7286d069a0
3 changed files with 13 additions and 4 deletions
app
|
@ -25,7 +25,7 @@ module.exports.normalizeFunc = (func_thing, object) ->
|
|||
if _.isString(func_thing)
|
||||
func = object[func_thing]
|
||||
if not func
|
||||
console.error "Could not find method #{func_thing} in object #{@}"
|
||||
console.error "Could not find method #{func_thing} in object", object
|
||||
return => null # always return a func, or Mediator will go boom
|
||||
func_thing = func
|
||||
return func_thing
|
||||
|
|
|
@ -47,6 +47,10 @@ module.exports = class SaveLevelModal extends SaveVersionModal
|
|||
|
||||
shouldSaveEntity: (m) ->
|
||||
return false unless m.hasWriteAccess()
|
||||
if not m.get('system') and m.type() is 'LevelComponent'
|
||||
# Trying to debug the occasional phantom all-Components-must-be-saved bug
|
||||
console.log "Should we save", m.get('system'), m.get('name'), m, "? localChanges:", m.hasLocalChanges(), "version:", m.get('version'), 'isPublished:', m.isPublished(), 'collection:', m.collection
|
||||
return false
|
||||
return true if m.hasLocalChanges()
|
||||
return true if (m.get('version').major is 0 and m.get('version').minor is 0) or not m.isPublished() and not m.collection
|
||||
# Sometimes we have two versions: one in a search collection and one with a URL. We only save changes to the latter.
|
||||
|
|
|
@ -58,8 +58,8 @@ module.exports = class ThangsTabView extends CocoView
|
|||
'delete, del, backspace': 'deleteSelectedExtantThang'
|
||||
'left': -> @moveAddThangSelection -1
|
||||
'right': -> @moveAddThangSelection 1
|
||||
'ctrl+z': 'undo'
|
||||
'ctrl+shift+z': 'redo'
|
||||
'ctrl+z, ⌘+z': 'undo'
|
||||
'ctrl+shift+z, ⌘+shift+z': 'redo'
|
||||
|
||||
constructor: (options) ->
|
||||
super options
|
||||
|
@ -106,6 +106,11 @@ module.exports = class ThangsTabView extends CocoView
|
|||
else
|
||||
$('#thangs-list').height(oldHeight - thangsHeaderHeight - 80)
|
||||
|
||||
undo: (e) ->
|
||||
if not @editThangView then @thangsTreema.undo() else @editThangView.undo()
|
||||
|
||||
redo: (e) ->
|
||||
if not @editThangView then @thangsTreema.redo() else @editThangView.redo()
|
||||
|
||||
afterRender: ->
|
||||
super()
|
||||
|
@ -495,7 +500,7 @@ class ThangsNode extends TreemaNode.nodeMap.array
|
|||
children = super(arguments...)
|
||||
# TODO: add some filtering to only work with certain types of units at a time
|
||||
return children
|
||||
|
||||
|
||||
class ThangNode extends TreemaObjectNode
|
||||
valueClass: 'treema-thang'
|
||||
collection: false
|
||||
|
|
Loading…
Reference in a new issue