mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
16 lines
363 B
JavaScript
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
|
|
}
|