Skip to content

Commit 516a6ff

Browse files
committed
fix linting issues
1 parent a67becc commit 516a6ff

File tree

5 files changed

+91
-51
lines changed

5 files changed

+91
-51
lines changed

client/src/components/AudioPreview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template>
1+
<template>
22
<div class="preview-container">
33
<div class="erase" @click="$emit('delete')" :title="t('app.base.delete_audio')"></div>
44
<div class="audio-container">

client/src/util/storage.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ export function loadCssPreference(): UserTheme {
8080
);
8181
}
8282

83-
84-
8583
//
8684
// General purpose helper functions, should only be called indirectly
8785
//

client/src/views/PostFormView.vue

Lines changed: 78 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,58 @@
22
<div v-if="!postHasError" class="container-fluid">
33
<div class="row">
44
<div class="col-10 offset-1">
5-
6-
75
<div class="row mb-2">
86
<div class="col w-50 formCol">
97
<div class="card flex-md-row mb-4 box-shadow h-md-250">
108
<div class="card-body">
119
<form @submit="submitForm($event)">
1210
<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 />
1512
<label for="title">{{ t("posts.form.title") }}</label>
1613
</div>
1714

1815
<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>
2122
<label for="description">{{ t("posts.form.description") }}</label>
2223
</div>
2324

2425
<div class="form-floating mb-3">
2526
<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+
/>
2936
</div>
3037

3138
<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>
3445
</div>
3546

3647
<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>
4057
<label for="markdown">{{ t("posts.form.message.label") }}</label>
4158
<div id="markdownHelp" class="form-text">{{ t("posts.form.message.hint") }}</div>
4259
</div>
@@ -56,35 +73,57 @@
5673
<span class="tiny">{{ t("posts.form.fileupload_hint") }}</span>
5774
</h4>
5875
<!-- 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+
/>
6184

6285
<div class="filesPreviewContainer" v-if="Object.keys(files).length">
6386
<div class="inner">
6487
<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="
6794
removeFileFromMarkdown(files[hash]);
68-
delete files[hash];
69-
" @softdelete="removeFileFromMarkdown(files[hash])">
95+
delete files[hash];
96+
"
97+
@softdelete="removeFileFromMarkdown(files[hash])"
98+
>
7099
</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="
73106
removeFileFromMarkdown(files[hash]);
74-
delete files[hash];
75-
" @softdelete="removeFileFromMarkdown(files[hash])">
107+
delete files[hash];
108+
"
109+
@softdelete="removeFileFromMarkdown(files[hash])"
110+
>
76111
</AudioPreview>
77112
</Suspense>
78113
</div>
79114
</div>
80115

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+
>
84124
<div class="plus"><fa-icon :icon="faUpload"></fa-icon></div>
85125
<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>
88127
</div>
89128
</div>
90129

@@ -98,16 +137,18 @@
98137
</div>
99138

100139
<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>
103141
<div class="card flex-md-row mb-4 box-shadow h-md-250">
104142
<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">
107144
<loading-spinner />
108145
</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>
111152
</div>
112153
</div>
113154
</div>
@@ -282,7 +323,6 @@
282323
}
283324
284325
@keyframes shake {
285-
286326
10%,
287327
90% {
288328
transform: scale(0.9) translate3d(-1px, 0, 0);
@@ -431,11 +471,11 @@ const removeFileFromMarkdown = (file: File) => {
431471
};
432472
433473
const isImageFile = (file: File): boolean => {
434-
return file.type.startsWith('image/');
474+
return file.type.startsWith("image/");
435475
};
436476
437477
const isAudioFile = (file: File): boolean => {
438-
return file.type.startsWith('audio/');
478+
return file.type.startsWith("audio/");
439479
};
440480
441481
const openFileDialog = (): void => {

common/src/markdown-converter-common.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,19 @@ export abstract class MarkdownConverter {
112112
renderer: {
113113
image({ href, title, text }: Tokens.Image) {
114114
// Check if this is an audio file (marked with audio: prefix)
115-
if (text && text.startsWith('audio:')) {
115+
if (text && text.startsWith("audio:")) {
116116
const audioName = text.substring(6); // Remove 'audio:' prefix
117117
// Determine audio type from href if it's a data URL
118118
let audioType = "audio/mpeg"; // default
119-
if (href && href.startsWith('data:audio/')) {
120-
audioType = href.split(';')[0].split(':')[1];
119+
if (href && href.startsWith("data:audio/")) {
120+
audioType = href.split(";")[0].split(":")[1];
121121
}
122122
return `<audio controls><source src="${href}" type="${audioType}">Your browser does not support the audio element.</audio>`;
123123
}
124124
// Default image rendering
125-
return `<img src="${href}" alt="${text || ''}" title="${title || ''}">`;
126-
}
127-
}
125+
return `<img src="${href}" alt="${text || ""}" title="${title || ""}">`;
126+
},
127+
},
128128
});
129129
marked.use(MarkdownConverter.rendererExtension);
130130
marked.use(

common/src/util/mimeType.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ export function determineMimeType(bytes: Uint8Array | Buffer): SupportedFileMime
2424
return "image/gif";
2525
} else if (doMagicBytesMatch(MAGIC_BMP_BYTES, bytes)) {
2626
return "image/bmp";
27-
} else if (doMagicBytesMatch(MAGIC_MP3_BYTES_1, bytes) ||
28-
doMagicBytesMatch(MAGIC_MP3_BYTES_2, bytes) ||
29-
doMagicBytesMatch(MAGIC_MP3_BYTES_3, bytes) ||
30-
doMagicBytesMatch(MAGIC_MP3_BYTES_4, bytes)) {
27+
} else if (
28+
doMagicBytesMatch(MAGIC_MP3_BYTES_1, bytes) ||
29+
doMagicBytesMatch(MAGIC_MP3_BYTES_2, bytes) ||
30+
doMagicBytesMatch(MAGIC_MP3_BYTES_3, bytes) ||
31+
doMagicBytesMatch(MAGIC_MP3_BYTES_4, bytes)
32+
) {
3133
return "audio/mp3";
3234
} else if (doMagicBytesMatch(MAGIC_WAV_BYTES, bytes)) {
3335
return "audio/wav";

0 commit comments

Comments
 (0)