diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index d3e34c8ce..ce25f363b 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1511,26 +1511,38 @@ define([ var _mediasSources = getMediasSources(); var images = _obj.data || []; if (!Array.isArray(images)) { return; } - var urls = images.map(function (name) { - var data = _mediasSources[name]; - if (!data) { return; } - var media = mediasData[data.src]; - if (!media) { return; } - return { - path: name, - url: media.blobUrl, - }; - }).filter(Boolean); - send({ - type: "documentOpen", - data: { - type: "imgurls", - status: "ok", + var urls = []; + nThen(function (waitFor) { + images.forEach(function (name) { + if (/^data\:image/.test(name)) { + Util.fetch(name, waitFor(function (err, u8) { + if (err) { return; } + var b = new Blob([u8]); + urls.push(URL.createObjectURL(b)); + })); + return; + } + var data = _mediasSources[name]; + if (!data) { return; } + var media = mediasData[data.src]; + if (!media) { return; } + urls.push({ + path: name, + url: media.blobUrl, + }); + }); + }).nThen(function () { + send({ + type: "documentOpen", data: { - urls: urls, - error: 0 + type: "imgurls", + status: "ok", + data: { + urls: urls, + error: 0 + } } - } + }); }); } break; diff --git a/www/common/test.js b/www/common/test.js index 5265c2311..486f70c0a 100644 --- a/www/common/test.js +++ b/www/common/test.js @@ -1,5 +1,12 @@ define([], function () { if (window.__CRYPTPAD_TEST_OBJ_) { return window.__CRYPTPAD_TEST_OBJ_; } + // XXX localhost secureiframe fix + var out = function () {}; + out.options = {}; + out.testing = false; + out.registerInner = function () { }; + out.registerOuter = function () { }; + return out; var locks = []; var tests = [];