Allow for easier template overrides in graphiql (#863)

* don't replace <body>

* Update graphene_django/templates/graphene/graphiql.html

Co-Authored-By: Jonathan Kim <jkimbo@gmail.com>

* Fix editor styling and initialisation

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
This commit is contained in:
Ben Howes 2020-02-07 10:16:11 +00:00 committed by GitHub
parent f3f0608606
commit 6b8c5bdefc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -97,6 +97,6 @@
// Render <GraphiQL /> into the body.
ReactDOM.render(
React.createElement(GraphiQL, options),
document.body
document.getElementById("editor")
);
})();

View File

@ -10,7 +10,7 @@ add "&raw" to the end of the URL within a browser.
<html>
<head>
<style>
html, body {
html, body, #editor {
height: 100%;
margin: 0;
overflow: hidden;
@ -31,6 +31,7 @@ add "&raw" to the end of the URL within a browser.
crossorigin="anonymous"></script>
</head>
<body>
<div id="editor"></div>
{% csrf_token %}
<script src="{% static 'graphene_django/graphiql.js' %}"></script>
</body>