Skip to content

Commit 9e3e881

Browse files
committed
feat: add chunk index to apply button attr
1 parent 793d83e commit 9e3e881

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

addon/merge/merge.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@
345345
var ch = dv.chunks[i];
346346
if (ch.editFrom <= vpEdit.to && ch.editTo >= vpEdit.from &&
347347
ch.origFrom <= vpOrig.to && ch.origTo >= vpOrig.from)
348-
drawConnectorsForChunk(dv, ch, sTopOrig, sTopEdit, w);
348+
drawConnectorsForChunk(dv, ch, sTopOrig, sTopEdit, w, i);
349349
}
350350
}
351351

@@ -524,7 +524,7 @@
524524
return cm.addLineWidget(line, elt, {height: size, above: false, mergeSpacer: true, handleMouseEvents: true});
525525
}
526526

527-
function drawConnectorsForChunk(dv, chunk, sTopOrig, sTopEdit, w) {
527+
function drawConnectorsForChunk(dv, chunk, sTopOrig, sTopEdit, w, index) {
528528
var flip = dv.type == "left";
529529
var top = dv.orig.heightAtLine(chunk.origFrom, "local", true) - sTopOrig;
530530
if (dv.svg) {
@@ -552,6 +552,7 @@
552552
copy.chunk = chunk;
553553
copy.style.top = (chunk.origTo > chunk.origFrom ? top : dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit) + "px";
554554
copy.setAttribute("role", "button");
555+
copy.setAttribute("data-chunk-index", index);
555556

556557
if (editOriginals) {
557558
var leftButton = typeof dv.getLeftRevertButton === 'function' && dv.getLeftRevertButton("CodeMirror-merge-copy-reverse");
@@ -565,6 +566,7 @@
565566
copyReverse.style.top = topReverse + "px";
566567
dv.type == "right" ? copyReverse.style.left = "2px" : copyReverse.style.right = "2px";
567568
copyReverse.setAttribute("role", "button");
569+
copyReverse.setAttribute("data-chunk-index", index);
568570
}
569571
}
570572
}

0 commit comments

Comments
 (0)