How to disable tinymce editor html auto format

This is so customized as I’m using the community version. I have this use case that I have a tinymce on top and bottom while html drag and drop in the middle.

top:
tinymce, content: <div class="test">

middle:
drag and drop html

bottom:
tinymce, content: </div> <!-- closing tag for class .test -->

Tinymce editor will accept only opening tag or only closing tag. I tried other options given from stackoverflow and nothing is working for my use case. As I tried adding a closing tag on source code plugin after I click save button, the closing tag is removed and only the comment remains. While adding an opening tag, it will automatically adding a closing tag.

The actual result that I want to achieve is to retain the opening tag or closing tag only if added on the tinymce editor using the code plugin or any open source plugin.

I used the following technologies below:
jQuery 3.7.1
Bootstrap 5.3
Tinymce 6.7.0