Skip to content

Commit

Permalink
allows use of attach_textarea on json sub doc that is text.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrypticSwarm committed Feb 24, 2012
1 parent eb95a59 commit e9c7466
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/client/textarea.coffee
Expand Up @@ -18,7 +18,7 @@ applyChange = (doc, oldval, newval) ->

window.sharejs.Doc::attach_textarea = (elem) ->
doc = this
elem.value = @snapshot
elem.value = @get()
prevvalue = elem.value

replaceText = (newText, transformCursor) ->
Expand Down
2 changes: 2 additions & 0 deletions src/types/json-api.coffee
Expand Up @@ -24,6 +24,8 @@ class SubDoc
add: (amount, cb) -> @doc.addAt @path, amount, cb
on: (event, cb) -> @doc.addListener @path, event, cb
removeListener: (l) -> @doc.removeListener l
if WEB?
attach_textarea: exports.Doc::attach_textarea

# text API compatibility
getLength: -> @get().length
Expand Down

0 comments on commit e9c7466

Please sign in to comment.