fixes in array type

This commit is contained in:
DadaMonad 2015-01-19 02:27:37 +00:00
parent 54844f4535
commit bec7d107bd
8 changed files with 66 additions and 30 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -30,7 +30,7 @@ var yatta, yattaHandler;
For now, you can use my API key. For now, you can use my API key.
*/ */
connector = new XMPPConnector("testy-xmpp-json"); connector = new XMPPConnector("testy-xmpp-json2");
connector.debug = true connector.debug = true
/** /**
### Yatta ### Yatta

View File

@ -15,7 +15,7 @@ module.exports = (HB)->
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created. # @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# #
constructor: (content, uid, prev, next, origin, parent)-> constructor: (content, uid, prev, next, origin, parent)->
if content?.uid?.creator if content?.creator
@saveOperation 'content', content @saveOperation 'content', content
else else
@content = content @content = content
@ -23,6 +23,17 @@ module.exports = (HB)->
type: "TextInsert" type: "TextInsert"
#
# Inserts a string into the word.
#
# @return {Array Type} This String object.
#
insert: (position, content, options)->
ith = @getOperationByPosition position
# the (i-1)th character. e.g. "abc" the 1th character is "a"
# the 0th character is the left Delimiter
@insertAfter ith, content, options
# #
# Retrieve the effective length of the $content of this operation. # Retrieve the effective length of the $content of this operation.
# #
@ -167,7 +178,7 @@ module.exports = (HB)->
ith = @getOperationByPosition position ith = @getOperationByPosition position
# the (i-1)th character. e.g. "abc" the 1th character is "a" # the (i-1)th character. e.g. "abc" the 1th character is "a"
# the 0th character is the left Delimiter # the 0th character is the left Delimiter
@insertAfter ith, content, options @insertAfter ith, [content], options
# #
# Deletes a part of the word. # Deletes a part of the word.
@ -208,7 +219,8 @@ module.exports = (HB)->
types.Array.create = (content, mutable)-> types.Array.create = (content, mutable)->
if (mutable is "mutable") if (mutable is "mutable")
list = new types.Array().execute() list = new types.Array().execute()
list.insert 0, content ith = list.getOperationByPosition 0
list.insertAfter ith, content
list list
else if (not mutable?) or (mutable is "immutable") else if (not mutable?) or (mutable is "immutable")
content content

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long