-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(code-editor): lint and fold json
- Loading branch information
1 parent
40b257b
commit 8e3c790
Showing
8 changed files
with
199 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/components/code-editor/examples/code-editor-with-linting-and-folding.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Component, h, State } from '@stencil/core'; | ||
import { data } from '../../table/examples/birds'; | ||
|
||
/** | ||
* Editable with JSON linting and folding | ||
* Here you see an instance of the Code Editor component with linting and | ||
* folding support, which allows the user to see syntax errors in the JSON | ||
* code shown in the editor. Folding makes it easier to collapse larger pieces | ||
* of code. | ||
*/ | ||
|
||
@Component({ | ||
tag: 'limel-example-code-editor-fold-lint', | ||
shadow: true, | ||
styleUrl: 'code-editor.scss', | ||
}) | ||
export class CodeFoldAndLintExample { | ||
@State() | ||
private json: string = JSON.stringify(data, null, ' '); | ||
|
||
private handleChange = (event: CustomEvent<string>) => { | ||
this.json = event.detail; | ||
}; | ||
|
||
public render() { | ||
return ( | ||
<limel-code-editor | ||
value={this.json} | ||
language="json" | ||
lineNumbers={true} | ||
lint={true} | ||
fold={true} | ||
onChange={this.handleChange} | ||
/> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.CodeMirror-lint-tooltip.cm-s-lime { | ||
position: fixed; | ||
z-index: var(--tooltip-z-index, var(--dropdown-z-index, 130)); | ||
transition: opacity 0.4s ease 0s; | ||
opacity: 0; | ||
|
||
color: var(--mdc-theme-text-primary-on-background); | ||
background-color: var(--mdc-theme-on-primary); | ||
|
||
font-family: monospace; | ||
font-size: 0.875rem; // 14px, like the default code editor's font size | ||
white-space: pre-wrap; | ||
// overflow: hidden; // Why `hidden`? | ||
|
||
padding: 0.25rem 0.5rem; | ||
border-radius: 0.5rem; | ||
max-width: 40rem; | ||
box-shadow: var(--shadow-depth-64); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters