const Timer = require('./timer'); const diff = require('./diff'); const DiffParser = require('./diff-parser'); const LCS = require('./lcs'); function CodeMirrorDiffView(el, options, { jQuery, CodeMirror }) { CodeMirror.defineExtension('centerOnCursor', function() { var coords = this.cursorCoords(null, 'local'); this.scrollTo(null, (coords.top + coords.bottom) / 2 - (this.getScrollerElement().clientHeight / 2)); }); this.jQuery = jQuery; this.CodeMirror = CodeMirror; this.init(el, options); }; CodeMirrorDiffView.prototype.init = function(el, options) { const { jQuery } = this; this.settings = { autoupdate: true, autoresize: true, rhs_margin: 'right', wrap_lines: false, line_numbers: true, lcs: true, sidebar: true, viewport: false, ignorews: false, ignorecase: false, ignoreaccents: false, fadein: 'fast', resize_timeout: 500, change_timeout: 150, fgcolor: {a:'#4ba3fa',c:'#a3a3a3',d:'#ff7f7f', // color for differences (soft color) ca:'#4b73ff',cc:'#434343',cd:'#ff4f4f'}, // color for currently active difference (bright color) bgcolor: '#eee', vpcolor: 'rgba(0, 0, 200, 0.5)', license: '', width: 'auto', height: 'auto', cmsettings: { styleSelectedText: true }, lhs_cmsettings: {}, rhs_cmsettings: {}, lhs: function(setValue) { }, rhs: function(setValue) { }, loaded: function() { }, resize: function(init) { const parent = jQuery(el).parent(); let w; let h; if (this.width == 'auto') { w = parent.width(); } else { w = this.width; } if (this.height == 'auto') { h = parent.height() - 2; } else { h = this.height; } const content_width = w / 2.0 - 2 * 8 - 8; const content_height = h; const self = jQuery(el); self.find('.mergely-column').css({ width: content_width + 'px' }); self.find('.mergely-column, .mergely-canvas, .mergely-margin, .mergely-column textarea, .CodeMirror-scroll, .cm-s-default').css({ height: content_height + 'px' }); self.find('.mergely-canvas').css({ height: content_height + 'px' }); self.find('.mergely-column textarea').css({ width: content_width + 'px' }); self.css({ width: w, height: h, clear: 'both' }); if (self.css('display') === 'none') { if (this.fadein != false) { self.fadeIn(this.fadein); } else { self.show(); } } if (this.resized) this.resized(); }, _debug: '', //scroll,draw,calc,diff,markup,change,init resized: function() { }, // user supplied options ...options }; // save this element for faster queries this.element = jQuery(el); this.lhs_cmsettings = { ...this.settings.cmsettings, ...this.settings.lhs_cmsettings, // these override any user-defined CodeMirror settings lineWrapping: this.settings.wrap_lines, lineNumbers: this.settings.line_numbers, gutters: (this.settings.line_numbers && ['merge', 'CodeMirror-linenumbers']) || [], }; this.rhs_cmsettings = { ...this.settings.cmsettings, ...this.settings.rhs_cmsettings, // these override any user-defined CodeMirror settings lineWrapping: this.settings.wrap_lines, lineNumbers: this.settings.line_numbers, gutters: (this.settings.line_numbers && ['merge', 'CodeMirror-linenumbers']) || [], }; // bind if the element is destroyed this.element.bind('destroyed', jQuery.proxy(this.teardown, this)); // save this instance in jQuery data, binding this view to the node jQuery.data(el, 'mergely', this); this._setOptions(options); }; CodeMirrorDiffView.prototype.unbind = function() { const { jQuery } = this; if (this.changed_timeout != null) clearTimeout(this.changed_timeout); this.editor[this.id + '-lhs'].toTextArea(); this.editor[this.id + '-rhs'].toTextArea(); jQuery(window).off('.mergely'); }; CodeMirrorDiffView.prototype.destroy = function() { this.element.unbind('destroyed', this.teardown); this.teardown(); }; CodeMirrorDiffView.prototype.teardown = function() { this.unbind(); }; CodeMirrorDiffView.prototype.lhs = function(text) { // invalidate existing changes and current position this.changes = []; delete this._current_diff; this.editor[this.id + '-lhs'].setValue(text); }; CodeMirrorDiffView.prototype.rhs = function(text) { // invalidate existing changes and current position this.changes = []; delete this._current_diff; this.editor[this.id + '-rhs'].setValue(text); }; CodeMirrorDiffView.prototype.update = function() { this._changing(this.id + '-lhs', this.id + '-rhs'); }; CodeMirrorDiffView.prototype.unmarkup = function() { this._clear(); }; CodeMirrorDiffView.prototype.scrollToDiff = function(direction) { if (!this.changes.length) return; if (direction == 'next') { if (this._current_diff == this.changes.length - 1) { this._current_diff = 0; } else { this._current_diff = Math.min(++this._current_diff, this.changes.length - 1); } } else if (direction == 'prev') { if (this._current_diff == 0) { this._current_diff = this.changes.length - 1; } else { this._current_diff = Math.max(--this._current_diff, 0); } } this._scroll_to_change(this.changes[this._current_diff]); this._changed(this.id + '-lhs', this.id + '-rhs'); }; CodeMirrorDiffView.prototype.mergeCurrentChange = function(side) { if (!this.changes.length) return; if (side == 'lhs' && !this.lhs_cmsettings.readOnly) { this._merge_change(this.changes[this._current_diff], 'rhs', 'lhs'); } else if (side == 'rhs' && !this.rhs_cmsettings.readOnly) { this._merge_change(this.changes[this._current_diff], 'lhs', 'rhs'); } }; CodeMirrorDiffView.prototype.scrollTo = function(side, num) { var le = this.editor[this.id + '-lhs']; var re = this.editor[this.id + '-rhs']; if (side == 'lhs') { le.setCursor(num); le.centerOnCursor(); } else { re.setCursor(num); re.centerOnCursor(); } }; CodeMirrorDiffView.prototype._setOptions = function(opts) { const { jQuery } = this; this.settings = { ...this.settings, ...opts }; if (this.settings.hasOwnProperty('rhs_margin')) { // dynami259*-6+cally swap the margin if (this.settings.rhs_margin == 'left') { this.element.find('.mergely-margin:last-child').insertAfter( this.element.find('.mergely-canvas')); } else { var target = this.element.find('.mergely-margin').last(); target.appendTo(target.parent()); } } if (this.settings.hasOwnProperty('sidebar')) { // dynamically enable sidebars if (this.settings.sidebar) { this.element.find('.mergely-margin').css({display: 'block'}); } else { this.element.find('.mergely-margin').css({display: 'none'}); } } var le, re; if (this.settings.hasOwnProperty('wrap_lines')) { if (this.editor) { le = this.editor[this.id + '-lhs']; re = this.editor[this.id + '-rhs']; le.setOption('lineWrapping', this.settings.wrap_lines); re.setOption('lineWrapping', this.settings.wrap_lines); } } if (this.settings.hasOwnProperty('line_numbers')) { if (this.editor) { le = this.editor[this.id + '-lhs']; re = this.editor[this.id + '-rhs']; le.setOption('lineNumbers', this.settings.line_numbers); re.setOption('lineNumbers', this.settings.line_numbers); } } }; CodeMirrorDiffView.prototype.options = function(opts) { if (opts) { this._setOptions(opts); if (this.settings.autoresize) this.resize(); if (this.settings.autoupdate) this.update(); } else { return this.settings; } }; CodeMirrorDiffView.prototype.swap = function() { if (this.lhs_cmsettings.readOnly || this.rhs_cmsettings.readOnly) return; var le = this.editor[this.id + '-lhs']; var re = this.editor[this.id + '-rhs']; var tmp = re.getValue(); re.setValue(le.getValue()); le.setValue(tmp); }; CodeMirrorDiffView.prototype.merge = function(side) { var le = this.editor[this.id + '-lhs']; var re = this.editor[this.id + '-rhs']; if (side == 'lhs' && !this.lhs_cmsettings.readOnly) le.setValue(re.getValue()); else if (!this.rhs_cmsettings.readOnly) re.setValue(le.getValue()); }; CodeMirrorDiffView.prototype.summary = function() { return { numChanges: this.changes.length, lhsLength: this.editor[this.id + '-lhs'].getValue().length, rhsLength: this.editor[this.id + '-rhs'].getValue().length, c: this.changes.filter(function (a) { return a.op === 'c'; }).length, a: this.changes.filter(function (a) { return a.op === 'a'; }).length, d: this.changes.filter(function (a) { return a.op === 'd'; }).length } }; CodeMirrorDiffView.prototype.get = function(side) { var ed = this.editor[this.id + '-' + side]; var t = ed.getValue(); if (t == undefined) return ''; return t; }; CodeMirrorDiffView.prototype.clear = function(side) { if (side == 'lhs' && this.lhs_cmsettings.readOnly) return; if (side == 'rhs' && this.rhs_cmsettings.readOnly) return; var ed = this.editor[this.id + '-' + side]; ed.setValue(''); delete this._current_diff; }; CodeMirrorDiffView.prototype.cm = function(side) { return this.editor[this.id + '-' + side]; }; CodeMirrorDiffView.prototype.search = function(side, query, direction) { var le = this.editor[this.id + '-lhs']; var re = this.editor[this.id + '-rhs']; var editor; if (side == 'lhs') editor = le; else editor = re; direction = (direction == 'prev') ? 'findPrevious' : 'findNext'; if ((editor.getSelection().length == 0) || (this.prev_query[side] != query)) { this.cursor[this.id] = editor.getSearchCursor(query, { line: 0, ch: 0 }, false); this.prev_query[side] = query; } var cursor = this.cursor[this.id]; if (cursor[direction]()) { editor.setSelection(cursor.from(), cursor.to()); } else { cursor = editor.getSearchCursor(query, { line: 0, ch: 0 }, false); } }; CodeMirrorDiffView.prototype.resize = function() { // recalculate line height as it may be zoomed this.em_height = null; this.settings.resize(); this._changing(this.id + '-lhs', this.id + '-rhs'); this._set_top_offset(this.id + '-lhs'); }; CodeMirrorDiffView.prototype.diff = function() { var lhs = this.editor[this.id + '-lhs'].getValue(); var rhs = this.editor[this.id + '-rhs'].getValue(); var d = new diff(lhs, rhs, this.settings); return d.normal_form(); }; CodeMirrorDiffView.prototype.bind = function(el) { const { jQuery, CodeMirror } = this; this.trace('init', 'bind'); this.element.hide(); this.id = jQuery(el).attr('id'); try { // ensure the id is valid for jQuery jQuery(`#${this.id}`); } catch (ex) { console.error(`jQuery failed to find mergely: #${this.id}`); return; } this.changed_timeout = null; this.chfns = {}; this.chfns[this.id + '-lhs'] = []; this.chfns[this.id + '-rhs'] = []; this.prev_query = []; this.cursor = []; this._skipscroll = {}; this.change_exp = new RegExp(/(\d+(?:,\d+)?)([acd])(\d+(?:,\d+)?)/); var merge_lhs_button; var merge_rhs_button; if (jQuery.button != undefined) { //jquery ui merge_lhs_button = ''; merge_rhs_button = ''; } else { // homebrew var style = 'opacity:0.6;height:16px;background-color:#bfbfbf;cursor:pointer;text-align:center;color:#eee;border:1px solid #848484;margin-right:-15px;margin-top:-2px;'; merge_lhs_button = '
<
'; merge_rhs_button = '
>
'; } this.merge_rhs_button = jQuery(merge_rhs_button); this.merge_lhs_button = jQuery(merge_lhs_button); // create the textarea and canvas elements var height = '10px'; var width = '10px'; var splash = jQuery('
'); var canvasLhs = jQuery(`
`); canvasLhs.find('#lhs-margin').attr('id', `${this.id}-lhs-margin`); var editorLhs = jQuery(`
`); editorLhs.eq(0).attr('id', `${this.id}-editor-lhs`); editorLhs.find('#text-lhs').attr('id', `${this.id}-lhs`); var canvasMid = jQuery(`
`); canvasMid.find('#mergely-canvas').attr('id', `${this.id}-mergely-canvas`); canvasMid.find('#lhs-rhs-canvas').attr('id', `${this.id}-lhs-${this.id}-rhs-canvas`); this.element.append(splash); this.element.append(canvasLhs); this.element.append(editorLhs); this.element.append(canvasMid); var canvasRhs = jQuery(`
`); canvasRhs.find('#rhs-margin').attr('id', `${this.id}-rhs-margin`); if (this.settings.rhs_margin == 'left') { this.element.append(canvasRhs); } var editorRhs = jQuery(`
`); editorRhs.eq(0).attr('id', `${this.id}-editor-rhs`); editorRhs.find('#text-rhs').attr('id', `${this.id}-rhs`); this.element.append(editorRhs); if (this.settings.rhs_margin != 'left') { this.element.append(canvasRhs); } if (!this.settings.sidebar) { this.element.find('.mergely-margin').css({display: 'none'}); } if (['lgpl-separate-notice', 'gpl-separate-notice', 'mpl-separate-notice', 'commercial'].indexOf(this.settings.license) < 0) { const _lic = { 'lgpl': 'GNU LGPL v3.0', 'gpl': 'GNU GPL v3.0', 'mpl': 'MPL 1.1' }; var lic = _lic[this.settings.license]; if (!lic) { lic = _lic['lgpl']; } const parenth = this.element.parent().height(); const parentw = this.element.parent().width(); const icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG4AAABuCAIAAABJObGsAAAAFXRFWHRDcmVhdGlvbiBUaW1lAAfbCw8UOxvjZ6kDAAAAB3RJTUUH2wsPFQESa9FGmQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAFDBJREFUeNrtXQtQVFeavk2DvF/yZlUetg+EJIqPIvgIEo1xIxArcWqiMZWqsVK1Mbprand0NVuVrY1WnN2NW8ZNzWasqawmupPAqMRdFDdG81BGGYIjLKiooA4QQUF5N4/ezz7w9+He233PbRoaCX9R1Onbp/9z/u/8/3/+87wGi8UijZMryMPdFRg75OnuCtglmEtLS8tDK+FjkJUCAwMNBoO7q6ZOowLKurq68vLySitVVFRcu3atubm5tbVV6XyAY0BAQEhIyLRp05KSkmZaKTk5OSYmxt1CSAY3+sqSkpJjx47l5+eXlpYOkdXs2bOzs7NzcnJSU1PdJc4jOxpJMpvNhYWFGzdunDx58nCIA7ZgjiJQ0AiLNkJaCa93/Phx6GBBQQHzfQ7I09MTbtF7gCZMmICHgKZrgMChp6fHMRNwWLlyJfR01apV8LAjIOOwQwnJP/roo507d967d89enrCwMJPJFB4eHmYloOC4b0GdgeY9KzU2NlZVVTlmvmPHjjfffBOt8rhC2dfXd+jQoXf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aGP8wbnBS8fHxrHOnjTeqMicmJqanp8OQ8RNITtwY4SO4ocGmTJkCbhgIOl5lQZXgc9LS0hB4gxvf50CTPv/8czpfs2/fPnsvBHD+aL3sQDs7Dw4llR2zAojs+Dpkg1TKg/FKbsoLBmQM2VY6hr69mwbYMWviBjSVdWPc4FvBkB2zZxEVz80FR+sl64UPFBihyE2bNik3CypvKVDyYWXLbntQJeJmjxXPUJybg7oxblQ3afAswcOHDz/88ENqgIKCAmcufGAETSSPCyVVjpbGNuXn59PhnMzMTGiog8waAfbu3buplUpLS69fv+5u6UaOICwdGQEIgMJxfg0o4YzXrFnD0jCQ3NxcNy77jCRBTAhLPgEgaF5Jr30nG7rv+fPn0+QSevYNGzaM7Quw0E3t37+fgjyEKBcvXtS8jF57BM3uYSfsUEBeXt7IvFrGLQTRICDhCMEhvsil/kKTEQsWLEAr0UcM7E+d0n2U4XEhiMZP4kBwwev8Red11q1bx9+khbG98q0lY4AgFD9tsW3bNvGL/HXc9Qsf/OKLL9LFqohmX3/99bF0seqdO3c++eQTWiDLyso6evSo+BX+49cm99PQr00ev8z7EbnhMm9G41fMq9L4iw/c+uIDRuOv45DR+Eti+smdL4lhNP7qIqLxF2qNmhdqEY2/5m385YOj7+WDROOvxHQxjb+o1ZU0/vpgF9P4S61dTD+FV63bFotHhoBIYWHhxo0baae2awlswRxFsFsTR5JGSCtVqaSkBHqKYS+tkTpNGF9lZ2dDB+3tQhkBcieURIhXysvLWb9RUVGBIKa5uZndOyOvrvWwdUhICIKqpKQk1mslJyfz52fcRaMCSlWyWO+deWglyer7QPwVAKONRi+Ujx0NV5D1E6T/BwkHUltwIapAAAAAAElFTkSuQmCC'; this.element.find('#mergely-splash').css({ position: 'absolute', zIndex: '100', backgroundColor: '#fff', border: '1px solid black', height: '70px', width: '300px', left: (parentw - 300) / 2, padding: '10px 10px 0 10px', fontFamily: 'arial', fontSize: '11px' }).append('

mergelyThis software is a Combined Work using Mergely and is covered by the ' + lic + ' license. For the full license, see http://www.mergely.com/license.

'); jQuery('body').one('click', function () { jQuery('#mergely-splash').fadeOut(100, 'linear', function () { jQuery('#mergely-splash').remove(); }); }); } // check initialization var rhstx; try { rhstx = this.element.find(`#${this.id}-rhs`).get(0); } catch (ex) { } if (!rhstx) { console.error('rhs textarea not defined - Mergely not initialized properly'); return; } var lhstx; try { lhstx = this.element.find(`#${this.id}-lhs`).get(0); } catch (ex) { } if (!lhstx) { console.error('lhs textarea not defined - Mergely not initialized properly'); return; } // get current diff border color var color = jQuery('