Skip to content

Commit 4847c83

Browse files
committed
feat(beautify): added buttons to beautify code
1 parent 7c31bc1 commit 4847c83

File tree

1 file changed

+68
-2
lines changed

1 file changed

+68
-2
lines changed

pages/v2/index.vue

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</section>
1717
<form class="flex flex-col w-full gap-4" @submit="checkForm">
1818
<section class="flex w-full gap-4 editor-wrapper">
19-
<div class="flex flex-col w-1/2 gap-4">
19+
<div class="relative flex flex-col w-1/2 gap-4">
2020
<label for="lhsLabel" class="relative">
2121
<input
2222
id="lhsLabel"
@@ -33,8 +33,41 @@
3333
name="lhs"
3434
class="h-screen p-2 border border-gray-600 rounded-md editor"
3535
></div>
36+
<button
37+
aria-label="Beautify entered text"
38+
type="button"
39+
title="Beautify"
40+
class="
41+
absolute
42+
p-2
43+
transition-all
44+
rounded-sm
45+
top-16
46+
right-3
47+
aspect-square
48+
dark:hover:bg-slate-600 dark:bg-slate-600/50
49+
hover:bg-slate-300
50+
bg-gray-300/50
51+
"
52+
@click="
53+
lhsEditor.trigger('editor', 'editor.action.formatDocument')
54+
"
55+
>
56+
<svg
57+
viewBox="0 0 15 15"
58+
fill="none"
59+
xmlns="http://www.w3.org/2000/svg"
60+
width="15"
61+
height="15"
62+
>
63+
<path
64+
d="M0 7.5h2m13 0h-2m-8 7H3.5a2 2 0 01-2-2v-10a2 2 0 012-2H5m5 14h1.5a2 2 0 002-2v-10a2 2 0 00-2-2H10"
65+
stroke="currentColor"
66+
></path>
67+
</svg>
68+
</button>
3669
</div>
37-
<div class="flex flex-col w-1/2 gap-4">
70+
<div class="relative flex flex-col w-1/2 gap-4">
3871
<label for="lhsLabel" class="relative">
3972
<input
4073
id="rhsLabel"
@@ -51,6 +84,39 @@
5184
name="rhs"
5285
class="h-screen p-2 border border-gray-600 rounded-md editor"
5386
></div>
87+
<button
88+
aria-label="Beautify entered text"
89+
type="button"
90+
title="Beautify"
91+
class="
92+
absolute
93+
p-2
94+
transition-all
95+
rounded-sm
96+
top-16
97+
right-3
98+
aspect-square
99+
dark:hover:bg-slate-600 dark:bg-slate-600/50
100+
hover:bg-slate-300
101+
bg-gray-300/50
102+
"
103+
@click="
104+
rhsEditor.trigger('editor', 'editor.action.formatDocument')
105+
"
106+
>
107+
<svg
108+
viewBox="0 0 15 15"
109+
fill="none"
110+
xmlns="http://www.w3.org/2000/svg"
111+
width="15"
112+
height="15"
113+
>
114+
<path
115+
d="M0 7.5h2m13 0h-2m-8 7H3.5a2 2 0 01-2-2v-10a2 2 0 012-2H5m5 14h1.5a2 2 0 002-2v-10a2 2 0 00-2-2H10"
116+
stroke="currentColor"
117+
></path>
118+
</svg>
119+
</button>
54120
</div>
55121
</section>
56122
<div class="self-end flex-grow-0 w-full mt-4 text-center">

0 commit comments

Comments
 (0)