Currently, I am integrating the Codemirror library with a textarea to enable autoclosing of HTML tags and brackets such as {}, (), []. However, I have come across an issue where they do not work together on the same line.
For example, when typing out a tag like this:
<div></div>
The tags autoclose and the cursor is positioned between them. But if I attempt to add a bracket, like so:
<div>{</div>
It fails to close properly due to the behavior of closebrackets.js. It functions correctly when each element is on its own line. As a workaround, I discovered a quick fix by modifying closetag.js (Line 80), where you can include a space to resolve this issue:
text: ">" + (indent ? "\n\n" : " ") + "</" + tagName + ">",
This modification results in the tags closing as follows:
<div> </div>
However, it's slightly cumbersome and aesthetically unpleasing with the extra space. Do you have any suggestions on how to achieve both functionalities smoothly on the same line?