File tree Expand file tree Collapse file tree 4 files changed +22
-22
lines changed Expand file tree Collapse file tree 4 files changed +22
-22
lines changed Original file line number Diff line number Diff line change 1+ declare module 'diff-match-patch'
Original file line number Diff line number Diff line change 11<template >
22 <div class =" h-full" >
3- <main class =" container h-full mx-auto mt-24" >
3+ <main class =" h-full mt-24 xl:container " >
44 <div class =" flex gap-4 mt-5" >
55 <div
66 class =" flex-1 p-4 overflow-y-auto border-2 rounded-sm max-h-screen--nav"
2222</template >
2323
2424<script >
25- import DiffMatchPatch from ' diff-match-patch'
26- import { urlDecode } from ' ../../../helpers/utils'
27- const dmp = new DiffMatchPatch ()
25+ import { urlDecode } from ' ../../helpers/utils'
2826export default {
2927 layout: ' main' ,
30- lhs: ' ' ,
31- rhs: ' ' ,
32- diff: [],
3328 mounted () {
34- const { lhs , rhs } = this .$route .params
35- this .originalLhs = urlDecode (lhs).split (' \n ' )
36- this .originalRhs = urlDecode (rhs).split (' \n ' )
37- const diff = this .originalLhs .map ((x , i ) => {
38- if (! this .originalRhs [i]) {
39- this .originalRhs [i] = ' '
40- }
41- return dmp .diff_main (x, this .originalRhs [i])
42- })
29+ const { diff: _diff } = this .$route .params
30+ const diff = JSON .parse (urlDecode (_diff))
4331 this .lhsDiff = diff
4432 .map ((lineDiff ) => {
4533 return lineDiff
@@ -71,9 +59,6 @@ export default {
7159 },
7260 data () {
7361 return {
74- diff: this .diff ,
75- originalRhs: this .originalRhs ,
76- originalLhs: this .originalLhs ,
7762 lhsDiff: this .lhsDiff ,
7863 rhsDiff: this .rhsDiff ,
7964 }
Original file line number Diff line number Diff line change 11<template >
22 <div class =" h-full" >
3- <main class =" container h-full mx-auto mt-24" >
3+ <main class =" h-full mt-24 xl:container " >
44 <form @submit =" checkForm" class =" w-full h-full" >
55 <div class =" flex flex-wrap w-full h-full gap-4" >
66 <textarea
2525</template >
2626
2727<script lang="ts">
28+ import DiffMatchPatch from ' diff-match-patch'
2829import Vue from ' vue'
2930import { urlEncode } from ' ../helpers/utils'
31+ const dmp = new DiffMatchPatch ()
3032export default Vue .extend ({
3133 layout: ' main' ,
3234 methods: {
@@ -40,8 +42,17 @@ export default Vue.extend({
4042 ' rhs'
4143 ) as HTMLTextAreaElement
4244 const rhs: string = rhsTextArea ?.value || ' '
45+
46+ const originalLhs = lhs .split (' \n ' )
47+ const originalRhs = rhs .split (' \n ' )
48+ const diff = originalLhs .map ((x , i ) => {
49+ if (! originalRhs [i ]) {
50+ originalRhs [i ] = ' '
51+ }
52+ return dmp .diff_main (x , originalRhs [i ])
53+ })
4354 this .$router .push ({
44- path: ` /diff/${urlEncode (lhs )}/${ urlEncode ( rhs )} ` ,
55+ path: ` /diff/${urlEncode (JSON . stringify ( diff ) )} ` ,
4556 })
4657 },
4758 },
Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ module.exports = {
33 theme : {
44 maxHeight : {
55 'screen--nav' : 'calc(100vh - 7rem)' ,
6- }
6+ } ,
7+ container : {
8+ center : true ,
9+ } ,
710 } ,
811 plugins : [
912 require ( '@tailwindcss/forms' ) ,
You can’t perform that action at this time.
0 commit comments