mirror of
https://github.com/wickedest/Mergely.git
synced 2026-04-17 11:28:35 +08:00
fix: fixes firefox scroll-linked effect issue
This commit is contained in:
@@ -290,11 +290,6 @@ CodeMirrorDiffView.prototype.bind = function(container) {
|
||||
className: container.className
|
||||
};
|
||||
const el = dom.getMergelyContainer({ clazz: container.className });
|
||||
// const found = document.getElementById(container.id);
|
||||
// if (!found) {
|
||||
// console.error(`Failed to find mergely: #${container.id}`);
|
||||
// return;
|
||||
// }
|
||||
const computedStyle = window.getComputedStyle(container);
|
||||
if (!computedStyle.height || computedStyle.height === '0px') {
|
||||
throw new Error(
|
||||
@@ -640,7 +635,10 @@ CodeMirrorDiffView.prototype._scrolling = function({ side }) {
|
||||
const scroller = this.editor[side].getScrollerElement();
|
||||
const { top } = scroller.getBoundingClientRect();
|
||||
let height;
|
||||
if (true || this.midway == undefined) {
|
||||
if (scroller.offsetParent === null) {
|
||||
return;
|
||||
}
|
||||
if (this.midway == undefined) {
|
||||
height = scroller.clientHeight
|
||||
- (scroller.offsetHeight - scroller.offsetParent.offsetHeight);
|
||||
this.midway = (height / 2.0 + top).toFixed(2);
|
||||
|
||||
@@ -67,7 +67,7 @@ function getColors(el) {
|
||||
function getMergelyContainer({ clazz = '' }) {
|
||||
const classes = [ 'mergely-editor', clazz ]
|
||||
return htmlToElement(`\
|
||||
<div class="${classes.join(' ')}" style="display:flex;height:100%;position:relative;"></div>`);
|
||||
<div class="${classes.join(' ')}" style="display:flex;height:100%;position:relative;overflow:hidden;"></div>`);
|
||||
}
|
||||
|
||||
function getMarginTemplate({ id }) {
|
||||
|
||||
@@ -186,7 +186,7 @@ class Mergely {
|
||||
|
||||
diff() {
|
||||
if (this._options._debug) {
|
||||
trace('api#diff', side);
|
||||
trace('api#diff');
|
||||
}
|
||||
const lhs_text = this.get('lhs');
|
||||
const rhs_text = this.get('rhs');
|
||||
|
||||
Reference in New Issue
Block a user