Toolbar in pad2
This commit is contained in:
parent
4acd9957a9
commit
fb512c8923
8
www/common/common-inner.js
Normal file
8
www/common/common-inner.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
define([
|
||||||
|
'jquery'
|
||||||
|
], function ($) {
|
||||||
|
var common = {};
|
||||||
|
|
||||||
|
|
||||||
|
return common;
|
||||||
|
});
|
||||||
@ -20,18 +20,21 @@ define([], function () {
|
|||||||
}
|
}
|
||||||
var mdo = {};
|
var mdo = {};
|
||||||
// We don't want to add our user data to the object multiple times.
|
// 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);
|
||||||
|
console.log(metadataObj.users);
|
||||||
Object.keys(metadataObj.users).forEach(function (x) {
|
Object.keys(metadataObj.users).forEach(function (x) {
|
||||||
if (members.indexOf(x) === -1) { return; }
|
if (members.indexOf(x) === -1) { return; }
|
||||||
mdo[x] = metadataObj.users[x];
|
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');
|
//console.log('document already contains you');
|
||||||
containsYou = true;
|
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;
|
metadataObj.users = mdo;
|
||||||
|
|
||||||
dirty = false;
|
dirty = false;
|
||||||
changeHandlers.forEach(function (f) { f(); });
|
changeHandlers.forEach(function (f) { f(); });
|
||||||
};
|
};
|
||||||
@ -74,7 +77,14 @@ define([], function () {
|
|||||||
checkUpdate();
|
checkUpdate();
|
||||||
return metadataObj;
|
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 });
|
return Object.freeze({ create: create });
|
||||||
|
|||||||
1044
www/common/toolbar3.js
Normal file
1044
www/common/toolbar3.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ define([
|
|||||||
'/bower_components/chainpad-crypto/crypto.js',
|
'/bower_components/chainpad-crypto/crypto.js',
|
||||||
'/common/sframe-chainpad-netflux-inner.js',
|
'/common/sframe-chainpad-netflux-inner.js',
|
||||||
'/bower_components/hyperjson/hyperjson.js',
|
'/bower_components/hyperjson/hyperjson.js',
|
||||||
'/common/toolbar2.js',
|
'/common/toolbar3.js',
|
||||||
'/common/cursor.js',
|
'/common/cursor.js',
|
||||||
'/bower_components/chainpad-json-validator/json-ot.js',
|
'/bower_components/chainpad-json-validator/json-ot.js',
|
||||||
'/common/TypingTests.js',
|
'/common/TypingTests.js',
|
||||||
@ -470,10 +470,24 @@ define([
|
|||||||
|
|
||||||
realtimeOptions.onInit = function (info) {
|
realtimeOptions.onInit = function (info) {
|
||||||
console.log('onInit');
|
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
|
// TODO
|
||||||
return;
|
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 };
|
var titleCfg = { getHeadingText: getHeadingText };
|
||||||
Title = Cryptpad.createTitle(titleCfg, realtimeOptions.onLocal, Cryptpad);
|
Title = Cryptpad.createTitle(titleCfg, realtimeOptions.onLocal, Cryptpad);
|
||||||
@ -651,6 +665,7 @@ define([
|
|||||||
|
|
||||||
if (readOnly) { return; }
|
if (readOnly) { return; }
|
||||||
//TODO UserList.getLastName(toolbar.$userNameButton, newPad);
|
//TODO UserList.getLastName(toolbar.$userNameButton, newPad);
|
||||||
|
onLocal();
|
||||||
editor.focus();
|
editor.focus();
|
||||||
if (newPad) {
|
if (newPad) {
|
||||||
cursor.setToEnd();
|
cursor.setToEnd();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user