MCPcopy
hub / github.com/ajaxorg/ace / CodeMirror

Function CodeMirror

src/keyboard/vim_test.js:41–78  ·  view source on GitHub ↗
(place, opts)

Source from the content-addressed store, hash-verified

39 behavioursEnabled: false,
40});
41function 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}
79CodeMirror.defineMode = function() {}
80for (var key in vim.CodeMirror)
81 CodeMirror[key] = vim.CodeMirror[key];

Callers 1

testVimFunction · 0.70

Calls 6

appendChildMethod · 0.80
setOptionMethod · 0.80
focusMethod · 0.45
setKeyboardHandlerMethod · 0.45
setValueMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…