Codemirror does not connect

Today I stopped working Codemirror , the code was correct and worked. I attached a screenshot, can anyone tell me what the problem is?

<script src="http://codemirror.net/lib/codemirror.js"></script>
<script src="http://codemirror.net/mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="http://codemirror.net/lib/codemirror.css">
<textarea id="code" >
Test{
	
	}
</textarea>


<script>
 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
        lineNumbers: true,
        lineWrapping:true,
        autofocus:true
      });

editor.setCursor(2,2);

var pos=editor.posFromIndex(3);
editor.setCursor(pos.line,pos.ch);       

</script>

I don’t see that pen listed in Derk Jan Speelman’s pens. Most, if not all, of his public pens are from 2017 and use an older version of CodeMirror. This pen of Derk’s seems to do what you are looking for though. Version 6 has just been released and has some breaking changes but you can follow Marijn’s Announcement or his Migration Guide to get similar results with the new version.

Oh, and if you want to get started with CodeMirror v6 using CodePen, I have an example CodePen that uses CodeMirror 6 with syntax highlighting, line numbers, and bracket matching.

Just the very basics.

I hope this was helpful.

You are hot-linking scripts on the old website. Don’t load the library from my server, put a copy on your own server.