richeditor-android icon indicating copy to clipboard operation
richeditor-android copied to clipboard

How to set the content length limit?

Open zxd191990 opened this issue 7 years ago • 7 comments

How to set the content length limit?

zxd191990 avatar Aug 31 '18 03:08 zxd191990

What did you do about it

liuchenc avatar Aug 31 '18 08:08 liuchenc

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

zxd191990 avatar Aug 31 '18 08:08 zxd191990

Have you solved the problem?

liuchenc avatar Aug 31 '18 08:08 liuchenc

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

zxd191990 avatar Aug 31 '18 08:08 zxd191990

I'm also looking for a solution

liuchenc avatar Aug 31 '18 08:08 liuchenc

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); } } });

Yelamanmyrzahanov avatar Jan 17 '19 11:01 Yelamanmyrzahanov

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() } } }

krunalpatel3 avatar Apr 08 '24 06:04 krunalpatel3