This repository was archived by the owner on May 31, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +42
-8
lines changed Expand file tree Collapse file tree 8 files changed +42
-8
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 11{
22 "name" : " @djsp/counter-example" ,
3- "homepage" : " https://github.com/draft-js-plugins/next" ,
4- "version" : " 0.0.1 " ,
3+ "homepage" : " https://github.com/draft-js-plugins/next#readme " ,
4+ "version" : " 0.1.5 " ,
55 "private" : true ,
66 "license" : " MIT" ,
77 "dependencies" : {
8- "@djsp/utils" : " latest " ,
9- "@djsp/editor" : " latest " ,
8+ "@djsp/utils" : " ^0.1.5 " ,
9+ "@djsp/editor" : " ^0.1.5 " ,
1010 "react" : " ^16.2.0" ,
1111 "react-dom" : " ^16.2.0" ,
1212 "react-scripts" : " ^1.1.1"
File renamed without changes.
Original file line number Diff line number Diff line change 1+ import React , { Fragment } from 'react'
2+ import { Plugin } from '@djsp/editor'
3+ import { getCharCount , getWordCount , getLineCount } from '@djsp/utils'
4+
5+ export default function WordCountPlugin ( ) {
6+ return (
7+ < Plugin >
8+ { ( { editorState } ) => (
9+ < Fragment >
10+ < div > Char count: { getCharCount ( editorState ) } </ div >
11+ < div > Word count: { getWordCount ( editorState ) } </ div >
12+ < div > Line count: { getLineCount ( editorState ) } </ div >
13+ </ Fragment >
14+ ) }
15+ </ Plugin >
16+ )
17+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'
33
44import { EditorState , ContentState } from 'draft-js'
55import { EditorContainer , Editor } from '@djsp/editor'
6- import { getCharCount , getWordCount , getLineCount } from '@djsp/utils '
6+ import WordCountPlugin from './WordCountPlugin '
77import './styles.css'
88
99class App extends Component {
@@ -21,9 +21,7 @@ class App extends Component {
2121 < EditorContainer
2222 editorState = { this . state . editorState }
2323 onChange = { this . onChange } >
24- < div > Char count: { getCharCount ( this . state . editorState ) } </ div >
25- < div > Word count: { getWordCount ( this . state . editorState ) } </ div >
26- < div > Line count: { getLineCount ( this . state . editorState ) } </ div >
24+ < WordCountPlugin />
2725 < Editor />
2826 </ EditorContainer >
2927 </ div >
File renamed without changes.
Original file line number Diff line number Diff line change @@ -125,6 +125,24 @@ hasEntity(
125125insertNewLine (editorState: EditorState): EditorState
126126```
127127
128+ ### getCharCount
129+
130+ ``` javascript
131+ getCharCount (editorState: EditorState): number
132+ ```
133+
134+ ### getLineCount
135+
136+ ``` javascript
137+ getLineCount (editorState: EditorState): number
138+ ```
139+
140+ ### getWordCount
141+
142+ ``` javascript
143+ getWordCount (editorState: EditorState): number
144+ ```
145+
128146## License
129147
130148MIT © [ juliankrispel] ( https://github.com/juliankrispel )
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414} from 'draft-js'
1515import type DraftEntityInstance from 'draft-js/lib/DraftEntityInstance'
1616import type { DraftDecorator } from 'draft-js/lib/DraftDecorator'
17+ // eslint-disable-next-line node/no-deprecated-api
1718import punycode from 'punycode'
1819
1920export function replaceWithAtomicBlock (
You can’t perform that action at this time.
0 commit comments