Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Word Count? #522

Closed
rts-gordon opened this issue May 19, 2023 · 5 comments
Closed

[feat] Word Count? #522

rts-gordon opened this issue May 19, 2023 · 5 comments

Comments

@rts-gordon
Copy link

Hi there,
Very lucky to test and use react-md-editor, it's simple and powerful.

Would you like to impl new feature "Word Count" to count English words and Chinese characters. I think it is a very useful feature.
Thank you.

@rts-gordon rts-gordon changed the title [fea] Word Count? [feat] Word Count? May 19, 2023
@rts-gordon rts-gordon changed the title [feat] Word Count? [feature] Word Count? May 19, 2023
@rts-gordon rts-gordon changed the title [feature] Word Count? [feat] Word Count? May 19, 2023
@jaywcjlove
Copy link
Member

@rts-gordon What kind of API needs to be provided?

@rts-gordon
Copy link
Author

Hi @jaywcjlove
Maybe not API, just show the word count in UI, like this:

image

@jaywcjlove
Copy link
Member

@rts-gordon

<MDEditor
  onStatistics={(data) => {
    console.log('data:', data)
  }}
/>
export interface Statistics extends TextState {
  /** total length of the document */
  length: number;
  /** Get the number of lines in the editor. */
  lineCount: number;
}

export interface TextState {
  text: string;
  selectedText: string;
  selection: TextRange;
}
export interface TextRange {
  start: number;
  end: number;
}

jaywcjlove added a commit that referenced this issue May 19, 2023
@jaywcjlove
Copy link
Member

@rts-gordon Upgrade v3.22.0

@rts-gordon
Copy link
Author

@jaywcjlove so fast so good. I will test the new feature. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants