Skip to content

Commit 72fc519

Browse files
ravefalcon92darkwing
authored andcommitted
[Log Point] Fix log point context menu accelerator (firefox-devtools#8115)
1 parent a7a04e1 commit 72fc519

File tree

6 files changed

+65
-26
lines changed

6 files changed

+65
-26
lines changed

assets/panel/debugger.properties

+16-6
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,17 @@ functionSearch.key=CmdOrCtrl+Shift+O
243243
# key identifiers, not messages displayed to the user.
244244
toggleBreakpoint.key=CmdOrCtrl+B
245245

246-
# LOCALIZATION NOTE (toggleCondPanel.key): A key shortcut to toggle
247-
# the conditional breakpoint panel.
246+
# LOCALIZATION NOTE (toggleCondPanel.breakpoint.key): A key shortcut to toggle
247+
# the conditional panel for breakpoints.
248248
# Do not localize "CmdOrCtrl+Shift+B", or change the format of the string. These are
249249
# key identifiers, not messages displayed to the user.
250-
toggleCondPanel.key=CmdOrCtrl+Shift+B
250+
toggleCondPanel.breakpoint.key=CmdOrCtrl+Shift+B
251+
252+
# LOCALIZATION NOTE (toggleCondPanel.logPoint.key): A key shortcut to toggle
253+
# the conditional panel for log points.
254+
# Do not localize "CmdOrCtrl+Shift+Y", or change the format of the string. These are
255+
# key identifiers, not messages displayed to the user.
256+
toggleCondPanel.logPoint.key=CmdOrCtrl+Shift+Y
251257

252258
# LOCALIZATION NOTE (stepOut.key): A key shortcut to
253259
# step out.
@@ -1028,9 +1034,13 @@ anonymousFunction=<anonymous>
10281034
shortcuts.toggleBreakpoint=Toggle Breakpoint
10291035
shortcuts.toggleBreakpoint.accesskey=B
10301036

1031-
# LOCALIZATION NOTE (shortcuts.toggleCondPanel): text describing
1032-
# keyboard shortcut action for toggling conditional panel keyboard
1033-
shortcuts.toggleCondPanel=Toggle Conditional Panel
1037+
# LOCALIZATION NOTE (shortcuts.toggleCondPanel.breakpoint): text describing
1038+
# keyboard shortcut action for toggling conditional panel for breakpoints
1039+
shortcuts.toggleCondPanel.breakpoint=Edit Conditional Breakpoint
1040+
1041+
# LOCALIZATION NOTE (shortcuts.toggleCondPanel.logPoint): text describing
1042+
# keyboard shortcut action for toggling conditional panel for log points
1043+
shortcuts.toggleCondPanel.logPoint=Edit Log Point
10341044

10351045
# LOCALIZATION NOTE (shortcuts.pauseOrResume): text describing
10361046
# keyboard shortcut action for pause of resume

src/components/Editor/index.js

+19-9
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ class Editor extends PureComponent<Props, State> {
217217

218218
shortcuts.on(L10N.getStr("toggleBreakpoint.key"), this.onToggleBreakpoint);
219219
shortcuts.on(
220-
L10N.getStr("toggleCondPanel.key"),
220+
L10N.getStr("toggleCondPanel.breakpoint.key"),
221+
this.onToggleConditionalPanel
222+
);
223+
shortcuts.on(
224+
L10N.getStr("toggleCondPanel.logPoint.key"),
221225
this.onToggleConditionalPanel
222226
);
223227
shortcuts.on(L10N.getStr("sourceTabs.closeTab.key"), this.onClosePress);
@@ -249,7 +253,8 @@ class Editor extends PureComponent<Props, State> {
249253
const shortcuts = this.context.shortcuts;
250254
shortcuts.off(L10N.getStr("sourceTabs.closeTab.key"));
251255
shortcuts.off(L10N.getStr("toggleBreakpoint.key"));
252-
shortcuts.off(L10N.getStr("toggleCondPanel.key"));
256+
shortcuts.off(L10N.getStr("toggleCondPanel.breakpoint.key"));
257+
shortcuts.off(L10N.getStr("toggleCondPanel.logPoint.key"));
253258
shortcuts.off(searchAgainPrevKey);
254259
shortcuts.off(searchAgainKey);
255260
}
@@ -301,11 +306,13 @@ class Editor extends PureComponent<Props, State> {
301306
e.stopPropagation();
302307
e.preventDefault();
303308
const line = this.getCurrentLine();
309+
304310
if (typeof line !== "number") {
305311
return;
306312
}
307313

308-
this.toggleConditionalPanel(line);
314+
const isLog = key === L10N.getStr("toggleCondPanel.logPoint.key");
315+
this.toggleConditionalPanel(line, isLog);
309316
};
310317

311318
onEditorScroll = throttle(this.props.updateViewport, 100);
@@ -454,7 +461,7 @@ class Editor extends PureComponent<Props, State> {
454461
}
455462
}
456463

457-
toggleConditionalPanel = line => {
464+
toggleConditionalPanel = (line, log: boolean = false) => {
458465
const {
459466
conditionalPanelLocation,
460467
closeConditionalPanel,
@@ -470,11 +477,14 @@ class Editor extends PureComponent<Props, State> {
470477
return;
471478
}
472479

473-
return openConditionalPanel({
474-
line: line,
475-
sourceId: selectedSource.id,
476-
sourceUrl: selectedSource.url
477-
});
480+
return openConditionalPanel(
481+
{
482+
line: line,
483+
sourceId: selectedSource.id,
484+
sourceUrl: selectedSource.url
485+
},
486+
log
487+
);
478488
};
479489

480490
shouldScrollToLocation(nextProps) {

src/components/Editor/menus/breakpoints.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const addConditionalBreakpointItem = (
3939
) => ({
4040
id: "node-menu-add-conditional-breakpoint",
4141
label: L10N.getStr("editor.addConditionBreakpoint"),
42-
accelerator: L10N.getStr("toggleCondPanel.key"),
42+
accelerator: L10N.getStr("toggleCondPanel.breakpoint.key"),
4343
accesskey: L10N.getStr("editor.addConditionBreakpoint.accesskey"),
4444
disabled: false,
4545
click: () => breakpointActions.openConditionalPanel(location)
@@ -51,7 +51,7 @@ export const editConditionalBreakpointItem = (
5151
) => ({
5252
id: "node-menu-edit-conditional-breakpoint",
5353
label: L10N.getStr("editor.editConditionBreakpoint"),
54-
accelerator: L10N.getStr("toggleCondPanel.key"),
54+
accelerator: L10N.getStr("toggleCondPanel.breakpoint.key"),
5555
accesskey: L10N.getStr("editor.addConditionBreakpoint.accesskey"),
5656
disabled: false,
5757
click: () => breakpointActions.openConditionalPanel(location)
@@ -79,7 +79,7 @@ export const addLogPointItem = (
7979
accesskey: L10N.getStr("editor.addLogPoint.accesskey"),
8080
disabled: false,
8181
click: () => breakpointActions.openConditionalPanel(location, true),
82-
accelerator: L10N.getStr("toggleCondPanel.key")
82+
accelerator: L10N.getStr("toggleCondPanel.logPoint.key")
8383
});
8484

8585
export const editLogPointItem = (
@@ -91,7 +91,7 @@ export const editLogPointItem = (
9191
accesskey: L10N.getStr("editor.addLogPoint.accesskey"),
9292
disabled: false,
9393
click: () => breakpointActions.openConditionalPanel(location, true),
94-
accelerator: L10N.getStr("toggleCondPanel.key")
94+
accelerator: L10N.getStr("toggleCondPanel.logPoint.key")
9595
});
9696

9797
export const logPointItem = (

src/components/SecondaryPanes/Breakpoints/BreakpointsContextMenu.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ export default function showContextMenu(props: Props) {
205205
click: () => {
206206
selectSpecificLocation(selectedLocation);
207207
openConditionalPanel(selectedLocation);
208-
}
208+
},
209+
accelerator: L10N.getStr("toggleCondPanel.breakpoint.key")
209210
};
210211

211212
const editConditionItem = {
@@ -215,7 +216,8 @@ export default function showContextMenu(props: Props) {
215216
click: () => {
216217
selectSpecificLocation(selectedLocation);
217218
openConditionalPanel(selectedLocation);
218-
}
219+
},
220+
accelerator: L10N.getStr("toggleCondPanel.breakpoint.key")
219221
};
220222

221223
const addLogPointItem = {
@@ -224,7 +226,7 @@ export default function showContextMenu(props: Props) {
224226
accesskey: L10N.getStr("editor.addLogPoint.accesskey"),
225227
disabled: false,
226228
click: () => openConditionalPanel(selectedLocation, true),
227-
accelerator: L10N.getStr("toggleCondPanel.key")
229+
accelerator: L10N.getStr("toggleCondPanel.logPoint.key")
228230
};
229231

230232
const editLogPointItem = {
@@ -233,7 +235,7 @@ export default function showContextMenu(props: Props) {
233235
accesskey: L10N.getStr("editor.addLogPoint.accesskey"),
234236
disabled: false,
235237
click: () => openConditionalPanel(selectedLocation, true),
236-
accelerator: L10N.getStr("toggleCondPanel.key")
238+
accelerator: L10N.getStr("toggleCondPanel.logPoint.key")
237239
};
238240

239241
const removeLogPointItem = {

src/components/ShortcutsModal.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ export class ShortcutsModal extends Component<Props> {
4646
formatKeyShortcut(L10N.getStr("toggleBreakpoint.key"))
4747
)}
4848
{this.renderShorcutItem(
49-
L10N.getStr("shortcuts.toggleCondPanel"),
50-
formatKeyShortcut(L10N.getStr("toggleCondPanel.key"))
49+
L10N.getStr("shortcuts.toggleCondPanel.breakpoint"),
50+
formatKeyShortcut(L10N.getStr("toggleCondPanel.breakpoint.key"))
51+
)}
52+
{this.renderShorcutItem(
53+
L10N.getStr("shortcuts.toggleCondPanel.logPoint"),
54+
formatKeyShortcut(L10N.getStr("toggleCondPanel.logPoint.key"))
5155
)}
5256
</ul>
5357
);

src/components/test/__snapshots__/ShortcutsModal.spec.js.snap

+14-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ exports[`ShortcutsModal renders when enabled 1`] = `
3333
</li>
3434
<li>
3535
<span>
36-
Toggle Conditional Panel
36+
Edit Conditional Breakpoint
3737
</span>
3838
<span>
3939
<span
@@ -44,6 +44,19 @@ exports[`ShortcutsModal renders when enabled 1`] = `
4444
</span>
4545
</span>
4646
</li>
47+
<li>
48+
<span>
49+
Edit Log Point
50+
</span>
51+
<span>
52+
<span
53+
className="keystroke"
54+
key="Ctrl+Shift+Y"
55+
>
56+
Ctrl+Shift+Y
57+
</span>
58+
</span>
59+
</li>
4760
</ul>
4861
</div>
4962
<div

0 commit comments

Comments
 (0)