I have a contentEditable div that I want to limit in size. The user should not be able to continue typing once the capacity is reached, and no new lines should be added beyond the fixed height. For example, if the div's height is 600px and the user tries to create new lines by pressing enter repeatedly, after reaching the capacity, no additional lines will be allowed. It's like Google Docs where a new page appears when the end is reached, but in this case, nothing happens once the contentEditable div's limit is reached.
Here is my current code without any overflow since the div has a set capacity:
<div
ref={contentEditableRef}
contentEditable
className="content-to-print"
style={{
padding: "20px",
color: changeToDarkMode === "true" ? "white" : "black",
backgroundColor: "none",
overflow: "hidden",
fontSize: "16px",
fontFamily: "Arial, sans-serif",
textAlign: "left",
top: "80px",
outline: "none",
height: "1020px",
border:'1px solid black',
}}
</div>