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 19:27:30 +00:00
export function init (rootEl) {
2018-02-21 14:55:08 +00:00
CodeMirror.defineMIME('application/x-tex', 'latex')
CodeMirror.defineMIME('application/x-latex', 'latex')
return CodeMirror(rootEl, {
mode: 'latex'
})
}
2018-02-22 19:27:30 +00:00
export function openDoc (cm, content) {
2018-02-21 14:55:08 +00:00
const newDoc = Doc(content, 'latex')
cm.swapDoc(newDoc)
return newDoc
}