diff options
| author | claustra01 <108509532+claustra01@users.noreply.github.com> | 2025-02-16 19:34:50 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-16 10:34:50 +0000 |
| commit | 9ffe504c7f75490822a3efdb39b70a8f0d046bcf (patch) | |
| tree | bb7f388b1bc08fcc5e697805d0280716ea1fd7a4 | |
| parent | fix(deps): broken lockfile (#15508) (diff) | |
| download | sharkey-9ffe504c7f75490822a3efdb39b70a8f0d046bcf.tar.gz sharkey-9ffe504c7f75490822a3efdb39b70a8f0d046bcf.tar.bz2 sharkey-9ffe504c7f75490822a3efdb39b70a8f0d046bcf.zip | |
enhance(frontend): CWの注釈で入力済みの文字数を表示する (#15070)
* enhance: CW注釈の文字数表示
* update: CHANGELOG.md
* chore: maxCwTextLengthをただのconstにする
* fix: 投稿ボタンのdisable判定条件
---------
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | packages/frontend/src/components/MkPostForm.vue | 34 |
2 files changed, 35 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 885c8270da..57100aaf3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,10 +12,12 @@ - Enhance: 開発者モードでメニューからファイルIDをコピー出来るように `#15441' - Enhance: ノートに埋め込まれたメディアのコンテキストメニューから管理者用のファイル管理画面を開けるように ( #15440 ) - Enhance: リアクションする際に確認ダイアログを表示できるように +- Enhance: CWの注釈で入力済みの文字数を表示 - Fix: コンディショナルロールを手動で割り当てできる導線を削除 `#13529` - Fix: 埋め込みプレイヤーから外部ページに移動できない問題を修正 - Fix: Play の再読込時に UI が以前の状態を引き継いでしまう問題を修正 `#14378` - Fix: カスタム絵文字管理画面(beta)にてisSensitive/localOnlyの絞り込みが上手くいかない問題の修正 ( #15445 ) +- Fix: CWの注釈が100文字を超えている場合、ノート投稿ボタンを非アクティブに ### Server - Fix: `following/invalidate`でフォロワーを解除しようとしているユーザーの情報を返すように diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 49ed4197de..ad0a332f99 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -65,7 +65,10 @@ SPDX-License-Identifier: AGPL-3.0-only </div> </div> <MkInfo v-if="hasNotSpecifiedMentions" warn :class="$style.hasNotSpecifiedMentions">{{ i18n.ts.notSpecifiedMentionWarning }} - <button class="_textButton" @click="addMissingMention()">{{ i18n.ts.add }}</button></MkInfo> - <input v-show="useCw" ref="cwInputEl" v-model="cw" :class="$style.cw" :placeholder="i18n.ts.annotation" @keydown="onKeydown" @keyup="onKeyup" @compositionend="onCompositionEnd"> + <div v-show="useCw" :class="$style.cwOuter"> + <input ref="cwInputEl" v-model="cw" :class="$style.cw" :placeholder="i18n.ts.annotation" @keydown="onKeydown" @keyup="onKeyup" @compositionend="onCompositionEnd"> + <div v-if="maxCwTextLength - cwTextLength < 20" :class="['_acrylic', $style.cwTextCount, { [$style.cwTextOver]: cwTextLength > maxCwTextLength }]">{{ maxCwTextLength - cwTextLength }}</div> + </div> <div :class="[$style.textOuter, { [$style.withCw]: useCw }]"> <div v-if="channel" :class="$style.colorBar" :style="{ background: channel.color }"></div> <textarea ref="textareaEl" v-model="text" :class="[$style.text]" :disabled="posting || posted" :readonly="textAreaReadOnly" :placeholder="placeholder" data-cy-post-form-text @keydown="onKeydown" @keyup="onKeyup" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd"/> @@ -244,6 +247,12 @@ const maxTextLength = computed((): number => { return instance ? instance.maxNoteTextLength : 1000; }); +const cwTextLength = computed((): number => { + return cw.value?.length ?? 0; +}); + +const maxCwTextLength = 100; + const canPost = computed((): boolean => { return !props.mock && !posting.value && !posted.value && ( @@ -254,6 +263,7 @@ const canPost = computed((): boolean => { quoteId.value != null ) && (textLength.value <= maxTextLength.value) && + (cwTextLength.value <= maxCwTextLength) && (files.value.length <= 16) && (!poll.value || poll.value.choices.length >= 2); }); @@ -1273,12 +1283,34 @@ html[data-color-scheme=light] .preview { } } +.cwOuter { + width: 100%; + position: relative; +} + .cw { z-index: 1; padding-bottom: 8px; border-bottom: solid 0.5px var(--MI_THEME-divider); } +.cwTextCount { + position: absolute; + top: 0; + right: 2px; + padding: 2px 6px; + font-size: .9em; + color: var(--MI_THEME-warn); + border-radius: 6px; + max-width: 100%; + min-width: 1.6em; + text-align: center; + + &.cwTextOver { + color: #ff2a2a; + } +} + .hashtags { z-index: 1; padding-top: 8px; |