Skip to content
This repository was archived by the owner on May 31, 2020. It is now read-only.

Commit 68f10a3

Browse files
freedomlangjuliankrispel
authored andcommitted
feat: add counter plugin
1 parent 880e0ab commit 68f10a3

File tree

12 files changed

+27960
-0
lines changed

12 files changed

+27960
-0
lines changed

packages/counter/.babelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": [
3+
["@babel/preset-env", {
4+
"targets": "> 0.25%, not dead"
5+
}],
6+
"@babel/preset-flow",
7+
"@babel/preset-react"
8+
],
9+
"plugins": ["@babel/plugin-proposal-class-properties"]
10+
}

packages/counter/.flowconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[ignore]
2+
.*/node_modules/.*
3+
4+
[include]
5+
node_modules/draft-js
6+
node_modules/react
7+
8+
[libs]
9+
10+
[lints]
11+
12+
[options]
13+
14+
[strict]
15+
16+
[version]
17+
^0.81.0

packages/counter/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# djs@counter - Not released, please use with caution ;)
2+
3+
[![NPM](https://img.shields.io/npm/v/@djsp/atomic-block.svg)](https://www.npmjs.com/package/@djsp/atomic-block) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
4+
5+
6+
Example:
7+
8+
```jsx
9+
import Counter, { getCharCount, getWordCount, getLineCount } from "./counter.js";
10+
11+
<EditorContainer>
12+
<Editor />
13+
14+
<Counter>
15+
{(editorState) => 'Char count: ' + getCharCount(editorState)}
16+
</Counter>
17+
18+
<Counter>
19+
{(editorState) => 'Word count: ' + getWordCount(editorState)}
20+
</Counter>
21+
22+
<Counter>
23+
{(editorState) => 'Line count: ' + getLineCount(editorState)}
24+
</Counter>
25+
26+
</EditorContainer>
27+
```

0 commit comments

Comments
 (0)