|
5 | 5 | <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated name in your note files...</h2>
|
6 | 6 | </header>
|
7 | 7 |
|
| 8 | + <Tab |
| 9 | + ref="tab" |
| 10 | + v-if="files.length" |
| 11 | + :dataArr="files" |
| 12 | + v-slot:name="{ item }" |
| 13 | + @onFileSelected="selectedFile = $event" |
| 14 | + > |
| 15 | + {{ item.name }} |
| 16 | + </Tab> |
| 17 | + |
| 18 | + <!-- Selected file --> |
| 19 | + <div v-if="selectedFile !== null" :class="{ 'c-selected-file': true }"> |
| 20 | + <b-field horizontal label="Name" grouped> |
| 21 | + <b-input style="width: 186px" type="text" v-model="selectedFile.name" placeholder="Your file name"> |
| 22 | + </b-input> |
| 23 | + <p class="control is-pulled-right"> |
| 24 | + <button class="button is-danger" @click="deleteFile(selectedFile)"> |
| 25 | + <b-icon icon="trash"></b-icon> |
| 26 | + </button> |
| 27 | + </p> |
| 28 | + </b-field> |
| 29 | + |
| 30 | + <b-field horizontal label="Language"> |
| 31 | + <b-select placeholder="Select a language" v-model="selectedFile.language"> |
| 32 | + <option v-for="language in languages" :value="language.name"> |
| 33 | + {{ language.name | capitalize }} |
| 34 | + </option> |
| 35 | + </b-select> |
| 36 | + </b-field> |
| 37 | + |
| 38 | + <b-field horizontal label="Content"> |
| 39 | + <editor v-model="selectedFile.content" :lang="selectedFile.language" theme="monokai" width="100%" height="260"> |
| 40 | + </editor> |
| 41 | + </b-field> |
| 42 | + </div> |
| 43 | + |
8 | 44 | <section class="modal-card-body">
|
9 | 45 | <b-field v-if="!gistsSelected" horizontal label="Name">
|
10 | 46 | <b-input
|
@@ -32,48 +68,30 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
|
32 | 68 | </b-taginput>
|
33 | 69 | </b-field>
|
34 | 70 |
|
35 |
| - <div class="note-file" v-for="file in files"> |
36 |
| - <b-field horizontal label="Name" grouped> |
37 |
| - <b-input |
38 |
| - style="width: 186px" |
39 |
| - type="text" |
40 |
| - v-model="file.name" |
41 |
| - placeholder="Your file name"> |
42 |
| - </b-input> |
43 |
| - <p class="control is-pulled-right" v-if="files.length > 1"> |
44 |
| - <button class="button is-danger" @click="deleteFile(file)"> |
45 |
| - <b-icon icon="trash"></b-icon> |
46 |
| - </button> |
47 |
| - </p> |
48 |
| - </b-field> |
49 | 71 |
|
50 |
| - <b-field horizontal label="Language"> |
51 |
| - <b-select placeholder="Select a language" v-model="file.language"> |
52 |
| - <option |
53 |
| - v-for="language in languages" |
54 |
| - :value="language.name"> |
55 |
| - {{ language.name | capitalize }} |
56 |
| - </option> |
57 |
| - </b-select> |
58 |
| - </b-field> |
| 72 | + <b-field horizontal label="Name" grouped> |
| 73 | + <b-input style="width: 186px" type="text" v-model="baseFile.name" placeholder="Your file name"> |
| 74 | + </b-input> |
| 75 | + </b-field> |
59 | 76 |
|
60 |
| - <b-field horizontal label="Content"> |
61 |
| - <editor v-model="file.content" |
62 |
| - :lang="file.language" |
63 |
| - theme="monokai" |
64 |
| - width="100%" |
65 |
| - height="260" |
66 |
| - ></editor> |
67 |
| - </b-field> |
68 |
| - </div> |
| 77 | + <b-field horizontal label="Language"> |
| 78 | + <b-select placeholder="Select a language" v-model="baseFile.language"> |
| 79 | + <option v-for="language in languages" :value="language.name"> |
| 80 | + {{ language.name | capitalize }} |
| 81 | + </option> |
| 82 | + </b-select> |
| 83 | + </b-field> |
| 84 | + |
| 85 | + <b-field horizontal label="Content"> |
| 86 | + <editor v-model="baseFile.content" :lang="baseFile.language" theme="monokai" width="100%" height="260"></editor> |
| 87 | + </b-field> |
69 | 88 |
|
70 | 89 | <div class="text-center">
|
71 |
| - <button class="button" type="button" @click="addFile()" v-if="files.length < 5"> |
| 90 | + <button class="button" type="button" @click="addFile()"> |
72 | 91 | <b-icon id="plus" icon="plus"></b-icon>
|
73 | 92 | Add a file
|
74 | 93 | </button>
|
75 | 94 | </div>
|
76 |
| - |
77 | 95 | </section>
|
78 | 96 |
|
79 | 97 | <footer class="modal-card-foot">
|
|
0 commit comments