|
|
@ -50,9 +50,14 @@ define([
|
|
|
|
extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
|
|
|
|
extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
|
|
|
|
foldGutter: true,
|
|
|
|
foldGutter: true,
|
|
|
|
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
|
|
|
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
|
|
|
mode: "javascript"
|
|
|
|
mode: "javascript",
|
|
|
|
|
|
|
|
readOnly: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var setEditable = module.setEditable = function (bool) {
|
|
|
|
|
|
|
|
editor.setOption('readOnly', !bool);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var userList = {}; // List of pretty name of all users (mapped with their server ID)
|
|
|
|
var userList = {}; // List of pretty name of all users (mapped with their server ID)
|
|
|
|
var toolbarList; // List of users still connected to the channel (server IDs)
|
|
|
|
var toolbarList; // List of users still connected to the channel (server IDs)
|
|
|
|
var addToUserList = function(data) {
|
|
|
|
var addToUserList = function(data) {
|
|
|
@ -101,9 +106,6 @@ define([
|
|
|
|
transformFunction: JsonOT.validate
|
|
|
|
transformFunction: JsonOT.validate
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// TODO lock editor until chain is synced
|
|
|
|
|
|
|
|
// then unlock
|
|
|
|
|
|
|
|
var setEditable = function () { };
|
|
|
|
|
|
|
|
var canonicalize = function (t) { return t.replace(/\r\n/g, '\n'); };
|
|
|
|
var canonicalize = function (t) { return t.replace(/\r\n/g, '\n'); };
|
|
|
|
|
|
|
|
|
|
|
|
var initializing = true;
|
|
|
|
var initializing = true;
|
|
|
@ -118,17 +120,6 @@ define([
|
|
|
|
toolbar = info.realtime.toolbar = Toolbar.create($bar, info.myID, info.realtime, info.getLag, info.userList, config);
|
|
|
|
toolbar = info.realtime.toolbar = Toolbar.create($bar, info.myID, info.realtime, info.getLag, info.userList, config);
|
|
|
|
createChangeName('cryptpad-changeName', $bar);
|
|
|
|
createChangeName('cryptpad-changeName', $bar);
|
|
|
|
window.location.hash = info.channel + key;
|
|
|
|
window.location.hash = info.channel + key;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*if (!hash) {
|
|
|
|
|
|
|
|
editor.setValue(Messages.codeInitialState);
|
|
|
|
|
|
|
|
module.patchText(Messages.codeInitialState);
|
|
|
|
|
|
|
|
module.patchText(Messages.codeInitialState);
|
|
|
|
|
|
|
|
editor.setValue(Messages.codeInitialState);
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$(window).on('hashchange', function() { window.location.reload(); });
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var updateUserList = function(shjson) {
|
|
|
|
var updateUserList = function(shjson) {
|
|
|
@ -161,6 +152,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
editor.setValue(newDoc);
|
|
|
|
editor.setValue(newDoc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setEditable(true);
|
|
|
|
initializing = false;
|
|
|
|
initializing = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -232,11 +224,6 @@ define([
|
|
|
|
console.error("shjson2 !== shjson");
|
|
|
|
console.error("shjson2 !== shjson");
|
|
|
|
module.patchText(shjson2);
|
|
|
|
module.patchText(shjson2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check cursor
|
|
|
|
|
|
|
|
// apply changes to textarea
|
|
|
|
|
|
|
|
// replace cursor
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var onLocal = config.onLocal = function () {
|
|
|
|
var onLocal = config.onLocal = function () {
|
|
|
@ -260,8 +247,8 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var onAbort = config.onAbort = function (info) {
|
|
|
|
var onAbort = config.onAbort = function (info) {
|
|
|
|
// TODO alert the user
|
|
|
|
|
|
|
|
// inform of network disconnect
|
|
|
|
// inform of network disconnect
|
|
|
|
|
|
|
|
setEditable(false);
|
|
|
|
window.alert("Network Connection Lost!");
|
|
|
|
window.alert("Network Connection Lost!");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|