-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add code snippet component #7294
Conversation
@nielslyngsoe what do you think on this? |
Hi @bjarnef I think it looks good, but I do feel that we should find a different color than red. It might give the impression that the code is wrong(has errors)? And now that we are at it, I think it would be nice to use a brighter gray, what do you think? |
@nielslyngsoe the red color is how the |
@bjarnef ah, that originates from Bootstrap CSS Library, which the BackOffice originally was build upon. But now we have decoupled the project so we have our own copy of the project, which we can change as wished. Feel free to change it. |
@nielslyngsoe we have this part for styling of and this for styling of |
Should it be a neutral text color like this (black or dark gray'ish)? |
It might also be possible to re-use the syntax highlighting from ace editor (which already is included), but we can look at this later. |
@bjarnef would be interesting to investigate if ACE is a possibility. If not possible with ACE then I think in terms of color that maybe this one would fit: But feel free to make a choice that you like, you can see color variables in variables.less |
@nielslyngsoe I have updated color of |
Prerequisites
Description
This PR add a
umb-code-snippet
component, which includes a copy button to copy the code and enhance this feature from this PR #6584 (comment)I have been inspired by these code samples https://docs.microsoft.com/en-us/odata/webapi/netcore (which are using highlight.js)
The idea is that package developers also can re-use this component in e.g. the view after installation, in dashboard and in another part of backoffice UI in core.
At the moment this doesn't use third parthy plugins like highlight.js or Prism. #7060
Prism is lightweight and it supported by default in TinyMCE, but doesn't out of the box support razor (cshtml/vbhtml)
Highlight.js seems to have some support for razor (cshtml - not sure about vbhtml) https://github.com/highlightjs/highlightjs-cshtml-razor
It could use one of these or maybe the Ace Editor in readonly mode (https://ace.c9.io/#nav=api&api=editor under setReadOnly) microsoft/monaco-editor#54
It is also possible in Monaco Editor to set readonly mode microsoft/monaco-editor#54 if Umbraco choose to switch editor #6267
Some enhancements that can be added/improved later