update pdf.js to use new iframe/postMessage api

This commit is contained in:
j 2014-09-23 23:47:55 +02:00
parent ac2f1a550f
commit 2db57c3c69

View file

@ -448,8 +448,8 @@ pandora.ui.textPDF = function(text) {
src: url, src: url,
width: '100%' width: '100%'
}) })
.onMessage(function(event, data) { .bindMessage({
if (event == 'edit') { edit: function(data) {
pandora.ui.insertEmbedDialog(data.src, function(url) { pandora.ui.insertEmbedDialog(data.src, function(url) {
data.src = url; data.src = url;
var embed = text.embeds.filter(function(embed) { var embed = text.embeds.filter(function(embed) {
@ -470,7 +470,8 @@ pandora.ui.textPDF = function(text) {
$iframe.postMessage('update', data); $iframe.postMessage('update', data);
}); });
}).open(); }).open();
} else if (event == 'page') { },
page: function(data) {
pandora.UI.set('texts.' + pandora.UI.encode(pandora.user.ui.text), { pandora.UI.set('texts.' + pandora.UI.encode(pandora.user.ui.text), {
'position': data.page 'position': data.page
}); });