(place, opts)
| 39 | behavioursEnabled: false, |
| 40 | }); |
| 41 | function CodeMirror(place, opts) { |
| 42 | if (!editor.container.parentNode) { |
| 43 | document.body.appendChild(editor.container); |
| 44 | } |
| 45 | var cm = editor.state && editor.state.cm; |
| 46 | if (cm && cm.state.currentNotificationClose) |
| 47 | cm.state.currentNotificationClose(); |
| 48 | if (cm) cm.focus(); |
| 49 | |
| 50 | editor.setKeyboardHandler(null); |
| 51 | editor.setKeyboardHandler(vim.handler); |
| 52 | cm = editor.state.cm; |
| 53 | |
| 54 | if (opts.value != null) |
| 55 | editor.session.setValue(opts.value); |
| 56 | editor.setOption("indentedSoftWrap", false); |
| 57 | editor.setOption("wrap", opts.lineWrapping); |
| 58 | editor.setOption("useSoftTabs", !opts.indentWithTabs); |
| 59 | editor.setOption("mode", opts.mode ? modes[opts.mode] : modes.js); |
| 60 | cm.setOption("tabSize", opts.tabSize || 4); |
| 61 | cm.setOption("indentUnit", opts.indentUnit || 2); |
| 62 | |
| 63 | cm.setSize = function(w, h) { |
| 64 | var changed = false; |
| 65 | if (w && editor.w != w) { |
| 66 | changed = true; |
| 67 | el.style.width = (editor.w = w) + "px"; |
| 68 | } |
| 69 | if (h && editor.h != h) { |
| 70 | changed = true; |
| 71 | el.style.height = (editor.h = h) + "px"; |
| 72 | } |
| 73 | if (changed) |
| 74 | editor.resize(true); |
| 75 | }; |
| 76 | cm.setSize(500, 300); |
| 77 | return cm; |
| 78 | } |
| 79 | CodeMirror.defineMode = function() {} |
| 80 | for (var key in vim.CodeMirror) |
| 81 | CodeMirror[key] = vim.CodeMirror[key]; |
no test coverage detected
searching dependent graphs…