Codemirror Editor Does Not Load Text Box Content

I am trying to apply CodeMirror to this gadget web application that I am using. It has two text fields. I would like to add CM for better visibility, so I can edit some things on the go. So far I have managed to apply the Eclipse theme, but the tool no longer works. It seems that CodeMirror is not copying the contents into a text box.

When I delete Codemirror js, the tool works again.

Here is my jsfiddle

HTML

<textarea id="input" rows="10" cols="80"></textarea>
<textarea id="output" rows="10" cols="80" readonly></textarea>

Js

$('textarea').each(function(index, elem) {
  CodeMirror.fromTextArea(elem, {
    lineWrapping: true,
    mode: "javascript",
    theme: "eclipse",
    lineNumbers: true,

  });

});
+4
source share
1 answer

, http://dean.edwards.name/packer/bindings.js, , :

"#pack-script": {
    disabled: false,

    onclick: function() {
        try {
            output.value = "";
            if (input.value) {
                var value = packer.pack(input.value, base62.checked, shrink.checked);
                output.value = value;
                message.update();
            }
        } catch (error) {
            message.error("error packing script", error);
        } finally {
            saveScript.disabled = !output.value;
            decodeScript.disabled = !output.value || !base62.checked;
        }
    }
},

CodeMirror . , textarea, input.value, . , CodeMirror / , .

1:

, .

:

  • CodeMirror editor, .
  • onclick. finally undefined saveScript decodeScript, . CodeMirror getValue() setValue() / .

- , , .

+1

Source: https://habr.com/ru/post/1664224/


All Articles