import 'codemirror/mode/nginx/nginx';
import 'codemirror/mode/php/php';
import 'codemirror/mode/powershell/powershell';
+import 'codemirror/mode/properties/properties';
import 'codemirror/mode/python/python';
import 'codemirror/mode/ruby/ruby';
import 'codemirror/mode/rust/rust';
// Addons
import 'codemirror/addon/scroll/scrollpastend';
+// Mapping of potential languages or formats from user input
+// to their proper codemirror modes.
const modeMap = {
css: 'css',
c: 'text/x-csrc',
haskell: 'haskell',
hs: 'haskell',
html: 'htmlmixed',
+ ini: 'properties',
javascript: 'javascript',
json: {name: 'javascript', json: true},
js: 'javascript',
ml: 'mllike',
nginx: 'nginx',
powershell: 'powershell',
+ properties: 'properties',
ocaml: 'mllike',
php: 'php',
py: 'python',
value: content,
mode: mode,
lineNumbers: true,
+ lineWrapping: false,
theme: getTheme(),
readOnly: true
});
value: content,
mode: getMode(lang),
lineNumbers: true,
+ lineWrapping: false,
theme: getTheme(),
readOnly: true
});
value: content,
mode: getMode(modeSuggestion),
lineNumbers: true,
- theme: getTheme(),
- lineWrapping: true
+ lineWrapping: false,
+ theme: getTheme()
});
}
}
/**
- * Get a CodeMirror instace to use for the markdown editor.
+ * Get a CodeMirror instance to use for the markdown editor.
* @param {HTMLElement} elem
* @returns {*}
*/
function markdownEditor(elem) {
- let content = elem.textContent;
-
- return CodeMirror(function (elt) {
- elem.parentNode.insertBefore(elt, elem);
- elem.style.display = 'none';
- }, {
+ const content = elem.textContent;
+ const config = {
value: content,
mode: "markdown",
lineNumbers: true,
- theme: getTheme(),
lineWrapping: true,
+ theme: getTheme(),
scrollPastEnd: true,
- });
+ };
+
+ window.$events.emitPublic(elem, 'editor-markdown-cm::pre-init', {config});
+
+ return CodeMirror(function (elt) {
+ elem.parentNode.insertBefore(elt, elem);
+ elem.style.display = 'none';
+ }, config);
}
/**