mirror of
https://github.com/wickedest/Mergely.git
synced 2026-02-02 09:38:00 +08:00
Co-authored-by: Jamie Peabody <jpeabody@axway.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# Changes
|
||||
|
||||
## 4.1.1:
|
||||
* patch: fixes issue #95
|
||||
|
||||
## 4.1.0:
|
||||
* minor: emits 'updated' event after every change.
|
||||
* patch: fixes `scrollTo` that no longer functioned after a codemirror update.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mergely",
|
||||
"version": "4.1.0",
|
||||
"version": "4.1.1",
|
||||
"description": "A javascript UI for diff/merge",
|
||||
"directories": {
|
||||
"doc": "doc",
|
||||
|
||||
@@ -435,7 +435,7 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
||||
}
|
||||
if (this.resized) this.resized();
|
||||
},
|
||||
_debug: '', //scroll,draw,calc,diff,markup,change
|
||||
_debug: '', //scroll,draw,calc,diff,markup,change,init
|
||||
resized: function() { }
|
||||
}, options);
|
||||
|
||||
@@ -845,23 +845,29 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
||||
var setv;
|
||||
if (this.settings.lhs) {
|
||||
self.trace('init', 'setting lhs value');
|
||||
setv = this.editor[this.id + '-lhs'].getDoc().setValue;
|
||||
this.settings.lhs(setv.bind(this.editor[this.id + '-lhs'].getDoc()));
|
||||
this.settings.lhs(function setValue(value) {
|
||||
this._initializing = true;
|
||||
this.editor[this.id + '-lhs'].getDoc().setValue(value);
|
||||
}.bind(this));
|
||||
}
|
||||
if (this.settings.rhs) {
|
||||
self.trace('init', 'setting rhs value');
|
||||
setv = this.editor[this.id + '-rhs'].getDoc().setValue;
|
||||
this.settings.rhs(setv.bind(this.editor[this.id + '-rhs'].getDoc()));
|
||||
this.settings.rhs(function setValue(value) {
|
||||
this._initializing = true;
|
||||
this.editor[this.id + '-rhs'].getDoc().setValue(value);
|
||||
}.bind(this));
|
||||
}
|
||||
this.element.one('updated', () => {
|
||||
this._initializing = false;
|
||||
if (self.settings.loaded) {
|
||||
self.settings.loaded();
|
||||
}
|
||||
});
|
||||
this.trace('init', 'bound');
|
||||
this.editor[this.id + '-lhs'].focus();
|
||||
},
|
||||
|
||||
_scroll_to_change : function(change) {
|
||||
_scroll_to_change: function(change) {
|
||||
if (!change) return;
|
||||
var self = this;
|
||||
var led = self.editor[self.id+'-lhs'];
|
||||
@@ -872,6 +878,7 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
||||
if (change["lhs-line-to"] >= 0) {
|
||||
led.scrollIntoView({line: change["lhs-line-to"]});
|
||||
}
|
||||
led.focus();
|
||||
},
|
||||
|
||||
_scrolling: function(editor_name) {
|
||||
@@ -1032,8 +1039,9 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
||||
this.trace('change', 'diff time', Timer.stop());
|
||||
this.changes = Mgly.DiffParser(d.normal_form());
|
||||
this.trace('change', 'parse time', Timer.stop());
|
||||
if (this._current_diff === undefined && this.changes.length) {
|
||||
// go to first difference on start-up
|
||||
if (this._current_diff === undefined && this.changes.length && this._initializing) {
|
||||
// go to first difference on start-up where values are provided in
|
||||
// settings.
|
||||
this._current_diff = 0;
|
||||
this._scroll_to_change(this.changes[0]);
|
||||
}
|
||||
|
||||
@@ -39,8 +39,7 @@ module.exports = {
|
||||
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'examples/app.html',
|
||||
filename: 'mergely.html'
|
||||
template: path.join(__dirname, 'examples', 'app.html')
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
$: 'jquery',
|
||||
|
||||
Reference in New Issue
Block a user