richeditor-android
richeditor-android copied to clipboard
How to set the content length limit?
How to set the content length limit?
What did you do about it
Because now copy large text frequent pasting will cause the program to stop running, want to limit the input to solve this problem
Have you solved the problem?
I haven't found a solution to this problem, would you please tell me? Please point out a feasible scheme
I'm also looking for a solution
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); } } });
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() } } }