Ensure that the externalLinkTarget option is correctly set when the viewer is embedded (PR 9479 follow-up)

*This was a stupid error on my part; sorry about breaking this!*

With the current code, the value of the `externalLinkTarget` option is now (potentially) updated *after* the viewer components have been initialized. For the "viewer in iframe/object tag" case, the result is that the value of the `externalLinkTarget` option isn't adjusted as intended any more.
This commit is contained in:
Jonas Jenwald 2018-07-23 20:12:19 +02:00
parent 5b17fe81dc
commit c6a0ae08f1

View File

@ -142,6 +142,12 @@ let PDFViewerApplication = {
}).then(() => {
return this._initializeL10n();
}).then(() => {
if (this.isViewerEmbedded &&
AppOptions.get('externalLinkTarget') === LinkTarget.NONE) {
// Prevent external links from "replacing" the viewer,
// when it's embedded in e.g. an <iframe> or an <object>.
AppOptions.set('externalLinkTarget', LinkTarget.TOP);
}
return this._initializeViewerComponents();
}).then(() => {
// Bind the various event handlers *after* the viewer has been
@ -157,13 +163,6 @@ let PDFViewerApplication = {
this.eventBus.dispatch('localized');
});
if (this.isViewerEmbedded &&
AppOptions.get('externalLinkTarget') === LinkTarget.NONE) {
// Prevent external links from "replacing" the viewer,
// when it's embedded in e.g. an iframe or an object.
AppOptions.set('externalLinkTarget', LinkTarget.TOP);
}
this.initialized = true;
});
},