Skip to content

Commit 4117245

Browse files
committed
implement persistent search
1 parent dbdec7a commit 4117245

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

packages/graphql-playground-react/src/components/Playground/QueryEditor.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ export class QueryEditor extends React.PureComponent<Props & ReduxProps, {}> {
150150
'Ctrl-Right': 'goSubwordRight',
151151
'Alt-Left': 'goGroupLeft',
152152
'Alt-Right': 'goGroupRight',
153+
154+
'Cmd-F': 'findPersistent',
155+
'Ctrl-F': 'findPersistent',
153156
},
154157
})
155158

packages/graphql-playground-react/src/components/Playground/ResultViewer.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export class ResultViewer extends React.Component<Props, {}> {
3535
require('codemirror/addon/fold/brace-fold')
3636
require('codemirror/addon/dialog/dialog')
3737
require('codemirror/addon/search/search')
38+
require('codemirror/addon/search/searchcursor')
39+
require('codemirror/addon/search/jump-to-line')
3840
require('codemirror/keymap/sublime')
3941
require('codemirror-graphql/results/mode')
4042

@@ -61,6 +63,10 @@ export class ResultViewer extends React.Component<Props, {}> {
6163
foldGutter,
6264
gutters,
6365
extraKeys: {
66+
// Persistent search box in Query Editor
67+
'Cmd-F': 'findPersistent',
68+
'Ctrl-F': 'findPersistent',
69+
6470
// Editor improvements
6571
'Ctrl-Left': 'goSubwordLeft',
6672
'Ctrl-Right': 'goSubwordRight',

packages/graphql-playground-react/src/styles/graphiql_dark.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,7 @@ div.CodeMirror-dragcursors {
990990
}
991991

992992
.cm-searching {
993-
background: #ffa;
994-
background: rgba(255, 255, 0, 0.4);
993+
background: rgba(255, 255, 255, 0.15);
995994
}
996995

997996
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
@@ -1045,7 +1044,7 @@ span.CodeMirror-selectedtext {
10451044
.CodeMirror-dialog input {
10461045
background: transparent;
10471046
border: 1px solid #d3d6db;
1048-
color: inherit;
1047+
color: rgba(255, 255, 255, 0.6);
10491048
font-family: monospace;
10501049
outline: none;
10511050
width: 20em;

0 commit comments

Comments
 (0)