memi-board 0.58.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/{ar-GNguZBN4.js → ar-CiZZkAEi.js} +6 -2
- package/dist/ar-CiZZkAEi.js.map +1 -0
- package/dist/{commentImages-CRK_2uVi.js → commentImages-Cu3UUpeR.js} +41 -11
- package/dist/commentImages-Cu3UUpeR.js.map +1 -0
- package/dist/composables/useMemiBoardBannerGeneration.d.ts +8 -0
- package/dist/composables/useMemiBoardStorage.d.ts +2 -1
- package/dist/config.d.ts +4 -0
- package/dist/{de-CS0iRLqe.js → de-BmsTyFa1.js} +6 -2
- package/dist/de-BmsTyFa1.js.map +1 -0
- package/dist/{en-DeExi-DR.js → en-Bizi62l1.js} +29 -2
- package/dist/en-Bizi62l1.js.map +1 -0
- package/dist/{es-dlEFrox-.js → es-wYEC2eO3.js} +6 -2
- package/dist/es-wYEC2eO3.js.map +1 -0
- package/dist/{fr-B9sjKJF4.js → fr-C_ThACcX.js} +6 -2
- package/dist/fr-C_ThACcX.js.map +1 -0
- package/dist/{id-Ca7skouh.js → id-CHzZpyk8.js} +6 -2
- package/dist/id-CHzZpyk8.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +656 -550
- package/dist/index.js.map +1 -1
- package/dist/{ja-ByVLGIDd.js → ja-CvlMTefX.js} +6 -2
- package/dist/ja-CvlMTefX.js.map +1 -0
- package/dist/{pt-COQL_Q7A.js → pt-DKsrQ_yb.js} +6 -2
- package/dist/pt-DKsrQ_yb.js.map +1 -0
- package/dist/runtime/components/AuthorMenu.vue +17 -13
- package/dist/runtime/components/BannerEditor.vue +198 -0
- package/dist/runtime/components/BoardInfo.vue +29 -49
- package/dist/runtime/components/CategorySettings.vue +25 -2
- package/dist/runtime/components/CommentFeed.vue +6 -7
- package/dist/runtime/components/CommentItem.vue +13 -14
- package/dist/runtime/components/Detail.vue +31 -40
- package/dist/runtime/components/Editor.vue +115 -9
- package/dist/runtime/components/Footer.vue +3 -3
- package/dist/runtime/components/LikeButton.vue +9 -10
- package/dist/runtime/components/List.vue +23 -11
- package/dist/runtime/components/ListCard.vue +5 -3
- package/dist/runtime/components/ListDefault.vue +14 -12
- package/dist/runtime/components/ListDense.vue +9 -9
- package/dist/runtime/components/ListImage.vue +6 -4
- package/dist/runtime/components/ListVideo.vue +10 -13
- package/dist/runtime/components/MiniComments.vue +6 -7
- package/dist/runtime/components/Settings.vue +26 -2
- package/dist/storage.js +18 -1
- package/dist/storage.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/utils/bannerGeneration.d.ts +9 -0
- package/dist/{zh-DBjX9qAS.js → zh-DiiqT_vJ.js} +6 -2
- package/dist/zh-DiiqT_vJ.js.map +1 -0
- package/docs/firebase-setup.md +50 -0
- package/docs/storage.rules.example +19 -0
- package/package.json +1 -1
- package/dist/ar-GNguZBN4.js.map +0 -1
- package/dist/commentImages-CRK_2uVi.js.map +0 -1
- package/dist/de-CS0iRLqe.js.map +0 -1
- package/dist/en-DeExi-DR.js.map +0 -1
- package/dist/es-dlEFrox-.js.map +0 -1
- package/dist/fr-B9sjKJF4.js.map +0 -1
- package/dist/id-Ca7skouh.js.map +0 -1
- package/dist/ja-ByVLGIDd.js.map +0 -1
- package/dist/pt-COQL_Q7A.js.map +0 -1
- package/dist/zh-DBjX9qAS.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
3
|
import { formatDate, useMemiBoardI18n, useMemiBoardSettings } from 'memi-board/runtime'
|
|
4
4
|
import MemiBoardInfoPerson from './BoardInfoPerson.vue'
|
|
5
5
|
|
|
6
6
|
const props = defineProps<{
|
|
7
7
|
boardId?: string
|
|
8
|
-
title
|
|
8
|
+
title?: string
|
|
9
9
|
description?: string
|
|
10
10
|
/** 만든 사람/관리자/스태프 메뉴 중 "프로필 보기" 링크. */
|
|
11
11
|
authorProfileTo?: (authorUid: string) => string | undefined
|
|
@@ -25,34 +25,31 @@ const staff = computed(() => (board.value?.allowedStaffUids ?? []).filter(uid =>
|
|
|
25
25
|
const creatorUid = computed(() => board.value?.createdByUid)
|
|
26
26
|
const createdAt = computed(() => formatDate(board.value?.createdAt, locale.value))
|
|
27
27
|
const hasInfo = computed(() => !!(props.description || managers.value.length || staff.value.length || creatorUid.value))
|
|
28
|
+
const open = ref(false)
|
|
28
29
|
</script>
|
|
29
30
|
|
|
30
31
|
<template>
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
>
|
|
32
|
+
<div class="flex min-w-0 flex-col gap-2">
|
|
33
|
+
<h1 v-if="title" class="min-w-0 text-2xl font-bold tracking-tight text-highlighted">
|
|
34
|
+
<UButton
|
|
35
|
+
v-if="hasInfo"
|
|
36
|
+
:label="title"
|
|
37
|
+
color="neutral"
|
|
38
|
+
variant="ghost"
|
|
39
|
+
trailing-icon="i-lucide-chevron-down"
|
|
40
|
+
:aria-expanded="open"
|
|
41
|
+
class="-mx-1.5 h-auto max-w-full min-w-0 justify-start px-1.5 py-0.5 text-start text-2xl font-bold tracking-tight text-highlighted"
|
|
42
|
+
:ui="{ label: 'truncate', trailingIcon: open ? 'size-5 rotate-180 text-muted transition-transform' : 'size-5 text-muted transition-transform' }"
|
|
43
|
+
@click="open = !open"
|
|
44
|
+
/>
|
|
45
|
+
<span v-else class="block truncate">{{ title }}</span>
|
|
46
|
+
</h1>
|
|
47
|
+
<div v-if="hasInfo && open" class="flex flex-col gap-3">
|
|
48
|
+
<p v-if="description" class="whitespace-pre-line break-words text-sm text-default">
|
|
49
49
|
{{ description }}
|
|
50
50
|
</p>
|
|
51
|
-
<dl class="flex flex-col gap-
|
|
52
|
-
<div
|
|
53
|
-
v-if="creatorUid"
|
|
54
|
-
class="flex flex-col gap-1"
|
|
55
|
-
>
|
|
51
|
+
<dl class="flex flex-col gap-3 text-sm sm:flex-row sm:flex-wrap sm:gap-x-6">
|
|
52
|
+
<div v-if="creatorUid" class="flex flex-col gap-1 rounded-lg border border-default px-3 py-2">
|
|
56
53
|
<dt class="text-xs text-muted">
|
|
57
54
|
{{ t('list.boardInfo.creator') }}
|
|
58
55
|
</dt>
|
|
@@ -63,22 +60,16 @@ const hasInfo = computed(() => !!(props.description || managers.value.length ||
|
|
|
63
60
|
:author-posts-to="authorPostsTo"
|
|
64
61
|
:author-comments-to="authorCommentsTo"
|
|
65
62
|
/>
|
|
66
|
-
<span
|
|
67
|
-
v-if="createdAt"
|
|
68
|
-
class="text-xs text-muted"
|
|
69
|
-
>
|
|
63
|
+
<span v-if="createdAt" class="text-xs text-muted">
|
|
70
64
|
{{ createdAt }}
|
|
71
65
|
</span>
|
|
72
66
|
</dd>
|
|
73
67
|
</div>
|
|
74
|
-
<div
|
|
75
|
-
v-if="managers.length"
|
|
76
|
-
class="flex flex-col gap-1"
|
|
77
|
-
>
|
|
68
|
+
<div v-if="managers.length" class="flex flex-col gap-1 rounded-lg border border-default px-3 py-2">
|
|
78
69
|
<dt class="text-xs text-muted">
|
|
79
70
|
{{ t('list.boardInfo.managers') }}
|
|
80
71
|
</dt>
|
|
81
|
-
<dd class="flex flex-
|
|
72
|
+
<dd class="flex flex-wrap items-center gap-x-3 gap-y-1">
|
|
82
73
|
<MemiBoardInfoPerson
|
|
83
74
|
v-for="uid in managers"
|
|
84
75
|
:key="uid"
|
|
@@ -89,14 +80,11 @@ const hasInfo = computed(() => !!(props.description || managers.value.length ||
|
|
|
89
80
|
/>
|
|
90
81
|
</dd>
|
|
91
82
|
</div>
|
|
92
|
-
<div
|
|
93
|
-
v-if="staff.length"
|
|
94
|
-
class="flex flex-col gap-1"
|
|
95
|
-
>
|
|
83
|
+
<div v-if="staff.length" class="flex flex-col gap-1 rounded-lg border border-default px-3 py-2">
|
|
96
84
|
<dt class="text-xs text-muted">
|
|
97
85
|
{{ t('list.boardInfo.staff') }}
|
|
98
86
|
</dt>
|
|
99
|
-
<dd class="flex flex-
|
|
87
|
+
<dd class="flex flex-wrap items-center gap-x-3 gap-y-1">
|
|
100
88
|
<MemiBoardInfoPerson
|
|
101
89
|
v-for="uid in staff"
|
|
102
90
|
:key="uid"
|
|
@@ -108,14 +96,6 @@ const hasInfo = computed(() => !!(props.description || managers.value.length ||
|
|
|
108
96
|
</dd>
|
|
109
97
|
</div>
|
|
110
98
|
</dl>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
</UPopover>
|
|
114
|
-
<span
|
|
115
|
-
v-else
|
|
116
|
-
class="block truncate"
|
|
117
|
-
>
|
|
118
|
-
{{ title }}
|
|
119
|
-
</span>
|
|
120
|
-
</h1>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
121
101
|
</template>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import MemiBoardSurface from './BoardSurface.vue'
|
|
3
|
+
import { useMemiBoardStorage } from 'memi-board/storage'
|
|
3
4
|
import { computed, onMounted, ref, watch } from 'vue'
|
|
4
5
|
import { boardCopyIsTranslated, boardTranslationLocales, MEMI_BOARD_LOCALES, memiBoardEnabledLocales, useMemiBoardAuth, useMemiBoardPostTranslations, useMemiBoardI18n, useMemiBoardSettings, useMemiBoardUsers } from 'memi-board/runtime'
|
|
5
6
|
import type { BoardCategory, BoardEditorType, BoardListView, BoardVisibility, BoardWriteRole } from 'memi-board/runtime'
|
|
6
7
|
import MemiBoardCustomFieldEditor from './CustomFieldEditor.vue'
|
|
7
8
|
import MemiBoardOptionCards from './OptionCards.vue'
|
|
9
|
+
import MemiBoardBannerEditor from './BannerEditor.vue'
|
|
8
10
|
|
|
9
11
|
const props = withDefaults(defineProps<{
|
|
10
12
|
categoryId: string
|
|
@@ -104,6 +106,9 @@ const translating = ref(false)
|
|
|
104
106
|
const translatedDraft = ref(false)
|
|
105
107
|
const saved = ref(false)
|
|
106
108
|
const error = ref('')
|
|
109
|
+
const bannerBusy = ref(false)
|
|
110
|
+
const bannerFile = ref<File | null | undefined>()
|
|
111
|
+
const { uploadBoardBanner, deleteAttachment } = useMemiBoardStorage()
|
|
107
112
|
|
|
108
113
|
function emptyDraft(id: string): BoardCategory {
|
|
109
114
|
return {
|
|
@@ -154,6 +159,7 @@ function toDraft(category: BoardCategory): BoardCategory {
|
|
|
154
159
|
// 카테고리 전환·최초 로드 시에만 draft를 서버 값으로 맞춘다.
|
|
155
160
|
// 저장 직후 onSnapshot 갱신으로 draft.description 이 비워지거나 입력 중이던 값이 덮이지 않게 한다.
|
|
156
161
|
watch(() => props.categoryId, (id) => {
|
|
162
|
+
bannerFile.value = undefined
|
|
157
163
|
translatedDraft.value = false
|
|
158
164
|
if (source.value) draft.value = toDraft(source.value)
|
|
159
165
|
else if (canCreate.value) draft.value = emptyDraft(id)
|
|
@@ -208,11 +214,12 @@ async function translateCopy() {
|
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
async function save() {
|
|
211
|
-
if (!draft.value || translating.value || saving.value) return
|
|
217
|
+
if (!draft.value || translating.value || saving.value || bannerBusy.value) return
|
|
212
218
|
saving.value = true
|
|
213
219
|
saved.value = false
|
|
214
220
|
error.value = ''
|
|
215
221
|
const snapshot = { ...draft.value, autoTranslate: draft.value.autoTranslate === true }
|
|
222
|
+
let uploadedPath: string | undefined
|
|
216
223
|
let translateFailed = false
|
|
217
224
|
if (translationEnabled.value && snapshot.autoTranslate) {
|
|
218
225
|
try {
|
|
@@ -229,7 +236,12 @@ async function save() {
|
|
|
229
236
|
}
|
|
230
237
|
try {
|
|
231
238
|
const order = isNew.value ? categories.value.length : (snapshot.order ?? 0)
|
|
239
|
+
if (bannerFile.value !== undefined) {
|
|
240
|
+
snapshot.banner = bannerFile.value ? await uploadBoardBanner(snapshot.id, bannerFile.value) : null
|
|
241
|
+
uploadedPath = snapshot.banner?.path
|
|
242
|
+
}
|
|
232
243
|
await saveCategory(snapshot, order)
|
|
244
|
+
bannerFile.value = undefined
|
|
233
245
|
snapshot.order = order
|
|
234
246
|
snapshot.visibilityTransition = undefined
|
|
235
247
|
// 저장 성공 직후 draft 유지 (스냅샷 오기 전에 watch가 비우지 않도록)
|
|
@@ -240,6 +252,7 @@ async function save() {
|
|
|
240
252
|
if (translateFailed) error.value = t('settings.autoTranslate.failed', { count: translationCount(snapshot) })
|
|
241
253
|
}
|
|
242
254
|
catch (cause) {
|
|
255
|
+
if (uploadedPath) await deleteAttachment({ path: uploadedPath }).catch(() => {})
|
|
243
256
|
error.value = cause instanceof Error ? cause.message : t('settings.error.saveFailed')
|
|
244
257
|
}
|
|
245
258
|
finally {
|
|
@@ -262,6 +275,16 @@ async function save() {
|
|
|
262
275
|
:title="t('settings.newBoard.title')"
|
|
263
276
|
:description="t('settings.newBoard.description')"
|
|
264
277
|
/>
|
|
278
|
+
<MemiBoardBannerEditor
|
|
279
|
+
:key="draft.id"
|
|
280
|
+
:banner="draft.banner"
|
|
281
|
+
:board-id="draft.id"
|
|
282
|
+
:title="draft.label"
|
|
283
|
+
:description="draft.description"
|
|
284
|
+
@busy="bannerBusy = $event"
|
|
285
|
+
:disabled="saving || translating"
|
|
286
|
+
@change="bannerFile = $event; saved = false"
|
|
287
|
+
/>
|
|
265
288
|
<div class="grid gap-2 sm:grid-cols-[9rem_1fr] sm:items-center">
|
|
266
289
|
<div><p class="text-sm font-medium">{{ t('settings.id.label') }}</p><p class="text-xs text-muted">{{ t('settings.id.help') }}</p></div>
|
|
267
290
|
<UInput :model-value="draft.id" disabled class="font-mono" />
|
|
@@ -386,7 +409,7 @@ async function save() {
|
|
|
386
409
|
/>
|
|
387
410
|
</div>
|
|
388
411
|
<div class="flex justify-end border-t border-default pt-4">
|
|
389
|
-
<UButton :label="isNew ? t('settings.action.create') : t('common.action.save')" :icon="isNew ? 'i-lucide-plus' : 'i-lucide-save'" :loading="saving" :disabled="translating" @click="save" />
|
|
412
|
+
<UButton :label="isNew ? t('settings.action.create') : t('common.action.save')" :icon="isNew ? 'i-lucide-plus' : 'i-lucide-save'" :loading="saving" :disabled="translating || bannerBusy" @click="save" />
|
|
390
413
|
</div>
|
|
391
414
|
<UAlert v-if="error" color="error" variant="subtle" :description="error" />
|
|
392
415
|
<UAlert v-if="saved" color="success" variant="subtle" :description="isNew ? t('settings.created') : t('settings.savedSettings')" />
|
|
@@ -119,13 +119,12 @@ const emptyMessage = computed(() =>
|
|
|
119
119
|
class="mr-1 text-primary"
|
|
120
120
|
>@{{ comment.replyToName }}</span><span v-text="displayCommentBody(comment, locale)" />
|
|
121
121
|
</p>
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</p>
|
|
122
|
+
<UTooltip v-if="(comment.likeCount ?? 0) > 0" :text="t('list.likeCount', { count: comment.likeCount ?? 0 })" :delay-duration="200" :content="{ side: 'top' }">
|
|
123
|
+
<p class="mt-1 flex items-center gap-1 text-xs text-muted">
|
|
124
|
+
<UIcon name="i-lucide-heart" class="size-3" />
|
|
125
|
+
{{ comment.likeCount }}
|
|
126
|
+
</p>
|
|
127
|
+
</UTooltip>
|
|
129
128
|
</component>
|
|
130
129
|
</li>
|
|
131
130
|
</ul>
|
|
@@ -208,19 +208,17 @@ async function toggleLike() {
|
|
|
208
208
|
:author-comments-to="authorCommentsTo"
|
|
209
209
|
/>
|
|
210
210
|
<span v-else class="text-sm font-medium">{{ comment.authorName ?? t('common.label.anonymous') }}</span>
|
|
211
|
-
<
|
|
211
|
+
<UTooltip :delay-duration="200" :content="{ side: 'top' }" :ui="{ content: 'h-auto px-3 py-2' }">
|
|
212
212
|
<time
|
|
213
213
|
:datetime="date?.toISOString()"
|
|
214
|
-
class="
|
|
214
|
+
class="text-xs text-muted"
|
|
215
215
|
>
|
|
216
216
|
{{ relativeDate }}
|
|
217
217
|
</time>
|
|
218
218
|
<template #content>
|
|
219
|
-
<
|
|
220
|
-
{{ timestampDetails }}
|
|
221
|
-
</p>
|
|
219
|
+
<span class="whitespace-pre-line">{{ timestampDetails }}</span>
|
|
222
220
|
</template>
|
|
223
|
-
</
|
|
221
|
+
</UTooltip>
|
|
224
222
|
</div>
|
|
225
223
|
<form
|
|
226
224
|
v-if="editing"
|
|
@@ -331,14 +329,15 @@ async function toggleLike() {
|
|
|
331
329
|
@click="toggleLike"
|
|
332
330
|
/>
|
|
333
331
|
</UTooltip>
|
|
334
|
-
<
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
332
|
+
<UTooltip v-else :text="t('list.likeCount', { count: localLikeCount })" :delay-duration="200" :content="{ side: 'top' }">
|
|
333
|
+
<span
|
|
334
|
+
class="flex items-center gap-0.5 px-1 text-xs text-muted"
|
|
335
|
+
:aria-label="t('list.likeCount', { count: localLikeCount })"
|
|
336
|
+
>
|
|
337
|
+
<UIcon name="i-lucide-heart" class="size-3.5" />
|
|
338
|
+
{{ localLikeCount }}
|
|
339
|
+
</span>
|
|
340
|
+
</UTooltip>
|
|
342
341
|
<UTooltip v-if="canEditComment(comment) && comment.id && !localBlinded" :text="t('commentItem.edit')" :delay-duration="200">
|
|
343
342
|
<UButton
|
|
344
343
|
icon="i-lucide-pencil"
|
|
@@ -256,8 +256,8 @@ watch(() => props.postId, () => {
|
|
|
256
256
|
</div>
|
|
257
257
|
|
|
258
258
|
<header class="flex flex-col gap-2">
|
|
259
|
-
<div class="flex items-start
|
|
260
|
-
<div class="flex items-center gap-2
|
|
259
|
+
<div class="flex items-start gap-3">
|
|
260
|
+
<div class="flex min-w-0 flex-1 items-center gap-2">
|
|
261
261
|
<UBadge
|
|
262
262
|
v-if="post.category"
|
|
263
263
|
:label="shownBoardLabel"
|
|
@@ -271,31 +271,6 @@ watch(() => props.postId, () => {
|
|
|
271
271
|
{{ shownTitle }}
|
|
272
272
|
</h1>
|
|
273
273
|
</div>
|
|
274
|
-
<UTooltip :text="t('detail.backToList')" :delay-duration="200">
|
|
275
|
-
<UButton
|
|
276
|
-
icon="i-lucide-arrow-left"
|
|
277
|
-
:aria-label="t('detail.backToList')"
|
|
278
|
-
color="neutral"
|
|
279
|
-
variant="ghost"
|
|
280
|
-
size="sm"
|
|
281
|
-
class="shrink-0"
|
|
282
|
-
@click="emit('list')"
|
|
283
|
-
/>
|
|
284
|
-
</UTooltip>
|
|
285
|
-
</div>
|
|
286
|
-
<div
|
|
287
|
-
v-if="post.tags?.length"
|
|
288
|
-
class="flex gap-1"
|
|
289
|
-
>
|
|
290
|
-
<UBadge
|
|
291
|
-
v-for="tag in post.tags"
|
|
292
|
-
:key="tag"
|
|
293
|
-
variant="subtle"
|
|
294
|
-
color="neutral"
|
|
295
|
-
size="sm"
|
|
296
|
-
>
|
|
297
|
-
{{ tag }}
|
|
298
|
-
</UBadge>
|
|
299
274
|
</div>
|
|
300
275
|
</header>
|
|
301
276
|
|
|
@@ -325,6 +300,25 @@ watch(() => props.postId, () => {
|
|
|
325
300
|
</div>
|
|
326
301
|
</dl>
|
|
327
302
|
|
|
303
|
+
<div v-if="post.tags?.length" class="flex flex-wrap justify-end gap-1">
|
|
304
|
+
<UTooltip
|
|
305
|
+
v-for="tag in post.tags"
|
|
306
|
+
:key="tag"
|
|
307
|
+
:text="t('detail.tag')"
|
|
308
|
+
:delay-duration="200"
|
|
309
|
+
:content="{ side: 'top' }"
|
|
310
|
+
:ui="{ content: 'h-auto px-3 py-2' }"
|
|
311
|
+
>
|
|
312
|
+
<UBadge
|
|
313
|
+
variant="subtle"
|
|
314
|
+
color="primary"
|
|
315
|
+
size="sm"
|
|
316
|
+
>
|
|
317
|
+
{{ tag }}
|
|
318
|
+
</UBadge>
|
|
319
|
+
</UTooltip>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
328
322
|
<div class="flex flex-col items-end gap-2">
|
|
329
323
|
<div class="flex items-center justify-end gap-3 text-sm text-muted">
|
|
330
324
|
<MemiBoardAuthorMenu
|
|
@@ -335,23 +329,20 @@ watch(() => props.postId, () => {
|
|
|
335
329
|
:author-profile-to="authorProfileTo"
|
|
336
330
|
:author-comments-to="authorCommentsTo"
|
|
337
331
|
/>
|
|
338
|
-
<
|
|
339
|
-
<
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
>
|
|
332
|
+
<UTooltip :text="t('common.label.viewCount', { count: post.viewCount ?? 0 })" :delay-duration="200" :content="{ side: 'top' }">
|
|
333
|
+
<span class="inline-flex items-center gap-1 tabular-nums">
|
|
334
|
+
<UIcon name="i-lucide-eye" class="size-3.5" />
|
|
335
|
+
{{ post.viewCount ?? 0 }}
|
|
336
|
+
</span>
|
|
337
|
+
</UTooltip>
|
|
338
|
+
<UTooltip :delay-duration="200" :content="{ side: 'top' }" :ui="{ content: 'h-auto px-3 py-2' }">
|
|
339
|
+
<time :datetime="post.createdAt?.toDate?.().toISOString()">
|
|
347
340
|
{{ formatRelativeDate(post.createdAt, now) }}
|
|
348
341
|
</time>
|
|
349
342
|
<template #content>
|
|
350
|
-
<
|
|
351
|
-
{{ formatTimestampDetails(post.createdAt, post.updatedAt).join('\n') }}
|
|
352
|
-
</p>
|
|
343
|
+
<span class="whitespace-pre-line">{{ formatTimestampDetails(post.createdAt, post.updatedAt).join('\n') }}</span>
|
|
353
344
|
</template>
|
|
354
|
-
</
|
|
345
|
+
</UTooltip>
|
|
355
346
|
</div>
|
|
356
347
|
<div v-if="canPin || canEdit(post) || canDelete(post)" class="flex gap-2">
|
|
357
348
|
<UButton
|
|
@@ -7,7 +7,7 @@ import MemiBoardSurface from './BoardSurface.vue'
|
|
|
7
7
|
*
|
|
8
8
|
* 커스텀은 handlers.image(파일 업로드), YouTube 임베드 + DOM paste/drop.
|
|
9
9
|
*/
|
|
10
|
-
import { ref, computed, watch, nextTick } from 'vue'
|
|
10
|
+
import { ref, computed, watch, nextTick, onBeforeUnmount } from 'vue'
|
|
11
11
|
import { imeSafeSubmitClick, imeSafeSubmitPointerDown } from 'memi-board/runtime'
|
|
12
12
|
import Youtube from '@tiptap/extension-youtube'
|
|
13
13
|
import type { DropdownMenuItem, EditorSuggestionMenuItem } from '@nuxt/ui'
|
|
@@ -104,6 +104,11 @@ const submitHint = ref('')
|
|
|
104
104
|
const error = ref('')
|
|
105
105
|
const imageUploading = ref(false)
|
|
106
106
|
const imageUploadError = ref('')
|
|
107
|
+
/** Body images still uploading: a local preview sits in the document and an overlay covers it. */
|
|
108
|
+
interface PendingEditorImage { url: string, top: number, left: number, width: number, height: number }
|
|
109
|
+
const pendingEditorImages = ref<PendingEditorImage[]>([])
|
|
110
|
+
const editorFrame = ref<HTMLElement>()
|
|
111
|
+
let pendingLayoutFrame = 0
|
|
107
112
|
const imageDialogOpen = ref(false)
|
|
108
113
|
const imageDialogEditor = ref<any | null>(null)
|
|
109
114
|
const externalImageUrl = ref('')
|
|
@@ -201,6 +206,11 @@ const editorExtensions = [
|
|
|
201
206
|
}),
|
|
202
207
|
]
|
|
203
208
|
|
|
209
|
+
/** Full how-to guide while the body is empty; the short block-menu hint on other empty lines. */
|
|
210
|
+
const editorPlaceholder = computed(() => isImageEditor.value
|
|
211
|
+
? t('editor.imageContentPlaceholder')
|
|
212
|
+
: { placeholder: ({ editor }: { editor: { isEmpty: boolean } }) => editor.isEmpty ? t('editor.contentGuide') : t('editor.contentPlaceholder') })
|
|
213
|
+
|
|
204
214
|
function imageNamespace(): string {
|
|
205
215
|
return props.postId || attachmentNamespace.value
|
|
206
216
|
}
|
|
@@ -426,35 +436,116 @@ function onCoverItemDragEnd() {
|
|
|
426
436
|
coverDropActive.value = false
|
|
427
437
|
}
|
|
428
438
|
|
|
429
|
-
|
|
439
|
+
function assertEditorImageFile(file: File) {
|
|
430
440
|
if (!file.type.startsWith('image/')) {
|
|
431
441
|
throw new Error(t('editor.errors.imageOnly'))
|
|
432
442
|
}
|
|
433
443
|
if (file.size > EDITOR_IMAGE_SOURCE_MAX_BYTES) {
|
|
434
444
|
throw new Error(t('editor.errors.imageTooLarge', { mb: EDITOR_IMAGE_SOURCE_MAX_BYTES / 1024 / 1024 }))
|
|
435
445
|
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
async function doUploadImage(file: File): Promise<EditorImageEntry> {
|
|
449
|
+
assertEditorImageFile(file)
|
|
436
450
|
const entry = await uploadEditorImage(file, imageNamespace())
|
|
437
451
|
uploadedEditorImages.value.push(entry)
|
|
438
452
|
return entry
|
|
439
453
|
}
|
|
440
454
|
|
|
441
|
-
|
|
455
|
+
function findImageNode(editor: any, src: string): { pos: number, node: any } | null {
|
|
456
|
+
let found: { pos: number, node: any } | null = null
|
|
457
|
+
editor.state.doc.descendants((node: any, pos: number) => {
|
|
458
|
+
if (found) return false
|
|
459
|
+
if (node.type.name === 'image' && node.attrs.src === src) {
|
|
460
|
+
found = { pos, node }
|
|
461
|
+
return false
|
|
462
|
+
}
|
|
463
|
+
})
|
|
464
|
+
return found
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** Keeps each uploading overlay on top of its preview image while the document moves. */
|
|
468
|
+
function layoutPendingEditorImages() {
|
|
469
|
+
pendingLayoutFrame = 0
|
|
470
|
+
const editor = resolveEditor()
|
|
471
|
+
const frame = editorFrame.value
|
|
472
|
+
if (!editor?.view || !frame || !pendingEditorImages.value.length) return
|
|
473
|
+
const base = frame.getBoundingClientRect()
|
|
474
|
+
for (const item of pendingEditorImages.value) {
|
|
475
|
+
const img = editor.view.dom.querySelector(`img[src="${CSS.escape(item.url)}"]`) as HTMLElement | null
|
|
476
|
+
if (!img) {
|
|
477
|
+
item.width = 0
|
|
478
|
+
continue
|
|
479
|
+
}
|
|
480
|
+
const rect = img.getBoundingClientRect()
|
|
481
|
+
item.top = rect.top - base.top
|
|
482
|
+
item.left = rect.left - base.left
|
|
483
|
+
item.width = Math.max(rect.width, 200)
|
|
484
|
+
item.height = Math.max(rect.height, 120)
|
|
485
|
+
}
|
|
486
|
+
pendingLayoutFrame = requestAnimationFrame(layoutPendingEditorImages)
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function startPendingLayout() {
|
|
490
|
+
if (!pendingLayoutFrame) pendingLayoutFrame = requestAnimationFrame(layoutPendingEditorImages)
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
onBeforeUnmount(() => {
|
|
494
|
+
if (pendingLayoutFrame) cancelAnimationFrame(pendingLayoutFrame)
|
|
495
|
+
for (const item of pendingEditorImages.value) URL.revokeObjectURL(item.url)
|
|
496
|
+
})
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Inserts a local preview where the image goes, shows a large uploading overlay on it,
|
|
500
|
+
* then swaps in the uploaded URL (or removes the preview on failure).
|
|
501
|
+
*/
|
|
502
|
+
async function uploadAndSetImage(editor: any, file: File, at?: number) {
|
|
442
503
|
// 이미지 보드: TipTap 삽입 금지 → 갤러리에 추가
|
|
443
504
|
if (isImageEditor.value) {
|
|
444
505
|
await uploadCoverImages([file])
|
|
445
506
|
return
|
|
446
507
|
}
|
|
447
|
-
imageUploading.value = true
|
|
448
508
|
imageUploadError.value = ''
|
|
509
|
+
try {
|
|
510
|
+
assertEditorImageFile(file)
|
|
511
|
+
}
|
|
512
|
+
catch (e) {
|
|
513
|
+
imageUploadError.value = (e as Error).message
|
|
514
|
+
return
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const previewUrl = URL.createObjectURL(file)
|
|
518
|
+
const chain = editor.chain().focus()
|
|
519
|
+
if (at !== undefined) chain.setTextSelection(at)
|
|
520
|
+
chain.setImage({ src: previewUrl }).run()
|
|
521
|
+
pendingEditorImages.value.push({ url: previewUrl, top: 0, left: 0, width: 0, height: 0 })
|
|
522
|
+
imageUploading.value = true
|
|
523
|
+
startPendingLayout()
|
|
524
|
+
|
|
449
525
|
try {
|
|
450
526
|
const entry = await doUploadImage(file)
|
|
451
|
-
|
|
527
|
+
const found = findImageNode(editor, previewUrl)
|
|
528
|
+
if (found) {
|
|
529
|
+
editor.view.dispatch(
|
|
530
|
+
editor.state.tr
|
|
531
|
+
.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, src: entry.originalUrl })
|
|
532
|
+
.setMeta('addToHistory', false),
|
|
533
|
+
)
|
|
534
|
+
}
|
|
452
535
|
}
|
|
453
536
|
catch (e) {
|
|
537
|
+
const found = findImageNode(editor, previewUrl)
|
|
538
|
+
if (found) {
|
|
539
|
+
editor.view.dispatch(
|
|
540
|
+
editor.state.tr.delete(found.pos, found.pos + found.node.nodeSize).setMeta('addToHistory', false),
|
|
541
|
+
)
|
|
542
|
+
}
|
|
454
543
|
imageUploadError.value = (e as Error).message || t('editor.errors.imageUploadFailed')
|
|
455
544
|
}
|
|
456
545
|
finally {
|
|
457
|
-
|
|
546
|
+
pendingEditorImages.value = pendingEditorImages.value.filter(item => item.url !== previewUrl)
|
|
547
|
+
URL.revokeObjectURL(previewUrl)
|
|
548
|
+
imageUploading.value = pendingEditorImages.value.length > 0
|
|
458
549
|
}
|
|
459
550
|
}
|
|
460
551
|
|
|
@@ -996,7 +1087,8 @@ function onEditorRootDrop(e: DragEvent) {
|
|
|
996
1087
|
}
|
|
997
1088
|
const editor = resolveEditor()
|
|
998
1089
|
if (!editor) return
|
|
999
|
-
|
|
1090
|
+
const dropPos = editor.view?.posAtCoords({ left: e.clientX, top: e.clientY })?.pos
|
|
1091
|
+
void uploadAndSetImage(editor, image, dropPos)
|
|
1000
1092
|
}
|
|
1001
1093
|
|
|
1002
1094
|
function onEditorRootDragOver(e: DragEvent) {
|
|
@@ -1437,14 +1529,15 @@ async function handleSubmit() {
|
|
|
1437
1529
|
class="rounded-none rounded-t-xl"
|
|
1438
1530
|
/>
|
|
1439
1531
|
|
|
1532
|
+
<div ref="editorFrame" class="relative">
|
|
1440
1533
|
<UEditor
|
|
1441
1534
|
ref="editorRef"
|
|
1442
1535
|
v-model="content"
|
|
1443
1536
|
content-type="html"
|
|
1444
1537
|
:extensions="editorExtensions"
|
|
1445
1538
|
:handlers="handlers"
|
|
1446
|
-
:placeholder="
|
|
1447
|
-
:ui="{ content: 'min-h-64 p-4' }"
|
|
1539
|
+
:placeholder="editorPlaceholder"
|
|
1540
|
+
:ui="{ content: 'min-h-64 p-4 [&_.is-empty]:before:whitespace-pre-line' }"
|
|
1448
1541
|
class="board-content w-full"
|
|
1449
1542
|
>
|
|
1450
1543
|
<template #default="{ editor, handlers: editorHandlers }">
|
|
@@ -1507,6 +1600,19 @@ async function handleSubmit() {
|
|
|
1507
1600
|
</template>
|
|
1508
1601
|
</UEditor>
|
|
1509
1602
|
|
|
1603
|
+
<div
|
|
1604
|
+
v-for="item in pendingEditorImages"
|
|
1605
|
+
v-show="item.width"
|
|
1606
|
+
:key="item.url"
|
|
1607
|
+
role="status"
|
|
1608
|
+
class="pointer-events-none absolute z-10 flex flex-col items-center justify-center gap-3 overflow-hidden rounded-lg bg-default/75 p-4 text-center ring ring-inset ring-default backdrop-blur-sm"
|
|
1609
|
+
:style="{ top: `${item.top}px`, left: `${item.left}px`, width: `${item.width}px`, height: `${item.height}px` }"
|
|
1610
|
+
>
|
|
1611
|
+
<UIcon name="i-lucide-loader-circle" class="size-10 shrink-0 animate-spin text-primary" />
|
|
1612
|
+
<span class="text-sm font-medium text-highlighted">{{ t('editor.imageOptimizing') }}</span>
|
|
1613
|
+
</div>
|
|
1614
|
+
</div>
|
|
1615
|
+
|
|
1510
1616
|
<p
|
|
1511
1617
|
v-if="aiError"
|
|
1512
1618
|
class="flex items-center gap-2 border-t border-default px-4 py-2 text-xs text-error"
|
|
@@ -68,7 +68,7 @@ const stacks = computed(() => [
|
|
|
68
68
|
<div v-if="showAbout" ref="anchor" class="contents">
|
|
69
69
|
<footer v-if="active" class="flex justify-center pt-2">
|
|
70
70
|
<button type="button" class="cursor-pointer text-[11px] text-dimmed transition-colors hover:text-muted" @click="open = true">
|
|
71
|
-
About memi-board
|
|
71
|
+
About memi-board™
|
|
72
72
|
</button>
|
|
73
73
|
</footer>
|
|
74
74
|
|
|
@@ -90,7 +90,7 @@ const stacks = computed(() => [
|
|
|
90
90
|
<UIcon name="i-lucide-code-2" class="size-5" />
|
|
91
91
|
</span>
|
|
92
92
|
<div>
|
|
93
|
-
<p class="text-sm font-semibold tracking-tight text-highlighted">memi-board
|
|
93
|
+
<p class="text-sm font-semibold tracking-tight text-highlighted">memi-board™</p>
|
|
94
94
|
<p v-if="version" class="mt-0.5 font-mono text-[10px] tracking-wider text-dimmed">v{{ version }}</p>
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
@@ -118,7 +118,7 @@ const stacks = computed(() => [
|
|
|
118
118
|
<div class="flex flex-col gap-5">
|
|
119
119
|
<div>
|
|
120
120
|
<p class="mb-4 text-[10px] font-semibold uppercase tracking-[0.24em] text-primary">{{ t('footer.eyebrow') }}</p>
|
|
121
|
-
<h2 class="text-4xl font-semibold tracking-[-0.06em] text-highlighted sm:text-5xl">memi-board<span class="text-primary">.</span></h2>
|
|
121
|
+
<h2 class="text-4xl font-semibold tracking-[-0.06em] text-highlighted sm:text-5xl">memi-board<sup class="ms-1 align-super text-sm font-medium tracking-normal text-muted">™</sup><span class="text-primary">.</span></h2>
|
|
122
122
|
<p class="mt-4 text-base font-medium tracking-tight text-toned sm:text-lg">{{ t('footer.tagline') }}</p>
|
|
123
123
|
</div>
|
|
124
124
|
<div>
|
|
@@ -26,14 +26,13 @@ const { isLiked, likePending, toggleLike } = useMemiBoardLikes(props.boardId, pr
|
|
|
26
26
|
@click="toggleLike"
|
|
27
27
|
/>
|
|
28
28
|
</UTooltip>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</span>
|
|
29
|
+
<UTooltip v-else :text="t('list.likeCount', { count: likeCount ?? 0 })" :delay-duration="200" :content="{ side: 'top' }">
|
|
30
|
+
<span class="flex items-center gap-1 text-sm text-muted">
|
|
31
|
+
<UIcon
|
|
32
|
+
name="i-lucide-heart"
|
|
33
|
+
class="size-4"
|
|
34
|
+
/>
|
|
35
|
+
{{ likeCount ?? 0 }}
|
|
36
|
+
</span>
|
|
37
|
+
</UTooltip>
|
|
39
38
|
</template>
|