|
|
|
@ -168,10 +168,7 @@ define([
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var createChangeName = function(id, $container) {
|
|
|
|
|
var buttonElmt = $container.find('#'+id)[0];
|
|
|
|
|
buttonElmt.addEventListener("click", function() {
|
|
|
|
|
Cryptpad.prompt(Messages.changeNamePrompt, '', function (newName) {
|
|
|
|
|
var setName = module.setName = function (newName) {
|
|
|
|
|
if (!(typeof(newName) === 'string' && newName.trim())) { return; }
|
|
|
|
|
var myUserNameTemp = newName.trim();
|
|
|
|
|
if(newName.trim().length > 32) {
|
|
|
|
@ -182,7 +179,21 @@ define([
|
|
|
|
|
name: myUserName
|
|
|
|
|
};
|
|
|
|
|
addToUserList(myData);
|
|
|
|
|
Cryptpad.setPadAttribute('username', myUserName);
|
|
|
|
|
onLocal();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var getLastName = function () {
|
|
|
|
|
return Cryptpad.getPadAttribute('username') || '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var createChangeName = function(id, $container) {
|
|
|
|
|
var buttonElmt = $container.find('#'+id)[0];
|
|
|
|
|
|
|
|
|
|
var lastName = getLastName();
|
|
|
|
|
buttonElmt.addEventListener("click", function() {
|
|
|
|
|
Cryptpad.prompt(Messages.changeNamePrompt, lastName, function (newName) {
|
|
|
|
|
setName(newName);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
@ -427,9 +438,16 @@ define([
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setEditable(true);
|
|
|
|
|
initializing = false;
|
|
|
|
|
//Cryptpad.log("Your document is ready");
|
|
|
|
|
|
|
|
|
|
var lastName = getLastName();
|
|
|
|
|
if (typeof(lastName) === 'string' && lastName.length) {
|
|
|
|
|
console.log("Setting previous name to %s", lastName);
|
|
|
|
|
setName(lastName);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var cursorToPos = function(cursor, oldText) {
|
|
|
|
|