22 <div class =" page-contents" >
33 <Navbar :show-back-button =" true" >
44 <template #right >
5+ <div class =" inline-flex items-center gap-1" >
6+ <label for =" toggleScrollInSync" class =" select-none"
7+ >Scroll in sync</label
8+ >
9+ <input
10+ id =" toggleScrollInSync"
11+ type =" checkbox"
12+ :checked =" scrollInSync"
13+ class =" form-checkbox filter mix-blend-luminosity"
14+ @click =" toggleInSyncScroll"
15+ />
16+ </div >
517 <button
618 type =" button"
719 class =" inline-flex justify-center px-4 py-2 transition-transform transform rounded-md shadow outline-none copy-uri-button align-center focus:ring-4 active:scale-y-75"
20+ aria-label =" Copy url to clipboard"
821 :class =" {
922 'bg-blue-500 text-white': !copied,
1023 'bg-green-500 text-gray-800': copied,
5770 {{ lhsLabel }}
5871 </p >
5972 <div
60- class =" relative flex-1 px-4 py-2 overflow-y-auto border-2 rounded-md dark:border-gray-500 max-h-screen--nav line-number-gutter min-h-80"
73+ class =" relative flex-1 px-4 py-2 border-2 rounded-md dark:border-gray-500 line-number-gutter min-h-80"
74+ :class =" {
75+ 'overflow-y-auto max-h-screen--nav': !scrollInSync,
76+ }"
6177 >
62- <RTStickyCopyButton :click-handler =" copyTextToClipboard" />
78+ <RTStickyCopyButton
79+ :aria-label =" 'Copy the content to clipboard'"
80+ :click-handler =" copyTextToClipboard"
81+ />
6382 <div
6483 v-for =" (lineDiff, index) in lhsDiff"
6584 :key =" index"
7190 </div >
7291 </div >
7392 </div >
74-
7593 <div class =" flex flex-col w-1/2 gap-2" >
7694 <p class =" flex-grow-0 text-lg font-bold text-center capitalize" >
7795 {{ rhsLabel }}
7896 </p >
7997 <div
80- class =" relative flex-1 px-4 py-2 overflow-y-auto border-2 rounded-md dark:border-gray-500 min-h-80 line-number-gutter max-h-screen--nav"
98+ class =" relative flex-1 px-4 py-2 border-2 rounded-md dark:border-gray-500 line-number-gutter min-h-80"
99+ :class =" {
100+ 'overflow-y-auto max-h-screen--nav': !scrollInSync,
101+ }"
81102 >
82- <RTStickyCopyButton :click-handler =" copyTextToClipboard" />
103+ <RTStickyCopyButton
104+ :click-handler =" copyTextToClipboard"
105+ :aria-label =" 'Copy the content to clipboard'"
106+ />
83107 <div
84108 v-for =" (lineDiff, index) in rhsDiff"
85109 :key =" index"
@@ -109,6 +133,7 @@ export default {
109133 rhsLabel: this .rhsLabel ,
110134 lhsLabel: this .lhsLabel ,
111135 copied: false ,
136+ scrollInSync: this .scrollInSync ,
112137 }
113138 },
114139 mounted () {
@@ -118,6 +143,7 @@ export default {
118143 const { diff , lhsLabel , rhsLabel } = diffData
119144 this .lhsLabel = lhsLabel
120145 this .rhsLabel = rhsLabel
146+ this .scrollInSync = true
121147 this .lhsDiff = diff
122148 .map ((item ) => {
123149 const hunkState = item[0 ]
@@ -197,6 +223,9 @@ export default {
197223 ' Text copied to your clipboard'
198224 )
199225 },
226+ toggleInSyncScroll () {
227+ this .scrollInSync = ! this .scrollInSync
228+ },
200229 },
201230}
202231 </script >
0 commit comments