overleaf/services/web/public/es/rich-text.js

17 lines
363 B
JavaScript
Raw Normal View History

import CodeMirror, { Doc } from 'codemirror'
2018-02-22 14:27:30 -05:00
export function init (rootEl) {
2018-02-21 09:55:08 -05:00
CodeMirror.defineMIME('application/x-tex', 'latex')
CodeMirror.defineMIME('application/x-latex', 'latex')
return CodeMirror(rootEl, {
mode: 'latex'
})
}
2018-02-22 14:27:30 -05:00
export function openDoc (cm, content) {
2018-02-21 09:55:08 -05:00
const newDoc = Doc(content, 'latex')
cm.swapDoc(newDoc)
return newDoc
}