Everything is working smoothly again. Execution speed increased by 10x. Cleaned up the code and unused stuff.
This commit is contained in:
@@ -118,7 +118,7 @@ module.exports = (HB)->
|
||||
@uid
|
||||
|
||||
dontSync: ()->
|
||||
@doSync = false
|
||||
@uid.doSync = false
|
||||
|
||||
#
|
||||
# @private
|
||||
@@ -279,7 +279,7 @@ module.exports = (HB)->
|
||||
applyDelete: (o)->
|
||||
@deleted_by ?= []
|
||||
callLater = false
|
||||
if @parent? and not @isDeleted()
|
||||
if @parent? and not @isDeleted() and o? # o? : if not o?, then the delimiter deleted this Insertion. Furthermore, it would be wrong to call it. TODO: make this more expressive and save
|
||||
# call iff wasn't deleted earlyer
|
||||
callLater = true
|
||||
if o?
|
||||
@@ -384,10 +384,11 @@ module.exports = (HB)->
|
||||
@next_cl.prev_cl = @
|
||||
|
||||
parent = @prev_cl?.getParent()
|
||||
super # notify the execution_listeners
|
||||
if parent? and fire_event
|
||||
@setParent parent
|
||||
@parent.callEvent "insert", @
|
||||
super # notify the execution_listeners
|
||||
@
|
||||
|
||||
#
|
||||
# Compute the position of this operation.
|
||||
@@ -493,13 +494,13 @@ module.exports = (HB)->
|
||||
if @prev_cl.next_cl?
|
||||
throw new Error "Probably duplicated operations"
|
||||
@prev_cl.next_cl = @
|
||||
delete @prev_cl.unchecked.next_cl
|
||||
super
|
||||
else
|
||||
false
|
||||
else if @prev_cl? and not @prev_cl.next_cl?
|
||||
delete @prev_cl.unchecked.next_cl
|
||||
@prev_cl.next_cl = @
|
||||
super
|
||||
else if @prev_cl? or @next_cl? or true # TODO: are you sure? This can happen right?
|
||||
super
|
||||
#else
|
||||
|
||||
@@ -122,11 +122,11 @@ module.exports = (HB)->
|
||||
# @return {Json}
|
||||
#
|
||||
toJson: ()->
|
||||
if not @bound_json? or not Object.observe?
|
||||
if not @bound_json? or not Object.observe? or true # TODO: currently, you are not watching mutable strings for changes, and, therefore, the @bound_json is not updated. TODO TODO wuawuawua easy
|
||||
val = @val()
|
||||
json = {}
|
||||
for name, o of val
|
||||
if o is null
|
||||
if not o?
|
||||
json[name] = o
|
||||
else if o.constructor is {}.constructor
|
||||
json[name] = @val(name).toJson()
|
||||
|
||||
@@ -91,7 +91,7 @@ module.exports = (HB)->
|
||||
# always have the same result (ReplaceManager, and its beginning and end are the same)
|
||||
#
|
||||
execute: ()->
|
||||
if not @validateSavedOperations()
|
||||
if not @validateSavedOperations()
|
||||
return false
|
||||
else
|
||||
# helper for cloning an object
|
||||
@@ -105,9 +105,9 @@ module.exports = (HB)->
|
||||
uid_r.op_number = "_#{uid_r.op_number}_RM_#{@name}"
|
||||
if not HB.getOperation(uid_r)?
|
||||
uid_beg = clone(uid_r)
|
||||
uid_beg.op_number = "_#{uid_beg.op_number}_RM_#{@name}_beginning"
|
||||
uid_beg.op_number = "#{uid_r.op_number}_beginning"
|
||||
uid_end = clone(uid_r)
|
||||
uid_end.op_number = "_#{uid_end.op_number}_RM_#{@name}_end"
|
||||
uid_end.op_number = "#{uid_r.op_number}_end"
|
||||
beg = (new types.Delimiter uid_beg, undefined, uid_end).execute()
|
||||
end = (new types.Delimiter uid_end, beg, undefined).execute()
|
||||
@map_manager.map[@name] = new ReplaceManager undefined, uid_r, beg, end
|
||||
|
||||
@@ -143,7 +143,8 @@ module.exports = (HB)->
|
||||
(new TextInsert content, undefined, left, right).execute()
|
||||
else
|
||||
for c in content
|
||||
left = (new TextInsert c, undefined, left, right).execute()
|
||||
tmp = (new TextInsert c, undefined, left, right).execute()
|
||||
left = tmp
|
||||
@
|
||||
#
|
||||
# Inserts a string into the word.
|
||||
|
||||
Reference in New Issue
Block a user