Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 29548c3

Browse files
committed
Initial commit
0 parents  commit 29548c3

33 files changed

+7321
-0
lines changed

.babelrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"presets": ["flow", ["env", {
3+
"targets": {
4+
"browsers": [">1%", "last 4 versions", "Firefox ESR", "not ie < 9"]
5+
}
6+
}]],
7+
"plugins": ["transform-react-jsx"]
8+
}

.flowconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[ignore]
2+
.*/node_modules/.*
3+
4+
[include]
5+
6+
[libs]
7+
8+
[options]
9+
suppress_comment=.*\\$FlowFixMe
10+
esproposal.class_instance_fields=enable
11+
esproposal.class_static_fields=enable

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.swp
2+
*~
3+
*.iml
4+
.*.haste_cache.*
5+
.DS_Store
6+
.idea
7+
npm-debug.log
8+
node_modules
9+
dist

.npmignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.swp
2+
*~
3+
*.iml
4+
.*.haste_cache.*
5+
.DS_Store
6+
.idea
7+
.babelrc
8+
.eslintrc
9+
npm-debug.log
10+
lib

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"trailingComma": "es5",
3+
"singleQuote": true
4+
}

.travis.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: node_js
2+
node_js:
3+
- 8
4+
script:
5+
- node --version
6+
- yarn --version
7+
- yarn run test
8+
notifications:
9+
email: false
10+
cache:
11+
yarn: true
12+
directories:
13+
- node_modules

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Space Program Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# `draft-js-code-editor-plugin`
2+
3+
Add IDE-like behaviours to code blocks in your DraftJS editor. Meant to be used with [`draft-js-plugins`](https://github.com/draft-js-plugins/draft-js-plugins).
4+
5+
> Note: If you're not using `draft-js-plugins` you can also use the lower-level [`draft-js-code`](https://github.com/SamyPesse/draft-js-code) library.
6+
7+
## Functionality
8+
9+
- Insert indentation on <kbd>tab</kbd>
10+
- Preserve indentation of current line when pressing <kbd>enter</kbd>
11+
- Remove indentation correctly with <kbd>backspace</kbd>
12+
- More to come!
13+
14+
## Usage
15+
16+
First, install the plugin:
17+
18+
```sh
19+
npm install --save draft-js-code-editor-plugin
20+
```
21+
22+
Then pass it to the `plugins` prop of the `draft-js-plugins` editor:
23+
24+
```JS
25+
import React, { Component } from 'react';
26+
import Editor from 'draft-js-plugins-editor';
27+
import createCodeEditorPlugin from 'draft-js-code-editor-plugin';
28+
import { EditorState } from 'draft-js';
29+
30+
export default class DemoEditor extends Component {
31+
state = {
32+
editorState: EditorState.createEmpty(),
33+
plugins: [createCodeEditorPlugin()]
34+
};
35+
36+
onChange = (editorState) => {
37+
this.setState({
38+
editorState,
39+
});
40+
};
41+
42+
render() {
43+
return (
44+
<Editor
45+
editorState={this.state.editorState}
46+
onChange={this.onChange}
47+
plugins={this.state.plugins}
48+
/>
49+
);
50+
}
51+
}
52+
```
53+
54+
### Add code block syntax highlighting
55+
56+
Using the [`draft-js-prism-plugin`](https://github.com/withspectrum/draft-js-prism-plugin) you can easily add syntax highlighting support to your code blocks!
57+
58+
```JS
59+
// Install prismjs and draft-js-prism-plugin
60+
import Prism from 'prismjs';
61+
import createPrismPlugin from 'draft-js-prism-plugin';
62+
63+
class Editor extends Component {
64+
state = {
65+
plugins: [
66+
// Add the Prism plugin to the plugins array
67+
createPrismPlugin({
68+
prism: Prism
69+
}),
70+
createCodeEditorPlugin()
71+
]
72+
};
73+
}
74+
```
75+
76+
## License
77+
78+
Licensed under the MIT License, Copyright ©️ 2017 Space Program Inc. See [LICENSE.md](LICENSE.md) for more information.

flow-typed/npm/babel-cli_vx.x.x.js

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// flow-typed signature: 0b1433c9c4ad723e7948a8a9d4a096b9
2+
// flow-typed version: <<STUB>>/babel-cli_v^6.26.0/flow_v0.55.0
3+
4+
/**
5+
* This is an autogenerated libdef stub for:
6+
*
7+
* 'babel-cli'
8+
*
9+
* Fill this stub out by replacing all the `any` types.
10+
*
11+
* Once filled out, we encourage you to share your work with the
12+
* community by sending a pull request to:
13+
* https://github.com/flowtype/flow-typed
14+
*/
15+
16+
declare module 'babel-cli' {
17+
declare module.exports: any;
18+
}
19+
20+
/**
21+
* We include stubs for each file inside this npm package in case you need to
22+
* require those files directly. Feel free to delete any files that aren't
23+
* needed.
24+
*/
25+
declare module 'babel-cli/bin/babel-doctor' {
26+
declare module.exports: any;
27+
}
28+
29+
declare module 'babel-cli/bin/babel-external-helpers' {
30+
declare module.exports: any;
31+
}
32+
33+
declare module 'babel-cli/bin/babel-node' {
34+
declare module.exports: any;
35+
}
36+
37+
declare module 'babel-cli/bin/babel' {
38+
declare module.exports: any;
39+
}
40+
41+
declare module 'babel-cli/lib/_babel-node' {
42+
declare module.exports: any;
43+
}
44+
45+
declare module 'babel-cli/lib/babel-external-helpers' {
46+
declare module.exports: any;
47+
}
48+
49+
declare module 'babel-cli/lib/babel-node' {
50+
declare module.exports: any;
51+
}
52+
53+
declare module 'babel-cli/lib/babel/dir' {
54+
declare module.exports: any;
55+
}
56+
57+
declare module 'babel-cli/lib/babel/file' {
58+
declare module.exports: any;
59+
}
60+
61+
declare module 'babel-cli/lib/babel/index' {
62+
declare module.exports: any;
63+
}
64+
65+
declare module 'babel-cli/lib/babel/util' {
66+
declare module.exports: any;
67+
}
68+
69+
// Filename aliases
70+
declare module 'babel-cli/bin/babel-doctor.js' {
71+
declare module.exports: $Exports<'babel-cli/bin/babel-doctor'>;
72+
}
73+
declare module 'babel-cli/bin/babel-external-helpers.js' {
74+
declare module.exports: $Exports<'babel-cli/bin/babel-external-helpers'>;
75+
}
76+
declare module 'babel-cli/bin/babel-node.js' {
77+
declare module.exports: $Exports<'babel-cli/bin/babel-node'>;
78+
}
79+
declare module 'babel-cli/bin/babel.js' {
80+
declare module.exports: $Exports<'babel-cli/bin/babel'>;
81+
}
82+
declare module 'babel-cli/index' {
83+
declare module.exports: $Exports<'babel-cli'>;
84+
}
85+
declare module 'babel-cli/index.js' {
86+
declare module.exports: $Exports<'babel-cli'>;
87+
}
88+
declare module 'babel-cli/lib/_babel-node.js' {
89+
declare module.exports: $Exports<'babel-cli/lib/_babel-node'>;
90+
}
91+
declare module 'babel-cli/lib/babel-external-helpers.js' {
92+
declare module.exports: $Exports<'babel-cli/lib/babel-external-helpers'>;
93+
}
94+
declare module 'babel-cli/lib/babel-node.js' {
95+
declare module.exports: $Exports<'babel-cli/lib/babel-node'>;
96+
}
97+
declare module 'babel-cli/lib/babel/dir.js' {
98+
declare module.exports: $Exports<'babel-cli/lib/babel/dir'>;
99+
}
100+
declare module 'babel-cli/lib/babel/file.js' {
101+
declare module.exports: $Exports<'babel-cli/lib/babel/file'>;
102+
}
103+
declare module 'babel-cli/lib/babel/index.js' {
104+
declare module.exports: $Exports<'babel-cli/lib/babel/index'>;
105+
}
106+
declare module 'babel-cli/lib/babel/util.js' {
107+
declare module.exports: $Exports<'babel-cli/lib/babel/util'>;
108+
}

0 commit comments

Comments
 (0)