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

Max length? #182

Open
ram-wavity opened this issue Aug 23, 2018 · 6 comments
Open

Max length? #182

ram-wavity opened this issue Aug 23, 2018 · 6 comments

Comments

@ram-wavity
Copy link

How to set max length to editor?

@fightcoder
Copy link

How to set max length to editor?

@Yelamanmyrzahanov
Copy link

How to set max length to editor?

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

@Yelamanmyrzahanov
Copy link

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

@ram-wavity
Copy link
Author

richEditor.setInputEnabled(false);

With the above condition, the keyboard got to hide. In this case, we are unable to reopen keyboard again, but how to remove existing characters.

@HovhannisyanKaro
Copy link

@ram-wavity +

@krunalpatel3
Copy link

krunalpatel3 commented Apr 8, 2024

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

5 participants