Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeMirror fails to load on database page #560

Closed
simonw opened this issue Jul 14, 2019 · 3 comments
Closed

CodeMirror fails to load on database page #560

simonw opened this issue Jul 14, 2019 · 3 comments
Labels

Comments

@simonw
Copy link
Owner

simonw commented Jul 14, 2019

It's not loading on https://latest.datasette.io/fixtures

But it does load on https://latest.datasette.io/fixtures?sql=select+*+from+facetable

@simonw simonw added the bug label Jul 14, 2019
@simonw
Copy link
Owner Author

simonw commented Jul 14, 2019

TypeError: textarea is null[Learn More] codemirror-5.31.0.js:9508:3
    fromTextArea http://127.0.0.1:8001/-/static/codemirror-5.31.0.js:9508
    <anonymous> http://127.0.0.1:8001/fixtures:286

@simonw
Copy link
Owner Author

simonw commented Jul 14, 2019

Here's why:

var editor = CodeMirror.fromTextArea(document.getElementById("sql-editor"), {

This works on the query.html template:

<p><textarea id="sql-editor" name="sql">{% if query and query.sql %}{{ query.sql }}{% else %}select * from {{ tables[0].name|escape_sqlite }}{% endif %}</textarea></p>

But fails on the database.html template:

<p><textarea name="sql">{% if tables %}select * from {{ tables[0].name|escape_sqlite }}{% else %}select sqlite_version(){% endif %}</textarea></p>

@simonw simonw closed this as completed in a9453c4 Jul 14, 2019
@simonw
Copy link
Owner Author

simonw commented Sep 3, 2019

This is released in 0.29.3

Compare https://v0-29.datasette.io/fixtures (broken) with https://v0-29-3.datasette.io/fixtures (fixed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant