wickedest / mergely Goto Github PK
View Code? Open in Web Editor NEWMerge and diff documents online
Home Page: http://www.mergely.com
License: Other
Merge and diff documents online
Home Page: http://www.mergely.com
License: Other
Hi.
Could you implement merging only specific/selected line(s) from one side to other?
I have quite complex requirements for what constitutes a diff or not in XML.
For this purpose I am using xmlunit as it gives me a lot of flexibility.
Is it possible to take the output of my xmlunit result and tell mergely what constitutes a diff?
i.e. just use the mergely viewer and not the mergely difference engine
Hi,
I tried to save a .diff file from a comparison.
After clicking the Button (File -> Save .diff), I was redirected to http://www.mergely.com/diff/XXXXXXX which was not the expected .diff file but the "Get Mergely" page.
Too bad :-)
Brgds
Jan
I love this library. Really well done ! It is the first I found that comes close to Apple's FileMerge.
FileMerge also shows an (editable) bottom area of the merge results, which is extremely helpful for understanding the final result and even allows to edit that merge block (basically overriding that sections output). Is this something that will be added sometime ?
First, this is awesome. Impressive job.
I'm working on a proof-of-concept node.js tool that will "deconstruct" HTML pages into components and sections. So, for example, you could use it to reverse engineer all of Bootstrap's built pages back into components and partials/includes.
I actually have everything working, but it would be awesome to automatically:
For example, given these two files:
The tool would automatically merge the two files into one, and create the following JSON file (using the basename of each file as the property name):
{
"css": "CSS · Upstage",
"components": "Components · Upstage"
}
The only thing I need help with is the extraction of differences, e.g. where in the code is the actual diff'ed text being highlighted, etc. and possible a strategy for merging files like those in the examples.
If you could even just point me in the right direction in the code, that would be great.
Hi,
Thanks for this great tool.
I'm loading one side and I disable the difference calculation. I only enable the difference calculation after loading the second text, because it does not make sense to show the difference between a text and an empty one.
There is only a small problem, because if the user tries to scroll down the first text, before loading the second one, there is a Javascript error.
I fixed it (just a hack), in _scrolling
, by adding:
if (!this.hasOwnProperty('changes')) return;
before the cycle where the property changes
is used.
If this hack makes sense, I can submit a pull request.
When you enter a character, the cursor always returns to the beginning of the line.
So I have to undo and redo, so that the characters can be entered normally.
Is there a more effective way??
sorry to say this, but the documentation is severely lacking. I have no idea how exactly to set the height. I tried setting editor_height as presented in documentation, but all it does is make the boxes taller. The content inside it is still confined to the original height. Can you please include examples in documentation?
Hi,
Is it possible to restrict merging to happen in only one direction? e.g. left to right or right to left only?
I couldn't find any settings for this.
Thank you.
Hi Jamie,
To start, Mergely is great!!
in your roadplan you mention SSL.
Starting on 03/12, Let's Encrypt, an initiative from the Linux Foundation, starts to handout free-of-charge HTTPS certificates.
This could be a free, automated and open solution to tackle that item on the Mergely roadplan.
If the changed word within a line has different length on both side, the right side is displayed incorrectly. E.g. see http://www.mergely.com/lKGcLOqu/
Changing 'lhs' to 'rhs" in the second part of
jQuery.extend(Mgly.LCS.prototype, { ...
seems to correct the problem.
Hi,
is it possible to merge/insert a diff line above or below the opposite reference line?
Like in Meld with pressing the Ctrl-key?
Regards,
Stefan
Please Tag the releases with the versions so that tools can automatically reference them.
Right now they seem to be missing completely an exist only on your site in the download section.
Thank you.
If each release is published to bower, it can be automatically added to webjars meaning that Java based projects can pull it in as a dependency.
Hello,
I cannot find where is the source code for the following PHP files access from:
editor/editor.js
168: url: '/ajax/handle_get.php',
178: url: '/ajax/handle_get.php',
427: url: '/ajax/handle_file.php',
432: var url = '/ajax/handle_save.php?key=' + key;
476: url: '/ajax/handle_crossdomain.php',
The menu options do not work without them.
Any ideas?
Please add a JSFiddle example of Mergely.
This would allow users to try it right away, but would be also much easier
this way to send bug test cases by just forking and modifying that example.
Thank you.
Hi 😀
I would like to obtain Mergely in cdnjs, however, it requires accurate version of licenses.
Would you mind to provide the accurate version of licenses?
Thank you!
The link below is the license list which cdnjs followed :
https://spdx.org/licenses/
I noticed there's already Save .diff
option available, but it has some kind of unknown syntax to me. Would it be possible to implement more export options for saving diffs, for example git diff? Yes, I know I can just use git, or if I'm online I can go play with github's diff, but Mergely provides a very nice split diff where you can merge stuff in both directions. For github, or real code editor I'd need to:
git diff
againand there's only one-side merge option if I don't want to copy the exact lines of code.
With this feature available I could just dump what I edit in Mergely right to the .patch
file and send away.
Hi, I'm not sure if this is by design, but the default resize function ( https://github.com/wickedest/Mergely/blob/master/lib/mergely.js#L374 ) uses element's parent to get the 'width' (non-auto case) but to get the hieght, the window's height is used.
Is this deliberate? (it seems to break embedding mergely into a page part way down the sccreen)
It is work-aroundable, by setting both width + height to 'auto' and by providing the following settings methods:
_auto_height: function(h) {
return $(that._comparerElement).parent().height() - 20;
},
_auto_width: function(h) {
return $(that._comparerElement).parent().width();
},
but is this the correct thing for me to be doing ?
Several diff utilities I've encountered allow the option to "return to top" during search or "next diff" type operations.
I'd be happy to submit a pull request to add this functionality to Mergely
It should be possible to use mergely within a polymer element. Polymer elements use shadow dom (i.e. ids are unique within a "dom-module", but not guaranteed to be unique for the whole doc, or even queryable from the main document.
For all invocations of $() or jQuery() search beneath the main mergely element.
By merge file it will merge both deleted lines and added lines. It would be twice more functional if it would also let merge deletions/additions only. Otherwise I had to click manually on red color only.
I paste some words that may have '/t' in a word, then '/t' will be convert a label of span, so if it has a diff, The whole sentence will be signed, how can l t solve this ##problem?
Under the documentation page of the website, you have a section that says "Then, create a div for the editor:" with this code:
<div id="compare"><div>
Might avoid headaches for a few people who are just blindly copypasting if you fix the closing div tag.
I appreciate developing this really handy project.
Instead of merging I need to use Megely for change tracking. In the same way that it works in MS word or Google Docs.
I need to present the user a single text editor pre-filled with some paragraphs and once user start typing he sees changes real-time and in-line.
Can you please advise how can I achieve this result please?
Love this tool, it would be great if you could label each pane.
Example. When you are comparing dev and production code, you could easily identify which one is which.
To delete the new changes made on left side by pressing Merge button on the right side, it is throwing the 'ed[oside].removeLine is not a function' error in the console.
The is happened by using upgraded version of codemirror.
After viewing the upgrade notes of codemirror, it is identified that removeLine function is removed from the codemirror library which is why this error is happening now in codemirror version 4.
The refactoring is required to replace the old method with the new method called 'replaceRange'.
I pulled your last version of mergely (pre-3.0) SHA: b5e669d and when used with some other libraries that extend some of the prototypes (like Array); mergely will break because it doesn't check to verify that the property it is trying to use is its own.
I can submit a patch for this version if you want; but I realize this is now a "obsolete" version as you are working on the 3.0 branch. I do NOT know if the 3.0 has the same issue; but it was only a couple minutes of work to change doing a search for all "for" and then on any of the "in" for's, adding a "if (!y.hasOwnProperty(x)) continue; " as the first line in the loop.
I couldn't see from the current API how I would 'remove' the differencing overlays, say I have 'autoupdate' turned off, and want explicit control over when the differences are applied (or more accurately _un_applied!).
To achieve this I added the following external code :
var d= jQuery.data(this._comparerElement, "mergely");
for (var name in d.editor) {
if (!d.editor.hasOwnProperty(name)) continue;
var editor = d.editor[name];
// clear editor changes
editor.operation(function() {
var timer = new Mgly.Timer();
for (var i = 0, l = editor.lineCount(); i < l; ++i) {
editor.removeLineClass(i, 'background');
}
for (var i = 0; i < d.change_funcs.length; ++i) {
var edid = editor.getDoc().id;
var change =d.change_funcs[i];
if (change.doc.id != edid) continue;
if (change.lines.length) {
d.trace('change', 'clear text', edid, change.lines[0].text);
}
change.clear();
}
editor.clearGutter('merge');
d.trace('change', 'clear time', timer.stop());
});
}
d.change_funcs = [];
d._draw_diff(d.id + '-lhs', d.id + '-rhs', []);
(Taken from the mergely#_changed method with a minor difference in the last line.) Is there a correct way to achieve what I'm doing here without exposing the internals of mergely to the consuming code ?
Alternatively would you accept a pull request adding support for this to the mergely interface, if so what form would you like that call to take ?
Thank you :)
Is there any way to instruct mergely to ignore case?
I think it would be nice to be able to easily install mergely as a bower dependency. There is a repo, erahhal/bower-mergely, that provides that functionality but it is quite out of date as of now. I would suggest a bower.json in this repo, as it would assure that it remains up to date in the future. I could draw one up if there is no opposition.
Does Mergely require anything but a webserver to run? (eg: node, frameworks, etc)
"Oops - that file cannot be found."
How to make the edit panes "read-only" for user edits (with the keyboard), but allow the merge operations.
If I set:
...
cmsettings: {
readOnly: true,
lineNumbers: true
},
...
the merging buttons/actions on each side disappear too, so the merging operations are not possible anymore.
Thank you.
A request:
can we only display diff part of two files instead of display all content?
Please submit to Bower the latest version of Mergely. Right now it seems to contain only an old one (3.3.6)
Thank you.
It seems that the only effect of setting autoresize to true is that we get some style applied to the element, the background window-resize event listener is always applied even when autoresize is false.
Is that the expected behaviour? I had hoped to control resizing myself (as resizing also fires a 'changing' event, and I do not neccessarily wish this to fire)
Mergely sometimes it a little too eager when trying to find common text. Here's a silly, made up example:
http://www.mergely.com/HA4vHsTS/
Line 5 (on the left, or line 4 on the right), the content is pretty much entirely different. However, mergely highlights it to show that "ar and "o" are in common between both lines. This in practice, is useless, since these are letters in the middle of works that happen to be common. I'd prefer it if mergely simply marked these entire lines as different (like is does for line 4left, 3right)
Is this a reasonable tweak to make?
Even when the "Ignore white space" menu option is selected, extra and/or missing newlines are marked as differences in the editor, which is not the behavior that I would expect.
editor/editor.php 25: <link type="text/css" rel="stylesheet" href="/style/mergely-theme/jquery-ui-1.10.1.custom.css" />
I see a 404 response , due to missing directory and file. Is the mergely-theme no longer available?
The included /examples/ include some .txt files which I assume the browser is supposed to read and pre-populate the lhs/rhs diff panes, but they don't seem to load in any of my browsers: Chrome, Firefox, IE
is it possible to get a summary of diff result?
like number of modification, number of add, number of deletion
Thank you
It would be probably better if you used the full spelled out "jQuery" in mergely library for those using other libraries that take over the $ symbol and when using jQuery.noConflict(). Again I can submit a patch for the last 2.x branch if you want; it was a two second change to do quick search & replace of all $ -> jQuery in the mergly.js file.
I'm looking for a way to scroll to first change once editor is loaded, and both lhs and rhs sides loaded as well. The problem is that i think there's no callback once the diff calculation is done.
In case of large files generating diffs takes some time, and there's no nice way to call the scrollToDiff function then.
Am i missing something ?
How to combine Mergely with Twitter Bootstrap?
I have a editor_width: '500px'
setting for mergely but how can I make it to take the entire width available by Bootstrap?
e.g.
<div id="compare" class="col-sm-12"><div>
seems to ignore the width exposed by the '.col-sm-12'
IMHO there should be more a "min_editor_width" setting.
if i have more then two files with similar content,how to use it ?
The about page says It can be embedded within your own Web application to compare files, text, C, C++, Java, HTML, XML, CSS, and javascript.
http://www.mergely.com/about
When I compare 2 xml files with attributes in different order or tags in different order mergely marks these as differences when in fact they are identical in terms of xml.
Is it in fact only doing a basic text diff?
Are there plans for proper xml diff?
On the left hand side, clicking a row number to scroll to/highlight that diff doesn't work.
On the right hand side, clicking the "Merge left" buttons don't work.
Demo: http://codepen.io/Sphinxxxx/pen/grVvjG
(I'll add a pull request shortly)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.