Load OO from window again

This commit is contained in:
Wolfgang Ginolas 2024-06-24 13:29:20 +02:00
parent 0309a2462e
commit 9b2fc90476
4 changed files with 13 additions and 42 deletions

View file

@ -47,7 +47,6 @@
"netflux-websocket": "^1.0.0",
"notp": "^2.0.3",
"nthen": "0.1.8",
"onlyoffice-editor": "file:../onlyoffice-editor",
"open-sans-fontface": "^1.4.0",
"openid-client": "^5.4.2",
"pako": "^2.1.0",

View file

@ -46,8 +46,7 @@ Fse.rmSync(oldComponentsPath, { recursive: true, force: true });
"netflux-websocket",
"drawio",
"pako",
"x2js",
"onlyoffice-editor"
"x2js"
].forEach(l => {
const source = Path.join("node_modules", l);
const destination = Path.join(componentsPath, l);

View file

@ -758,35 +758,6 @@
return ver || undefined;
};
Util.get = function(obj, key, defaultValue = undefined) {
if (typeof key === "string") {
key = key.split(".");
}
for (const k of key) {
if (obj == null) {
return defaultValue;
}
obj = obj[k];
}
if (obj == null) {
return defaultValue;
}
return obj;
};
Util.deepAssign = function(target, source) {
if (typeof target != "object") {
return source;
}
const result = Object.assign({}, target);
for (const key of Object.keys(source)) {
result[key] = Util.deepAssign(target[key], source[key]);
}
return result;
};
if (typeof(module) !== 'undefined' && module.exports) {
module.exports = Util;

View file

@ -23,7 +23,6 @@ define([
'/common/onlyoffice/oodoc_base.js',
'/common/onlyoffice/ooslide_base.js',
'/components/onlyoffice-editor/dist/bundle.js',
'/common/onlyoffice/current-version.js',
'/components/file-saver/FileSaver.min.js',
@ -50,7 +49,6 @@ define([
EmptyCell,
EmptyDoc,
EmptySlide,
OOEditor,
OOCurrentVersion)
{
var saveAs = window.saveAs;
@ -2105,14 +2103,14 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
}, void 0, common.getCache());
};
APP.docEditor = new window.DocsAPI.DocEditor("cp-app-oo-placeholder-a", APP.ooconfig);
APP.docEditor.init(APP.ooconfig).then(() => {
ooLoaded = true;
if (content.version < 7) {
APP.docEditor.installLegacyChannel();
}
APP.docEditor.setOnMessageFromOOHandler(fromOOHandler);
});
ooLoaded = true;
// TODO movie this back to CryptPad
// if (content.version < 7) {
// APP.docEditor.installLegacyChannel();
// }
APP.docEditor.setOnMessageFromOOHandler(fromOOHandler);
};
APP.printPdf = function (obj, cb) {
@ -3032,7 +3030,11 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
checkCheckpoint();
}
APP.docEditor = new OOEditor.OnlyOfficeEditor("cp-app-oo-placeholder-a", '/common/onlyoffice/dist/'+version+'web-apps/apps/api/documents/api.js');
var s = h('script', {
type:'text/javascript',
src: '/common/onlyoffice/dist/'+version+'web-apps/apps/api/documents/api.js'
});
$('#cp-app-oo-editor').append(s);
if (metadataMgr.getPrivateData().burnAfterReading && content && content.channel) {
sframeChan.event('EV_BURN_PAD', content.channel);