Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07f32b9a7d | ||
|
|
60d18f8d5c | ||
|
|
4bd19c6e2e | ||
|
|
02e383d94d | ||
|
|
b09671febe | ||
|
|
1702bd6e0a | ||
|
|
5e4dfc9e78 | ||
|
|
827487a598 | ||
|
|
bc46617d5e | ||
|
|
dec1e9509d | ||
|
|
0733f3a6c6 | ||
|
|
254adf15ab | ||
|
|
a07073a13c | ||
|
|
3facfec6b7 | ||
|
|
2b561c1856 | ||
|
|
cd09815b7d | ||
|
|
cb46821103 | ||
|
|
7b2040c6ad | ||
|
|
df7d23244b |
62
CHANGELOG.md
62
CHANGELOG.md
@@ -1,3 +1,45 @@
|
||||
## [5.1.2](https://github.com/wickedest/Mergely/compare/v5.1.1...v5.1.2) (2024-05-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* trace only when debug enabled ([#194](https://github.com/wickedest/Mergely/issues/194)) ([60d18f8](https://github.com/wickedest/Mergely/commit/60d18f8d5c0df349b4806b2e8a6c0f79d9f8074e))
|
||||
|
||||
## [5.1.1](https://github.com/wickedest/Mergely/compare/v5.1.0...v5.1.1) (2024-03-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **#183:** fixes undefined 'k' due to scoped 'let' ([02e383d](https://github.com/wickedest/Mergely/commit/02e383d94d685e41cb68d945b9726bbcbfeb0ccf))
|
||||
|
||||
# [5.1.0](https://github.com/wickedest/Mergely/compare/v5.0.4...v5.1.0) (2023-08-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support CM modes: go, javascript, htmlmixed, markdown, python ([827487a](https://github.com/wickedest/Mergely/commit/827487a5983cb89ef41415435d44239e35983b9a))
|
||||
|
||||
## [5.0.4](https://github.com/wickedest/Mergely/compare/v5.0.3...v5.0.4) (2023-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* updated CDN example ([dec1e95](https://github.com/wickedest/Mergely/commit/dec1e9509d94811914e77cbc33dc1aaedf154f7c))
|
||||
|
||||
## [5.0.3](https://github.com/wickedest/Mergely/compare/v5.0.2...v5.0.3) (2023-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Updated docs with CDN example ([254adf1](https://github.com/wickedest/Mergely/commit/254adf15ab09fe9c5c3dff542d0a7f62ce2c9782))
|
||||
|
||||
## [5.0.2](https://github.com/wickedest/Mergely/compare/v5.0.1...v5.0.2) (2023-04-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **scroll:** fixed issue where first rhs scroll was unlinked ([7b2040c](https://github.com/wickedest/Mergely/commit/7b2040c6ad17ea70a09720f54d9a255cdc57cd67))
|
||||
|
||||
## [5.0.1](https://github.com/wickedest/Mergely/compare/v5.0.0...v5.0.1) (2023-04-23)
|
||||
|
||||
|
||||
@@ -9,6 +51,26 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [5.0.0](https://github.com/wickedest/Mergely/compare/v4.3.9...v5.0.0) (2023-04-23)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
- Mergely is no longer a jQuery plugin.
|
||||
- Removed options.autoresize
|
||||
- Removed options.editor_width
|
||||
- Removed options.editor_height
|
||||
- Removed options.fadein
|
||||
- Removed options.fgcolor
|
||||
- Removed options.resize
|
||||
- Removed options.width
|
||||
- Removed options.height
|
||||
- Removed options.loaded callback
|
||||
- Removed options.resized callback
|
||||
- Removed styles .mergely-resizer, .mergely-full-screen-0, and .mergely-full-screen-8
|
||||
- Changed default for options.change_timeout changed from 150 to 50.
|
||||
- No longer automatically scrolls to first change.
|
||||
|
||||
### 4.3.9 (2022-01-19)
|
||||
|
||||
|
||||
|
||||
18
README.md
18
README.md
@@ -4,7 +4,7 @@
|
||||
|
||||
https://mergely.com
|
||||
|
||||
Mergely is a JavaScript component for differencing and merging files interactively in a browser (diff/merge). It provides a rich API that enables you to easily integrate Mergely into your existing web application. It is suitable for comparing text files online, for example, .txt, .html, .xml, .c, .cpp, .java, etc.
|
||||
Mergely is a JavaScript component for differencing and merging files interactively in a browser (diff/merge). It provides a rich API that enables you to easily integrate Mergely into your existing web application. It is suitable for comparing text files online, such as .txt, .html, .xml, .c, .cpp, .java, .js, etc.
|
||||
|
||||
Mergely has a JavaScript implementation of the Longest Common Subsequence (LCS) diff algorithm, and a customizable markup engine. It computes the diff within the browser.
|
||||
|
||||
@@ -36,11 +36,11 @@ rm -rf .git
|
||||
|
||||
### Usage via CDN
|
||||
|
||||
Unpack mergely.tgz into a folder, for example, `./lib`, and add the following to the `<head>` of your target HTML source file.
|
||||
Add the following to the `<head>` of your target HTML source file. Note that `codemirror` is bundled.
|
||||
|
||||
```html
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.css"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.min.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.css" />
|
||||
```
|
||||
|
||||
### Synchronous initialization
|
||||
@@ -82,6 +82,16 @@ Mergely will emit an `updated` event when the editor is first initialized, and e
|
||||
</body>
|
||||
```
|
||||
|
||||
### Visualization modes
|
||||
|
||||
Mergely supports the following CodeMirror visualizations for [mode](codemirror.net/5/doc/manual.html#option_mode):
|
||||
|
||||
* go
|
||||
* javascript
|
||||
* htmlmixed
|
||||
* markdown
|
||||
* python
|
||||
|
||||
## Options
|
||||
|
||||
|Option|Type|Default value|Description|
|
||||
|
||||
38
examples/cdn.html
Normal file
38
examples/cdn.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Mergely - Example full page editor</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1, IE=edge">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="mergely,diff,merge,compare" />
|
||||
<meta name="author" content="Jamie Peabody" />
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
||||
|
||||
<!-- Mergely -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.min.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.css" />
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
#compare {
|
||||
height: inherit;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="compare"></div>
|
||||
|
||||
<script>
|
||||
const mergely = new Mergely('#compare');
|
||||
mergely.once('updated', () => {
|
||||
mergely.lhs('the quick red fox\njumped over the hairy dog');
|
||||
mergely.rhs('the quick brown fox\njumped over the lazy dog');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -21,6 +21,9 @@ This example demonstrates the minimum amount of code required to use Mergely.
|
||||
<h1>Examples</h1>
|
||||
|
||||
<dl>
|
||||
<dt><a href="cdn.html">cdn.html</a></dt>
|
||||
<dd>Demonstrates how to use Mergely with CDN.</dd>
|
||||
|
||||
<dt><a href="editor.html">editor.html</a></dt>
|
||||
<dd>An example editor showcasing some of Mergely's API features.</dd>
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
"changelog" : {
|
||||
"commitTypes": [
|
||||
"docs",
|
||||
"feat",
|
||||
"fix",
|
||||
"perf",
|
||||
|
||||
149
package-lock.json
generated
149
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "mergely",
|
||||
"version": "5.0.1",
|
||||
"version": "5.1.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mergely",
|
||||
"version": "5.0.1",
|
||||
"version": "5.1.2",
|
||||
"license": "(GPL-3.0 OR LGPL-3.0 OR MPL-1.1 OR SEE LICENSE IN LICENSE)",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.6",
|
||||
@@ -60,12 +60,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz",
|
||||
"integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==",
|
||||
"version": "7.22.13",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz",
|
||||
"integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.18.6"
|
||||
"@babel/highlight": "^7.22.13",
|
||||
"chalk": "^2.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -111,12 +112,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/generator": {
|
||||
"version": "7.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz",
|
||||
"integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==",
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz",
|
||||
"integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.21.4",
|
||||
"@babel/types": "^7.23.0",
|
||||
"@jridgewell/gen-mapping": "^0.3.2",
|
||||
"@jridgewell/trace-mapping": "^0.3.17",
|
||||
"jsesc": "^2.5.1"
|
||||
@@ -239,9 +240,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-environment-visitor": {
|
||||
"version": "7.18.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz",
|
||||
"integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==",
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz",
|
||||
"integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -260,25 +261,25 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-function-name": {
|
||||
"version": "7.21.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz",
|
||||
"integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==",
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz",
|
||||
"integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.20.7",
|
||||
"@babel/types": "^7.21.0"
|
||||
"@babel/template": "^7.22.15",
|
||||
"@babel/types": "^7.23.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-hoist-variables": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz",
|
||||
"integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==",
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz",
|
||||
"integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.18.6"
|
||||
"@babel/types": "^7.22.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -408,30 +409,30 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-split-export-declaration": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz",
|
||||
"integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==",
|
||||
"version": "7.22.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz",
|
||||
"integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.18.6"
|
||||
"@babel/types": "^7.22.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.19.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz",
|
||||
"integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==",
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz",
|
||||
"integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-validator-identifier": {
|
||||
"version": "7.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz",
|
||||
"integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==",
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz",
|
||||
"integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -476,13 +477,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz",
|
||||
"integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==",
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz",
|
||||
"integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.18.6",
|
||||
"chalk": "^2.0.0",
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"chalk": "^2.4.2",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -490,9 +491,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz",
|
||||
"integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==",
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz",
|
||||
"integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
@@ -1611,33 +1612,33 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@babel/template": {
|
||||
"version": "7.20.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz",
|
||||
"integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz",
|
||||
"integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.18.6",
|
||||
"@babel/parser": "^7.20.7",
|
||||
"@babel/types": "^7.20.7"
|
||||
"@babel/code-frame": "^7.22.13",
|
||||
"@babel/parser": "^7.22.15",
|
||||
"@babel/types": "^7.22.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/traverse": {
|
||||
"version": "7.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz",
|
||||
"integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==",
|
||||
"version": "7.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz",
|
||||
"integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.21.4",
|
||||
"@babel/generator": "^7.21.4",
|
||||
"@babel/helper-environment-visitor": "^7.18.9",
|
||||
"@babel/helper-function-name": "^7.21.0",
|
||||
"@babel/helper-hoist-variables": "^7.18.6",
|
||||
"@babel/helper-split-export-declaration": "^7.18.6",
|
||||
"@babel/parser": "^7.21.4",
|
||||
"@babel/types": "^7.21.4",
|
||||
"@babel/code-frame": "^7.22.13",
|
||||
"@babel/generator": "^7.23.0",
|
||||
"@babel/helper-environment-visitor": "^7.22.20",
|
||||
"@babel/helper-function-name": "^7.23.0",
|
||||
"@babel/helper-hoist-variables": "^7.22.5",
|
||||
"@babel/helper-split-export-declaration": "^7.22.6",
|
||||
"@babel/parser": "^7.23.0",
|
||||
"@babel/types": "^7.23.0",
|
||||
"debug": "^4.1.0",
|
||||
"globals": "^11.1.0"
|
||||
},
|
||||
@@ -1646,13 +1647,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz",
|
||||
"integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==",
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz",
|
||||
"integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.19.4",
|
||||
"@babel/helper-validator-identifier": "^7.19.1",
|
||||
"@babel/helper-string-parser": "^7.22.5",
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -6899,9 +6900,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io": {
|
||||
"version": "6.4.1",
|
||||
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.4.1.tgz",
|
||||
"integrity": "sha512-JFYQurD/nbsA5BSPmbaOSLa3tSVj8L6o4srSwXXY3NqE+gGUNmmPTbhn8tjzcCtSqhFgIeqef81ngny8JM25hw==",
|
||||
"version": "6.4.2",
|
||||
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.4.2.tgz",
|
||||
"integrity": "sha512-FKn/3oMiJjrOEOeUub2WCox6JhxBXq/Zn3fZOMCBxKnNYtsdKjxhl7yR3fZhM9PV+rdE75SU5SYMc+2PGzo+Tg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/cookie": "^0.4.1",
|
||||
@@ -14877,9 +14878,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.21",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz",
|
||||
"integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==",
|
||||
"version": "8.4.31",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -14889,10 +14890,14 @@
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.4",
|
||||
"nanoid": "^3.3.6",
|
||||
"picocolors": "^1.0.0",
|
||||
"source-map-js": "^1.0.2"
|
||||
},
|
||||
@@ -16564,9 +16569,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-parser": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz",
|
||||
"integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==",
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.3.tgz",
|
||||
"integrity": "sha512-JMafRntWVO2DCJimKsRTh/wnqVvO4hrfwOqtO7f+uzwsQMuxO6VwImtYxaQ+ieoyshWOTJyV0fA21lccEXRPpQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mergely",
|
||||
"version": "5.0.1",
|
||||
"version": "5.1.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": {
|
||||
|
||||
174
src/diff-view.js
174
src/diff-view.js
@@ -2,6 +2,12 @@ const CodeMirror = require('codemirror');
|
||||
require('codemirror/addon/search/searchcursor.js');
|
||||
require('codemirror/addon/selection/mark-selection.js');
|
||||
require('codemirror/lib/codemirror.css');
|
||||
require('codemirror/mode/go/go.js');
|
||||
require('codemirror/mode/javascript/javascript.js');
|
||||
require('codemirror/mode/htmlmixed/htmlmixed.js');
|
||||
require('codemirror/mode/markdown/markdown.js');
|
||||
require('codemirror/mode/python/python.js');
|
||||
|
||||
const dom = require('./dom.js');
|
||||
const VDoc = require('./vdoc');
|
||||
|
||||
@@ -45,15 +51,14 @@ CodeMirrorDiffView.prototype.init = function(el, options = {}) {
|
||||
gutters: (this.settings.line_numbers && [ 'merge', 'CodeMirror-linenumbers' ]) || [],
|
||||
};
|
||||
this._vdoc = new VDoc({ _debug: this.settings._debug });
|
||||
this._linkedScrollTimeout = {};
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.unbind = function() {
|
||||
if (this._unbound) {
|
||||
return;
|
||||
}
|
||||
if (this.settings._debug) {
|
||||
trace('api#unbind');
|
||||
}
|
||||
this.trace('api#unbind');
|
||||
if (this._changedTimeout != null) {
|
||||
clearTimeout(this._changedTimeout);
|
||||
}
|
||||
@@ -82,9 +87,7 @@ CodeMirrorDiffView.prototype.readOnly = function(side) {
|
||||
}
|
||||
|
||||
CodeMirrorDiffView.prototype.lhs = function(text) {
|
||||
if (this.settings._debug) {
|
||||
trace('api#lhs', text && text.length);
|
||||
}
|
||||
this.trace('api#lhs', text && text.length);
|
||||
// invalidate existing changes and current position
|
||||
this.changes = [];
|
||||
this._current_diff = -1;
|
||||
@@ -93,33 +96,25 @@ CodeMirrorDiffView.prototype.lhs = function(text) {
|
||||
|
||||
CodeMirrorDiffView.prototype.rhs = function(text) {
|
||||
// invalidate existing changes and current position
|
||||
if (this.settings._debug) {
|
||||
trace('api#rhs', text && text.length);
|
||||
}
|
||||
this.trace('api#rhs', text && text.length);
|
||||
this.changes = [];
|
||||
this._current_diff = -1;
|
||||
this.editor.rhs.setValue(text);
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.update = function() {
|
||||
if (this.settings._debug) {
|
||||
trace('api#update');
|
||||
}
|
||||
this.trace('api#update');
|
||||
this.el.dispatchEvent(new Event('changed'));
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.unmarkup = function() {
|
||||
if (this.settings._debug) {
|
||||
trace('api#unmarkup');
|
||||
}
|
||||
this.trace('api#unmarkup');
|
||||
this._clear();
|
||||
this.el.dispatchEvent(new Event('updated'));
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.scrollToDiff = function(direction) {
|
||||
if (this.settings._debug) {
|
||||
trace('api#scrollToDiff', direction);
|
||||
}
|
||||
this.trace('api#scrollToDiff', direction);
|
||||
if (!this.changes.length) return;
|
||||
if (direction === 'next') {
|
||||
if (this._current_diff === this.changes.length - 1
|
||||
@@ -136,18 +131,14 @@ CodeMirrorDiffView.prototype.scrollToDiff = function(direction) {
|
||||
this._current_diff = Math.max(--this._current_diff, 0);
|
||||
}
|
||||
}
|
||||
if (this.settings._debug) {
|
||||
trace('change', 'current-diff', this._current_diff);
|
||||
}
|
||||
this.trace('change', 'current-diff', this._current_diff);
|
||||
// _current_diff changed, refresh the view
|
||||
this._scroll_to_change(this.changes[this._current_diff]);
|
||||
this.setChanges(this.changes);
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.mergeCurrentChange = function(side) {
|
||||
if (this.settings._debug) {
|
||||
trace('api#mergeCurrentChange', side);
|
||||
}
|
||||
this.trace('api#mergeCurrentChange', side);
|
||||
if (!this.changes.length) return;
|
||||
if (side == 'lhs' && !this.lhs_cmsettings.readOnly) {
|
||||
this._merge_change(this.changes[this._current_diff], 'rhs', 'lhs');
|
||||
@@ -158,9 +149,7 @@ CodeMirrorDiffView.prototype.mergeCurrentChange = function(side) {
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.scrollTo = function(side, num) {
|
||||
if (this.settings._debug) {
|
||||
trace('api#scrollTo', side, num);
|
||||
}
|
||||
this.trace('api#scrollTo', side, num);
|
||||
const ed = this.editor[side];
|
||||
ed.setCursor(num);
|
||||
ed.centerOnCursor();
|
||||
@@ -174,9 +163,7 @@ CodeMirrorDiffView.prototype.setOptions = function(opts) {
|
||||
...this.settings,
|
||||
...opts
|
||||
};
|
||||
if (this.settings._debug) {
|
||||
trace('api#setOptions', opts);
|
||||
}
|
||||
this.trace('api#setOptions', opts);
|
||||
|
||||
// if options set after init
|
||||
if (this.editor) {
|
||||
@@ -209,9 +196,7 @@ CodeMirrorDiffView.prototype.setOptions = function(opts) {
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.get = function(side) {
|
||||
if (this.settings._debug) {
|
||||
trace('api#get', side);
|
||||
}
|
||||
this.trace('api#get', side);
|
||||
const ed = this.editor[side];
|
||||
const value = ed.getValue();
|
||||
if (value === undefined) {
|
||||
@@ -221,16 +206,12 @@ CodeMirrorDiffView.prototype.get = function(side) {
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.cm = function(side) {
|
||||
if (this.settings._debug) {
|
||||
trace('api#cm', 'side');
|
||||
}
|
||||
this.trace('api#cm', 'side');
|
||||
return this.editor[side];
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.search = function(side, query, direction) {
|
||||
if (this.settings._debug) {
|
||||
trace('api#search', side, query, direction);
|
||||
}
|
||||
this.trace('api#search', side, query, direction);
|
||||
const editor = this.editor[side];
|
||||
if (!editor.getSearchCursor) {
|
||||
throw new Error('install CodeMirror search addon');
|
||||
@@ -257,9 +238,7 @@ CodeMirrorDiffView.prototype.search = function(side, query, direction) {
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.resize = function() {
|
||||
if (this.settings._debug) {
|
||||
trace('api#resize');
|
||||
}
|
||||
this.trace('api#resize');
|
||||
const parent = this.el;
|
||||
const contentHeight = parent.offsetHeight - 2;
|
||||
|
||||
@@ -282,9 +261,7 @@ CodeMirrorDiffView.prototype.resize = function() {
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.bind = function(container) {
|
||||
if (this.settings._debug) {
|
||||
trace('api#bind', container);
|
||||
}
|
||||
this.trace('api#bind', container);
|
||||
this._origEl = {
|
||||
style: container.style,
|
||||
className: container.className
|
||||
@@ -406,9 +383,7 @@ CodeMirrorDiffView.prototype.bind = function(container) {
|
||||
}
|
||||
});
|
||||
this.editor.rhs.on('beforeChange', (cm, ev) => {
|
||||
if (this.settings._debug) {
|
||||
trace('event#rhs-beforeChange', ev);
|
||||
}
|
||||
this.trace('event#rhs-beforeChange', ev);
|
||||
if (ev.text.length > 1
|
||||
|| ((ev.from.line - ev.to.line) && ev.origin === '+delete')) {
|
||||
this._clear();
|
||||
@@ -416,24 +391,16 @@ CodeMirrorDiffView.prototype.bind = function(container) {
|
||||
});
|
||||
|
||||
this.editor.lhs.on('change', (instance, ev) => {
|
||||
if (this.settings._debug) {
|
||||
trace('event#lhs-change');
|
||||
}
|
||||
this.trace('event#lhs-change');
|
||||
this._changing();
|
||||
if (this.settings._debug) {
|
||||
trace('event#lhs-change [emitted]');
|
||||
}
|
||||
this.trace('event#lhs-change [emitted]');
|
||||
});
|
||||
this.editor.lhs.on('scroll', () => {
|
||||
if (this._skipscroll.lhs) {
|
||||
if (this.settings._debug) {
|
||||
trace('event#lhs-scroll (skipped)');
|
||||
}
|
||||
this.trace('event#lhs-scroll (skipped)');
|
||||
return;
|
||||
} else {
|
||||
if (this.settings._debug) {
|
||||
trace('event#lhs-scroll');
|
||||
}
|
||||
this.trace('event#lhs-scroll');
|
||||
}
|
||||
// firefox scroll-linked effect render issue
|
||||
setTimeout(() => {
|
||||
@@ -441,21 +408,15 @@ CodeMirrorDiffView.prototype.bind = function(container) {
|
||||
}, 1);
|
||||
});
|
||||
this.editor.rhs.on('change', (instance, ev) => {
|
||||
if (this.settings._debug) {
|
||||
trace('event#rhs-change', ev);
|
||||
}
|
||||
this.trace('event#rhs-change', ev);
|
||||
this._changing();
|
||||
});
|
||||
this.editor.rhs.on('scroll', () => {
|
||||
if (this._skipscroll.rhs) {
|
||||
if (this.settings._debug) {
|
||||
trace('event#rhs-scroll (skipped)');
|
||||
}
|
||||
this.trace('event#rhs-scroll (skipped)');
|
||||
return;
|
||||
} else {
|
||||
if (this.settings._debug) {
|
||||
trace('event#rhs-scroll');
|
||||
}
|
||||
this.trace('event#rhs-scroll');
|
||||
}
|
||||
// firefox scroll-linked effect render issue
|
||||
setTimeout(() => {
|
||||
@@ -468,7 +429,7 @@ CodeMirrorDiffView.prototype.bind = function(container) {
|
||||
const resize = () => {
|
||||
if (this.settings._debug) {
|
||||
traceTimeStart('event#resize');
|
||||
trace('event#resize [start]');
|
||||
this.trace('event#resize [start]');
|
||||
}
|
||||
this.resize();
|
||||
if (this.settings._debug) {
|
||||
@@ -525,16 +486,12 @@ CodeMirrorDiffView.prototype.bind = function(container) {
|
||||
}
|
||||
|
||||
this.editor.lhs.on('gutterClick', (cm, n, gutterClass, ev) => {
|
||||
if (this.settings._debug) {
|
||||
trace('event#gutterClick', 'lhs', n, ev);
|
||||
}
|
||||
this.trace('event#gutterClick', 'lhs', n, ev);
|
||||
gutterClicked.call(this, 'lhs', n, ev);
|
||||
});
|
||||
|
||||
this.editor.rhs.on('gutterClick', (cm, n, gutterClass, ev) => {
|
||||
if (this.settings._debug) {
|
||||
trace('event#gutterClick', 'rhs', n, ev);
|
||||
}
|
||||
this.trace('event#gutterClick', 'rhs', n, ev);
|
||||
gutterClicked.call(this, 'rhs', n, ev);
|
||||
});
|
||||
|
||||
@@ -682,18 +639,14 @@ CodeMirrorDiffView.prototype._scrolling = function({ side }) {
|
||||
const vp = this.editor[oside].getViewport();
|
||||
let scroll = true;
|
||||
if (last_change) {
|
||||
if (this.settings._debug) {
|
||||
trace('scroll#_scrolling', 'last change before midline', last_change);
|
||||
}
|
||||
this.trace('scroll#_scrolling', 'last change before midline', last_change);
|
||||
if (midline.line >= vp.from && midline <= vp.to) {
|
||||
scroll = false;
|
||||
}
|
||||
}
|
||||
if (scroll || force_scroll) {
|
||||
// scroll the other side
|
||||
if (this.settings._debug) {
|
||||
trace('scroll#_scrolling', 'other side', oside, 'pos:', top_to - top_adjust);
|
||||
}
|
||||
this.trace('scroll#_scrolling', 'other side', oside, 'pos:', top_to - top_adjust);
|
||||
|
||||
// disable linked scroll events for the opposite editor because this
|
||||
// triggers the next one explicitly, and we don't want to link the
|
||||
@@ -701,18 +654,21 @@ CodeMirrorDiffView.prototype._scrolling = function({ side }) {
|
||||
// coming in 2s, so this will "link" scrolling the other editor to
|
||||
// this editor until this editor stops scrolling and times out.
|
||||
this._skipscroll[oside] = true;
|
||||
if (this._linkedScrollTimeout) {
|
||||
clearTimeout(this._linkedScrollTimeout);
|
||||
this.trace('scroll#set oside skip set:', oside, this._skipscroll);
|
||||
if (this._linkedScrollTimeout[oside]) {
|
||||
clearTimeout(this._linkedScrollTimeout[oside]);
|
||||
this.trace('scroll#clearing timeout:', this._skipscroll);
|
||||
}
|
||||
this._linkedScrollTimeout = setTimeout(() => {
|
||||
this._linkedScrollTimeout[oside] = setTimeout(() => {
|
||||
this._skipscroll[oside] = false;
|
||||
this.trace('scroll#set oside skip unset:', oside, this._skipscroll);
|
||||
}, 100);
|
||||
|
||||
const top = top_to - top_adjust;
|
||||
// scroll the opposite editor
|
||||
this.editor[oside].scrollTo(left_to, top);
|
||||
} else if (this.settings._debug) {
|
||||
trace('scroll#_scrolling', 'not scrolling other side');
|
||||
} else {
|
||||
this.trace('scroll#_scrolling', 'not scrolling other side');
|
||||
}
|
||||
this._renderChanges();
|
||||
|
||||
@@ -723,23 +679,19 @@ CodeMirrorDiffView.prototype._scrolling = function({ side }) {
|
||||
|
||||
CodeMirrorDiffView.prototype._changing = function() {
|
||||
if (!this.settings.autoupdate) {
|
||||
if (this.settings._debug) {
|
||||
trace('change#_changing autoupdate is disabled');
|
||||
}
|
||||
this.trace('change#_changing autoupdate is disabled');
|
||||
return;
|
||||
}
|
||||
if (this.settings._debug) {
|
||||
traceTimeStart('change#_changing');
|
||||
trace('change#_changing [start]');
|
||||
this.trace('change#_changing [start]');
|
||||
}
|
||||
const handleChange = () => {
|
||||
this._changedTimeout = null;
|
||||
this.el.dispatchEvent(new Event('changed'));
|
||||
};
|
||||
if (this.settings.change_timeout > 0) {
|
||||
if (this.settings._debug) {
|
||||
trace('change#setting timeout', this.settings.change_timeout)
|
||||
}
|
||||
this.trace('change#setting timeout', this.settings.change_timeout)
|
||||
if (this._changedTimeout != null) {
|
||||
clearTimeout(this._changedTimeout);
|
||||
}
|
||||
@@ -753,9 +705,7 @@ CodeMirrorDiffView.prototype._changing = function() {
|
||||
};
|
||||
|
||||
CodeMirrorDiffView.prototype.setChanges = function(changes) {
|
||||
if (this.settings._debug) {
|
||||
trace('change#setChanges');
|
||||
}
|
||||
this.trace('change#setChanges');
|
||||
this._clear();
|
||||
// after clear, set the new changes
|
||||
this.changes = changes;
|
||||
@@ -765,7 +715,7 @@ CodeMirrorDiffView.prototype.setChanges = function(changes) {
|
||||
CodeMirrorDiffView.prototype._renderChanges = function() {
|
||||
if (this.settings._debug) {
|
||||
traceTimeStart('draw#_renderChanges');
|
||||
trace('draw#_renderChanges [start]', this.changes.length, 'changes');
|
||||
this.trace('draw#_renderChanges [start]', this.changes.length, 'changes');
|
||||
}
|
||||
this._clearCanvases();
|
||||
this._calculateOffsets(this.changes);
|
||||
@@ -1093,12 +1043,9 @@ CodeMirrorDiffView.prototype._renderDiff = function(changes) {
|
||||
const ctx_lhs = mcanvas_lhs.getContext('2d');
|
||||
const ctx_rhs = mcanvas_rhs.getContext('2d');
|
||||
|
||||
if (this.settings._debug
|
||||
&& this.settings._debug) {
|
||||
trace('draw#_renderDiff', 'visible page height', ex.visible_page_height);
|
||||
trace('draw#_renderDiff', 'scroller-top lhs', ex.lhs_scroller.scrollTop);
|
||||
trace('draw#_renderDiff', 'scroller-top rhs', ex.rhs_scroller.scrollTop);
|
||||
}
|
||||
this.trace('draw#_renderDiff', 'visible page height', ex.visible_page_height);
|
||||
this.trace('draw#_renderDiff', 'scroller-top lhs', ex.lhs_scroller.scrollTop);
|
||||
this.trace('draw#_renderDiff', 'scroller-top rhs', ex.rhs_scroller.scrollTop);
|
||||
|
||||
ex.lhs_margin.removeEventListener('click', this._handleLhsMarginClick);
|
||||
ex.rhs_margin.removeEventListener('click', this._handleRhsMarginClick);
|
||||
@@ -1123,17 +1070,16 @@ CodeMirrorDiffView.prototype._renderDiff = function(changes) {
|
||||
const rhs_y_end = change['rhs-y-end'] - rhsScrollTop;
|
||||
|
||||
if (Number.isNaN(lhs_y_start)) {
|
||||
trace('draw#_renderDiff', 'unexpected NaN',
|
||||
change['lhs-y-start'], change['lhs-y-end']);
|
||||
this.trace(
|
||||
'draw#_renderDiff unexpected NaN',
|
||||
change['lhs-y-start'], change['lhs-y-end']
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
// draw margin indicators
|
||||
if (this.settings._debug
|
||||
&& this.settings._debug) {
|
||||
trace('draw#_renderDiff', 'draw1', 'marker',
|
||||
lhs_y_start, lhs_y_end, rhs_y_start, rhs_y_end);
|
||||
}
|
||||
this.trace('draw#_renderDiff', 'draw1', 'marker',
|
||||
lhs_y_start, lhs_y_end, rhs_y_start, rhs_y_end);
|
||||
|
||||
const mkr_lhs_y_start = change['lhs-y-start'] * lratio;
|
||||
const mkr_lhs_y_end = Math.max(change['lhs-y-end'] * lratio, 5);
|
||||
@@ -1262,4 +1208,10 @@ CodeMirrorDiffView.prototype._queryElement = function(selector) {
|
||||
return this[cacheName];
|
||||
}
|
||||
|
||||
CodeMirrorDiffView.prototype.trace = function(...args) {
|
||||
if (this.settings._debug) {
|
||||
console.log(...args);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CodeMirrorDiffView;
|
||||
|
||||
@@ -146,7 +146,7 @@ diff.prototype._sms = function(lhs_ctx, lhs_lower, lhs_upper, rhs_ctx, rhs_lower
|
||||
}
|
||||
}
|
||||
// Extend the reverse path.
|
||||
for (k = kup - d; k <= kup + d; k += 2) {
|
||||
for (let k = kup - d; k <= kup + d; k += 2) {
|
||||
// find the only or better starting point
|
||||
if (k === kup + d) {
|
||||
x = vector_u[offset_up + k - 1]; // up
|
||||
|
||||
@@ -23,7 +23,8 @@ const defaultOptions = {
|
||||
vpcolor: 'rgba(0, 0, 200, 0.5)',
|
||||
license: 'lgpl',
|
||||
cmsettings: {
|
||||
styleSelectedText: true
|
||||
styleSelectedText: true,
|
||||
mode: null
|
||||
},
|
||||
lhs_cmsettings: {},
|
||||
rhs_cmsettings: {},
|
||||
|
||||
@@ -22,7 +22,8 @@ const defaultOptions = {
|
||||
vpcolor: 'rgba(0, 0, 200, 0.5)',
|
||||
license: 'lgpl',
|
||||
cmsettings: {
|
||||
styleSelectedText: true
|
||||
styleSelectedText: true,
|
||||
mode: null
|
||||
},
|
||||
_debug: false
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user