 
 exports.disableEditor = ->
 	behaviorConfigEditor.setMode 'view'
-
-confirmChange = (evt, editor, config) ->
-	if evt.keyCode is 13 # enter key
-		evt.preventDefault()
-		json = editor.get()
-		activeBehavior = behaviorList.getActiveBehavior()
-		activeBehavior.setConfig json

	alertify.success 'Image changed'

handleConfigChange = (data) ->
	node = data.nodes?[0]
	if node?.parent is null then behaviorConfig.set(node.field, null) # Delete

getCategory = (behavior) ->
	category = behavior.getMeta()?.category

behaviorConfig = null
behaviorConfigEditor = null
behaviorEditorEl = document.getElementById 'behaviorConfigEditor'
behaviorEditorEl.addEventListener 'keydown', (evt) -> confirmChange evt, behaviorConfig

confirmChange = (evt, config) ->
	if evt.keyCode is 13 # enter key
		evt.preventDefault()
		json = behaviorConfigEditor.get()
		activeBehavior = behaviorList.getActiveBehavior()
		activeBehavior.setConfig json

# fill category select
categoryList = ['action', 'condition', 'other']
