-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(data-query-playground): new code editor to fix cursor [LIBS-177] (
#1380) * chore(deps): update yarn.lock * fix(query-playground): update dhis2 deps * fix: use imported font for consistency across platforms * fix(query-playground): use codemirror to fix cursor issue * chore: remove react-ace * fix: font and tab size * fix: scrolling for long codemirror blocks * fix(deps): downgrade @dhis2/cli-app-scripts to work with Node 14 * fix: try lower cli-app-scripts and UI version to fix Node version error
- Loading branch information
1 parent
d71558e
commit 5d58f2a
Showing
12 changed files
with
7,345 additions
and
5,107 deletions.
There are no files selected for viewing
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import { json } from '@codemirror/lang-json' | ||
import { githubLight } from '@uiw/codemirror-theme-github' | ||
import { monokai } from '@uiw/codemirror-theme-monokai' | ||
import CodeMirror from '@uiw/react-codemirror' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import AceEditor from 'react-ace' | ||
import styles from './Editor.module.css' | ||
|
||
import 'brace/mode/json' | ||
import 'brace/theme/monokai' | ||
import 'brace/theme/github' | ||
import './Editor.css' | ||
|
||
export const Editor = (props) => ( | ||
<AceEditor | ||
fontSize={14} | ||
mode="json" | ||
theme="github" | ||
editorProps={{ $blockScrolling: true }} | ||
showPrintMargin={false} | ||
export const Editor = ({ theme, ...editorProps }) => ( | ||
<CodeMirror | ||
className={styles.editor} | ||
extensions={[json()]} | ||
theme={theme === 'light' ? githubLight : monokai} | ||
basicSetup={{ tabSize: 4 }} | ||
width="100%" | ||
height="100%" | ||
{...props} | ||
{...editorProps} | ||
/> | ||
) | ||
Editor.propTypes = { | ||
theme: PropTypes.oneOf(['light', 'dark']), | ||
} |
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,9 @@ | ||
.editor { | ||
height: 100%; | ||
font-size: 13px; | ||
} | ||
|
||
/* Need this selector to override the blanket rule `* { font-family: Roboto; }` */ | ||
.editor * { | ||
font-family: inherit; | ||
} |
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
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
Oops, something went wrong.