From 29407aeed7564cc2a4af3dd28235614619d24f50 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 21 Mar 2019 22:16:13 +0000 Subject: [PATCH] Bug 1537596 - Make shift-click toggle all breakpoint states per line r=loganfsmyth Implements a function to enable or disable all breakpoints on a line based on shift-clicking. Uses the first breakpoint's state to decide whether to enable or disable all. Differential Revision: https://phabricator.services.mozilla.com/D24440 --HG-- extra : moz-landing-system : lando --- .../debugger/new/src/actions/breakpoints/index.js | 13 ++++++++++++- .../new/src/components/Editor/Breakpoint.js | 7 +++++++ .../new/src/components/Editor/menus/breakpoints.js | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/devtools/client/debugger/new/src/actions/breakpoints/index.js b/devtools/client/debugger/new/src/actions/breakpoints/index.js index 00ba53032c93..61f7c578fd9e 100644 --- a/devtools/client/debugger/new/src/actions/breakpoints/index.js +++ b/devtools/client/debugger/new/src/actions/breakpoints/index.js @@ -18,7 +18,8 @@ import { getBreakpointAtLocation, getConditionalPanelLocation, getBreakpointsForSource, - isEmptyLineInSource + isEmptyLineInSource, + getBreakpointsAtLine } from "../../selectors"; import { assertBreakpoint, @@ -208,6 +209,16 @@ export function toggleBreakpoints( }; } +export function toggleBreakpointsAtLine( + shouldDisableBreakpoints: boolean, + line: number +) { + return async ({ dispatch, getState }: ThunkArgs) => { + const breakpoints = await getBreakpointsAtLine(getState(), line); + return dispatch(toggleBreakpoints(shouldDisableBreakpoints, breakpoints)); + }; +} + /** * Removes all breakpoints * diff --git a/devtools/client/debugger/new/src/components/Editor/Breakpoint.js b/devtools/client/debugger/new/src/components/Editor/Breakpoint.js index 9d38244d52d7..e2387604a437 100644 --- a/devtools/client/debugger/new/src/components/Editor/Breakpoint.js +++ b/devtools/client/debugger/new/src/components/Editor/Breakpoint.js @@ -97,6 +97,13 @@ class Breakpoint extends PureComponent { } if (event.shiftKey) { + if (features.columnBreakpoints) { + return breakpointActions.toggleBreakpointsAtLine( + !breakpoint.disabled, + this.selectedLocation.line + ); + } + return breakpointActions.toggleDisabledBreakpoint(breakpoint); } diff --git a/devtools/client/debugger/new/src/components/Editor/menus/breakpoints.js b/devtools/client/debugger/new/src/components/Editor/menus/breakpoints.js index f798d9f14e98..3a5b47b77e68 100644 --- a/devtools/client/debugger/new/src/components/Editor/menus/breakpoints.js +++ b/devtools/client/debugger/new/src/components/Editor/menus/breakpoints.js @@ -228,6 +228,7 @@ export function breakpointItemActions(dispatch: Function) { disableBreakpointsAtLine: actions.disableBreakpointsAtLine, disableBreakpoint: actions.disableBreakpoint, toggleDisabledBreakpoint: actions.toggleDisabledBreakpoint, + toggleBreakpointsAtLine: actions.toggleBreakpointsAtLine, openConditionalPanel: actions.openConditionalPanel }, dispatch