Bug 1577257 - Share logic behind panel headers across the UI r=willdurand,Gijs,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D160972
This commit is contained in:
@@ -1374,20 +1374,27 @@ var PanelView = class extends AssociatedToNode {
|
||||
};
|
||||
|
||||
// If the header already exists, update or remove it as requested.
|
||||
let header = this.node.firstElementChild;
|
||||
if (header && header.classList.contains("panel-header")) {
|
||||
if (value) {
|
||||
// The back button has a label in it - we want to select
|
||||
// the label that's a direct child of the header.
|
||||
header.querySelector(".panel-header > h1 > span").textContent = value;
|
||||
ensureHeaderSeparator(header);
|
||||
} else {
|
||||
let header = this.node.querySelector(".panel-header");
|
||||
if (header) {
|
||||
if (!this.node.getAttribute("mainview")) {
|
||||
if (value) {
|
||||
// The back button has a label in it - we want to select
|
||||
// the span that's a child of the header.
|
||||
header.querySelector(".panel-header > h1 > span").textContent = value;
|
||||
ensureHeaderSeparator(header);
|
||||
} else {
|
||||
if (header.nextSibling.tagName == "toolbarseparator") {
|
||||
header.nextSibling.remove();
|
||||
}
|
||||
header.remove();
|
||||
}
|
||||
return;
|
||||
} else if (!this.node.getAttribute("showheader")) {
|
||||
if (header.nextSibling.tagName == "toolbarseparator") {
|
||||
header.nextSibling.remove();
|
||||
}
|
||||
header.remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// The header doesn't exist, only create it if needed.
|
||||
|
||||
@@ -74,9 +74,12 @@
|
||||
hidden="true">
|
||||
<panelmultiview mainViewId="unified-extensions-view">
|
||||
<panelview id="unified-extensions-view"
|
||||
class="cui-widget-panelview">
|
||||
<vbox class="unified-extensions-panel-header">
|
||||
<html:h1 data-l10n-id="unified-extensions-header-title"/>
|
||||
class="cui-widget-panelview"
|
||||
showheader="true">
|
||||
<vbox class="panel-header">
|
||||
<html:h1>
|
||||
<html:span data-l10n-id="unified-extensions-header-title"/>
|
||||
</html:h1>
|
||||
</vbox>
|
||||
|
||||
<toolbarseparator />
|
||||
|
||||
Reference in New Issue
Block a user