Toolbar in pad2

pull/1/head
yflory 7 years ago
parent 4acd9957a9
commit fb512c8923

@ -0,0 +1,8 @@
define([
'jquery'
], function ($) {
var common = {};
return common;
});

@ -20,18 +20,21 @@ define([], function () {
}
var mdo = {};
// We don't want to add our user data to the object multiple times.
var containsYou = false;
//var containsYou = false;
//console.log(metadataObj);
console.log(metadataObj.users);
Object.keys(metadataObj.users).forEach(function (x) {
if (members.indexOf(x) === -1) { return; }
mdo[x] = metadataObj.users[x];
if (metadataObj.users[x].uid === meta.user.uid) {
/*if (metadataObj.users[x].uid === meta.user.uid) {
//console.log('document already contains you');
containsYou = true;
}
}*/
});
if (!containsYou) { mdo[meta.user.netfluxId] = meta.user; }
//if (!containsYou) { mdo[meta.user.netfluxId] = meta.user; }
mdo[meta.user.netfluxId] = meta.user;
metadataObj.users = mdo;
dirty = false;
changeHandlers.forEach(function (f) { f(); });
};
@ -74,7 +77,14 @@ define([], function () {
checkUpdate();
return metadataObj;
},
onChange: function (f) { changeHandlers.push(f); }
onChange: function (f) { changeHandlers.push(f); },
getNetfluxId: function () {
return meta && meta.user && meta.user.netfluxId;
},
getUserlist: function () {
var list = members.slice().filter(function (m) { return m.length === 32; });
return list;
}
});
};
return Object.freeze({ create: create });

File diff suppressed because it is too large Load Diff

@ -4,7 +4,7 @@ define([
'/bower_components/chainpad-crypto/crypto.js',
'/common/sframe-chainpad-netflux-inner.js',
'/bower_components/hyperjson/hyperjson.js',
'/common/toolbar2.js',
'/common/toolbar3.js',
'/common/cursor.js',
'/bower_components/chainpad-json-validator/json-ot.js',
'/common/TypingTests.js',
@ -470,10 +470,24 @@ define([
realtimeOptions.onInit = function (info) {
console.log('onInit');
var configTb = {
displayed: ['userlist'],
userList: cpNfInner.metadataMgr,
readOnly: readOnly,
ifrw: window,
realtime: info.realtime,
common: Cryptpad,
$container: $bar,
$contentContainer: $('#cke_1_contents'),
};
toolbar = info.realtime.toolbar = Toolbar.create(configTb);
// TODO
return;
UserList = Cryptpad.createUserList(info, realtimeOptions.onLocal, Cryptget, Cryptpad);
// TODO UserList not needed anymore?
// --> selectTemplate
// --> select username on first visit
//UserList = Cryptpad.createUserList(info, realtimeOptions.onLocal, Cryptget, Cryptpad);
var titleCfg = { getHeadingText: getHeadingText };
Title = Cryptpad.createTitle(titleCfg, realtimeOptions.onLocal, Cryptpad);
@ -651,6 +665,7 @@ define([
if (readOnly) { return; }
//TODO UserList.getLastName(toolbar.$userNameButton, newPad);
onLocal();
editor.focus();
if (newPad) {
cursor.setToEnd();

Loading…
Cancel
Save