'Strange behavior with spaces and symbols in codemirror

I'm working with CodeMirror in React and everything is fine, but for some reason when I press a symbol, spaces or tab the editor shows a strange behavior and doesn´t stay aligned, so I can't run python code because it shows me identation errors when executing the program. I tried to change the editor size but the problem persists, does anyone know what it could be?. Thanks to all!

This is a example using the tabs inside the while

Using braces in print

Behevior when press enter and go to the next line



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source