Merge pull request #17142 from calixteman/no_connect_root
[L10n] Don't try to connect the root element when it has already been done
This commit is contained in:
commit
d094e8aab0
14
web/app.js
14
web/app.js
@ -272,14 +272,6 @@ const PDFViewerApplication = {
|
||||
this.bindEvents();
|
||||
this.bindWindowEvents();
|
||||
|
||||
// We can start UI localization now.
|
||||
const appContainer = appConfig.appContainer || document.documentElement;
|
||||
this.l10n.translate(appContainer).then(() => {
|
||||
// Dispatch the 'localized' event on the `eventBus` once the viewer
|
||||
// has been fully initialized and translated.
|
||||
this.eventBus.dispatch("localized", { source: this });
|
||||
});
|
||||
|
||||
this._initializedCapability.resolve();
|
||||
},
|
||||
|
||||
@ -375,6 +367,12 @@ const PDFViewerApplication = {
|
||||
: null
|
||||
);
|
||||
document.getElementsByTagName("html")[0].dir = this.l10n.getDirection();
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
const appContainer =
|
||||
this.appConfig.appContainer || document.documentElement;
|
||||
// Connect Fluent and translate what we already have.
|
||||
this.l10n.translate(appContainer);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -46,8 +46,6 @@ const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading";
|
||||
*/
|
||||
|
||||
class Toolbar {
|
||||
#wasLocalized = false;
|
||||
|
||||
/**
|
||||
* @param {ToolbarOptions} options
|
||||
* @param {EventBus} eventBus
|
||||
@ -206,11 +204,6 @@ class Toolbar {
|
||||
// Suppress context menus for some controls.
|
||||
scaleSelect.oncontextmenu = noContextMenu;
|
||||
|
||||
this.eventBus._on("localized", () => {
|
||||
this.#wasLocalized = true;
|
||||
this.#updateUIState(true);
|
||||
});
|
||||
|
||||
this.#bindEditorToolsListener(options);
|
||||
}
|
||||
|
||||
@ -254,10 +247,6 @@ class Toolbar {
|
||||
}
|
||||
|
||||
#updateUIState(resetNumPages = false) {
|
||||
if (!this.#wasLocalized) {
|
||||
// Don't update the UI state until we localize the toolbar.
|
||||
return;
|
||||
}
|
||||
const { pageNumber, pagesCount, pageScaleValue, pageScale, items } = this;
|
||||
|
||||
if (resetNumPages) {
|
||||
|
Loading…
Reference in New Issue
Block a user