Compare commits

..

2 Commits

Author SHA1 Message Date
Jamie Peabody
9dcbd0b910 feat(#220): Exposes Mergely's instance of CodeMirror as Mergely.CodeMirror 2025-11-15 15:33:30 +00:00
Moritz
b9aed167f3 Fix documentation for CM modes in README.md (#218) 2025-01-17 17:10:33 +00:00
3 changed files with 16 additions and 10 deletions

View File

@@ -84,13 +84,15 @@ Mergely will emit an `updated` event when the editor is first initialized, and e
### Visualization modes
Mergely supports the following CodeMirror visualizations for [mode](codemirror.net/5/doc/manual.html#option_mode):
* go
* javascript
* htmlmixed
* markdown
* python
Mergely does not support any CodeMirror highlighting for different languages (xml, html, javascript etc.) out of the box.
You can compile your own Mergely-Version with support for the desired modes by adding them to diff-view.js. For example:
```
require('codemirror/mode/go/go.js');
require('codemirror/mode/javascript/javascript.js');
require('codemirror/mode/htmlmixed/htmlmixed.js');
require('codemirror/mode/markdown/markdown.js');
require('codemirror/mode/python/python.js');
```
## Options

View File

@@ -18,9 +18,11 @@ function CodeMirrorDiffView(el, options) {
const coords = this.cursorCoords(null, 'local');
this.scrollTo(null,
(coords.top + coords.bottom) / 2 - (this.getScrollerElement().clientHeight / 2));
});
this.init(el, options);
};
});
this.init(el, options);
};
CodeMirrorDiffView.CodeMirror = CodeMirror;
const trace = console.log;
const traceTimeStart = console.time;

View File

@@ -253,6 +253,8 @@ class Mergely {
}
}
Mergely.CodeMirror = CodeMirrorDiffView.CodeMirror;
window.Mergely = Mergely;
module.exports = Mergely;