mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #370 from sharelatex/as-cm-parsing
CodeMirror syntax parsing
This commit is contained in:
commit
67a78accbb
5 changed files with 19 additions and 5 deletions
|
@ -11,7 +11,10 @@
|
|||
"expect": true
|
||||
},
|
||||
"rules": {
|
||||
"max-len": "error",
|
||||
"max-len": ["error", {
|
||||
// Ignore long describe/it test blocks
|
||||
"ignorePattern": "^\\s*(it|describe)\\s*\\(['\"]"
|
||||
}],
|
||||
|
||||
// Add some chai specific rules
|
||||
"chai-expect/missing-assertion": "error",
|
||||
|
|
|
@ -33,7 +33,6 @@ module.exports = function (config) {
|
|||
'test/unit_frontend/es/**/*.js': ['webpack']
|
||||
},
|
||||
frameworks: ['requirejs', 'mocha', 'chai-sinon'],
|
||||
reporters: ['tap'],
|
||||
// Configure webpack in the tests
|
||||
webpack: {
|
||||
resolve: {
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
import CodeMirror, { Doc } from 'codemirror'
|
||||
|
||||
import LatexMode from './ide/editor/codemirror/LatexMode'
|
||||
|
||||
export function init (rootEl) {
|
||||
return CodeMirror(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)
|
||||
const newDoc = Doc(content, 'latex')
|
||||
cm.swapDoc(newDoc)
|
||||
return newDoc
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ define ['ide/editor/directives/cmEditor'], () ->
|
|||
}
|
||||
}
|
||||
|
||||
afterEach () -> window.Frontend = null
|
||||
|
||||
it 'inits Rich Text', () ->
|
||||
inject ($compile, $rootScope) =>
|
||||
$compile('<div cm-editor></div>')($rootScope)
|
||||
|
|
|
@ -45,7 +45,9 @@ module.exports = {
|
|||
use: [{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['env'],
|
||||
presets: [
|
||||
['env', { modules: false }]
|
||||
],
|
||||
// Configure babel-loader to cache compiled output so that subsequent
|
||||
// compile runs are much faster
|
||||
cacheDirectory: true
|
||||
|
|
Loading…
Reference in a new issue