codemirror widths and lefts are so large they push codemirror to right edge of browser
See original GitHub issueusing babel and webpack-dev-server to bundle and serve the the rendered GraphiQL component. For some reason the margin-left and certain width style properties are set to almost the entire width of the screen so all i see is a blank space and then the first character of each code line up against the right side of the browser window
<div class="CodeMirror-sizer" style="margin-left: 1904px; margin-bottom: 0px; border-right-width: 30px; min-height: 675px; min-width: 619px; padding-right: 0px; padding-bottom: 0px;">
<div ....>....
</di>
</div>
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
CodeMirror 5 User Manual
User manual and reference guide version 5.65.11. CodeMirror is a code-editor component that can be embedded in Web pages. The core library provides...
Read more >Reference Manual - CodeMirror
Reference Manual. CodeMirror is published as a set of NPM packages under the @codemirror scope. The core packages are listed in this reference...
Read more >CodeMirror System Guide
System Guide. This is the guide to the CodeMirror editor system. It provides a prose description of the system's functionality. For the item-by-item ......
Read more >Are these styles all right, or is this intervening too much into ...
I'm using markdown language, and I would like to highlight CodeBlock elements, for the whole line, but not from the left of the...
Read more >Internals - CodeMirror
ACE uses its hidden textarea only as a text input shim, and does all cursor movement and things like text deletion itself by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I encountered the same problem recently. After dived into the source code of CodeMirror and fixed my issue I think it is better to share my experience here. In case someone else get stuck by this really weird, tricky issue.
TL;DR: Find a way to ensure
graphiql.css
is loaded before<GraphiQL />
get rendered. Be very careful when playing with Webpack code-splitting and GraphiQL at the same time.My problem is highly related with the differences of the style processing between dev and prod of a customized version of start-react-app. I also used “code splitting” technique to split the GraphiQL and CodeMirror from the main bundle.
In general, in dev mode all styles are loaded in inline
<style>
block bystyle-loader
and there’s no problem. However, in prod mode, instead of being added tomain.css
, thegraphiql.css
was added to the chunk file which contained CodeMirror and GraphiQL.It took me a lot of hours trying to upgrade my old
react-relay
to the newest version (since apparently thegraphiql
package requiredgraphql@^0.10.5
viacodemirror-graphql
viagraphql-language-service-interface
) therefore I can upgradegraphiql
to the newest one. However after the upgrading I found the problem existing with the newest version. Then I started to set breakpoints and debugCodeMirror
. Then I found without the proper style,.CodeMirror-gutter.CodeMirror-foldgutter
became “display: block
” instead of “display: inline-block
”. The width of that element cascaded to all its parent elements and caused the disaster. Evengraphiql.css
was loaded immediately after the initialization, the mess didn’t go away.Once found the problem, I changed my code to ensure that
graphiql.css
must be loaded before<GraphiQL />
get rendered. The problem was gone.@hotgazpacho I think any value larger than 0 for
setInterval()
is acceptable as long as the delay isn’t perceptible to the user. How about 100?