Merge branch 'ooslide' into staging

pull/1/head
yflory 4 years ago
commit 4c8d142542

@ -20,7 +20,7 @@ define(function() {
* users and these users will be redirected to the login page if they still try to access * users and these users will be redirected to the login page if they still try to access
* the app * the app
*/ */
config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'notifications', 'support']; config.registeredOnlyTypes = ['file', 'contacts', 'notifications', 'support'];
/* CryptPad is available is multiple languages, but only English and French are maintained /* CryptPad is available is multiple languages, but only English and French are maintained
* by the developers. The other languages may be outdated, and any missing string for a langauge * by the developers. The other languages may be outdated, and any missing string for a langauge

@ -1089,7 +1089,7 @@ define([
changes: parseChanges(obj.changes), changes: parseChanges(obj.changes),
changesIndex: ooChannel.cpIndex || 0, changesIndex: ooChannel.cpIndex || 0,
locks: getUserLock(getId()), locks: getUserLock(getId()),
excelAdditionalInfo: null excelAdditionalInfo: obj.excelAdditionalInfo
}, null, function (err, hash) { }, null, function (err, hash) {
if (err) { if (err) {
return void console.error(err); return void console.error(err);
@ -1164,6 +1164,17 @@ define([
} }
} }
break; break;
case "cursor":
cursor.updateCursor({
type: "cursor",
messages: [{
cursor: obj.cursor,
time: +new Date(),
user: myUniqueOOId,
useridoriginal: myOOId
}]
});
break;
case "getLock": case "getLock":
handleLock(obj, send); handleLock(obj, send);
break; break;
@ -1438,6 +1449,29 @@ define([
}; };
*/ */
APP.getUserColor = function (userId) {
var hex;
Object.keys(content.ids || {}).some(function (k) {
var u = content.ids[k];
if (Number(u.ooid) === Number(userId)) {
var md = common.getMetadataMgr().getMetadataLazy();
if (md && md.users && md.users[u.netflux]) {
hex = md.users[u.netflux].color;
}
return true;
}
});
if (hex) {
var rgb = Util.hexToRGB(hex);
return {
r: rgb[0],
g: rgb[1],
b: rgb[2],
a: 255
};
}
};
APP.UploadImageFiles = function (files, type, id, jwt, cb) { APP.UploadImageFiles = function (files, type, id, jwt, cb) {
return void cb(); return void cb();
}; };
@ -1500,6 +1534,12 @@ define([
APP.loadingImage = 0; APP.loadingImage = 0;
APP.getImageURL = function(name, callback) { APP.getImageURL = function(name, callback) {
if (name && /^data:image/.test(name)) {
var b = Util.dataURIToBlob(name);
var url = URL.createObjectURL(blob);
return void callback(url);
}
var mediasSources = getMediasSources(); var mediasSources = getMediasSources();
var data = mediasSources[name]; var data = mediasSources[name];
@ -2243,6 +2283,7 @@ define([
$contentContainer: $('#cp-app-oo-container') $contentContainer: $('#cp-app-oo-container')
}; };
toolbar = APP.toolbar = Toolbar.create(configTb); toolbar = APP.toolbar = Toolbar.create(configTb);
toolbar.showColors();
Title.setToolbar(toolbar); Title.setToolbar(toolbar);
if (window.CP_DEV_MODE) { if (window.CP_DEV_MODE) {
@ -2530,6 +2571,15 @@ define([
initializing = false; initializing = false;
common.openPadChat(APP.onLocal); common.openPadChat(APP.onLocal);
if (!readOnly) {
common.openCursorChannel(APP.onLocal);
cursor = common.createCursor(APP.onLocal);
cursor.onCursorUpdate(function (data) {
if (!data || !data.cursor) { return; }
ooChannel.send(data.cursor);
});
}
if (APP.startWithTemplate) { if (APP.startWithTemplate) {
var template = APP.startWithTemplate; var template = APP.startWithTemplate;
loadTemplate(template.href, template.password, template.content); loadTemplate(template.href, template.password, template.content);

File diff suppressed because one or more lines are too long

@ -31,6 +31,7 @@ define([
cursor: client.cursor cursor: client.cursor
}; };
chan.sendMsg(JSON.stringify(data)); chan.sendMsg(JSON.stringify(data));
console.error(data);
ctx.emit('MESSAGE', data, chan.clients.filter(function (cl) { ctx.emit('MESSAGE', data, chan.clients.filter(function (cl) {
return cl !== clientId; return cl !== clientId;
})); }));

@ -37,6 +37,7 @@ define([
var $i = $('<iframe>').attr('id', 'sbox-iframe').attr('src', var $i = $('<iframe>').attr('id', 'sbox-iframe').attr('src',
ApiConfig.httpSafeOrigin + (pathname || window.location.pathname) + 'inner.html?' + ApiConfig.httpSafeOrigin + (pathname || window.location.pathname) + 'inner.html?' +
requireConfig.urlArgs + '#' + encodeURIComponent(JSON.stringify(req))); requireConfig.urlArgs + '#' + encodeURIComponent(JSON.stringify(req)));
$i.attr('allowfullscreen', 'true');
$('iframe-placeholder').after($i).remove(); $('iframe-placeholder').after($i).remove();
// This is a cheap trick to avoid loading sframe-channel in parallel with the // This is a cheap trick to avoid loading sframe-channel in parallel with the

Loading…
Cancel
Save