Skip to content

Commit 85251da

Browse files
committed
Remove the NullL10n default value from viewer components not included in the COMPONENTS-bundle
For any viewer component not listed in `web/pdf_viewer.component.js`, it shouldn't be necessary to provide a default value for the `l10n`-parameters. Note also that these *specific* components are heavily tailored towards the default viewer use-case, rather than for general usage.
1 parent 8b7dee0 commit 85251da

9 files changed

+12
-36
lines changed

web/password_prompt.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { NullL10n } from "./ui_utils.js";
1716
import { PasswordResponses } from "pdfjs-lib";
1817

1918
/**
@@ -37,12 +36,7 @@ class PasswordPrompt {
3736
* @param {boolean} [isViewerEmbedded] - If the viewer is embedded, in e.g.
3837
* an <iframe> or an <object>. The default value is `false`.
3938
*/
40-
constructor(
41-
options,
42-
overlayManager,
43-
l10n = NullL10n,
44-
isViewerEmbedded = false
45-
) {
39+
constructor(options, overlayManager, l10n, isViewerEmbedded = false) {
4640
this.overlayName = options.overlayName;
4741
this.container = options.container;
4842
this.label = options.label;

web/pdf_document_properties.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
getPageSizeInches,
1919
getPDFFileNameFromURL,
2020
isPortraitOrientation,
21-
NullL10n,
2221
} from "./ui_utils.js";
2322

2423
const DEFAULT_FIELD_CONTENT = "-";
@@ -63,7 +62,7 @@ class PDFDocumentProperties {
6362
{ overlayName, fields, container, closeButton },
6463
overlayManager,
6564
eventBus,
66-
l10n = NullL10n
65+
l10n
6766
) {
6867
this.overlayName = overlayName;
6968
this.fields = fields;

web/pdf_find_bar.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515

1616
import { FindState } from "./pdf_find_controller.js";
17-
import { NullL10n } from "./ui_utils.js";
1817

1918
const MATCHES_COUNT_LIMIT = 1000;
2019

@@ -25,7 +24,7 @@ const MATCHES_COUNT_LIMIT = 1000;
2524
* is done by PDFFindController.
2625
*/
2726
class PDFFindBar {
28-
constructor(options, eventBus, l10n = NullL10n) {
27+
constructor(options, eventBus, l10n) {
2928
this.opened = false;
3029

3130
this.bar = options.bar || null;

web/pdf_print_service.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { CSS_UNITS, NullL10n } from "./ui_utils.js";
1716
import { PDFPrintServiceFactory, PDFViewerApplication } from "./app.js";
17+
import { CSS_UNITS } from "./ui_utils.js";
1818
import { viewerCompatibilityParams } from "./viewer_compatibility.js";
1919

2020
let activeService = null;
@@ -82,7 +82,7 @@ function PDFPrintService(
8282
this._printResolution = printResolution || 150;
8383
this._optionalContentConfigPromise =
8484
optionalContentConfigPromise || pdfDocument.getOptionalContentConfig();
85-
this.l10n = l10n || NullL10n;
85+
this.l10n = l10n;
8686
this.currentPage = -1;
8787
// The temporary canvas where renderPage paints one page at a time.
8888
this.scratchCanvas = document.createElement("canvas");

web/pdf_sidebar.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { NullL10n, PresentationModeState, SidebarView } from "./ui_utils.js";
16+
import { PresentationModeState, SidebarView } from "./ui_utils.js";
1717
import { RenderingStates } from "./pdf_rendering_queue.js";
1818

1919
const UI_NOTIFICATION_CLASS = "pdfSidebarNotification";
@@ -61,13 +61,7 @@ class PDFSidebar {
6161
/**
6262
* @param {PDFSidebarOptions} options
6363
*/
64-
constructor({
65-
elements,
66-
pdfViewer,
67-
pdfThumbnailViewer,
68-
eventBus,
69-
l10n = NullL10n,
70-
}) {
64+
constructor({ elements, pdfViewer, pdfThumbnailViewer, eventBus, l10n }) {
7165
this.isOpen = false;
7266
this.active = SidebarView.THUMBS;
7367
this.isInitialViewSet = false;

web/pdf_sidebar_resizer.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { NullL10n } from "./ui_utils.js";
17-
1816
const SIDEBAR_WIDTH_VAR = "--sidebar-width";
1917
const SIDEBAR_MIN_WIDTH = 200; // pixels
2018
const SIDEBAR_RESIZING_CLASS = "sidebarResizing";
@@ -33,7 +31,7 @@ class PDFSidebarResizer {
3331
* @param {EventBus} eventBus - The application event bus.
3432
* @param {IL10n} l10n - Localization service.
3533
*/
36-
constructor(options, eventBus, l10n = NullL10n) {
34+
constructor(options, eventBus, l10n) {
3735
this.isRTL = false;
3836
this.sidebarOpen = false;
3937
this.doc = document.documentElement;

web/pdf_thumbnail_view.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { getOutputScale, NullL10n } from "./ui_utils.js";
16+
import { getOutputScale } from "./ui_utils.js";
1717
import { RenderingCancelledException } from "pdfjs-lib";
1818
import { RenderingStates } from "./pdf_rendering_queue.js";
1919

@@ -97,7 +97,7 @@ class PDFThumbnailView {
9797
renderingQueue,
9898
checkSetImageDisabled,
9999
disableCanvasToImageConversion = false,
100-
l10n = NullL10n,
100+
l10n,
101101
}) {
102102
this.id = id;
103103
this.renderingId = "thumbnail" + id;

web/pdf_thumbnail_viewer.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import {
1717
getVisibleElements,
1818
isValidRotation,
19-
NullL10n,
2019
scrollIntoView,
2120
watchScroll,
2221
} from "./ui_utils.js";
@@ -45,13 +44,7 @@ class PDFThumbnailViewer {
4544
/**
4645
* @param {PDFThumbnailViewerOptions} options
4746
*/
48-
constructor({
49-
container,
50-
eventBus,
51-
linkService,
52-
renderingQueue,
53-
l10n = NullL10n,
54-
}) {
47+
constructor({ container, eventBus, linkService, renderingQueue, l10n }) {
5548
this.container = container;
5649
this.linkService = linkService;
5750
this.renderingQueue = renderingQueue;

web/toolbar.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
MAX_SCALE,
2121
MIN_SCALE,
2222
noContextMenuHandler,
23-
NullL10n,
2423
} from "./ui_utils.js";
2524

2625
const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading";
@@ -58,7 +57,7 @@ class Toolbar {
5857
* @param {EventBus} eventBus
5958
* @param {IL10n} l10n - Localization service.
6059
*/
61-
constructor(options, eventBus, l10n = NullL10n) {
60+
constructor(options, eventBus, l10n) {
6261
this.toolbar = options.container;
6362
this.eventBus = eventBus;
6463
this.l10n = l10n;

0 commit comments

Comments
 (0)