зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1455443 - Convert dock menu options to a checkbox list; r=jryans
This also fixes the grouping so that the checkboxes appear before the separator as per the mockup here: https://mozilla.invisionapp.com/share/M5G8OO1ZVE4#/screens MozReview-Commit-ID: FfVNzPHEk43 --HG-- extra : rebase_source : 50f1060ab65c307a5474b40ebfb7bfaf8649070d
This commit is contained in:
Родитель
e23d2028e1
Коммит
e1ca7a480d
|
@ -26,6 +26,7 @@ class ToolboxController extends Component {
|
||||||
highlightedTools: new Set(),
|
highlightedTools: new Set(),
|
||||||
panelDefinitions: [],
|
panelDefinitions: [],
|
||||||
hostTypes: [],
|
hostTypes: [],
|
||||||
|
currentHostType: undefined,
|
||||||
areDockOptionsEnabled: true,
|
areDockOptionsEnabled: true,
|
||||||
canCloseToolbox: true,
|
canCloseToolbox: true,
|
||||||
isSplitConsoleActive: false,
|
isSplitConsoleActive: false,
|
||||||
|
@ -43,6 +44,7 @@ class ToolboxController extends Component {
|
||||||
this.highlightTool = this.highlightTool.bind(this);
|
this.highlightTool = this.highlightTool.bind(this);
|
||||||
this.unhighlightTool = this.unhighlightTool.bind(this);
|
this.unhighlightTool = this.unhighlightTool.bind(this);
|
||||||
this.setHostTypes = this.setHostTypes.bind(this);
|
this.setHostTypes = this.setHostTypes.bind(this);
|
||||||
|
this.setCurrentHostType = this.setCurrentHostType.bind(this);
|
||||||
this.setDockOptionsEnabled = this.setDockOptionsEnabled.bind(this);
|
this.setDockOptionsEnabled = this.setDockOptionsEnabled.bind(this);
|
||||||
this.setCanCloseToolbox = this.setCanCloseToolbox.bind(this);
|
this.setCanCloseToolbox = this.setCanCloseToolbox.bind(this);
|
||||||
this.setIsSplitConsoleActive = this.setIsSplitConsoleActive.bind(this);
|
this.setIsSplitConsoleActive = this.setIsSplitConsoleActive.bind(this);
|
||||||
|
@ -137,6 +139,10 @@ class ToolboxController extends Component {
|
||||||
this.setState({ hostTypes });
|
this.setState({ hostTypes });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCurrentHostType(currentHostType) {
|
||||||
|
this.setState({ currentHostType });
|
||||||
|
}
|
||||||
|
|
||||||
setCanCloseToolbox(canCloseToolbox) {
|
setCanCloseToolbox(canCloseToolbox) {
|
||||||
this.setState({ canCloseToolbox }, this.updateButtonIds);
|
this.setState({ canCloseToolbox }, this.updateButtonIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,9 @@ class ToolboxToolbar extends Component {
|
||||||
position: PropTypes.string.isRequired,
|
position: PropTypes.string.isRequired,
|
||||||
switchHost: PropTypes.func.isRequired,
|
switchHost: PropTypes.func.isRequired,
|
||||||
})),
|
})),
|
||||||
|
// Current docking type. Typically one of the position values in
|
||||||
|
// |hostTypes| but this is not always the case (e.g. when it is "custom").
|
||||||
|
currentHostType: PropTypes.string,
|
||||||
// Should the docking options be enabled? They are disabled in some
|
// Should the docking options be enabled? They are disabled in some
|
||||||
// contexts such as WebIDE.
|
// contexts such as WebIDE.
|
||||||
areDockButtonsEnabled: PropTypes.bool,
|
areDockButtonsEnabled: PropTypes.bool,
|
||||||
|
@ -212,6 +215,8 @@ function renderSeparator() {
|
||||||
* Position name.
|
* Position name.
|
||||||
* @param {Function} hostTypes[].switchHost
|
* @param {Function} hostTypes[].switchHost
|
||||||
* Function to switch the host.
|
* Function to switch the host.
|
||||||
|
* @param {string} currentHostType
|
||||||
|
* The current docking configuration.
|
||||||
* @param {boolean} areDockOptionsEnabled
|
* @param {boolean} areDockOptionsEnabled
|
||||||
* They are not enabled in certain situations like when they are in the
|
* They are not enabled in certain situations like when they are in the
|
||||||
* WebIDE.
|
* WebIDE.
|
||||||
|
@ -298,12 +303,14 @@ function renderToolboxControls(props) {
|
||||||
* The id of the currently selected tool.
|
* The id of the currently selected tool.
|
||||||
* @param {Object[]} props.hostTypes
|
* @param {Object[]} props.hostTypes
|
||||||
* Array of host type objects.
|
* Array of host type objects.
|
||||||
|
* This array will be empty if we shouldn't shouldn't show any dock
|
||||||
|
* options.
|
||||||
* @param {string} props.hostTypes[].position
|
* @param {string} props.hostTypes[].position
|
||||||
* Position name.
|
* Position name.
|
||||||
* @param {Function} props.hostTypes[].switchHost
|
* @param {Function} props.hostTypes[].switchHost
|
||||||
* Function to switch the host.
|
* Function to switch the host.
|
||||||
* This array will be empty if we shouldn't shouldn't show any dock
|
* @param {string} props.currentHostType
|
||||||
* options.
|
* The current docking configuration.
|
||||||
* @param {boolean} isSplitConsoleActive
|
* @param {boolean} isSplitConsoleActive
|
||||||
* Is the split console currently visible?
|
* Is the split console currently visible?
|
||||||
* @param {boolean|undefined} disableAutohide
|
* @param {boolean|undefined} disableAutohide
|
||||||
|
@ -327,6 +334,7 @@ function showMeatballMenu(
|
||||||
{
|
{
|
||||||
currentToolId,
|
currentToolId,
|
||||||
hostTypes,
|
hostTypes,
|
||||||
|
currentHostType,
|
||||||
isSplitConsoleActive,
|
isSplitConsoleActive,
|
||||||
disableAutohide,
|
disableAutohide,
|
||||||
selectTool,
|
selectTool,
|
||||||
|
@ -340,13 +348,23 @@ function showMeatballMenu(
|
||||||
|
|
||||||
// Dock options
|
// Dock options
|
||||||
for (const hostType of hostTypes) {
|
for (const hostType of hostTypes) {
|
||||||
menu.append(new MenuItem({
|
const l10nkey =
|
||||||
id: `toolbox-meatball-menu-dock-${hostType.position}`,
|
hostType.position === "window"
|
||||||
label: L10N.getStr(
|
? "separateWindow"
|
||||||
`toolbox.meatballMenu.dock.${hostType.position}.label`
|
: hostType.position;
|
||||||
),
|
menu.append(
|
||||||
click: () => hostType.switchHost(),
|
new MenuItem({
|
||||||
}));
|
id: `toolbox-meatball-menu-dock-${hostType.position}`,
|
||||||
|
label: L10N.getStr(`toolbox.meatballMenu.dock.${l10nkey}.label`),
|
||||||
|
click: () => hostType.switchHost(),
|
||||||
|
type: "checkbox",
|
||||||
|
checked: hostType.position === currentHostType,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (menu.items.length) {
|
||||||
|
menu.append(new MenuItem({ type: "separator" }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split console
|
// Split console
|
||||||
|
@ -377,10 +395,6 @@ function showMeatballMenu(
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu.items.length) {
|
|
||||||
menu.append(new MenuItem({ type: "separator" }));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
id: "toolbox-meatball-menu-settings",
|
id: "toolbox-meatball-menu-settings",
|
||||||
|
|
|
@ -1094,8 +1094,7 @@ Toolbox.prototype = {
|
||||||
let hostTypes = [];
|
let hostTypes = [];
|
||||||
for (let type in Toolbox.HostType) {
|
for (let type in Toolbox.HostType) {
|
||||||
let position = Toolbox.HostType[type];
|
let position = Toolbox.HostType[type];
|
||||||
if (position == this.hostType ||
|
if (position == Toolbox.HostType.CUSTOM ||
|
||||||
position == Toolbox.HostType.CUSTOM ||
|
|
||||||
(!sideEnabled && position == Toolbox.HostType.SIDE)) {
|
(!sideEnabled && position == Toolbox.HostType.SIDE)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1106,6 +1105,7 @@ Toolbox.prototype = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.component.setCurrentHostType(this.hostType);
|
||||||
this.component.setHostTypes(hostTypes);
|
this.component.setHostTypes(hostTypes);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2445,6 +2445,8 @@ Toolbox.prototype = {
|
||||||
|
|
||||||
this.emit("host-changed");
|
this.emit("host-changed");
|
||||||
this._telemetry.log(HOST_HISTOGRAM, this._getTelemetryHostId());
|
this._telemetry.log(HOST_HISTOGRAM, this._getTelemetryHostId());
|
||||||
|
|
||||||
|
this.component.setCurrentHostType(hostType);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -151,7 +151,7 @@ toolbox.meatballMenu.button.tooltip=Customize Developer Tools and get help
|
||||||
# docking (or undocking) the developer tools toolbox.
|
# docking (or undocking) the developer tools toolbox.
|
||||||
toolbox.meatballMenu.dock.bottom.label=Dock to bottom
|
toolbox.meatballMenu.dock.bottom.label=Dock to bottom
|
||||||
toolbox.meatballMenu.dock.side.label=Dock to side
|
toolbox.meatballMenu.dock.side.label=Dock to side
|
||||||
toolbox.meatballMenu.dock.window.label=Undock
|
toolbox.meatballMenu.dock.separateWindow.label=Separate window
|
||||||
|
|
||||||
# LOCALIZATION NOTE (toolbox.meatballMenu.{splitconsole,hideconsole}.label):
|
# LOCALIZATION NOTE (toolbox.meatballMenu.{splitconsole,hideconsole}.label):
|
||||||
# These are the labels in the "..." menu in the toolbox for toggling the split
|
# These are the labels in the "..." menu in the toolbox for toggling the split
|
||||||
|
|
Загрузка…
Ссылка в новой задаче