added regext to handle cursor at beginning or end of code as well as inside tags
Currently the code pushes the cursor to the beginning if it's inside a script or style tag, this adds three more instances where that will happen:
-
If cursor is at the beginning of the code. This branch resolves an issue where an empty p tag would be inserted at the beginning in these cases
-
If cursor is at the end of the code. This branch resolves an issue where an empty p tag would be inserted at the end in these cases.
-
If cursor is inside a tag. This branch fixes #47 (closed)
Testing
This was tested with Codemirror version 5.56 and TinyMCE 5 (release: 2020-07-08)
Enter some content, play around with cursor positioning, you should no longer get unexpected code or entities if your cursor is at the beginning/end or inside a tag.
The test noted in the issue above should behave properly with this update.