1
0
mirror of synced 2025-12-14 18:38:33 +08:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Jamie Peabody
37fedd05c8 v5.0 (#174)
* feat: v5

BREAKING CHANGE: Mergely is no longer a jQuery plugin.

BREAKING CHANGE: Removed `options.autoresize`

BREAKING CHANGE: Removed `options.editor_width`

BREAKING CHANGE: Removed `options.editor_height`

BREAKING CHANGE: Removed `options.fadein`

BREAKING CHANGE: Removed `options.fgcolor`

BREAKING CHANGE: Removed `options.resize`

BREAKING CHANGE: Removed `options.width`

BREAKING CHANGE: Removed `options.height`

BREAKING CHANGE: Removed `options.loaded` callback

BREAKING CHANGE: Removed `options.resized` callback

BREAKING CHANGE: Removed styles `.mergely-resizer`, `.mergely-full-screen-0`, and `.mergely-full-screen-8`

BREAKING CHANGE: Changed default for `options.change_timeout` changed from `150` to `50`.

BREAKING CHANGE: No longer automatically scrolls to first change.

feat: CodeMirror is now an explicit dependency.

feat: No longer necessary to separately require codemirror/addon/search/searchcursor

feat: No longer necessary to separately require codemirror/addon/selection/mark-selection

feat: `mergely.js` is now unminimized, and added new minimized version `mergely.min.js`

feat: Gutter click now scrolls to any line

feat: Mergely now emits `resize` event on resize

feat: The UI is now non-blocking as diff now runs in background

feat: Added support to provide `options.lhs` and `options.rhs` as strings

feat: #16 added titles to editor.mergely.com

fix: #165 block of changes at end of file are now distinguishable

fix: #140 fixed performance issue with large files

fix: Fixed issue where canvas markup was not rendered when `viewport` enabled

fix: Fixed timing issue where swap sides may not work as expected.

fix: Fixed issue where unmarkup did not emit an updated event.

fix: Fixed documentation issue where `merge` incorrectly stated: from the specified `side` to the opposite side.

fix: Fixed performance issue scrolling

fix: Fixed issue where initial render scrolled to first change, showing it at the bottom (as opposed to middle as expected)

fix: Fixed issue where line-diffs failed to diff non-alphanumeric characters

* chore: tweaked no-start/end styles

* feat: dark mode

* chore: updated examples

* chore(ci): updated webpack

* chore(ci): alpha, beta, next branches

* chore(ci): test

* chore(ci): package-lock.json

* chore(ci): ignore alpha, beta, next on branch

* fix: fixes firefox scroll-linked effect issue

* fix: fixes firefox scroll-linked effect issue

* chore: fix css

* chore: debug
2023-04-23 16:29:59 +01:00
Jamie Peabody
f3e90b7588 chore(release): 4.3.9 2022-01-19 21:49:12 +00:00
Jamie Peabody
650daaff63 fix(#161): Fixed issue with options.ignorews (#162) 2022-01-19 21:46:43 +00:00
6 changed files with 32 additions and 18 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "mergely",
"version": "5.0.0-rc0",
"version": "5.0.0-alpha.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mergely",
"version": "5.0.0-rc0",
"version": "5.0.0-alpha.2",
"license": "(GPL-3.0 OR LGPL-3.0 OR MPL-1.1 OR SEE LICENSE IN LICENSE)",
"devDependencies": {
"@babel/core": "^7.1.6",

View File

@@ -1,6 +1,6 @@
{
"name": "mergely",
"version": "5.0.0-rc0",
"version": "5.0.0-alpha.2",
"description": "A javascript UI for diff/merge",
"license": "(GPL-3.0 OR LGPL-3.0 OR MPL-1.1 OR SEE LICENSE IN LICENSE)",
"author": {

View File

@@ -44,7 +44,7 @@ CodeMirrorDiffView.prototype.init = function(el, options = {}) {
lineNumbers: this.settings.line_numbers,
gutters: (this.settings.line_numbers && [ 'merge', 'CodeMirror-linenumbers' ]) || [],
};
this._vdoc = new VDoc();
this._vdoc = new VDoc({ _debug: this.settings._debug });
};
CodeMirrorDiffView.prototype.unbind = function() {
@@ -561,7 +561,7 @@ CodeMirrorDiffView.prototype._clearMarkup = function () {
traceTimeStart('draw#_clearMarkup');
}
this._vdoc.clear();
this._vdoc = new VDoc();
this._vdoc = new VDoc({ _debug: this.settings._debug });
if (this.settings._debug) {
traceTimeEnd('draw#_clearMarkup');
}
@@ -995,14 +995,10 @@ CodeMirrorDiffView.prototype._markupLineChanges = function (changes) {
}
}
led.operation(() => {
for (let i = 0; i < changes.length; ++i) {
vdoc.update('lhs', i, led, lhsvp);
}
vdoc.update('lhs', led, lhsvp);
});
red.operation(() => {
for (let i = 0; i < changes.length; ++i) {
vdoc.update('rhs', i, red, rhsvp);
}
vdoc.update('rhs', red, rhsvp);
});
if (this.settings._debug) {
traceTimeEnd('draw#_markupLineChanges');

View File

@@ -17,7 +17,7 @@
}
.mergely-editor .CodeMirror-selected {
background: #ffcb0f;
background: #0f73ff47;
}
.mergely-splash {
@@ -52,8 +52,6 @@
.mergely-editor .merge-button {
height: 18px;
cursor: pointer;
width: 26px;
padding-left: 3px;
}
/* common stles */

View File

@@ -114,7 +114,7 @@ class Mergely {
_setOptions(options) {
if (this._options && this._options._debug) {
trace('api#options', opts);
trace('api#options');
}
const colors = dom.getColors(this.el);
this._options = {

View File

@@ -1,7 +1,10 @@
const diff = require('./diff');
const trace = console.log;
class VDoc {
constructor() {
constructor(options) {
this.options = options;
this._lines = {
lhs: {},
rhs: {}
@@ -13,6 +16,9 @@ class VDoc {
}
addRender(side, change, changeId, options) {
if (this.options._debug) {
trace('vdoc#addRender', side, changeId, change);
}
const {
isCurrent,
lineDiff,
@@ -23,6 +29,9 @@ class VDoc {
const alreadyRendered = !!this._rendered[side][changeId];
if (alreadyRendered) {
if (this.options._debug) {
trace('vdoc#addRender (already rendered)', side, changeId, change);
}
return;
}
@@ -116,6 +125,9 @@ class VDoc {
}
addInlineDiff(change, changeId, { getText, ignorews, ignoreaccents, ignorecase }) {
if (this.options._debug) {
trace('vdoc#addInlineDiff', changeId, change);
}
const { lf, lt, olf, olt } = getExtents('lhs', change);
const vdoc = this;
@@ -169,6 +181,9 @@ class VDoc {
}
_setRenderedChange(side, changeId) {
if (this.options._debug) {
trace('vdoc#_setRenderedChange', side, changeId);
}
return this._rendered[side][changeId] = true;
}
@@ -182,8 +197,10 @@ class VDoc {
return line;
}
update(side, changeId, editor, viewport) {
this._setRenderedChange(side, changeId);
update(side, editor, viewport) {
if (this.options._debug) {
trace('vdoc#update', side, editor, viewport);
}
const lines = Object.keys(this._lines[side]);
for (let i = 0; i < lines.length; ++i) {
const id = lines[i];
@@ -200,6 +217,9 @@ class VDoc {
}
clear() {
if (this.options._debug) {
trace('vdoc#clear');
}
for (const lineId in this._lines.lhs) {
this._lines.lhs[lineId].clear();
}