Skip to content

Commit 136bb50

Browse files
committed
fix: allow use filename when there are more then one file
1 parent f588087 commit 136bb50

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

components/Editor.vue

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,21 @@
110110
</div>
111111
</div>
112112

113-
<div class="flex w-full px-1 pb-1 border-b">
114-
<input
115-
type="text"
116-
:value="filename"
117-
@input="(event) => $emit('update:filename', event.target.value)"
118-
class="block w-full py-1 pl-3 pr-10 text-base border-gray-300 focus:outline-none rounded-lg focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
119-
placeholder="filename"
120-
/>
113+
<div v-if="allowFilename" class="flex items-center justify-between bg-ui-gray-700">
114+
<div class="flex items-center gap-2 m-2 mt-0 rounded-lg bg-ui-gray-800 focus-within:ring-2 focus-within:ring-ui-focus w-full">
115+
<label
116+
class="hidden pl-2 text-xs font-semibold leading-none tracking-wide uppercase text-ui-gray-500 xl:inline-block whitespace-nowrap"
117+
>
118+
Filename
119+
</label>
120+
<input
121+
type="text"
122+
:value="filename"
123+
class="text-xs font-medium text-ui-gray-400 bg-ui-gray-800 border-0 rounded-lg cursor-pointer hover:bg-ui-gray-900 focus:bg-ui-gray-900 focus:outline-none focus:ring-0 w-full"
124+
@input="(event) => $emit('update:filename', event.target.value)"
125+
placeholder="filename"
126+
/>
127+
</div>
121128
</div>
122129

123130
<div ref="monaco" class="w-full h-full"></div>
@@ -148,6 +155,7 @@ export default {
148155
size: Number,
149156
tabSize: [String, Number],
150157
filename: String,
158+
allowFilename: Boolean,
151159
language: String,
152160
options: Object,
153161
landscape: Boolean,

components/Page.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
:tab-size="editor.tabSize"
2727
:language="editor.language"
2828
:filename="editor.filename"
29+
:allow-filename="editors.length > 1"
2930
:landscape="isLandscape"
3031
:can-move-up="index !== 0"
3132
:can-move-down="index !== editors.length - 1"

components/Preview.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
ref="window"
9393
class="z-10"
9494
:blocks="blocks"
95+
:filenames="filenames"
9596
:settings="settings"
9697
@update:title="(title) => (settings.title = title)"
9798
/>

components/Window.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
</div>
4141
</div>
4242

43-
<div
44-
v-for="(lines, index) in blocks"
45-
:key="index"
46-
:style="{ padding: `${settings.padding}px` }"
47-
>
43+
<div v-for="(lines, index) in blocks" :key="index" :style="{ padding: `${settings.padding}px` }">
44+
<div
45+
v-if="filenames.length > 1"
46+
class="text-sm mb-2 text-gray-400 w-full text-right"
47+
>{{ filenames[index] }}</div>
4848
<Code
4949
class="relative"
5050
:lines="lines"
@@ -63,6 +63,7 @@ export default {
6363
props: {
6464
blocks: Array,
6565
settings: Object,
66+
filenames: Array
6667
},
6768
6869
components: { Code, FauxMenu },

0 commit comments

Comments
 (0)