Ask coding questions

← Back to all posts
Why isn't code mirror defined?
ZarmDev

So repl is telling me that code mirror didn't load even though I used the exact code from the code mirror website.

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
ZarmDev
Comments
hotnewtop
Coder100

Don't worry if you don't understand, here is a simple template to help get you started
https://replit.com/@Coder100/LameEmotionalStrings-aoeu-aeouaeoua-eou#index.html

ZarmDev

@Coder100 More cycles for your already crazy cycles, "don't worry if you don't understand her" i feel really dumb

Coder100

what
well

most of it is just boilerplate so that's why I said that @ZarmDev

ZarmDev

@Coder100 How do I run it though? I got a n iframe but I can't make it auto run

Coder100

@ZarmDev you set the innerhtml to the iframe, would you like me to help you

ZarmDev
Coder100

invite me then? @ZarmDev

ZarmDev
InvisibleOne

The issue is that your source code for code mirror is looking for a file inside of a folder called lib which doesn't exist, so unless you actually copy the source code and put it into a file, you'll need to use the cdn script tag.

InvisibleOne

I think you need to put this in the head
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.61.0/codemirror.min.js" integrity="sha512-LwxFyHyqmDdcint8dhTSHeJuI+uH5r/vrcGkxH4QhHGP8SpNaS9MVa1BxZRNTb1GPyLBAWrjbWpZTPGgtDgJOw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

ZarmDev

@InvisibleOne Now ReferenceError: myTextarea is not defined
at /:15:40

InvisibleOne

Put this in the html: <textarea id='ta'></textarea> then put this inside your script tag above var editor = ...
var myTextarea = document.getElementById('ta');
@ZarmDev

ZarmDev

@InvisibleOne Uhhhhh run the repl idk what's happening there

InvisibleOne

I think you need to read the manual: https://codemirror.net/doc/manual.html @ZarmDev

ZarmDev

@InvisibleOne this is too complicated :/

ZarmDev

@InvisibleOne I have a 1-dimensinal brain