Added error handling to query prettify to prevent event propagation
This commit is contained in:
@@ -151,8 +151,8 @@ export default {
|
|||||||
name: "prettifyGQLQuery",
|
name: "prettifyGQLQuery",
|
||||||
exec: () => this.prettifyQuery(),
|
exec: () => this.prettifyQuery(),
|
||||||
bindKey: {
|
bindKey: {
|
||||||
mac: "cmd-g",
|
mac: "cmd-p",
|
||||||
win: "ctrl-g",
|
win: "ctrl-p",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -168,7 +168,12 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
prettifyQuery() {
|
prettifyQuery() {
|
||||||
|
try {
|
||||||
this.value = gql.print(gql.parse(this.editor.getValue()))
|
this.value = gql.print(gql.parse(this.editor.getValue()))
|
||||||
|
} catch (e) {
|
||||||
|
// Catching the exception to avoid the event to be passed to the browser
|
||||||
|
// Prevents the print dialog from appearing
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
defineTheme() {
|
defineTheme() {
|
||||||
|
|||||||
Reference in New Issue
Block a user