Fix duplicating slide with images in OnlyOffice

pull/1/head
yflory 3 years ago
parent c92092c662
commit 8c299a59fb

@ -1501,6 +1501,37 @@ define([
APP.onDocumentUnlock = undefined; APP.onDocumentUnlock = undefined;
} }
break; break;
case 'openDocument':
// When duplicating a slide, OO may ask the URLs of the images
// in that slide
var _obj = obj.message;
if (_obj.c === "imgurls") {
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",
data: {
urls: urls,
error: 0
}
}
});
}
break;
} }
}); });
}); });

Loading…
Cancel
Save