memi-board 0.65.0 → 0.66.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/dist/{ar-Dg9e1ruU.js → ar-vCWN4UgB.js} +4 -1
- package/dist/ar-vCWN4UgB.js.map +1 -0
- package/dist/{commentImages-DHIuwvex.js → commentImages-Bdy_5GoM.js} +96 -49
- package/dist/commentImages-Bdy_5GoM.js.map +1 -0
- package/dist/composables/useMemiBoardAutoTranslate.d.ts +1 -1
- package/dist/{de-CpGJ3KkZ.js → de-Br2Z_mcP.js} +4 -1
- package/dist/de-Br2Z_mcP.js.map +1 -0
- package/dist/{en-yS55nNno.js → en-dwiFlzpm.js} +45 -1
- package/dist/en-dwiFlzpm.js.map +1 -0
- package/dist/{es-tMBUNff2.js → es-E1OXjEpy.js} +4 -1
- package/dist/{es-tMBUNff2.js.map → es-E1OXjEpy.js.map} +1 -1
- package/dist/{fr-BFXp_PeM.js → fr-BBiQmovr.js} +4 -1
- package/dist/fr-BBiQmovr.js.map +1 -0
- package/dist/{id-B7lgKUHZ.js → id-D-XLJeg9.js} +4 -1
- package/dist/id-D-XLJeg9.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1678 -1597
- package/dist/index.js.map +1 -1
- package/dist/{ja-3SXam5Sk.js → ja-DDx8RDwB.js} +4 -1
- package/dist/ja-DDx8RDwB.js.map +1 -0
- package/dist/{pt-C2_VknPa.js → pt-CmLdTNz1.js} +4 -1
- package/dist/pt-CmLdTNz1.js.map +1 -0
- package/dist/runtime/components/Attachments.vue +2 -2
- package/dist/runtime/components/AuthorMenu.vue +7 -3
- package/dist/runtime/components/CommentItem.vue +178 -175
- package/dist/runtime/components/Diagnostics.vue +32 -0
- package/dist/runtime/components/Editor.vue +94 -8
- package/dist/runtime/components/Footer.vue +27 -3
- package/dist/runtime/components/GameMemory.vue +78 -0
- package/dist/runtime/components/GameSnake.vue +162 -0
- package/dist/runtime/components/GameSudoku.vue +118 -0
- package/dist/runtime/components/ListCard.vue +9 -5
- package/dist/runtime/components/ProfileEditModal.vue +37 -14
- package/dist/runtime/components/Settings.vue +2 -0
- package/dist/runtime/components/Spec.vue +276 -0
- package/dist/runtime/components/WaitingGames.vue +31 -0
- package/dist/runtime/components/WaitingOverlay.vue +76 -0
- package/dist/storage.js +22 -22
- package/dist/utils/localizedFields.d.ts +8 -0
- package/dist/utils/postLimits.d.ts +26 -0
- package/dist/utils/postSlug.d.ts +3 -1
- package/dist/utils/profileLimits.d.ts +5 -0
- package/dist/{zh-CuOjIYyr.js → zh-nWOVw2PS.js} +4 -1
- package/dist/zh-nWOVw2PS.js.map +1 -0
- package/docs/firebase-setup.md +25 -0
- package/docs/firestore.rules.example +114 -9
- package/docs/storage.rules.example +10 -1
- package/package.json +1 -1
- package/dist/ar-Dg9e1ruU.js.map +0 -1
- package/dist/commentImages-DHIuwvex.js.map +0 -1
- package/dist/de-CpGJ3KkZ.js.map +0 -1
- package/dist/en-yS55nNno.js.map +0 -1
- package/dist/fr-BFXp_PeM.js.map +0 -1
- package/dist/id-B7lgKUHZ.js.map +0 -1
- package/dist/ja-3SXam5Sk.js.map +0 -1
- package/dist/pt-C2_VknPa.js.map +0 -1
- package/dist/zh-CuOjIYyr.js.map +0 -1
|
@@ -208,20 +208,21 @@ async function toggleLike() {
|
|
|
208
208
|
</script>
|
|
209
209
|
|
|
210
210
|
<template>
|
|
211
|
-
<div :id="comment.id ? `memi-comment-${comment.id}` : undefined" class="flex
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
<div class="flex items-center gap-2">
|
|
211
|
+
<div :id="comment.id ? `memi-comment-${comment.id}` : undefined" class="flex flex-col gap-2 scroll-mt-20">
|
|
212
|
+
<div class="flex items-center gap-2">
|
|
213
|
+
<UAvatar
|
|
214
|
+
:src="comment.authorPhoto ?? undefined"
|
|
215
|
+
:alt="comment.authorName ?? t('common.label.anonymous')"
|
|
216
|
+
size="sm"
|
|
217
|
+
/>
|
|
218
|
+
<div class="flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5">
|
|
219
219
|
<MemiBoardAuthorMenu
|
|
220
220
|
v-if="comment.authorUid"
|
|
221
221
|
:author-uid="comment.authorUid"
|
|
222
222
|
:author-name="comment.authorName"
|
|
223
223
|
:author-photo="comment.authorPhoto"
|
|
224
224
|
:show-avatar="false"
|
|
225
|
+
ellipsis
|
|
225
226
|
:author-profile-to="authorProfileTo"
|
|
226
227
|
:author-posts-to="authorPostsTo"
|
|
227
228
|
:author-comments-to="authorCommentsTo"
|
|
@@ -249,186 +250,188 @@ async function toggleLike() {
|
|
|
249
250
|
</UBadge>
|
|
250
251
|
</UTooltip>
|
|
251
252
|
</div>
|
|
252
|
-
<
|
|
253
|
-
v-if="
|
|
254
|
-
class="mt-2 flex flex-col gap-2"
|
|
255
|
-
@submit.prevent="saveEdit"
|
|
256
|
-
>
|
|
257
|
-
<UTextarea
|
|
258
|
-
v-model="editBody"
|
|
259
|
-
@paste="imageField?.handlePaste($event)"
|
|
260
|
-
:rows="2"
|
|
261
|
-
autoresize
|
|
262
|
-
:maxrows="10"
|
|
263
|
-
:maxlength="COMMENT_BODY_MAX_LENGTH"
|
|
264
|
-
:disabled="saving || aiBusy"
|
|
265
|
-
autofocus
|
|
266
|
-
/>
|
|
267
|
-
<MemiBoardCommentAi v-model="editBody" v-model:translations="translations" :board-id="boardId"
|
|
268
|
-
:disabled="saving || imageBusy || isWriteRestricted" @busy="aiBusy = $event" />
|
|
269
|
-
<MemiBoardCommentImageField
|
|
270
|
-
ref="imageField"
|
|
271
|
-
v-if="comment.id"
|
|
272
|
-
v-model="editImage"
|
|
273
|
-
:post-id="postId"
|
|
274
|
-
:comment-id="comment.id"
|
|
275
|
-
:disabled="saving"
|
|
276
|
-
@busy="imageBusy = $event"
|
|
277
|
-
/>
|
|
278
|
-
<p class="text-right text-xs text-dimmed">
|
|
279
|
-
{{ editBody.length.toLocaleString() }} / {{ COMMENT_BODY_MAX_LENGTH.toLocaleString() }}
|
|
280
|
-
</p>
|
|
281
|
-
<p v-if="editError" class="text-xs text-error">
|
|
282
|
-
{{ editError }}
|
|
283
|
-
</p>
|
|
284
|
-
<div class="flex justify-end gap-1">
|
|
253
|
+
<div class="flex shrink-0 items-center gap-1">
|
|
254
|
+
<UTooltip v-if="isSignedIn && commentLikes && comment.id" :text="isLiked ? t('common.action.unlike') : t('common.action.like')" :delay-duration="200">
|
|
285
255
|
<UButton
|
|
286
|
-
|
|
287
|
-
|
|
256
|
+
icon="i-lucide-heart"
|
|
257
|
+
size="xs"
|
|
258
|
+
variant="ghost"
|
|
259
|
+
:color="isLiked ? 'error' : 'neutral'"
|
|
260
|
+
:label="String(localLikeCount)"
|
|
261
|
+
:loading="likePending"
|
|
262
|
+
:aria-label="isLiked ? t('common.action.unlike') : t('common.action.like')"
|
|
263
|
+
@click="toggleLike"
|
|
264
|
+
/>
|
|
265
|
+
</UTooltip>
|
|
266
|
+
<UTooltip v-else :text="t('list.likeCount', { count: localLikeCount })" :delay-duration="200" :content="{ side: 'top' }">
|
|
267
|
+
<span
|
|
268
|
+
class="flex items-center gap-0.5 px-1 text-xs text-muted"
|
|
269
|
+
:aria-label="t('list.likeCount', { count: localLikeCount })"
|
|
270
|
+
>
|
|
271
|
+
<UIcon name="i-lucide-heart" class="size-3.5" />
|
|
272
|
+
{{ localLikeCount }}
|
|
273
|
+
</span>
|
|
274
|
+
</UTooltip>
|
|
275
|
+
<UTooltip v-if="canEditComment(comment) && comment.id && !localBlinded" :text="t('commentItem.edit')" :delay-duration="200">
|
|
276
|
+
<UButton
|
|
277
|
+
icon="i-lucide-pencil"
|
|
288
278
|
size="xs"
|
|
289
279
|
color="neutral"
|
|
290
280
|
variant="ghost"
|
|
291
|
-
:
|
|
292
|
-
|
|
281
|
+
:aria-label="t('commentItem.edit')"
|
|
282
|
+
:disabled="editing"
|
|
283
|
+
@click="startEdit"
|
|
293
284
|
/>
|
|
285
|
+
</UTooltip>
|
|
286
|
+
<UTooltip v-if="canManageBoard(comment.boardId) && comment.id" :text="localBlinded ? t('commentItem.unblind') : t('commentItem.blind')" :delay-duration="200">
|
|
294
287
|
<UButton
|
|
295
|
-
|
|
296
|
-
@pointerdown="imeSafeSubmitPointerDown"
|
|
297
|
-
@click="imeSafeSubmitClick"
|
|
298
|
-
:label="t('common.action.save')"
|
|
288
|
+
:icon="localBlinded ? 'i-lucide-eye' : 'i-lucide-eye-off'"
|
|
299
289
|
size="xs"
|
|
300
|
-
:
|
|
301
|
-
|
|
290
|
+
:color="localBlinded ? 'neutral' : 'warning'"
|
|
291
|
+
variant="ghost"
|
|
292
|
+
:loading="blindSaving"
|
|
293
|
+
:aria-label="localBlinded ? t('commentItem.unblind') : t('commentItem.blind')"
|
|
294
|
+
@click="toggleBlind"
|
|
302
295
|
/>
|
|
303
|
-
</
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
:key="line"
|
|
313
|
-
class="h-3"
|
|
314
|
-
:class="line === blindLines ? 'w-1/2' : 'w-5/6'"
|
|
296
|
+
</UTooltip>
|
|
297
|
+
<UTooltip v-if="localRevision > 0 && canManageBoard(comment.boardId) && comment.id" :text="t('commentItem.history')" :delay-duration="200">
|
|
298
|
+
<UButton
|
|
299
|
+
icon="i-lucide-history"
|
|
300
|
+
size="xs"
|
|
301
|
+
color="neutral"
|
|
302
|
+
variant="ghost"
|
|
303
|
+
:aria-label="t('commentItem.history')"
|
|
304
|
+
@click="revisionsOpen = true"
|
|
315
305
|
/>
|
|
316
|
-
</
|
|
317
|
-
<
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
:
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
class="max-h-60 max-w-full rounded-md border border-default object-contain"
|
|
336
|
-
>
|
|
337
|
-
</button>
|
|
338
|
-
<MemiBoardImageLightbox
|
|
339
|
-
v-if="localImage"
|
|
340
|
-
v-model:open="imageOpen"
|
|
341
|
-
:images="[localImage.url]"
|
|
306
|
+
</UTooltip>
|
|
307
|
+
<UTooltip :text="t('common.action.reply')" :delay-duration="200">
|
|
308
|
+
<UButton
|
|
309
|
+
icon="i-lucide-reply"
|
|
310
|
+
size="xs"
|
|
311
|
+
color="neutral"
|
|
312
|
+
variant="ghost"
|
|
313
|
+
:aria-label="t('common.action.reply')"
|
|
314
|
+
@click="emit('reply', comment)"
|
|
315
|
+
/>
|
|
316
|
+
</UTooltip>
|
|
317
|
+
<MemiBoardCommentReportButton
|
|
318
|
+
v-if="comment.id"
|
|
319
|
+
:board-id="boardId"
|
|
320
|
+
:post-id="postId"
|
|
321
|
+
:comment-id="comment.id"
|
|
322
|
+
:author-uid="comment.authorUid"
|
|
323
|
+
:author-name="comment.authorName"
|
|
324
|
+
:comment-body="localBody"
|
|
342
325
|
/>
|
|
326
|
+
<UTooltip v-if="canDeleteComment(comment) && comment.id" :text="t('commentItem.delete')" :delay-duration="200">
|
|
327
|
+
<UButton
|
|
328
|
+
icon="i-lucide-trash-2"
|
|
329
|
+
size="xs"
|
|
330
|
+
variant="ghost"
|
|
331
|
+
color="error"
|
|
332
|
+
:loading="deleting"
|
|
333
|
+
:aria-label="t('commentItem.delete')"
|
|
334
|
+
@click="emit('delete', comment.id)"
|
|
335
|
+
/>
|
|
336
|
+
</UTooltip>
|
|
343
337
|
</div>
|
|
344
|
-
<p v-if="likeError" class="mt-1 text-xs text-error">
|
|
345
|
-
{{ likeError }}
|
|
346
|
-
</p>
|
|
347
338
|
</div>
|
|
348
|
-
<div class="
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
variant="ghost"
|
|
354
|
-
:color="isLiked ? 'error' : 'neutral'"
|
|
355
|
-
:label="String(localLikeCount)"
|
|
356
|
-
:loading="likePending"
|
|
357
|
-
:aria-label="isLiked ? t('common.action.unlike') : t('common.action.like')"
|
|
358
|
-
@click="toggleLike"
|
|
359
|
-
/>
|
|
360
|
-
</UTooltip>
|
|
361
|
-
<UTooltip v-else :text="t('list.likeCount', { count: localLikeCount })" :delay-duration="200" :content="{ side: 'top' }">
|
|
362
|
-
<span
|
|
363
|
-
class="flex items-center gap-0.5 px-1 text-xs text-muted"
|
|
364
|
-
:aria-label="t('list.likeCount', { count: localLikeCount })"
|
|
339
|
+
<div class="min-w-0">
|
|
340
|
+
<form
|
|
341
|
+
v-if="editing"
|
|
342
|
+
class="mt-2 flex flex-col gap-2"
|
|
343
|
+
@submit.prevent="saveEdit"
|
|
365
344
|
>
|
|
366
|
-
<
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
345
|
+
<UTextarea
|
|
346
|
+
v-model="editBody"
|
|
347
|
+
@paste="imageField?.handlePaste($event)"
|
|
348
|
+
:rows="2"
|
|
349
|
+
autoresize
|
|
350
|
+
:maxrows="10"
|
|
351
|
+
:maxlength="COMMENT_BODY_MAX_LENGTH"
|
|
352
|
+
:disabled="saving || aiBusy"
|
|
353
|
+
autofocus
|
|
354
|
+
/>
|
|
355
|
+
<MemiBoardCommentAi v-model="editBody" v-model:translations="translations" :board-id="boardId"
|
|
356
|
+
:disabled="saving || imageBusy || isWriteRestricted" @busy="aiBusy = $event" />
|
|
357
|
+
<MemiBoardCommentImageField
|
|
358
|
+
ref="imageField"
|
|
359
|
+
v-if="comment.id"
|
|
360
|
+
v-model="editImage"
|
|
361
|
+
:post-id="postId"
|
|
362
|
+
:comment-id="comment.id"
|
|
363
|
+
:disabled="saving"
|
|
364
|
+
@busy="imageBusy = $event"
|
|
365
|
+
/>
|
|
366
|
+
<p class="text-right text-xs text-dimmed">
|
|
367
|
+
{{ editBody.length.toLocaleString() }} / {{ COMMENT_BODY_MAX_LENGTH.toLocaleString() }}
|
|
368
|
+
</p>
|
|
369
|
+
<p v-if="editError" class="text-xs text-error">
|
|
370
|
+
{{ editError }}
|
|
371
|
+
</p>
|
|
372
|
+
<div class="flex justify-end gap-1">
|
|
373
|
+
<UButton
|
|
374
|
+
type="button"
|
|
375
|
+
:label="t('common.action.cancel')"
|
|
376
|
+
size="xs"
|
|
377
|
+
color="neutral"
|
|
378
|
+
variant="ghost"
|
|
379
|
+
:disabled="saving || imageBusy || aiBusy"
|
|
380
|
+
@click="cancelEdit"
|
|
381
|
+
/>
|
|
382
|
+
<UButton
|
|
383
|
+
type="submit"
|
|
384
|
+
@pointerdown="imeSafeSubmitPointerDown"
|
|
385
|
+
@click="imeSafeSubmitClick"
|
|
386
|
+
:label="t('common.action.save')"
|
|
387
|
+
size="xs"
|
|
388
|
+
:loading="saving"
|
|
389
|
+
:disabled="!editBody.trim() || imageBusy || aiBusy || (editBody.trim() === localBody && !imageChanged && !translations)"
|
|
390
|
+
/>
|
|
391
|
+
</div>
|
|
392
|
+
</form>
|
|
393
|
+
<div
|
|
394
|
+
v-else-if="localBlinded"
|
|
395
|
+
class="relative min-h-10 overflow-hidden rounded-md py-1"
|
|
396
|
+
>
|
|
397
|
+
<div class="flex flex-col items-center gap-1.5 opacity-50 blur-[1px]" aria-hidden="true">
|
|
398
|
+
<USkeleton
|
|
399
|
+
v-for="line in blindLines"
|
|
400
|
+
:key="line"
|
|
401
|
+
class="h-3"
|
|
402
|
+
:class="line === blindLines ? 'w-1/2' : 'w-5/6'"
|
|
403
|
+
/>
|
|
404
|
+
</div>
|
|
405
|
+
<div class="absolute inset-0 flex items-center justify-center px-3 text-center text-xs font-medium text-muted">
|
|
406
|
+
{{ t('commentItem.blinded') }}
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
<div v-else>
|
|
410
|
+
<p class="whitespace-pre-wrap break-words text-sm">
|
|
411
|
+
<span v-if="comment.parentId && comment.replyToName" class="mr-1 text-primary">@{{ comment.replyToName }}</span><span v-text="displayedBody" />
|
|
412
|
+
</p>
|
|
413
|
+
<button
|
|
414
|
+
v-if="localImage"
|
|
415
|
+
type="button"
|
|
416
|
+
class="mt-2 inline-block cursor-zoom-in bg-transparent p-0"
|
|
417
|
+
:aria-label="t('commentItem.attachedImage')"
|
|
418
|
+
@click="imageOpen = true"
|
|
419
|
+
>
|
|
420
|
+
<img
|
|
421
|
+
:src="localImage.url"
|
|
422
|
+
:alt="t('commentItem.attachedImage')"
|
|
423
|
+
class="max-h-60 max-w-full rounded-md border border-default object-contain"
|
|
424
|
+
>
|
|
425
|
+
</button>
|
|
426
|
+
<MemiBoardImageLightbox
|
|
427
|
+
v-if="localImage"
|
|
428
|
+
v-model:open="imageOpen"
|
|
429
|
+
:images="[localImage.url]"
|
|
430
|
+
/>
|
|
431
|
+
</div>
|
|
432
|
+
<p v-if="likeError" class="mt-1 text-xs text-error">
|
|
433
|
+
{{ likeError }}
|
|
434
|
+
</p>
|
|
432
435
|
</div>
|
|
433
436
|
<UModal v-model:open="editLimitOpen" :title="t('commentItem.editLimitTitle')">
|
|
434
437
|
<template #body>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AUTHOR_MEMO_MAX_COUNT, useMemiBoardI18n } from 'memi-board/runtime'
|
|
3
|
+
|
|
4
|
+
const { t } = useMemiBoardI18n()
|
|
5
|
+
|
|
6
|
+
// Each check maps to a CLIENT-only row of the Spec sheet. Scanning other users' memos needs an admin
|
|
7
|
+
// read rule on memiBoardUsers/{uid}/memos or a server-side job — neither exists yet.
|
|
8
|
+
const checks = [
|
|
9
|
+
{ key: 'authorMemoCount', spec: '1.6', params: { max: AUTHOR_MEMO_MAX_COUNT } },
|
|
10
|
+
] as const
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<section class="flex flex-col gap-3 rounded-lg border border-default p-4">
|
|
15
|
+
<div class="flex flex-wrap items-start justify-between gap-3">
|
|
16
|
+
<div>
|
|
17
|
+
<h2 class="flex items-center gap-2 font-semibold">
|
|
18
|
+
{{ t('settings.diagnostics.title') }}
|
|
19
|
+
<UBadge :label="t('settings.diagnostics.comingSoon')" color="neutral" variant="subtle" size="sm" />
|
|
20
|
+
</h2>
|
|
21
|
+
<p class="mt-1 text-sm text-muted">{{ t('settings.diagnostics.description') }}</p>
|
|
22
|
+
</div>
|
|
23
|
+
<UButton :label="t('settings.diagnostics.scan')" icon="i-lucide-stethoscope" color="neutral" variant="outline" disabled />
|
|
24
|
+
</div>
|
|
25
|
+
<ul class="divide-y divide-default rounded-lg border border-default">
|
|
26
|
+
<li v-for="check in checks" :key="check.key" class="flex items-start gap-3 px-3 py-2 text-sm">
|
|
27
|
+
<span class="shrink-0 font-mono text-xs text-muted">{{ check.spec }}</span>
|
|
28
|
+
<span>{{ t(`settings.diagnostics.checks.${check.key}`, check.params) }}</span>
|
|
29
|
+
</li>
|
|
30
|
+
</ul>
|
|
31
|
+
</section>
|
|
32
|
+
</template>
|
|
@@ -8,7 +8,7 @@ import MemiBoardSurface from './BoardSurface.vue'
|
|
|
8
8
|
* 커스텀은 handlers.image(파일 업로드), YouTube 임베드 + DOM paste/drop.
|
|
9
9
|
*/
|
|
10
10
|
import { ref, computed, watch, nextTick, onBeforeUnmount } from 'vue'
|
|
11
|
-
import { imeSafeSubmitClick, imeSafeSubmitPointerDown, POST_EDIT_LIMIT } from 'memi-board/runtime'
|
|
11
|
+
import { imeSafeSubmitClick, imeSafeSubmitPointerDown, normalizePostTags, POST_EDIT_LIMIT, POST_TAG_LENGTH_MAX, POST_TAG_MAX, POST_TITLE_MAX } from 'memi-board/runtime'
|
|
12
12
|
import Youtube from '@tiptap/extension-youtube'
|
|
13
13
|
import type { DropdownMenuItem, EditorSuggestionMenuItem } from '@nuxt/ui'
|
|
14
14
|
import { mapEditorItems } from '@nuxt/ui/utils/editor'
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
useMemiBoardPosts,
|
|
20
20
|
useMemiBoardModeration,
|
|
21
21
|
boardTranslationLocales,
|
|
22
|
+
boardPostBodyMax,
|
|
22
23
|
MEMI_BOARD_LOCALES,
|
|
23
24
|
useMemiBoardAppSettings,
|
|
24
25
|
useMemiBoardI18n,
|
|
@@ -36,6 +37,7 @@ import {
|
|
|
36
37
|
} from 'memi-board/runtime'
|
|
37
38
|
import { useMemiBoardStorage, EDITOR_IMAGE_SOURCE_MAX_BYTES } from 'memi-board/storage'
|
|
38
39
|
import MemiBoardAttachments from './Attachments.vue'
|
|
40
|
+
import MemiBoardWaitingOverlay from './WaitingOverlay.vue'
|
|
39
41
|
import { useUnsavedChangesGuard } from './useUnsavedChangesGuard'
|
|
40
42
|
|
|
41
43
|
const props = defineProps<{
|
|
@@ -101,6 +103,31 @@ watch(customFields, (fields) => {
|
|
|
101
103
|
const loading = ref(false)
|
|
102
104
|
const saving = ref(false)
|
|
103
105
|
const submitHint = ref('')
|
|
106
|
+
// 자동 번역이 도는 동안 전체 화면 대기 오버레이(미니게임)를 띄운다. 저장까지 끝나면 'done'이 되고,
|
|
107
|
+
// 사용자가 "계속하기"를 눌러야 saved 를 내보낸다(자동으로 닫지 않는다).
|
|
108
|
+
const waiting = ref<'off' | 'translating' | 'done'>('off')
|
|
109
|
+
let waitingSavedId = ''
|
|
110
|
+
// 번역·저장이 이 시간 안에 끝나면 오버레이 없이 바로 이동한다(잠깐 번쩍이는 것을 막는다).
|
|
111
|
+
const WAITING_DELAY_MS = 2000
|
|
112
|
+
let waitingTimer: ReturnType<typeof setTimeout> | undefined
|
|
113
|
+
function cancelWaiting() {
|
|
114
|
+
clearTimeout(waitingTimer)
|
|
115
|
+
waiting.value = 'off'
|
|
116
|
+
}
|
|
117
|
+
onBeforeUnmount(() => clearTimeout(waitingTimer))
|
|
118
|
+
function finishSave(id: string) {
|
|
119
|
+
clearTimeout(waitingTimer)
|
|
120
|
+
if (waiting.value === 'translating') {
|
|
121
|
+
waiting.value = 'done'
|
|
122
|
+
waitingSavedId = id
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
emit('saved', id)
|
|
126
|
+
}
|
|
127
|
+
function continueAfterWaiting() {
|
|
128
|
+
waiting.value = 'off'
|
|
129
|
+
emit('saved', waitingSavedId)
|
|
130
|
+
}
|
|
104
131
|
const error = ref('')
|
|
105
132
|
const imageUploading = ref(false)
|
|
106
133
|
const imageUploadError = ref('')
|
|
@@ -893,6 +920,19 @@ function currentBodyContent(): string {
|
|
|
893
920
|
: content.value
|
|
894
921
|
}
|
|
895
922
|
|
|
923
|
+
// X(트위터)식 링: 평소엔 흐리게, 80%부터 노랑·남은 글자 수, 넘으면 빨강.
|
|
924
|
+
const bodyLimit = computed(() => boardPostBodyMax(getBoard(resolvedBoardId.value)))
|
|
925
|
+
const bodyLength = computed(() => currentBodyContent().length)
|
|
926
|
+
const bodyRatio = computed(() => bodyLength.value / bodyLimit.value.max)
|
|
927
|
+
const bodyOverLimit = computed(() => bodyLength.value > bodyLimit.value.max)
|
|
928
|
+
const BODY_RING_CIRCUMFERENCE = 2 * Math.PI * 8
|
|
929
|
+
const bodyUsageText = computed(() => {
|
|
930
|
+
const usage = t('editor.bodyUsage', { count: bodyLength.value.toLocaleString(), max: bodyLimit.value.max.toLocaleString() })
|
|
931
|
+
return bodyLimit.value.translationTargets
|
|
932
|
+
? `${usage} · ${t('editor.bodyUsageTranslated', { languages: bodyLimit.value.translationTargets })}`
|
|
933
|
+
: usage
|
|
934
|
+
})
|
|
935
|
+
|
|
896
936
|
function currentStoredTitle(body: string): string {
|
|
897
937
|
return isImageEditor.value ? (title.value.trim() || titleFromBody(body)) : title.value.trim()
|
|
898
938
|
}
|
|
@@ -954,7 +994,7 @@ function applyAiPreview() {
|
|
|
954
994
|
const { action, result, hasSelection, from, to } = pending
|
|
955
995
|
|
|
956
996
|
if (action === 'title') {
|
|
957
|
-
title.value = result.replace(/^['"“”]|['"“”]$/g, '').trim()
|
|
997
|
+
title.value = result.replace(/^['"“”]|['"“”]$/g, '').trim().slice(0, POST_TITLE_MAX)
|
|
958
998
|
}
|
|
959
999
|
else if (action === 'continue') {
|
|
960
1000
|
const position = hasSelection ? to : editor.state.doc.content.size
|
|
@@ -1278,6 +1318,8 @@ async function handleSubmit() {
|
|
|
1278
1318
|
|| translationKey(bodyContent, storedTitle) !== loadedTranslationKey.value
|
|
1279
1319
|
if (needsTranslation && translationEnabled.value && getBoard(resolvedBoardId.value)?.autoTranslatePosts === true && !translations) {
|
|
1280
1320
|
submitHint.value = t('editor.hint.translating', { count: translationTargets.value.length })
|
|
1321
|
+
clearTimeout(waitingTimer)
|
|
1322
|
+
waitingTimer = setTimeout(() => { waiting.value = 'translating' }, WAITING_DELAY_MS)
|
|
1281
1323
|
// 번역 한도 초과·실패가 글 저장을 막지 않게 원문만 저장한다. 번역은 나중에 도우미로 다시 할 수 있다.
|
|
1282
1324
|
try {
|
|
1283
1325
|
translations = await translatePost({
|
|
@@ -1299,7 +1341,7 @@ async function handleSubmit() {
|
|
|
1299
1341
|
const payload = {
|
|
1300
1342
|
title: title.value.trim(),
|
|
1301
1343
|
content: bodyContent,
|
|
1302
|
-
tags: tags.value
|
|
1344
|
+
tags: normalizePostTags(tags.value),
|
|
1303
1345
|
// 이미지 보드: 파일 첨부 없음 (커버는 본문 앞 img 로 저장)
|
|
1304
1346
|
attachments: imageBoard ? [] : attachments.value,
|
|
1305
1347
|
extend: extendForFields(extendValues.value, customFields.value),
|
|
@@ -1314,7 +1356,7 @@ async function handleSubmit() {
|
|
|
1314
1356
|
}
|
|
1315
1357
|
saving.value = false
|
|
1316
1358
|
markSaved()
|
|
1317
|
-
|
|
1359
|
+
finishSave(props.postId)
|
|
1318
1360
|
}
|
|
1319
1361
|
else {
|
|
1320
1362
|
const id = await createPost({
|
|
@@ -1326,10 +1368,11 @@ async function handleSubmit() {
|
|
|
1326
1368
|
})
|
|
1327
1369
|
saving.value = false
|
|
1328
1370
|
markSaved()
|
|
1329
|
-
|
|
1371
|
+
finishSave(id)
|
|
1330
1372
|
}
|
|
1331
1373
|
}
|
|
1332
1374
|
catch (e) {
|
|
1375
|
+
cancelWaiting()
|
|
1333
1376
|
error.value = friendlyWriteError(e)
|
|
1334
1377
|
}
|
|
1335
1378
|
finally {
|
|
@@ -1341,6 +1384,7 @@ async function handleSubmit() {
|
|
|
1341
1384
|
|
|
1342
1385
|
<template>
|
|
1343
1386
|
<MemiBoardSurface>
|
|
1387
|
+
<MemiBoardWaitingOverlay :open="waiting !== 'off'" :done="waiting === 'done'" @continue="continueAfterWaiting" />
|
|
1344
1388
|
<div
|
|
1345
1389
|
v-if="loading"
|
|
1346
1390
|
:dir="dir"
|
|
@@ -1363,9 +1407,15 @@ async function handleSubmit() {
|
|
|
1363
1407
|
v-model="title"
|
|
1364
1408
|
:placeholder="postId || !aiTitleEnabled ? t('editor.titlePlaceholder') : t('editor.titleOptionalPlaceholder')"
|
|
1365
1409
|
size="lg"
|
|
1410
|
+
:maxlength="POST_TITLE_MAX"
|
|
1366
1411
|
:required="(Boolean(postId) || !aiTitleEnabled) && !isImageEditor"
|
|
1412
|
+
:ui="{ trailing: 'pointer-events-none' }"
|
|
1367
1413
|
@keydown.tab.exact.prevent="focusContentFromTitle"
|
|
1368
|
-
|
|
1414
|
+
>
|
|
1415
|
+
<template v-if="title.length >= POST_TITLE_MAX * 0.8" #trailing>
|
|
1416
|
+
<span class="text-xs tabular-nums text-muted">{{ title.length }} / {{ POST_TITLE_MAX }}</span>
|
|
1417
|
+
</template>
|
|
1418
|
+
</UInput>
|
|
1369
1419
|
<!-- 이미지 보드: 여러 장 갤러리 (TipTap 과 분리) -->
|
|
1370
1420
|
<div
|
|
1371
1421
|
v-if="isImageEditor"
|
|
@@ -1617,6 +1667,36 @@ async function handleSubmit() {
|
|
|
1617
1667
|
</div>
|
|
1618
1668
|
</div>
|
|
1619
1669
|
|
|
1670
|
+
<div class="flex items-center justify-end gap-2 border-t border-default px-4 py-1.5">
|
|
1671
|
+
<UTooltip :text="bodyUsageText" :delay-duration="200" :content="{ side: 'top' }">
|
|
1672
|
+
<span
|
|
1673
|
+
role="meter"
|
|
1674
|
+
:aria-label="bodyUsageText"
|
|
1675
|
+
:aria-valuenow="bodyLength"
|
|
1676
|
+
aria-valuemin="0"
|
|
1677
|
+
:aria-valuemax="bodyLimit.max"
|
|
1678
|
+
class="inline-flex items-center gap-1.5 text-xs tabular-nums"
|
|
1679
|
+
:class="bodyOverLimit ? 'text-error' : bodyRatio >= 0.8 ? 'text-warning' : 'text-dimmed'"
|
|
1680
|
+
>
|
|
1681
|
+
<span v-if="bodyRatio >= 0.8">{{ (bodyLimit.max - bodyLength).toLocaleString() }}</span>
|
|
1682
|
+
<svg viewBox="0 0 20 20" class="size-5 -rotate-90" aria-hidden="true">
|
|
1683
|
+
<circle cx="10" cy="10" r="8" fill="none" stroke="currentColor" stroke-width="2.5" class="opacity-20" />
|
|
1684
|
+
<circle
|
|
1685
|
+
cx="10"
|
|
1686
|
+
cy="10"
|
|
1687
|
+
r="8"
|
|
1688
|
+
fill="none"
|
|
1689
|
+
stroke="currentColor"
|
|
1690
|
+
stroke-width="2.5"
|
|
1691
|
+
stroke-linecap="round"
|
|
1692
|
+
:stroke-dasharray="BODY_RING_CIRCUMFERENCE"
|
|
1693
|
+
:stroke-dashoffset="BODY_RING_CIRCUMFERENCE * (1 - Math.min(bodyRatio, 1))"
|
|
1694
|
+
/>
|
|
1695
|
+
</svg>
|
|
1696
|
+
</span>
|
|
1697
|
+
</UTooltip>
|
|
1698
|
+
</div>
|
|
1699
|
+
|
|
1620
1700
|
<p
|
|
1621
1701
|
v-if="aiError"
|
|
1622
1702
|
class="flex items-center gap-2 border-t border-default px-4 py-2 text-xs text-error"
|
|
@@ -1648,9 +1728,15 @@ async function handleSubmit() {
|
|
|
1648
1728
|
v-model="tags"
|
|
1649
1729
|
:placeholder="t('editor.tagsPlaceholder')"
|
|
1650
1730
|
:delimiter="','"
|
|
1731
|
+
:max="POST_TAG_MAX"
|
|
1732
|
+
:max-length="POST_TAG_LENGTH_MAX"
|
|
1651
1733
|
add-on-paste
|
|
1652
1734
|
@keydown.enter.prevent
|
|
1653
|
-
|
|
1735
|
+
>
|
|
1736
|
+
<template v-if="tags.length" #trailing>
|
|
1737
|
+
<span class="text-xs tabular-nums" :class="tags.length >= POST_TAG_MAX ? 'text-warning' : 'text-dimmed'">{{ tags.length }} / {{ POST_TAG_MAX }}</span>
|
|
1738
|
+
</template>
|
|
1739
|
+
</UInputTags>
|
|
1654
1740
|
|
|
1655
1741
|
<!-- 이미지 보드: 본문 이미지 업로드만 (파일 첨부 없음) -->
|
|
1656
1742
|
<MemiBoardAttachments
|
|
@@ -1706,7 +1792,7 @@ async function handleSubmit() {
|
|
|
1706
1792
|
<UButton
|
|
1707
1793
|
type="submit"
|
|
1708
1794
|
:loading="saving"
|
|
1709
|
-
:disabled="isWriteRestricted || imageUploading"
|
|
1795
|
+
:disabled="isWriteRestricted || imageUploading || bodyOverLimit"
|
|
1710
1796
|
:label="isEdit ? t('editor.submitEdit') : t('editor.submitNext')"
|
|
1711
1797
|
@pointerdown="imeSafeSubmitPointerDown"
|
|
1712
1798
|
@click="imeSafeSubmitClick"
|