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

How to set the content length limit? #183

Open
zxd191990 opened this issue Aug 31, 2018 · 7 comments
Open

How to set the content length limit? #183

zxd191990 opened this issue Aug 31, 2018 · 7 comments

Comments

@zxd191990
Copy link

How to set the content length limit?

@liuchenc
Copy link

What did you do about it

@zxd191990
Copy link
Author

Because now copy large text frequent pasting will cause the program to stop running, want to limit the input to solve this problem

@liuchenc
Copy link

Have you solved the problem?

@zxd191990
Copy link
Author

I haven't found a solution to this problem, would you please tell me? Please point out a feasible scheme

@liuchenc
Copy link

I'm also looking for a solution

@Yelamanmyrzahanov
Copy link

richEditor.setOnTextChangeListener(new RichEditor.OnTextChangeListener() {
@OverRide
public void onTextChange(String text) {
int leng = text.length();
if (leng<=yourMaxLengthInteger){
text_count.setText(String.valueOf(leng));
}else{
richEditor.setInputEnabled(false);
}
}
});

@krunalpatel3
Copy link

binding.abcd.richEditor.setMaxLength(4005)

fun RichEditor.setMaxLength(maxLength:Int){
this.setOnTextChangeListener { text ->
val length = text.length
if (length > maxLength) {
this.html = text.substring(0, maxLength)
this.clearFocusEditor()
}
}
}

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

4 participants