-<![CDATA[\r
- var editor = new CodeMirror(CodeMirror.replace("target"), {\r
- parserfile: ["tokenizejavascript.js", "parsejavascript.js"],\r
- path: "{{STATIC_URL}}js/lib/codemirror",\r
- stylesheet: "{{STATIC_URL}}css/xmlcolors.css",\r
- content: "Hello world!"\r
-});\r
+<![CDATA[ \r
+ $('#target').bind('keydown', function(event) {\r
+ console.log("Keydown:", String.fromCharCode(event.keyCode), event);\r
+ console.log("Selection:", window.getSelection() );\r
+ if(event.keyCode == 37 \r
+ || event.keyCode == 38 || event.keyCode == 39 || event.keyCode == 40)\r
+ return true;\r
+\r
+ if(event.keyCode == 8)\r
+ {\r
+ var selection = window.getSelection();\r
+ if(selection.anchorOffset == 0)\r
+ {\r
+ var r = selection.getRangeAt(0);\r
+ r.setStartBefore( $("#elem")[0] ); \r
+\r
+ return true;\r
+ }\r
+ return true;\r
+ }\r
+ \r
+ return true;\r
+ }).\r
+ bind('dragstart', function() { console.log('dragstart'); }).\r
+ bind('dragenter', function() { console.log('dragenter'); }).\r
+ bind('dragover', function() { console.log('dragover'); }).\r
+ bind('dragover', function() { console.log('dragend'); }).\r
+ bind('drag', function() { console.log('drag'); });\r
+\r
+ $('*').bind('drop', function(event) { console.log('drop on:', event.target, 'received on', this); });\r
+ \r
+\r