Skip to content

Commit 41b1f0b

Browse files
committed
allow tabbing via numbers
1 parent 733109a commit 41b1f0b

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

packages/graphql-playground-electron/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage": "https://github.com/graphcool/graphql-playground",
55
"repository": "graphcool/graphql-playground",
66
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration)",
7-
"version": "v1.3.15",
7+
"version": "v1.3.16",
88
"author": {
99
"name": "Graphcool",
1010
"email": "[email protected]",
@@ -134,7 +134,7 @@
134134
"extract-text-webpack-plugin": "^2.0.0-beta.3",
135135
"file-loader": "^0.11.2",
136136
"fork-ts-checker-webpack-plugin": "^0.1.5",
137-
"graphql-playground": "^1.3.13",
137+
"graphql-playground": "^1.3.14",
138138
"happypack": "^3.1.0",
139139
"html-webpack-plugin": "^2.30.1",
140140
"identity-obj-proxy": "^3.0.0",

packages/graphql-playground-electron/src/renderer/components/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ cd ${folderPath}; graphql playground`)
219219
this.prevTab()
220220
} else if (e.key === '}' && e.metaKey) {
221221
this.nextTab()
222+
} else if (e.key >= 1 && e.key <= 9 && e.metaKey) {
223+
this.playground.switchTab(e.key)
222224
}
223225
}
224226

packages/graphql-playground-electron/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3539,9 +3539,9 @@ graphql-language-service-utils@^1.0.16:
35393539
graphql-config "1.0.8"
35403540
graphql-language-service-types "^0.1.14"
35413541

3542-
graphql-playground@^1.3.13:
3543-
version "1.3.13"
3544-
resolved "https://registry.yarnpkg.com/graphql-playground/-/graphql-playground-1.3.13.tgz#61b3949bb36f863035d80419c59b57882db6a30f"
3542+
graphql-playground@^1.3.14:
3543+
version "1.3.14"
3544+
resolved "https://registry.yarnpkg.com/graphql-playground/-/graphql-playground-1.3.14.tgz#14db9eeea46a82d8a0d2d5686f51c3dacc068177"
35453545
dependencies:
35463546
calculate-size "^1.1.1"
35473547
classnames "^2.2.5"

packages/graphql-playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-playground",
3-
"version": "1.3.13",
3+
"version": "1.3.14",
44
"main": "./lib/lib.js",
55
"typings": "./lib/lib.d.ts",
66
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,21 @@ export class Playground extends React.PureComponent<Props & DocsState, State> {
612612
}
613613
}
614614

615+
public switchTab = (index: number) => {
616+
const arrayIndex = index - 1
617+
const { sessions, selectedSessionIndex } = this.state
618+
const numberOfSessions = sessions.length
619+
620+
if (arrayIndex !== selectedSessionIndex || arrayIndex <= numberOfSessions) {
621+
this.setState(state => {
622+
return {
623+
...state,
624+
selectedSessionIndex: arrayIndex,
625+
}
626+
})
627+
}
628+
}
629+
615630
public handleNewSession = (newIndexZero: boolean = false) => {
616631
const session = this.createSession()
617632
if (session.query === defaultQuery) {

0 commit comments

Comments
 (0)