mirror of
https://github.com/wickedest/Mergely.git
synced 2026-03-28 10:08:45 +08:00
29 lines
568 B
JavaScript
29 lines
568 B
JavaScript
require('codemirror');
|
|
require('codemirror/addon/search/searchcursor.js');
|
|
require('codemirror/addon/selection/mark-selection.js');
|
|
require('codemirror/lib/codemirror.css');
|
|
require('../src/mergely.css');
|
|
|
|
const lhs = `hello`;
|
|
|
|
const rhs = `hello\ngoodbye`;
|
|
|
|
|
|
document.onreadystatechange = function () {
|
|
if (document.readyState !== 'complete') {
|
|
return;
|
|
}
|
|
|
|
const mergely = new Mergely('#compare', {
|
|
license: 'lgpl',
|
|
inline: 'words',
|
|
lhs,
|
|
rhs
|
|
});
|
|
|
|
// On init, scroll to first diff
|
|
mergely.once('updated', () => {
|
|
mergely.scrollToDiff('next');
|
|
});
|
|
};
|