   index      = 1 + $container.find('.task-list-item-checkbox').index($item)
   checked    = $item.prop 'checked'
 
-  disableTaskList $container
-
+  $container.trigger 'tasklist:changing', [index, checked]
   $field.val updateTaskListItem($field.val(), index, checked)
   $field.trigger 'change'
   $field.trigger 'tasklist:change', [index, checked]

    $container.
      find('.task-list-item').addClass('enabled').
      find('.task-list-item-checkbox').attr('disabled', null)
    $container.trigger 'tasklist:enabled'

disableTaskList = ($container) ->
  $container.
    find('.task-list-item').removeClass('enabled').
    find('.task-list-item-checkbox').attr('disabled', 'disabled')
  $container.trigger 'tasklist:disabled'

# Updates the $field value to reflect the state of $item.
# Triggers the `tasklist:change` event when the value has changed.

#
#= provides tasklist:enabled
#= provides tasklist:disabled
#= provides tasklist:changing
#= provides tasklist:change
#
#= require crema/events/pageupdate
