overleaf/services/web/public/es/rich-text.js
2018-03-20 11:23:15 +00:00

16 lines
363 B
JavaScript

import CodeMirror, { Doc } from 'codemirror'
export function init (rootEl) {
CodeMirror.defineMIME('application/x-tex', 'latex')
CodeMirror.defineMIME('application/x-latex', 'latex')
return CodeMirror(rootEl, {
mode: 'latex'
})
}
export function openDoc (cm, content) {
const newDoc = Doc(content, 'latex')
cm.swapDoc(newDoc)
return newDoc
}