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

Increase the size of the CodeEditor used for additionalJsonData #126

Merged
merged 1 commit into from
Oct 5, 2020

Conversation

PhilippHeuer
Copy link
Contributor

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.

Copy link
Owner

@simPod simPod left a 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?

@PhilippHeuer
Copy link
Contributor Author

I had to make one more change to adjust the sizes of the parent div gf-form and a div that was wrapped around the codeeditor by the grafana component, so i added a css file for that.

The final result looks like this:
image

@PhilippHeuer PhilippHeuer marked this pull request as ready for review September 29, 2020 07:41
width="500px"
height="100px"
width="100%"
height="175px"
Copy link

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?

Copy link
Owner

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

Copy link
Contributor Author

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.

Co-authored-by: Simon Podlipsky <simon@podlipsky.net>
@simPod simPod changed the title Increase the size of the CodeEditor used for additionalJsonData (fix #125) Increase the size of the CodeEditor used for additionalJsonData Oct 5, 2020
@simPod simPod merged commit a7810b3 into simPod:master Oct 5, 2020
@simPod
Copy link
Owner

simPod commented Oct 5, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

grafana 7.2 - json data editor size
3 participants