summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2023-12-29 18:22:40 +0900
committerGitHub <noreply@github.com>2023-12-29 18:22:40 +0900
commit8fb8d7c10caac6696a9364beb3457521f3966c31 (patch)
tree9f6fa839fd791d0c1ffaa5ef176e26c8119d7efa
parentchore(misskey-js): `build-misskey-js-with-types`時に`api-extractor`を走... (diff)
downloadmisskey-8fb8d7c10caac6696a9364beb3457521f3966c31.tar.gz
misskey-8fb8d7c10caac6696a9364beb3457521f3966c31.tar.bz2
misskey-8fb8d7c10caac6696a9364beb3457521f3966c31.zip
enhance(frontend): ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように (#12851)
* (enhance) ハッシュタグ入力時に、本文の末尾の行に何も書かれていないならスペースを追記しない * Updahe Changelog
-rw-r--r--CHANGELOG.md5
-rw-r--r--packages/frontend/src/components/MkPostForm.vue12
2 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 30e2e57b7d..ea34fa9ef7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,11 @@
-->
+## 202x.x.x (Unreleased)
+
+### Client
+- Enhance: ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように
+
## 2023.12.2
### General
diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue
index 3aacf4c2da..b86f50eac6 100644
--- a/packages/frontend/src/components/MkPostForm.vue
+++ b/packages/frontend/src/components/MkPostForm.vue
@@ -752,7 +752,17 @@ async function post(ev?: MouseEvent) {
if (withHashtags.value && hashtags.value && hashtags.value.trim() !== '') {
const hashtags_ = hashtags.value.trim().split(' ').map(x => x.startsWith('#') ? x : '#' + x).join(' ');
- postData.text = postData.text ? `${postData.text} ${hashtags_}` : hashtags_;
+ if (!postData.text) {
+ postData.text = hashtags_;
+ } else {
+ const postTextLines = postData.text.split('\n');
+ if (postTextLines[postTextLines.length - 1].trim() === '') {
+ postTextLines[postTextLines.length - 1] += hashtags_;
+ } else {
+ postTextLines[postTextLines.length - 1] += ' ' + hashtags_;
+ }
+ postData.text = postTextLines.join('\n');
+ }
}
// plugin