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
This commit is contained in:
David Walsh 2019-03-21 22:16:13 +00:00
Родитель a936755fa6
Коммит 29407aeed7
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -18,7 +18,8 @@ import {
getBreakpointAtLocation, getBreakpointAtLocation,
getConditionalPanelLocation, getConditionalPanelLocation,
getBreakpointsForSource, getBreakpointsForSource,
isEmptyLineInSource isEmptyLineInSource,
getBreakpointsAtLine
} from "../../selectors"; } from "../../selectors";
import { import {
assertBreakpoint, 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 * Removes all breakpoints
* *

Просмотреть файл

@ -97,6 +97,13 @@ class Breakpoint extends PureComponent<Props> {
} }
if (event.shiftKey) { if (event.shiftKey) {
if (features.columnBreakpoints) {
return breakpointActions.toggleBreakpointsAtLine(
!breakpoint.disabled,
this.selectedLocation.line
);
}
return breakpointActions.toggleDisabledBreakpoint(breakpoint); return breakpointActions.toggleDisabledBreakpoint(breakpoint);
} }

Просмотреть файл

@ -228,6 +228,7 @@ export function breakpointItemActions(dispatch: Function) {
disableBreakpointsAtLine: actions.disableBreakpointsAtLine, disableBreakpointsAtLine: actions.disableBreakpointsAtLine,
disableBreakpoint: actions.disableBreakpoint, disableBreakpoint: actions.disableBreakpoint,
toggleDisabledBreakpoint: actions.toggleDisabledBreakpoint, toggleDisabledBreakpoint: actions.toggleDisabledBreakpoint,
toggleBreakpointsAtLine: actions.toggleBreakpointsAtLine,
openConditionalPanel: actions.openConditionalPanel openConditionalPanel: actions.openConditionalPanel
}, },
dispatch dispatch