resoved issue #7, empty value when addProperty fires on late join

This commit is contained in:
Kevin Jahns
2014-09-26 11:58:42 +02:00
parent 93a04c8e23
commit 12e8768c31
36 changed files with 662 additions and 586 deletions

View File

@@ -321,8 +321,8 @@ module.exports = (HB)->
#
# @private
# Include this operation in the associative lists.
#
execute: ()->
# @param fire_event {boolean} Whether to fire the insert-event.
execute: (fire_event = true)->
if not @validateSavedOperations()
return false
else
@@ -374,7 +374,7 @@ module.exports = (HB)->
@next_cl.prev_cl = @
parent = @prev_cl?.getParent()
if parent?
if parent? and fire_event
@setParent parent
@parent.callEvent "insert", @
super # notify the execution_listeners

View File

@@ -257,8 +257,7 @@ module.exports = (HB)->
repl_manager.parent.callEvent 'change', property_name, op
# Call this, when the first element is inserted. Then delete the listener.
addPropertyListener = (event, op)->
if op.next_cl instanceof types.Delimiter and op.prev_cl instanceof types.Delimiter
repl_manager.parent.callEvent 'addProperty', property_name, op
repl_manager.parent.callEvent 'addProperty', property_name, op
repl_manager.deleteListener 'addProperty', addPropertyListener
@on 'insert', addPropertyListener
super parent
@@ -356,7 +355,10 @@ module.exports = (HB)->
return false
else
@content?.setReplaceManager?(@parent)
ins_result = super()
# only fire 'insert-event' (which will result in addProperty and change events),
# when content is added. In case of Json, empty content means that this is not the last update,
# since content is deleted when 'applyDelete' was exectuted.
ins_result = super(@content?) # @content? whether to fire or not
if ins_result
if @next_cl.type is "Delimiter" and @prev_cl.type isnt "Delimiter"
@prev_cl.applyDelete()