forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGutterMenu.js
More file actions
85 lines (78 loc) · 2.04 KB
/
Copy pathGutterMenu.js
File metadata and controls
85 lines (78 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { showMenu } from "devtools-launchpad";
export default function GutterMenu({
breakpoint,
line,
event,
toggleBreakpoint,
showConditionalPanel,
toggleDisabledBreakpoint,
isCbPanelOpen,
closeConditionalPanel
}) {
event.stopPropagation();
event.preventDefault();
const gutterItems = {
addBreakpoint: {
id: "node-menu-add-breakpoint",
label: L10N.getStr("editor.addBreakpoint")
},
addConditional: {
id: "node-menu-add-conditional-breakpoint",
label: L10N.getStr("editor.addConditionalBreakpoint")
},
removeBreakpoint: {
id: "node-menu-remove-breakpoint",
label: L10N.getStr("editor.removeBreakpoint")
},
editConditional: {
id: "node-menu-edit-conditional-breakpoint",
label: L10N.getStr("editor.editBreakpoint")
},
enableBreakpoint: {
id: "node-menu-enable-breakpoint",
label: L10N.getStr("editor.enableBreakpoint")
},
disableBreakpoint: {
id: "node-menu-disable-breakpoint",
label: L10N.getStr("editor.disableBreakpoint")
}
};
const toggleBreakpointItem = Object.assign(
{
accesskey: "B",
disabled: false,
click: () => {
toggleBreakpoint(line);
if (isCbPanelOpen) {
closeConditionalPanel();
}
}
},
breakpoint ? gutterItems.removeBreakpoint : gutterItems.addBreakpoint
);
const conditionalBreakpoint = Object.assign(
{
accesskey: "C",
disabled: false,
click: () => showConditionalPanel(line)
},
breakpoint && breakpoint.condition
? gutterItems.editConditional
: gutterItems.addConditional
);
let items = [toggleBreakpointItem, conditionalBreakpoint];
if (breakpoint) {
const disableBreakpoint = Object.assign(
{
accesskey: "D",
disabled: false,
click: () => toggleDisabledBreakpoint(line)
},
breakpoint.disabled
? gutterItems.enableBreakpoint
: gutterItems.disableBreakpoint
);
items.push(disableBreakpoint);
}
showMenu(event, items);
}