TinyMCE: Cursor Does Not Move to Next Line After Inserting Content with Tag Using mceInsertContent

I’m using TinyMCE for my rich text editor, and I’m performing clipboard operations to insert content into the editor using the mceInsertContent command. When I insert content that ends with a
tag, for example, the string “text
“, the content is inserted correctly, but the cursor does not move to the next line as expected. (I had copied this content from notepad. The content was a line called “test” and then I had hit enter after that, so a new line below the string “test”)

Here is a simplified version of my code:

tinymce.init({
    selector: 'textarea#editor',
    setup: function (editor) {
    editor.on('paste', function (e) {
        e.preventDefault();
        const clipboardData = e.clipboardData || window.clipboardData;
        let textContent = clipboardData.getData('Text'); //Got the data as "textrn"

        // Replace new lines with <br/>
        textContent = textContent.replace(/r?n/g, "<br/>"); //now, "text<br/>"

        // Insert the modified content into the editor
        editor.execCommand('mceInsertContent', false, textContent);
    });
}

});

I expect after this execution, I want the line text inserted and the cursor blinking in the next line so when I start entering text it should start in the next line after the string “test”.

Tested this in Tinymce JS fiddle’s default example code page. There also it does not work as I need. (The cursor does not shift to the next line) which results in multiple br tags to be input as shown in the image below

enter image description here