I am trying to write an online editor and at the moment am trying to implement code folding. On the CodeMirror website they do a demo that uses the foldCode command that comes from the foldcode.js addon.
Here is my code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Mirror Test</title>
<script type="text/javascript" src="codemirror-5.4/lib/codemirror.js"></script>
<link rel="stylesheet" href="codemirror-5.4/lib/codemirror.css">
<link rel="stylesheet" href="codemirror-5.4/theme/neat.css">
<script type="text/javascript" src="codemirror-5.4/mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="src/Main.css">
<script type="type/javascript" src="codemirror-5.4/addon/fold/foldcode.js"></script>
<script type="type/javascript" src="codemirror-5.4/addon/fold/foldgutter.js"></script>
<link rel="stylesheet" href="codemirror-5.4/addon/fold/foldgutter.css">
</head>
<body>
<script>
window.onload = function() {
var editor = CodeMirror(document.body, {
mode: "javascript",
lineNumbers: true,
theme: "neat",
extraKeys: {"Ctrl-Q": function(cm) { cm.foldCode(cm.getCursor()); }},
foldgutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
});
}
</script>
</body>
</html>
IntelliJ is telling me that foldCode is an unresolved method. Im wondering if maybe I am importing the script wrong or may be foldCode was depreciated with the newest versions of CodeMirror?