-
Notifications
You must be signed in to change notification settings - Fork 44
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
HDS::CodeEditor with Code Mirror 6 #2573
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
e91b5a5
to
672f756
Compare
3399f55
to
6aae2e5
Compare
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.
Thank you for opening this PR for early feedback! The functionalities look very promising.
The main comment at this stage (when the design is finalized I can do an in-depth review of the component API) is to look into how can we leverage dynamic imports (leveraging ember-auto-import
) to defer loading the third-party code until consumers start using the component on the page
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.
Left a couple of high-level comments, about something that stood out for me (I hope you won't mind).
8025534
to
904ef46
Compare
📌 Summary
This PR adds a code editor utilizing Code Mirror 6 to the HDS component library. The code editor can be instantiated via:
hds-code-editor
modifier, which can be added to any element to transform that element into a code editor instanceHds::CodeEditor
component, which uses thehds-code-editor
modifier under the hood, but adds support for title, description, and various tools.Details
hds-code-editor
modifierThis modifier will instantiate a Code Mirror editor on the element that it's added to. In order to reduce the up-front cost of loading the editor, we only load the CodeMirror package when the editor is scrolled into view. Because of this, there may be an exceptionally brief loading state before the editor is ready when it is viewed by the user.
value
: The initial value of the editorlanguage
: optional, one of 4 possible supported languages (json, sql, go, hcl)onInput
: callback function when the code editor changesonSetup
: callback function when the modifier has completed loading dependencies and instantiating the editor, receives CodeMirror Editor instance.This editor features support for:
cmd+z
and other history commands)Hds::CodeEditor
componentThis component uses the
hds-code-editor
modifier in combination with a customizable header and support for a fullscreen mode.value
: The initial value of the editorhasExpandButton
: Whether the editor can be expanded into fullscreen modehasCopyButton
: Whether the editor has a button that adds the current value to the clipboardlanguage
: optional, one of 4 possible supported languages (json, sql, go, hcl)onInput
: callback function when the code editor changesonSetup
: callback function when the component has completed loading dependencies and instantiating the editor, receives CodeMirror Editor instance.📸 Screenshots
🔗 External links
Jira ticket: HDS-4016
Figma
👀 Component checklist
💬 Please consider using conventional comments when reviewing this PR.