Added prettifying to GQL Query Editor
This commit is contained in:
@@ -147,6 +147,15 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
editor.commands.addCommand({
|
||||||
|
name: "prettifyGQLQuery",
|
||||||
|
exec: () => this.prettifyQuery(),
|
||||||
|
bindKey: {
|
||||||
|
mac: "cmd-g",
|
||||||
|
win: "ctrl-g",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
editor.on("change", () => {
|
editor.on("change", () => {
|
||||||
const content = editor.getValue()
|
const content = editor.getValue()
|
||||||
this.$emit("input", content)
|
this.$emit("input", content)
|
||||||
@@ -158,6 +167,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
prettifyQuery() {
|
||||||
|
this.value = gql.print(gql.parse(this.editor.getValue()))
|
||||||
|
},
|
||||||
|
|
||||||
defineTheme() {
|
defineTheme() {
|
||||||
if (this.theme) {
|
if (this.theme) {
|
||||||
return this.theme
|
return this.theme
|
||||||
|
|||||||
Reference in New Issue
Block a user