home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 1452495049 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 2

  • simonw 2
  • bgrins 2

author_association 2

  • CONTRIBUTOR 2
  • OWNER 2

issue 1

  • Clicking within the CodeMirror area below the SQL (i.e. when there's only a single line) doesn't cause the editor to get focused · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1319642338 https://github.com/simonw/datasette/issues/1899#issuecomment-1319642338 https://api.github.com/repos/simonw/datasette/issues/1899 IC_kwDOBm6k_c5OqCTi simonw 9599 2022-11-18T07:28:28Z 2022-11-18T07:28:28Z OWNER

Demo: https://latest.datasette.io/fixtures

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Clicking within the CodeMirror area below the SQL (i.e. when there's only a single line) doesn't cause the editor to get focused  1452495049  
1319584553 https://github.com/simonw/datasette/issues/1899#issuecomment-1319584553 https://api.github.com/repos/simonw/datasette/issues/1899 IC_kwDOBm6k_c5Op0Mp simonw 9599 2022-11-18T06:00:10Z 2022-11-18T06:01:50Z OWNER

I can't actually remember where that min-height: 70px came from. I just tried without it and it seems fine - especially since any time you add a newline in the editor it increases its height to fit.

I ran this in the DevTools console:

javascript document.querySelector('.cm-editor').style.minHeight = 'none';

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Clicking within the CodeMirror area below the SQL (i.e. when there's only a single line) doesn't cause the editor to get focused  1452495049  
1318897922 https://github.com/simonw/datasette/issues/1899#issuecomment-1318897922 https://api.github.com/repos/simonw/datasette/issues/1899 IC_kwDOBm6k_c5OnMkC bgrins 95570 2022-11-17T16:32:42Z 2022-11-17T16:32:42Z CONTRIBUTOR

Another idea would be to just not set a min-height and allow the 1 line input to be 1 line heigh

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Clicking within the CodeMirror area below the SQL (i.e. when there's only a single line) doesn't cause the editor to get focused  1452495049  
1317873458 https://github.com/simonw/datasette/issues/1899#issuecomment-1317873458 https://api.github.com/repos/simonw/datasette/issues/1899 IC_kwDOBm6k_c5OjScy bgrins 95570 2022-11-17T00:31:07Z 2022-11-17T00:31:07Z CONTRIBUTOR

This is one way to fix it

patch r.html diff --git a/datasette/static/cm-editor-6.0.1.js b/datasette/static/cm-editor-6.0.1.js index c1fd2ab..68cf398 100644 --- a/datasette/static/cm-editor-6.0.1.js +++ b/datasette/static/cm-editor-6.0.1.js @@ -22,7 +22,14 @@ export function editorFromTextArea(textarea, conf = {}) { // https://github.com/codemirror/lang-sql#user-content-sqlconfig.tables let view = new EditorView({ doc: textarea.value, + extensions: [ + EditorView.theme({ + ".cm-content": { + // Height on cm-content ensures the editor is focusable by clicking beyond the height of the text + minHeight: "70px", + }, + }), keymap.of([ { key: "Shift-Enter", diff --git a/datasette/templates/_codemirror.html b/datasette/templates/_codemirror.html index dea4710..c4629ae 100644 --- a/datasette/templates/_codemirror.html +++ b/datasette/templates/_codemirror.html @@ -4,7 +4,6 @@ .cm-editor { resize: both; overflow: hidden; - min-height: 70px; width: 80%; border: 1px solid #ddd; }

I don't love it but it seems to work for the default case. You can still retrigger the bug by resizing the editor to be > 70px high.

The other approach would be to listen for a click on that empty region and move focus to the editor, or something

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Clicking within the CodeMirror area below the SQL (i.e. when there's only a single line) doesn't cause the editor to get focused  1452495049  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 28.914ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows