Skip to content

Commit

Permalink
For #11838: trigger fallback bar after user clicks in pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
emalysz committed Jun 1, 2020
1 parent 8fc1126 commit bbdabc5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ const PDFViewerApplication = {
externalServices: DefaultExternalServices,
_boundEvents: {},
contentDispositionFilename: null,
_hasInteracted: false,
_isAcroFormPresent: false,

// Called once when the document is loaded.
async initialize(appConfig) {
Expand Down Expand Up @@ -868,10 +870,16 @@ const PDFViewerApplication = {
PDFJSDev.test("MOZCENTRAL || GENERIC")
) {
// Only trigger the fallback once so we don't spam the user with messages
// for one PDF.
// for one PDF. For forms, it should only be triggered once the user has
// clicked within the PDF.
if (this.fellback) {
return;
}

if (featureId === UNSUPPORTED_FEATURES.forms && !this._hasInteracted) {
return;
}

this.fellback = true;
this.externalServices.fallback(
{
Expand Down Expand Up @@ -1317,7 +1325,7 @@ const PDFViewerApplication = {

if (info.IsAcroFormPresent) {
console.warn("Warning: AcroForm/XFA is not supported");
this.fallback(UNSUPPORTED_FEATURES.forms);
this._isAcroFormPresent = true;
}

if (
Expand Down Expand Up @@ -2473,6 +2481,11 @@ function webViewerWheel(evt) {
}

function webViewerClick(evt) {
PDFViewerApplication._hasInteracted = true;
if (PDFViewerApplication._isAcroFormPresent) {
PDFViewerApplication.fallback(UNSUPPORTED_FEATURES.forms);
}

if (!PDFViewerApplication.secondaryToolbar.isOpen) {
return;
}
Expand Down

0 comments on commit bbdabc5

Please sign in to comment.