Skip to content

Commit

Permalink
enhance(frontend): ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように (m…
Browse files Browse the repository at this point in the history
…isskey-dev#12851)

* (enhance) ハッシュタグ入力時に、本文の末尾の行に何も書かれていないならスペースを追記しない

* Updahe Changelog
  • Loading branch information
kakkokari-gtyih authored Dec 29, 2023
1 parent 7ca0af9 commit 8fb8d7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
-->

## 202x.x.x (Unreleased)

### Client
- Enhance: ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように

## 2023.12.2

### General
Expand Down
12 changes: 11 additions & 1 deletion packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8fb8d7c

Please sign in to comment.