problem description
do a chat editor, you can insert pictures and text, I am using a div,contenteditable set to true, need to limit the text 5000
the environmental background of the problems and what methods you have tried
tried using keypress and keyup,keydown, but the blocking default event of these methods cannot detect Chinese characters. Input can detect Chinese characters, but can"t stop input. If you use the method of replacing the html, value, this method is not easy to implement because of the mixing of graphics and text in the editor, the html tag characters that need to be inserted into html, text and characters such as can not be parsed into HTML.
related codes
/ / Please paste the code text below (do not replace the code with pictures)