Save and open oo docs

pull/1/head
yflory 7 years ago
parent d5dce6ac22
commit fd1b4189be

@ -66,6 +66,12 @@ module.exports.install = function(server, port, callbackFunction) {
console.log("Received: " + message); console.log("Received: " + message);
data = JSON.parse(message); data = JSON.parse(message);
if (data.type === "isSaveLock") {
//return void sendData(conn, {type: "saveLock", saveLock: false});
}
if (data.type === "saveChanges") {
//return void sendData(conn, {type: 'savePartChanges', changesIndex: 0});
}
if (data.type !== 'auth') { return; } if (data.type !== 'auth') { return; }
console.log("Response auth"); console.log("Response auth");

File diff suppressed because one or more lines are too long

@ -39,9 +39,19 @@ define([
var addData = function (obj) { var addData = function (obj) {
obj.ooType = window.location.pathname.replace(/^\//, '').replace(/\/$/, ''); obj.ooType = window.location.pathname.replace(/^\//, '').replace(/\/$/, '');
}; };
var addRpc = function (sframeChan, Cryptpad, Utils) {
sframeChan.on('Q_OO_SAVE', function (data, cb) {
var chanId = Utils.Hash.hrefToHexChannelId(data.url);
Cryptpad.pinPads([chanId], function (e) {
if (e) { return void cb(e); }
Cryptpad.setPadAttribute('lastVersion', data.url, cb);
});
});
};
SFCommonO.start({ SFCommonO.start({
type: 'oo', type: 'oo',
addData: addData addData: addData,
addRpc: addRpc
}); });
}); });
}); });

@ -75,14 +75,20 @@ define([
// not pin these pads) // not pin these pads)
var files = store.userObject.getFiles([store.userObject.FILES_DATA]); var files = store.userObject.getFiles([store.userObject.FILES_DATA]);
var edPublic = store.proxy.edPublic; var edPublic = store.proxy.edPublic;
var toConcat = [];
var list = files.map(function (id) { var list = files.map(function (id) {
var d = store.userObject.getFileData(id); var d = store.userObject.getFileData(id);
if (d.owners && d.owners.length && edPublic && if (d.owners && d.owners.length && edPublic &&
d.owners.indexOf(edPublic) === -1) { return; } d.owners.indexOf(edPublic) === -1) { return; }
if (d.lastVersion) { toConcat.push(Hash.hrefToHexChannelId(d.lastVersion)); }
return Hash.hrefToHexChannelId(d.href); return Hash.hrefToHexChannelId(d.href);
}) })
.filter(function (x) { return x; }); .filter(function (x) { return x; });
// Non-destructive concat
console.log(toConcat);
Array.prototype.push.apply(list, toConcat);
// Get the avatar // Get the avatar
var profile = store.proxy.profile; var profile = store.proxy.profile;
if (profile) { if (profile) {

@ -227,4 +227,7 @@ define({
// This is for sending data out of the iframe when we are in testing mode // This is for sending data out of the iframe when we are in testing mode
// The exact protocol is defined in common/test.js // The exact protocol is defined in common/test.js
'EV_TESTDATA': true, 'EV_TESTDATA': true,
// OnlyOffice: save a new version
'Q_OO_SAVE': true,
}); });

Loading…
Cancel
Save