mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
19 lines
478 B
JavaScript
19 lines
478 B
JavaScript
import CodeMirror, { Doc } from 'codemirror'
|
|
|
|
import LatexMode from './ide/editor/codemirror/LatexMode'
|
|
|
|
export function init (rootEl) {
|
|
CodeMirror.defineMode('latex', () => new LatexMode())
|
|
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
|
|
}
|