Skip to content

Commit

Permalink
CodeMirror: using extendDoc.
Browse files Browse the repository at this point in the history
Thanks to Wout Mertens for pointing this out.

Signed-off-by: Thaddee Tyl <thaddee.tyl@gmail.com>
  • Loading branch information
espadrine committed Mar 21, 2012
1 parent 0ee23be commit e9f9431
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client/cm.coffee
Expand Up @@ -31,15 +31,15 @@ applyToShareJS = (editorDoc, delta, doc) ->
# Attach a CodeMirror editor to the document. The editor's contents are replaced
# with the document's contents unless keepEditorContents is true. (In which case
# the document's contents are nuked and replaced with the editor's).
window.sharejs.Doc::attach_cm = (editor, keepEditorContents) ->
window.sharejs.extendDoc 'attach_cm', (editor, keepEditorContents) ->
unless @provides.text
throw new Error 'Only text documents can be attached to CodeMirror2'

sharedoc = @
check = ->
window.setTimeout ->
editorText = editor.getValue()
otText = sharedoc.getText()
otText = sharedoc.snapshot

if editorText != otText
console.error "Text does not match!"
Expand Down

0 comments on commit e9f9431

Please sign in to comment.