Search code examples
codemirror

When using custom key for autocompletion in CodeMirror, how to print the key that has been pressed?


I am currently using the following code:

 jQuery(document).ready(function() {
     editorftl = CodeMirror.fromTextArea(document.getElementById("codeftl"), {
         mode: "text/ftl",
         lineNumbers : "true",
         extraKeys: {"'<'": function (cm){CodeMirror.showHint(cm, CodeMirror.hint.ftl);}},
     });
});

I want to print the "<" key on the textarea and also display the autocomplete options. Is it possible?


Solution

  • See http://codemirror.net/demo/xmlcomplete.html for a demo that does autocompletion like that.