WIP make oo encrypted
This commit is contained in:
parent
ee4d12bd57
commit
978b6b95df
@ -66,12 +66,17 @@ define([
|
|||||||
config.onRemote();
|
config.onRemote();
|
||||||
}
|
}
|
||||||
|
|
||||||
var getContent = function () {
|
var getContent = APP.getContent = function () {
|
||||||
|
APP.ed = window.frames[0].frames[0].editor;
|
||||||
try {
|
try {
|
||||||
return window.frames[0].frames[0].editor.asc_nativeGetFile();
|
return window.frames[0].frames[0].editor.asc_nativeGetFile();
|
||||||
} catch (e) { return null; }
|
} catch (e) { return null; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var setContent = APP.setContent = function (content) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
var saveDocument = APP.saveDocument = function () {
|
var saveDocument = APP.saveDocument = function () {
|
||||||
var defaultName = "text.oot";
|
var defaultName = "text.oot";
|
||||||
UI.prompt(Messages.exportPrompt, defaultName, function (filename) {
|
UI.prompt(Messages.exportPrompt, defaultName, function (filename) {
|
||||||
|
|||||||
11
www/common/onlyoffice/sdkjs/cell/sdk-all-min.js
vendored
11
www/common/onlyoffice/sdkjs/cell/sdk-all-min.js
vendored
@ -9205,6 +9205,7 @@ function saveWithParts(fSendCommand, fCallback, fCallbackRequest, oAdditionalDat
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadFileContent(url, callback) {
|
function loadFileContent(url, callback) {
|
||||||
|
console.error(url);
|
||||||
asc_ajax({
|
asc_ajax({
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "text",
|
dataType: "text",
|
||||||
@ -9230,6 +9231,7 @@ function getImageFromChanges (name) {
|
|||||||
function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
||||||
var bError = false, oResult = new OpenFileResult(), bEndLoadFile = false, bEndLoadChanges = false;
|
var bError = false, oResult = new OpenFileResult(), bEndLoadFile = false, bEndLoadChanges = false;
|
||||||
var onEndOpen = function() {
|
var onEndOpen = function() {
|
||||||
|
console.error("this is where we should decrypt");
|
||||||
if (bEndLoadFile && bEndLoadChanges) {
|
if (bEndLoadFile && bEndLoadChanges) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(bError, oResult);
|
callback(bError, oResult);
|
||||||
@ -9257,6 +9259,7 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
|||||||
}
|
}
|
||||||
bEndLoadFile = true;
|
bEndLoadFile = true;
|
||||||
onEndOpen();
|
onEndOpen();
|
||||||
|
console.error(oResult); // XXX
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
bEndLoadFile = true;
|
bEndLoadFile = true;
|
||||||
@ -9267,6 +9270,7 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null != changesUrl) {
|
if (null != changesUrl) {
|
||||||
|
console.error("null changesUrl"); // XXX
|
||||||
getJSZipUtils().getBinaryContent(changesUrl, function(err, data) {
|
getJSZipUtils().getBinaryContent(changesUrl, function(err, data) {
|
||||||
bEndLoadChanges = true;
|
bEndLoadChanges = true;
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -9280,7 +9284,8 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
|||||||
for (var i in oZipChanges.files) {
|
for (var i in oZipChanges.files) {
|
||||||
if (i.endsWith('.json')) {
|
if (i.endsWith('.json')) {
|
||||||
// Заглушка на имя файла (стоило его начинать с цифры)
|
// Заглушка на имя файла (стоило его начинать с цифры)
|
||||||
oResult.changes[parseInt(i.slice('changes'.length))] = JSON.parse(oZipChanges.files[i].asText());
|
oResult.changes[parseInt(i.slice('changes'.length))] =
|
||||||
|
JSON.parse(oZipChanges.files[i].asText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEndOpen();
|
onEndOpen();
|
||||||
@ -9290,6 +9295,7 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (window['IS_NATIVE_EDITOR']) {
|
if (window['IS_NATIVE_EDITOR']) {
|
||||||
|
console.error("is native editor");
|
||||||
var result = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
var result = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
||||||
|
|
||||||
var url;
|
var url;
|
||||||
@ -9302,11 +9308,10 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
|||||||
} else {
|
} else {
|
||||||
bError = true;
|
bError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bEndLoadFile = true;
|
bEndLoadFile = true;
|
||||||
onEndOpen();
|
onEndOpen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function sendCommand(editor, fCallback, rdata, dataContainer) {
|
function sendCommand(editor, fCallback, rdata, dataContainer) {
|
||||||
//json не должен превышать размера 2097152, иначе при его чтении будет exception
|
//json не должен превышать размера 2097152, иначе при его чтении будет exception
|
||||||
var docConnectionId = editor.CoAuthoringApi.getDocId();
|
var docConnectionId = editor.CoAuthoringApi.getDocId();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
window.config = {
|
window.config = {
|
||||||
"document": {
|
"document": {
|
||||||
"fileType": "xlsx",
|
"fileType": "xlsx",
|
||||||
"key": "Khirz6zTPdfd7",
|
"key": "fresh", // "Khirz6zTPdfd7",
|
||||||
"title": "test.xlsx",
|
"title": "test.xlsx",
|
||||||
"url": "/onlyoffice/test.xlsx"
|
"url": "/onlyoffice/test.xlsx"
|
||||||
},
|
},
|
||||||
@ -15,8 +15,8 @@ window.config = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"id": "c0c3bf82-20d7-4663-bf6d-7fa39c598b1d",
|
"id": "", //"c0c3bf82-20d7-4663-bf6d-7fa39c598b1d",
|
||||||
"name": "John Smith"
|
"name": "", //"John Smith"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"events": {
|
"events": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user