import 'codemirror/mode/markdown/markdown';
import 'codemirror/mode/mllike/mllike';
import 'codemirror/mode/nginx/nginx';
+import 'codemirror/mode/perl/perl';
import 'codemirror/mode/pascal/pascal';
import 'codemirror/mode/php/php';
import 'codemirror/mode/powershell/powershell';
import 'codemirror/mode/shell/shell';
import 'codemirror/mode/sql/sql';
import 'codemirror/mode/toml/toml';
+import 'codemirror/mode/vbscript/vbscript';
import 'codemirror/mode/xml/xml';
import 'codemirror/mode/yaml/yaml';
markdown: 'markdown',
ml: 'mllike',
nginx: 'nginx',
+ perl: 'perl',
+ pl: 'perl',
powershell: 'powershell',
properties: 'properties',
ocaml: 'mllike',
bash: 'shell',
toml: 'toml',
sql: 'text/x-sql',
+ vbs: 'vbscript',
+ vbscript: 'vbscript',
xml: 'xml',
yaml: 'yaml',
yml: 'yaml',
function highlightElem(elem) {
const innerCodeElem = elem.querySelector('code[class^=language-]');
elem.innerHTML = elem.innerHTML.replace(/<br\s*[\/]?>/gi ,'\n');
- const content = elem.textContent;
+ const content = elem.textContent.trimEnd();
let mode = '';
if (innerCodeElem !== null) {
* @returns {*|string}
*/
function getTheme() {
- return window.codeTheme || 'default';
+ const darkMode = document.documentElement.classList.contains('dark-mode');
+ return window.codeTheme || (darkMode ? 'darcula' : 'default');
}
/**
theme: getTheme(),
readOnly: true
});
- setTimeout(() => {
- cm.refresh();
- }, 300);
+
return {wrap: newWrap, editor: cm};
}