|
62 | 62 | <label class="form-check-label" for="draft">{{ t("posts.form.draft") }}</label>
|
63 | 63 | </div>
|
64 | 64 |
|
| 65 | + <div class="form-floating mb-3 uploadCard"> |
| 66 | + <h4> |
| 67 | + {{ tc("posts.form.imageupload", Object.keys(files).length) }} |
| 68 | + <small class="text-body-secondary f-4" v-if="Object.keys(files).length > 0"> |
| 69 | + ({{ convertToHumanReadableFileSize(totalBytesInFiles) }}) |
| 70 | + </small> |
| 71 | + </h4> |
| 72 | + <!-- Hidden file input, used to open the file dialog, when the dropzone is clicked --> |
| 73 | + <input |
| 74 | + style="display: none" |
| 75 | + type="file" |
| 76 | + id="file" |
| 77 | + multiple |
| 78 | + v-on:change="handleFileChange($event)" |
| 79 | + accept=".png, .gif, .jpg, .jpeg, image/png, image/jpeg, image/gif" |
| 80 | + /> |
| 81 | + |
| 82 | + <div class="imagesPreviewContaier" v-if="Object.keys(files).length"> |
| 83 | + <div class="inner"> |
| 84 | + <Suspense v-for="hash in Object.keys(files).reverse()" v-bind:key="hash"> |
| 85 | + <ImagePreview |
| 86 | + :value="files[hash]" |
| 87 | + :hash="hash" |
| 88 | + @paste="pasteImageFileToMarkdown($event, 'afterCursor')" |
| 89 | + @delete=" |
| 90 | + removeImageFileFromMarkdown(files[hash]); |
| 91 | + delete files[hash]; |
| 92 | + " |
| 93 | + > |
| 94 | + </ImagePreview> |
| 95 | + </Suspense> |
| 96 | + </div> |
| 97 | + </div> |
| 98 | + |
| 99 | + <div |
| 100 | + id="dropzone" |
| 101 | + v-on:click="openFileDialog()" |
| 102 | + v-on:drop="handleFileChange($event)" |
| 103 | + v-on:dragover="highlightDropzone($event, true)" |
| 104 | + v-on:dragleave="highlightDropzone($event, false)" |
| 105 | + :class="{ active: dropzoneHighlight }" |
| 106 | + > |
| 107 | + <div class="plus"><fa-icon :icon="faUpload"></fa-icon></div> |
| 108 | + <span class="label" v-if="dropzoneHighlight">Dateien fallen lassen</span> |
| 109 | + <span class="label" v-else>Neue Dateien hierher ziehen oder hier klicken um Dateien auszuwählen</span> |
| 110 | + </div> |
| 111 | + </div> |
| 112 | + |
65 | 113 | <button type="submit" class="btn btn-sm btn-primary float-end">{{ t("app.base.save") }}</button>
|
66 | 114 | <button type="button" class="btn btn-sm btn-secondary float-end mx-3" @click="router.go(-1)">
|
67 | 115 | {{ t("app.base.cancel") }}
|
|
88 | 136 | </div>
|
89 | 137 | </div>
|
90 | 138 | </div>
|
91 |
| - <div class="card mb-4 box-shadow h-md-250"> |
92 |
| - <div class="card-body"> |
93 |
| - <h3> |
94 |
| - {{ tc("posts.form.imageupload", Object.keys(files).length) }} |
95 |
| - <small class="text-body-secondary f-4" v-if="Object.keys(files).length > 0" |
96 |
| - >({{ convertToHumanReadableFileSize(totalBytesInFiles) }})</small |
97 |
| - > |
98 |
| - </h3> |
99 |
| - <!-- Hidden file input, used to open the file dialog, when the dropzone is clicked --> |
100 |
| - <input |
101 |
| - style="display: none" |
102 |
| - type="file" |
103 |
| - id="file" |
104 |
| - multiple |
105 |
| - v-on:change="handleFileChange($event)" |
106 |
| - accept=".png, .gif, .jpg, .jpeg, image/png, image/jpeg, image/gif" |
107 |
| - /> |
108 |
| - <div |
109 |
| - id="dropzone" |
110 |
| - v-on:click="openFileDialog()" |
111 |
| - v-on:drop="handleFileChange($event)" |
112 |
| - v-on:dragover="highlightDropzone($event, true)" |
113 |
| - v-on:dragleave="highlightDropzone($event, false)" |
114 |
| - :class="{ active: dropzoneHighlight }" |
115 |
| - > |
116 |
| - <div class="plus"><fa-icon :icon="faUpload"></fa-icon></div> |
117 |
| - <span class="label" v-if="dropzoneHighlight">Dateien fallen lassen</span> |
118 |
| - <span class="label" v-else>Neue Dateien hierher ziehen oder hier klicken um Dateien auszuwählen</span> |
119 |
| - </div> |
120 |
| - <Suspense v-for="hash in Object.keys(files)" v-bind:key="hash"> |
121 |
| - <ImagePreview |
122 |
| - :value="files[hash]" |
123 |
| - :hash="hash" |
124 |
| - @paste="pasteImageFileToMarkdown($event, 'afterCursor')" |
125 |
| - @delete=" |
126 |
| - removeImageFileFromMarkdown(files[hash]); |
127 |
| - delete files[hash]; |
128 |
| - " |
129 |
| - > |
130 |
| - </ImagePreview> |
131 |
| - </Suspense> |
132 |
| - </div> |
133 |
| - </div> |
134 | 139 | </div>
|
135 | 140 | <post-not-available v-else></post-not-available>
|
136 | 141 | </template>
|
|
147 | 152 | width: 50%;
|
148 | 153 | }
|
149 | 154 |
|
| 155 | +.uploadCard { |
| 156 | + border: 1px solid #404040; |
| 157 | + border-radius: 0.375rem; |
| 158 | + padding: 1rem; |
| 159 | + margin-top: 1rem; |
| 160 | + background-color: #dee2e6; |
| 161 | +} |
| 162 | +
|
| 163 | +.imagesPreviewContaier { |
| 164 | + width: 100%; |
| 165 | + max-width: 100%; |
| 166 | + min-width: 100%; |
| 167 | + position: relative; |
| 168 | + display: flex; |
| 169 | + flex-direction: column; |
| 170 | + margin: 0 0 10px 0; |
| 171 | + padding: 0; |
| 172 | + overflow-x: auto; |
| 173 | + height: auto; |
| 174 | + min-height: 290px; |
| 175 | + // border: 1px solid #222; |
| 176 | + // border-radius: 0.375rem; |
| 177 | +} |
| 178 | +
|
| 179 | +.inner { |
| 180 | + position: absolute; |
| 181 | + display: flex; |
| 182 | + flex-direction: row; |
| 183 | + width: 100%; |
| 184 | + max-width: 100%; |
| 185 | + min-width: 100%; |
| 186 | +} |
| 187 | +
|
150 | 188 | #dropzone {
|
151 |
| - color: #555; |
| 189 | + background-color: #f8f9fa55; |
| 190 | + border: 1px solid #ccc; |
| 191 | + color: #222; |
152 | 192 | cursor: pointer;
|
153 | 193 | vertical-align: top;
|
154 | 194 | display: inline-block;
|
155 |
| - width: 12rem; |
156 | 195 | min-height: 15rem;
|
157 | 196 | padding: 1rem 0.25rem;
|
158 |
| - margin: 0.25rem; |
| 197 | + margin: 0; |
159 | 198 | text-align: center;
|
160 |
| - border: 2px solid #ddd; |
| 199 | + border-radius: 0.375rem; |
161 | 200 | box-shadow: inset 0 0 0 0 #ffc377;
|
162 | 201 | transition: 0.5s ease-out box-shadow, 3s ease border-color;
|
| 202 | + width: 100%; |
163 | 203 |
|
164 | 204 | .plus {
|
165 | 205 | font-size: 5rem;
|
|
0 commit comments