@@ -33,12 +33,13 @@ function getBreakpointLocation(source, line, column) {
3333 return bpLocation ;
3434}
3535
36- class BreakpointItem extends Component < Props > {
36+ class Breakpoint extends Component < Props > {
3737 editor : SourceEditor ;
3838
3939 componentDidMount ( ) {
4040 this . setupEditor ( ) ;
4141 }
42+
4243 componentDidUpdate ( ) {
4344 this . setupEditor ( ) ;
4445 }
@@ -63,13 +64,17 @@ class BreakpointItem extends Component<Props> {
6364 ) ;
6465 }
6566
66- setupEditor ( ) {
67+ getBreakpointText ( ) {
6768 const { breakpoint } = this . props ;
69+ return breakpoint . condition || breakpoint . text ;
70+ }
71+
72+ setupEditor ( ) {
6873 if ( this . editor ) {
6974 return ;
7075 }
7176
72- this . editor = createEditor ( breakpoint . text ) ;
77+ this . editor = createEditor ( this . getBreakpointText ( ) ) ;
7378
7479 // disables the default search shortcuts
7580 // $FlowIgnore
@@ -87,18 +92,52 @@ class BreakpointItem extends Component<Props> {
8792 }
8893 }
8994
95+ renderCheckbox ( ) {
96+ const { onChange, breakpoint } = this . props ;
97+ const { disabled } = breakpoint ;
98+
99+ return (
100+ < input
101+ type = "checkbox"
102+ className = "breakpoint-checkbox"
103+ checked = { ! disabled }
104+ onChange = { onChange }
105+ onClick = { ev => ev . stopPropagation ( ) }
106+ />
107+ ) ;
108+ }
109+
110+ renderText ( ) {
111+ const text = this . getBreakpointText ( ) ;
112+
113+ return (
114+ < label className = "breakpoint-label" title = { text } >
115+ { text }
116+ </ label >
117+ ) ;
118+ }
119+
120+ renderLineClose ( ) {
121+ const { breakpoint, onCloseClick } = this . props ;
122+ const { line, column } = breakpoint . location ;
123+
124+ return (
125+ < div className = "breakpoint-line-close" >
126+ < div className = "breakpoint-line" >
127+ { getBreakpointLocation ( breakpoint . source , line , column ) }
128+ </ div >
129+ < CloseButton
130+ handleClick = { onCloseClick }
131+ tooltip = { L10N . getStr ( "breakpoints.removeBreakpointTooltip" ) }
132+ />
133+ </ div >
134+ ) ;
135+ }
136+
90137 render ( ) {
91- const {
92- breakpoint,
93- onClick,
94- onChange,
95- onContextMenu,
96- onCloseClick
97- } = this . props ;
138+ const { breakpoint, onClick, onContextMenu } = this . props ;
98139
99140 const locationId = breakpoint . locationId ;
100- const line = breakpoint . location . line ;
101- const column = breakpoint . location . column ;
102141 const isCurrentlyPaused = breakpoint . isCurrentlyPaused ;
103142 const isDisabled = breakpoint . disabled ;
104143 const isConditional = ! ! breakpoint . condition ;
@@ -115,28 +154,12 @@ class BreakpointItem extends Component<Props> {
115154 onClick = { onClick }
116155 onContextMenu = { onContextMenu }
117156 >
118- < input
119- type = "checkbox"
120- className = "breakpoint-checkbox"
121- checked = { ! isDisabled }
122- onChange = { onChange }
123- onClick = { ev => ev . stopPropagation ( ) }
124- />
125- < label className = "breakpoint-label" title = { breakpoint . text } >
126- { breakpoint . text }
127- </ label >
128- < div className = "breakpoint-line-close" >
129- < div className = "breakpoint-line" >
130- { getBreakpointLocation ( breakpoint . source , line , column ) }
131- </ div >
132- < CloseButton
133- handleClick = { onCloseClick }
134- tooltip = { L10N . getStr ( "breakpoints.removeBreakpointTooltip" ) }
135- />
136- </ div >
157+ { this . renderCheckbox ( ) }
158+ { this . renderText ( ) }
159+ { this . renderLineClose ( ) }
137160 </ div >
138161 ) ;
139162 }
140163}
141164
142- export default BreakpointItem ;
165+ export default Breakpoint ;
0 commit comments