1

I've searched Google and these forums without luck. Here's my code where the error appears to be originating. Digging around in the source file is no help. This is installed on a Multi-Site WordPress and works with posts etc in admin area. All the sites are throwing this error when in post etc.

var editor = CodeMirror.fromTextArea(

                document.getElementById("code"), {  

                    lineNumbers: true,

                    mode: "text/x-scss", 

                    theme: "solarized light", 

                    lineWrapping: true,  

                    onCursorActivity: function() {    

                        editor.setLineClass(hlLine, null, null);    

                        hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline");  }

                    });

              var hlLine = editor.addLineClass(0, "background", "activeline");

                editor.on("cursorActivity", function() {

                    var cur = editor.getLineHandle(editor.getCursor().line);

                        if (cur != hlLine) {

                            editor.removeLineClass(hlLine, "background", "activeline");

                            hlLine = editor.addLineClass(cur, "background", "activeline");

                        }

                    });

              var number = jQuery(".CodeMirror-wrap").length;

              if(number > 1){

                jQuery(".CodeMirror-wrap").hide();

                jQuery(".CodeMirror-wrap:first").show();

              }

CSS Plus WordPress plugin

Any insight is greatly appreciated.

Jarod Thornton
  • 401
  • 1
  • 7
  • 24
  • I am facing a similar issue and I have posted it here: https://stackoverflow.com/q/69430941/7584240 If you get a chance can you please have a look and provide some resolution. – BATMAN_2008 Oct 04 '21 at 05:33

1 Answers1

1

You need to include CodeMirror library in your site before this code is executed along with css plugin. Head over to http://codemirror.net/doc/compress.html and select core library, css mode and active line plugin.

You would also need to include https://codemirror.net/lib/codemirror.css along with your stylesheets.

Vedanshu
  • 617
  • 1
  • 7
  • 20
  • I followed your directions without luck. I ended up disabling the codemirror in favor of getting back to work. I'll dig into it later. I appreciate your feedback. – Jarod Thornton Mar 10 '16 at 17:51
  • I am facing a similar issue and I have posted it here: https://stackoverflow.com/q/69430941/7584240 If you get a chance can you please have a look and provide some resolution. – BATMAN_2008 Oct 04 '21 at 05:33