mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-26 06:50:50 +00: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
|
|
}
|