mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Pause translation when appending the outline/attachment/layer trees to the sidebar
Also, pause translation when collapsing/expanding subtrees.
This commit is contained in:
parent
0fc899338c
commit
6b265b3a15
6 changed files with 41 additions and 2 deletions
|
@ -25,6 +25,7 @@ class BaseTreeViewer {
|
|||
}
|
||||
this.container = options.container;
|
||||
this.eventBus = options.eventBus;
|
||||
this._l10n = options.l10n;
|
||||
|
||||
this.reset();
|
||||
}
|
||||
|
@ -99,10 +100,14 @@ class BaseTreeViewer {
|
|||
* @private
|
||||
*/
|
||||
_toggleTreeItem(root, show = false) {
|
||||
// Pause translation when collapsing/expanding the subtree.
|
||||
this._l10n.pause();
|
||||
|
||||
this._lastToggleIsShow = show;
|
||||
for (const toggler of root.querySelectorAll(".treeItemToggler")) {
|
||||
toggler.classList.toggle("treeItemsHidden", !show);
|
||||
}
|
||||
this._l10n.resume();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,7 +127,10 @@ class BaseTreeViewer {
|
|||
|
||||
this._lastToggleIsShow = !fragment.querySelector(".treeItemsHidden");
|
||||
}
|
||||
// Pause translation when inserting the tree into the DOM.
|
||||
this._l10n.pause();
|
||||
this.container.append(fragment);
|
||||
this._l10n.resume();
|
||||
|
||||
this._dispatchEvent(count);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue