Save and open oo docs
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -39,9 +39,19 @@ define([
|
||||
var addData = function (obj) {
|
||||
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({
|
||||
type: 'oo',
|
||||
addData: addData
|
||||
addData: addData,
|
||||
addRpc: addRpc
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -75,14 +75,20 @@ define([
|
||||
// not pin these pads)
|
||||
var files = store.userObject.getFiles([store.userObject.FILES_DATA]);
|
||||
var edPublic = store.proxy.edPublic;
|
||||
var toConcat = [];
|
||||
var list = files.map(function (id) {
|
||||
var d = store.userObject.getFileData(id);
|
||||
if (d.owners && d.owners.length && edPublic &&
|
||||
d.owners.indexOf(edPublic) === -1) { return; }
|
||||
if (d.lastVersion) { toConcat.push(Hash.hrefToHexChannelId(d.lastVersion)); }
|
||||
return Hash.hrefToHexChannelId(d.href);
|
||||
})
|
||||
.filter(function (x) { return x; });
|
||||
|
||||
// Non-destructive concat
|
||||
console.log(toConcat);
|
||||
Array.prototype.push.apply(list, toConcat);
|
||||
|
||||
// Get the avatar
|
||||
var profile = store.proxy.profile;
|
||||
if (profile) {
|
||||
|
||||
@@ -227,4 +227,7 @@ define({
|
||||
// This is for sending data out of the iframe when we are in testing mode
|
||||
// The exact protocol is defined in common/test.js
|
||||
'EV_TESTDATA': true,
|
||||
|
||||
// OnlyOffice: save a new version
|
||||
'Q_OO_SAVE': true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user