About the character length of codemirror input limit

“beforeChange” (instance: CodeMirror, changeObj: object)*

I want to use api to achieve this function; But what is the way I can’t get user input

Sorry, I don’t understand what you mean.

How do I implement the input character length limit?

In other words, I want my codemirror to limit the user input length to 20. I did not find a configuration file that can meet my needs. Do you have any good suggestions?
:grinning:

"beforeChange" is indeed the way to do this. The handler function will be passed all the information you need.

The second parameter of the callback of beforeChange changeObj,
How many types of changeObj.origin fields are there, and what do they mean?
I only need to monitor user input, paste, and select scenes to limit the input length

Is there a demo to watch?

1 Like