Merge pull request #12952 from Snuffleupagus/issue-12951
Don't focus the `PasswordPrompt` input-field on load, when the viewer is embedded in e.g. an `iframe` (issue 12951)
This commit is contained in:
commit
27ffbdf7df
@ -558,7 +558,8 @@ const PDFViewerApplication = {
|
|||||||
this.passwordPrompt = new PasswordPrompt(
|
this.passwordPrompt = new PasswordPrompt(
|
||||||
appConfig.passwordOverlay,
|
appConfig.passwordOverlay,
|
||||||
this.overlayManager,
|
this.overlayManager,
|
||||||
this.l10n
|
this.l10n,
|
||||||
|
this.isViewerEmbedded
|
||||||
);
|
);
|
||||||
|
|
||||||
this.pdfOutlineViewer = new PDFOutlineViewer({
|
this.pdfOutlineViewer = new PDFOutlineViewer({
|
||||||
|
@ -34,8 +34,15 @@ class PasswordPrompt {
|
|||||||
* @param {PasswordPromptOptions} options
|
* @param {PasswordPromptOptions} options
|
||||||
* @param {OverlayManager} overlayManager - Manager for the viewer overlays.
|
* @param {OverlayManager} overlayManager - Manager for the viewer overlays.
|
||||||
* @param {IL10n} l10n - Localization service.
|
* @param {IL10n} l10n - Localization service.
|
||||||
|
* @param {boolean} [isViewerEmbedded] - If the viewer is embedded, in e.g.
|
||||||
|
* an <iframe> or an <object>. The default value is `false`.
|
||||||
*/
|
*/
|
||||||
constructor(options, overlayManager, l10n = NullL10n) {
|
constructor(
|
||||||
|
options,
|
||||||
|
overlayManager,
|
||||||
|
l10n = NullL10n,
|
||||||
|
isViewerEmbedded = false
|
||||||
|
) {
|
||||||
this.overlayName = options.overlayName;
|
this.overlayName = options.overlayName;
|
||||||
this.container = options.container;
|
this.container = options.container;
|
||||||
this.label = options.label;
|
this.label = options.label;
|
||||||
@ -44,6 +51,7 @@ class PasswordPrompt {
|
|||||||
this.cancelButton = options.cancelButton;
|
this.cancelButton = options.cancelButton;
|
||||||
this.overlayManager = overlayManager;
|
this.overlayManager = overlayManager;
|
||||||
this.l10n = l10n;
|
this.l10n = l10n;
|
||||||
|
this._isViewerEmbedded = isViewerEmbedded;
|
||||||
|
|
||||||
this.updateCallback = null;
|
this.updateCallback = null;
|
||||||
this.reason = null;
|
this.reason = null;
|
||||||
@ -67,7 +75,12 @@ class PasswordPrompt {
|
|||||||
|
|
||||||
open() {
|
open() {
|
||||||
this.overlayManager.open(this.overlayName).then(() => {
|
this.overlayManager.open(this.overlayName).then(() => {
|
||||||
this.input.focus();
|
if (
|
||||||
|
!this._isViewerEmbedded ||
|
||||||
|
this.reason === PasswordResponses.INCORRECT_PASSWORD
|
||||||
|
) {
|
||||||
|
this.input.focus();
|
||||||
|
}
|
||||||
|
|
||||||
let promptString;
|
let promptString;
|
||||||
if (this.reason === PasswordResponses.INCORRECT_PASSWORD) {
|
if (this.reason === PasswordResponses.INCORRECT_PASSWORD) {
|
||||||
|
Loading…
Reference in New Issue
Block a user