-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CodeEditor): add new code editor (#5294)
* feat(CodeEditor): add new code editor * add snapshots and aria-label props * fix test typo * add tooltips * add custom controls and address comments * add aria-label to new example * add keyboard controls * update versions * clean up prop docs * switch to webpack config * fix unit tests * add note in docs about webpack requirement * update theme version * update versions * i thought i had fixed all the versions... * remove invalid aria role from monaco editor * update prop names * fix versions * fix versions again
- Loading branch information
1 parent
c2a86c7
commit 1c36ce3
Showing
23 changed files
with
1,003 additions
and
16 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 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,2 @@ | ||
dist/*.tsbuildinfo | ||
tsconfig.* |
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,92 @@ | ||
# @patternfly/react-code-editor | ||
|
||
This package provides a PatternFly wrapper for the Monaco code editor | ||
|
||
### Prerequisite | ||
|
||
#### Node Environment | ||
|
||
This project currently supports Node [Active LTS](https://github.com/nodejs/Release#release-schedule) releases. Please stay current with Node Active LTS when developing patternfly-react. | ||
|
||
For example, to develop with Node 8, use the following: | ||
|
||
``` | ||
nvm install 8 | ||
nvm use 8 | ||
``` | ||
|
||
This project also requires a Yarn version of >=1.6.0. The latest version can be installed [here](https://yarnpkg.com/). | ||
|
||
### Installing | ||
|
||
``` | ||
yarn add @patternfly/react-code-editor | ||
``` | ||
|
||
or | ||
|
||
``` | ||
npm install @patternfly/react-code-editor --save | ||
``` | ||
|
||
### Usage | ||
|
||
#### Pre-requisites | ||
|
||
It's strongly advised to use the PatternFly Base CSS in your whole project, or some components may diverge in appearance: | ||
|
||
```js | ||
import '@patternfly/react-core/dist/styles/base.css'; | ||
``` | ||
|
||
```js | ||
import { CodeEditor } from '@patternfly/react-code-editor'; | ||
``` | ||
|
||
# Documentation | ||
|
||
This project uses Gatsby. For an overview of the project structure please refer to the [Gatsby documentation - Building with Components](https://www.gatsbyjs.org/docs/building-with-components/). | ||
|
||
A comprehensive list of components and detailed usage of each can be found on the [PatternFly React Docs][docs] website | ||
You can also find how each component is meant to be used from a design perspective on the [PatternFly 4 Core][patternfly-4] website. | ||
|
||
Note: All commands below assume you are on the root directory in this repository. | ||
|
||
### Install | ||
|
||
Run to install all the dependencies | ||
|
||
```sh | ||
yarn && yarn bootstrap && yarn build && yarn build:docs | ||
``` | ||
|
||
### Running | ||
|
||
To start the site locally. | ||
|
||
```sh | ||
yarn build && yarn start:pf4 | ||
``` | ||
|
||
### Building | ||
|
||
To build the site. | ||
|
||
```sh | ||
yarn build:docs | ||
``` | ||
|
||
# Contributing Components | ||
|
||
This library makes use of the babel plugin from [@patternfly/react-styles](../react-styles/README.md) to enable providing the CSS alongside the components. This removes the need for consumers to use (style|css|sass)-loaders. For any CSS not provided by core please use the `StyleSheet.create` utility from [@patternfly/react-styles](../react-styles/README.md). This will prevent collisions with any consumers, and allow the CSS to be bundled with the component. | ||
|
||
### Building | ||
|
||
``` | ||
yarn build | ||
``` | ||
|
||
Note the build scripts for this are located in the root package.json under `yarn build`. | ||
|
||
[patternfly-4]: https://github.com/patternfly/patternfly | ||
[docs]: https://patternfly-react.surge.sh/ |
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,50 @@ | ||
{ | ||
"name": "@patternfly/react-code-editor", | ||
"version": "4.0.0", | ||
"description": "This package provides a PatternFly wrapper for the Monaco code editor\n", | ||
"main": "dist/js/index.js", | ||
"module": "dist/esm/index.js", | ||
"types": "dist/js/index.d.ts", | ||
"patternfly:src": "src/", | ||
"sideEffects": false, | ||
"publishConfig": { | ||
"access": "public", | ||
"tag": "prerelease" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/patternfly/patternfly-react.git" | ||
}, | ||
"keywords": [ | ||
"react", | ||
"patternfly", | ||
"code-editor" | ||
], | ||
"author": "Red Hat", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/patternfly/patternfly-react/issues" | ||
}, | ||
"homepage": "https://github.com/patternfly/patternfly-react/tree/master/packages/react-code-editor#readme", | ||
"scripts": { | ||
"clean": "rimraf dist" | ||
}, | ||
"dependencies": { | ||
"@patternfly/react-core": "^4.89.2", | ||
"@patternfly/react-icons": "^4.8.3", | ||
"@patternfly/react-styles": "^4.7.27", | ||
"react-dropzone": "9.0.0", | ||
"tslib": "1.13.0" | ||
}, | ||
"peerDependencies": { | ||
"monaco-editor": "^0.21.3", | ||
"monaco-editor-webpack-plugin": "^2.1.0", | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0", | ||
"react-monaco-editor": "^0.41.2" | ||
}, | ||
"devDependencies": { | ||
"rimraf": "^2.6.2", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
Oops, something went wrong.