From a9ba2b50f9167b41c397ddc30057e8a6ac7234d7 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Thu, 5 Mar 2020 14:24:48 -0500 Subject: [PATCH] Added error handling to query prettify to prevent event propagation --- components/graphql/queryeditor.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/graphql/queryeditor.vue b/components/graphql/queryeditor.vue index 52cfcae21..e351bf5b3 100644 --- a/components/graphql/queryeditor.vue +++ b/components/graphql/queryeditor.vue @@ -151,8 +151,8 @@ export default { name: "prettifyGQLQuery", exec: () => this.prettifyQuery(), bindKey: { - mac: "cmd-g", - win: "ctrl-g", + mac: "cmd-p", + win: "ctrl-p", }, }) @@ -168,7 +168,12 @@ export default { methods: { prettifyQuery() { - this.value = gql.print(gql.parse(this.editor.getValue())) + try { + 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() {