-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Increase the size of the CodeEditor used for additionalJsonData #126
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, can you please add a screenshot of the final look?
bd41311
to
5f6eeba
Compare
width="500px" | ||
height="100px" | ||
width="100%" | ||
height="175px" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't (or could not) height also be dynamic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dynamic would be certainly nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was my initial idea aswell, but this didn't seem so simple to achieve.
I did investigate this a bit, this is the code in grafana/ui for the codeEditor which also shows the div thats wrapping the editor: https://github.com/grafana/grafana/blob/master/packages/grafana-ui/src/components/Monaco/CodeEditor.tsx#L92-L104
which led me to the MonacoEditor:
https://github.com/react-monaco-editor/react-monaco-editor/blob/master/src/editor.tsx
and then ended up on this open issue: microsoft/monaco-editor#794 (comment)
All of the suggestions propose to use editor.onDidChangeModelDecorations
, but we can't access that when using the grafana/ui CodeEditor.
So imo. we would need a pr to grafana/ui CodeEditor first to add one of the workarounds from the issue above, ie. when height: auto
is set or by adding a new property to toggle it. Without this i don't think that we can have a auto growing code editor.
But i can give it a try and see if i can apply the workaround locally in node_modules for a local build. But the PR to grafana + waiting for the next release will take a while - so this could be a intermediate solution.
5f6eeba
to
ec1882f
Compare
Co-authored-by: Simon Podlipsky <simon@podlipsky.net>
ec1882f
to
a5922b2
Compare
Thanks! |
This pr should fix #125, those values felt like a good default to make the window a little bigger.
I didn't have time to test how it looks / if it works yet - i will be able to test that tomorrow, so i will leave it as a draft for now.