22
22
type =" text"
23
23
class =" flex-1 flex-grow-0 w-full bg-transparent rounded-md"
24
24
placeholder =" Add label to this text block"
25
- value =" Original Text "
25
+ : value =" lhsLabel "
26
26
/>
27
- <span class =" sr-only"
28
- >Add label to this original text bloack</span
29
- >
27
+ <span class =" sr-only" >Add label to this original text block</span >
30
28
</label >
31
29
<textarea
32
30
id =" lhs"
33
31
rows =" 28"
34
32
name =" lhs"
35
33
class =" flex-1 w-full bg-transparent rounded-md resize-none form-textarea"
34
+ v-html =" lhs"
36
35
></textarea >
37
36
</div >
38
37
<div class =" flex flex-col w-1/2 gap-4" >
43
42
type =" text"
44
43
class =" flex-1 flex-grow-0 w-full bg-transparent rounded-md"
45
44
placeholder =" Add label to this text block"
46
- value =" Changed text "
45
+ : value =" rhsLabel "
47
46
/>
48
- <span class =" sr-only"
49
- >Add label to this original text bloack</span
50
- >
47
+ <span class =" sr-only" >Add label to this changed text block</span >
51
48
</label >
52
49
<textarea
53
50
id =" rhs"
54
51
rows =" 28"
55
52
name =" rhs"
56
53
class =" flex-1 w-full bg-transparent rounded-md resize-none form-textarea"
57
- ></textarea >
54
+ v-html =" rhs"
55
+ >
56
+ </textarea >
58
57
</div >
59
58
</section >
60
59
<div class =" self-end flex-grow-0 w-full text-center" >
@@ -82,6 +81,7 @@ export default Vue.extend({
82
81
return {
83
82
isDarkMode: this .$isDarkMode ,
84
83
isSkipTutorial: this .$isSkipTutorial ,
84
+ ... this .$store .state .data ,
85
85
}
86
86
},
87
87
async mounted() {
@@ -125,31 +125,17 @@ export default Vue.extend({
125
125
const lhsLabel = formData .get (' lhsLabel' )
126
126
const rhsLabel = formData .get (' rhsLabel' )
127
127
if (! lhs || ! rhs ) {
128
- this .$store .commit (' toast/show' , {
129
- show: true ,
130
- content: ' Please enter some data on both sides to compare' ,
131
- iconHTML: `
132
- <svg
133
- class="w-6 h-6"
134
- fill="none"
135
- stroke="currentColor"
136
- viewBox="0 0 24 24"
137
- xmlns="http://www.w3.org/2000/svg"
138
- >
139
- <path
140
- stroke-linecap="round"
141
- stroke-linejoin="round"
142
- stroke-width="2"
143
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
144
- ></path>
145
- </svg>
146
- ` ,
147
- theme: ' error' ,
148
- })
128
+ this .showError ()
149
129
return
150
130
}
151
131
const originalLhs = lhs
152
132
const originalRhs = rhs
133
+ this .$store .commit (' data/set' , {
134
+ lhs ,
135
+ rhs ,
136
+ lhsLabel ,
137
+ rhsLabel ,
138
+ })
153
139
const diff = dmp .diff_main (originalLhs , originalRhs )
154
140
const gzip = Buffer .from (
155
141
pako .gzip (
@@ -165,6 +151,29 @@ export default Vue.extend({
165
151
hash: ` #${doUrlSafeBase64 (gzip )} ` ,
166
152
})
167
153
},
154
+ showError() {
155
+ this .$store .commit (' toast/show' , {
156
+ show: true ,
157
+ content: ' Please enter some data on both sides to compare' ,
158
+ iconHTML: `
159
+ <svg
160
+ class="w-6 h-6"
161
+ fill="none"
162
+ stroke="currentColor"
163
+ viewBox="0 0 24 24"
164
+ xmlns="http://www.w3.org/2000/svg"
165
+ >
166
+ <path
167
+ stroke-linecap="round"
168
+ stroke-linejoin="round"
169
+ stroke-width="2"
170
+ d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
171
+ ></path>
172
+ </svg>
173
+ ` ,
174
+ theme: ' error' ,
175
+ })
176
+ },
168
177
},
169
178
})
170
179
</script >
0 commit comments