| 308 | |
| 309 | if (devMode) { console.error(Hash.hrefToHexChannelId(href)); } |
| 310 | let startApp = function (blob) { |
| 311 | window.CP_integration_outer = { |
| 312 | pathname: `/${data.application}/`, |
| 313 | hash: data.key, |
| 314 | href: href, |
| 315 | initialState: blob, |
| 316 | config: { |
| 317 | readOnly: data.readOnly, |
| 318 | fileName: data.name, |
| 319 | fileType: data.ext, |
| 320 | autosave: data.autosave, |
| 321 | user: data.editorConfig.user, |
| 322 | _: data._config |
| 323 | }, |
| 324 | utils: { |
| 325 | onError, |
| 326 | onReady: onReady, |
| 327 | onDownloadAs, |
| 328 | setDownloadAs, |
| 329 | setSave, |
| 330 | save: save, |
| 331 | reload: reload, |
| 332 | onHasUnsavedChanges: onHasUnsavedChanges, |
| 333 | onUserlistChange, |
| 334 | onInsertImage: onInsertImage |
| 335 | } |
| 336 | }; |
| 337 | let path = "/common/sframe-app-outer.js"; |
| 338 | if (['sheet', 'doc', 'presentation'].includes(data.application)) { |
| 339 | path = '/common/onlyoffice/main.js'; |
| 340 | } |
| 341 | require([path], function () { |
| 342 | delete window.CP_integration_outer; |
| 343 | cb(); |
| 344 | }); |
| 345 | }; |
| 346 | |
| 347 | if (data.document) { return void startApp(data.document); } |
| 348 | getBlobServer(data.url, (err, blob) => { |