@@ -6,6 +6,8 @@ import { DOMHelpers } from '../DOMHelpers';
6
6
import { EditorPanel } from './EditorPanel' ;
7
7
import { EditorWindow } from './EditorWindow' ;
8
8
9
+ import styles from './Editor.css' ;
10
+
9
11
export class Editor extends React . Component <
10
12
Editor . RequiredProps & Partial < Editor . OptionalProps >
11
13
> {
@@ -18,13 +20,13 @@ export class EditorComponent extends React.Component<
18
20
Editor . State
19
21
> {
20
22
private message : ( ev : MessageEvent ) => void ;
21
- // prettier-ignore
23
+
22
24
private keypress : ( ev : KeyboardEvent ) => void ;
23
- // prettier-ignore
25
+
24
26
private click : ( e : MouseEvent ) => void ;
27
+
25
28
// prettier-ignore
26
29
private postMessage ! : Promise < EditorWindow . PostMessage > ;
27
- // prettier-ignore
28
30
29
31
private editor : HTMLElement ;
30
32
@@ -53,6 +55,7 @@ export class EditorComponent extends React.Component<
53
55
this . onToggleSearch ( ) ;
54
56
}
55
57
} ;
58
+ this . setSearchDomState ( this . state . searchEnabled ) ;
56
59
57
60
this . editor = DOMHelpers . Editor . createTargetElement (
58
61
this . props . document ,
@@ -101,8 +104,17 @@ export class EditorComponent extends React.Component<
101
104
) ;
102
105
}
103
106
private onTogglePinned ( ) {
104
- this . setState ( { pinned : ! this . state . pinned } ) ;
107
+ const pinned = ! this . state . pinned ;
108
+ this . setState ( { pinned } ) ;
109
+ }
110
+ private setSearchDomState ( searchEnabled : boolean ) {
111
+ DOMHelpers . Editor . toggleClass (
112
+ this . props . document . body ,
113
+ searchEnabled ,
114
+ styles . searchEnabled ,
115
+ ) ;
105
116
}
117
+
106
118
private onShowIds ( ) {
107
119
const { showIds : oldShowIds , ...rest } = this . state ;
108
120
const showIds = ! oldShowIds ;
@@ -156,8 +168,10 @@ export class EditorComponent extends React.Component<
156
168
}
157
169
158
170
private onToggleSearch ( ) {
159
- const { searchEnabled } = this . state ;
160
- this . setState ( { searchEnabled : ! searchEnabled } ) ;
171
+ const searchEnabled = ! this . state . searchEnabled ;
172
+ this . setState ( { searchEnabled } ) ;
173
+
174
+ this . setSearchDomState ( searchEnabled ) ;
161
175
}
162
176
private onRefresh ( ) {
163
177
this . props . onRefresh ( ) ;
0 commit comments