|
2 | 2 | <div v-if="!postHasError" class="container-fluid"> |
3 | 3 | <div class="row"> |
4 | 4 | <div class="col-10 offset-1"> |
5 | | - |
6 | | - |
7 | 5 | <div class="row mb-2"> |
8 | 6 | <div class="col w-50 formCol"> |
9 | 7 | <div class="card flex-md-row mb-4 box-shadow h-md-250"> |
10 | 8 | <div class="card-body"> |
11 | 9 | <form @submit="submitForm($event)"> |
12 | 10 | <div class="form-floating mb-3"> |
13 | | - <input v-model="form.title" type="text" class="form-control" id="title" placeholder="Titel" |
14 | | - required /> |
| 11 | + <input v-model="form.title" type="text" class="form-control" id="title" placeholder="Titel" required /> |
15 | 12 | <label for="title">{{ t("posts.form.title") }}</label> |
16 | 13 | </div> |
17 | 14 |
|
18 | 15 | <div class="form-floating mb-3"> |
19 | | - <textarea v-model="form.description" style="overflow-y: scroll; height: 6rem" class="form-control" |
20 | | - id="description"></textarea> |
| 16 | + <textarea |
| 17 | + v-model="form.description" |
| 18 | + style="overflow-y: scroll; height: 6rem" |
| 19 | + class="form-control" |
| 20 | + id="description" |
| 21 | + ></textarea> |
21 | 22 | <label for="description">{{ t("posts.form.description") }}</label> |
22 | 23 | </div> |
23 | 24 |
|
24 | 25 | <div class="form-floating mb-3"> |
25 | 26 | <label for="stringTags">{{ t("posts.form.tags.tags") }}</label> |
26 | | - <vue-tags-input v-model="tag" :tags="tags" :autocomplete-items="tagList" |
27 | | - :placeholder="t('posts.form.tags.enter')" @tags-changed="handleTagsChanged" |
28 | | - @input="handleAutocompletion" @before-adding-tag="checkTag" /> |
| 27 | + <vue-tags-input |
| 28 | + v-model="tag" |
| 29 | + :tags="tags" |
| 30 | + :autocomplete-items="tagList" |
| 31 | + :placeholder="t('posts.form.tags.enter')" |
| 32 | + @tags-changed="handleTagsChanged" |
| 33 | + @input="handleAutocompletion" |
| 34 | + @before-adding-tag="checkTag" |
| 35 | + /> |
29 | 36 | </div> |
30 | 37 |
|
31 | 38 | <div class="mb-3"> |
32 | | - <ai-summaries :full-text="form.markdown" :onSetDescription="setDescription" :onAddTag="addTag" |
33 | | - :onSetKeyvisual="setKeyvisual"></ai-summaries> |
| 39 | + <ai-summaries |
| 40 | + :full-text="form.markdown" |
| 41 | + :onSetDescription="setDescription" |
| 42 | + :onAddTag="addTag" |
| 43 | + :onSetKeyvisual="setKeyvisual" |
| 44 | + ></ai-summaries> |
34 | 45 | </div> |
35 | 46 |
|
36 | 47 | <div class="form-floating mb-3"> |
37 | | - <textarea v-model="form.markdown" class="form-control md-area" placeholder="Blogpost" |
38 | | - ref="markdownArea" style="height: 40vh; min-height: 200px" aria-describedby="markdownHelp" |
39 | | - required></textarea> |
| 48 | + <textarea |
| 49 | + v-model="form.markdown" |
| 50 | + class="form-control md-area" |
| 51 | + placeholder="Blogpost" |
| 52 | + ref="markdownArea" |
| 53 | + style="height: 40vh; min-height: 200px" |
| 54 | + aria-describedby="markdownHelp" |
| 55 | + required |
| 56 | + ></textarea> |
40 | 57 | <label for="markdown">{{ t("posts.form.message.label") }}</label> |
41 | 58 | <div id="markdownHelp" class="form-text">{{ t("posts.form.message.hint") }}</div> |
42 | 59 | </div> |
|
56 | 73 | <span class="tiny">{{ t("posts.form.fileupload_hint") }}</span> |
57 | 74 | </h4> |
58 | 75 | <!-- Hidden file input, used to open the file dialog, when the dropzone is clicked --> |
59 | | - <input style="display: none" type="file" id="file" multiple v-on:change="handleFileChange($event)" |
60 | | - accept=".png, .gif, .jpg, .jpeg, .webp, .mp3, .wav, image/png, image/jpeg, image/gif, image/webp, audio/mp3, audio/wav" /> |
| 76 | + <input |
| 77 | + style="display: none" |
| 78 | + type="file" |
| 79 | + id="file" |
| 80 | + multiple |
| 81 | + v-on:change="handleFileChange($event)" |
| 82 | + accept=".png, .gif, .jpg, .jpeg, .webp, .mp3, .wav, image/png, image/jpeg, image/gif, image/webp, audio/mp3, audio/wav" |
| 83 | + /> |
61 | 84 |
|
62 | 85 | <div class="filesPreviewContainer" v-if="Object.keys(files).length"> |
63 | 86 | <div class="inner"> |
64 | 87 | <Suspense v-for="hash in Object.keys(files).reverse()" v-bind:key="hash"> |
65 | | - <ImagePreview v-if="isImageFile(files[hash])" :value="files[hash]" :hash="hash" |
66 | | - @paste="pasteFileToMarkdown($event, 'afterCursor')" @delete=" |
| 88 | + <ImagePreview |
| 89 | + v-if="isImageFile(files[hash])" |
| 90 | + :value="files[hash]" |
| 91 | + :hash="hash" |
| 92 | + @paste="pasteFileToMarkdown($event, 'afterCursor')" |
| 93 | + @delete=" |
67 | 94 | removeFileFromMarkdown(files[hash]); |
68 | | - delete files[hash]; |
69 | | - " @softdelete="removeFileFromMarkdown(files[hash])"> |
| 95 | + delete files[hash]; |
| 96 | + " |
| 97 | + @softdelete="removeFileFromMarkdown(files[hash])" |
| 98 | + > |
70 | 99 | </ImagePreview> |
71 | | - <AudioPreview v-else-if="isAudioFile(files[hash])" :value="files[hash]" :hash="hash" |
72 | | - @paste="pasteFileToMarkdown($event, 'afterCursor')" @delete=" |
| 100 | + <AudioPreview |
| 101 | + v-else-if="isAudioFile(files[hash])" |
| 102 | + :value="files[hash]" |
| 103 | + :hash="hash" |
| 104 | + @paste="pasteFileToMarkdown($event, 'afterCursor')" |
| 105 | + @delete=" |
73 | 106 | removeFileFromMarkdown(files[hash]); |
74 | | - delete files[hash]; |
75 | | - " @softdelete="removeFileFromMarkdown(files[hash])"> |
| 107 | + delete files[hash]; |
| 108 | + " |
| 109 | + @softdelete="removeFileFromMarkdown(files[hash])" |
| 110 | + > |
76 | 111 | </AudioPreview> |
77 | 112 | </Suspense> |
78 | 113 | </div> |
79 | 114 | </div> |
80 | 115 |
|
81 | | - <div id="dropzone" v-on:click="openFileDialog()" v-on:drop="handleFileChange($event)" |
82 | | - v-on:dragover="highlightDropzone($event, true)" v-on:dragleave="highlightDropzone($event, false)" |
83 | | - :class="{ active: dropzoneHighlight }"> |
| 116 | + <div |
| 117 | + id="dropzone" |
| 118 | + v-on:click="openFileDialog()" |
| 119 | + v-on:drop="handleFileChange($event)" |
| 120 | + v-on:dragover="highlightDropzone($event, true)" |
| 121 | + v-on:dragleave="highlightDropzone($event, false)" |
| 122 | + :class="{ active: dropzoneHighlight }" |
| 123 | + > |
84 | 124 | <div class="plus"><fa-icon :icon="faUpload"></fa-icon></div> |
85 | 125 | <span class="label" v-if="dropzoneHighlight">Dateien fallen lassen</span> |
86 | | - <span class="label" v-else>Neue Dateien hierher ziehen oder hier klicken um Dateien |
87 | | - auszuwählen</span> |
| 126 | + <span class="label" v-else>Neue Dateien hierher ziehen oder hier klicken um Dateien auszuwählen</span> |
88 | 127 | </div> |
89 | 128 | </div> |
90 | 129 |
|
|
98 | 137 | </div> |
99 | 138 |
|
100 | 139 | <div class="col w-50 previewCol"> |
101 | | - <h2 class="display-6">{{ (form?.title?.length ?? 0) > 0 ? form?.title : t("posts.form.preview.title") }} |
102 | | - </h2> |
| 140 | + <h2 class="display-6">{{ (form?.title?.length ?? 0) > 0 ? form?.title : t("posts.form.preview.title") }}</h2> |
103 | 141 | <div class="card flex-md-row mb-4 box-shadow h-md-250"> |
104 | 142 | <div class="card-body" style="max-width: 100%"> |
105 | | - <div v-if="loading" style="position: absolute; width: 100%; margin-top: 10vh; text-align: center" |
106 | | - class="text-primary"> |
| 143 | + <div v-if="loading" style="position: absolute; width: 100%; margin-top: 10vh; text-align: center" class="text-primary"> |
107 | 144 | <loading-spinner /> |
108 | 145 | </div> |
109 | | - <mark-down :markdown="md" v-bind:custom-file-urls="files" @loading="loading = $event" |
110 | | - :style="loading ? 'opacity:0.2' : 'opacity:1'"></mark-down> |
| 146 | + <mark-down |
| 147 | + :markdown="md" |
| 148 | + v-bind:custom-file-urls="files" |
| 149 | + @loading="loading = $event" |
| 150 | + :style="loading ? 'opacity:0.2' : 'opacity:1'" |
| 151 | + ></mark-down> |
111 | 152 | </div> |
112 | 153 | </div> |
113 | 154 | </div> |
|
282 | 323 | } |
283 | 324 |
|
284 | 325 | @keyframes shake { |
285 | | -
|
286 | 326 | 10%, |
287 | 327 | 90% { |
288 | 328 | transform: scale(0.9) translate3d(-1px, 0, 0); |
@@ -431,11 +471,11 @@ const removeFileFromMarkdown = (file: File) => { |
431 | 471 | }; |
432 | 472 |
|
433 | 473 | const isImageFile = (file: File): boolean => { |
434 | | - return file.type.startsWith('image/'); |
| 474 | + return file.type.startsWith("image/"); |
435 | 475 | }; |
436 | 476 |
|
437 | 477 | const isAudioFile = (file: File): boolean => { |
438 | | - return file.type.startsWith('audio/'); |
| 478 | + return file.type.startsWith("audio/"); |
439 | 479 | }; |
440 | 480 |
|
441 | 481 | const openFileDialog = (): void => { |
|
0 commit comments