Permalink
Browse files

Store editor instead of editor session

  • Loading branch information...
1 parent f4a0568 commit f87c20069ab56ef956fe47d92712bffbb4acc1da @pksunkara committed Sep 18, 2011
Showing with 5 additions and 5 deletions.
  1. +4 −4 public/javascripts/collab.js
  2. +1 −1 views/code.jade
@@ -28,7 +28,7 @@ getCursor = function() {
cursor = $('.ace_cursor')[0];
linem1 = parseInt(cursor.style.top.replace('px',''))/18;
column = (parseInt(cursor.style.left.replace('px',''))-4)/7;
- text = acee.getValue().split("\n");
+ text = acee.getSession().getValue().split("\n");
pos = 0;
for(i=0;i<linem1;i++) {
pos += text[i].length+1;
@@ -46,15 +46,15 @@ key_handler = function (event) {
}
socket.on('edit', function (data){
- var text = acee.getValue();
+ var text = acee.getSession().getValue();
text = text.substr(0,data.cursor-1) + data.edit + text.substr(data.cursor-1+data.edit.length);
docVersion += 1;
- acee.setValue(text);
+ acee.getSession().setValue(text);
});
socket.on('version', function(data){
version = data.version;
- acee.setValue(data.text);
+ acee.getSession().setValue(data.text);
});
socket.on('nickname?', function(data){
View
@@ -10,7 +10,7 @@ script(type='text/javascript')
editor.setTheme("ace/theme/twilight");
var JavaScriptMode = require("ace/mode/javascript").Mode;
editor.getSession().setMode(new JavaScriptMode());
- acee = editor.getSession();
+ acee = editor;
}
.page-header
h1 app.js

0 comments on commit f87c200

Please sign in to comment.