added XMPP example, fixed bug in TextType binding to textfield
This commit is contained in:
@@ -22,6 +22,15 @@ class HistoryBuffer
|
||||
@reserved_identifier_counter = 0
|
||||
setTimeout @emptyGarbage, @garbageCollectTimeout
|
||||
|
||||
resetUserId: (id)->
|
||||
own = @buffer[@user_id]
|
||||
if own?
|
||||
for o in own
|
||||
o.uid.creator = id
|
||||
@operation_counter[id] = @operation_counter[@user_id]
|
||||
delete @operation_counter[@user_id]
|
||||
@user_id = id
|
||||
|
||||
emptyGarbage: ()=>
|
||||
for o in @garbage
|
||||
#if @getOperationCounter(o.uid.creator) > o.uid.op_number
|
||||
|
||||
@@ -108,6 +108,7 @@ module.exports = (HB)->
|
||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
||||
#
|
||||
constructor: (uid, beginning, end, prev, next, origin)->
|
||||
@textfields = []
|
||||
super uid, beginning, end, prev, next, origin
|
||||
|
||||
#
|
||||
@@ -123,6 +124,10 @@ module.exports = (HB)->
|
||||
type: "WordType"
|
||||
|
||||
applyDelete: ()->
|
||||
for textfield in @textfields
|
||||
textfield.onkeypress = null
|
||||
textfield.onpaste = null
|
||||
textfield.oncut = null
|
||||
o = @beginning
|
||||
while o?
|
||||
o.applyDelete()
|
||||
@@ -205,6 +210,7 @@ module.exports = (HB)->
|
||||
bind: (textfield)->
|
||||
word = @
|
||||
textfield.value = @val()
|
||||
@textfields.push textfield
|
||||
|
||||
@observe (events)->
|
||||
for event in events
|
||||
|
||||
@@ -5,7 +5,14 @@ Engine = require "./Engine"
|
||||
adaptConnector = require "./ConnectorAdapter"
|
||||
|
||||
createYatta = (connector)->
|
||||
user_id = connector.id # TODO: change to getUniqueId()
|
||||
user_id = null
|
||||
if connector.id?
|
||||
user_id = connector.id # TODO: change to getUniqueId()
|
||||
else
|
||||
user_id = "_temp"
|
||||
connector.whenUserIdSet (id)->
|
||||
user_id = id
|
||||
HB.resetUserId id
|
||||
HB = new HistoryBuffer user_id
|
||||
type_manager = json_types_uninitialized HB
|
||||
types = type_manager.types
|
||||
|
||||
Reference in New Issue
Block a user