Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a773413
💄 feat: MessageInputTextAreaに縦の伸長を追加
reiroop Sep 27, 2024
11f2fcb
💄 feat: MessageEditorでの高さを無制限に
reiroop Sep 27, 2024
e3ea5d3
🎨 chore: cssの記述を簡略化
reiroop Sep 27, 2024
da31dd6
🐛 fix: type-checkエラーを修正、命名を変更
reiroop Sep 27, 2024
0883833
isStretchableOnFocusの削除
reiroop Oct 19, 2024
53d3919
npm run format
reiroop Oct 19, 2024
1fe967a
🎨 refactor: MessageInputTextArea の props の命名を isMaxHeightNone に変更
reiroop Feb 2, 2025
0424a10
🎨 feat: MessageInput コンポーネントにテキストエリアの拡張機能を追加
reiroop Feb 2, 2025
36c529b
feat: MessageInput コンポーネントにテキストエリアのサイズ変更イベントを追加し、ボタン表示の条件を更新
reiroop Feb 2, 2025
78fbd47
feat: MessageInputTextArea コンポーネントでサイズ変更イベントを入力イベントに置き換え
reiroop Feb 2, 2025
53813e7
fix: MessageInput コンポーネントでボタン表示のバインディングを修正
reiroop Feb 2, 2025
c8b8b14
🐛 fix: リロード時・メッセージ送信後・チャンネル移動時に、トグルボタンの表示非表示が更新されていなかった問題を修正
reiroop Feb 2, 2025
07ebd22
fix: TextareaAutosize コンポーネントから不要な input イベントのエミットを削除
reiroop Feb 2, 2025
515e492
refactor: MessageInputTextArea コンポーネントのウォッチャーに immediate オプションを追加し、on…
reiroop Feb 2, 2025
0a1d323
feat: MessageInputTextArea の textarea-autosize の max-height をオブジェクトの…
reiroop Feb 2, 2025
5f296a0
🐛 fix: src/components/UI/TextareaAutosize.vue で max-height 変更時に autos…
reiroop Feb 2, 2025
59eaba8
💄 feat: IsInputTextAreaExpandedButton が上部に位置するように調整
reiroop Feb 3, 2025
bc316cb
🎨 refactor: MessageInputTextArea の max-height をカスタムプロパティに変更
reiroop Feb 3, 2025
9cf0a4a
🐛 fix: textarea の height が max-height を超えた時にのみ拡張ボタンが表示されるように条件を改善
reiroop Feb 3, 2025
d0049bd
🎨 refactor: showIsInputTextAreaExpandedButton を showTextAreaExpandBut…
reiroop Feb 3, 2025
3baabcd
💄 feat: textAreaExpandButton を color-ui-secondary、右寄せにし、右側の margin を削…
reiroop Feb 3, 2025
1c799d4
🎨 refactor: textarea の autosize.update() を MessageInputTextArea で発火させ…
reiroop Feb 4, 2025
13a0424
🐛 fix: LeftControls 展開時に textarea の autosize.update が走るように
reiroop Feb 4, 2025
767dd24
🐛 fix: 特定の条件下で textareaAutosizeRef.value?.autosizeUpdateTextarea() が発…
reiroop Feb 4, 2025
07b5f3b
💄 feat: MessageInputLeftControls のボタンに color-ui-secondary スタイルを追加
reiroop Feb 4, 2025
2cafc4b
💄 feat: leftControls の上の margin を 2px に
reiroop Feb 4, 2025
8fedd31
🐛 fix: LeftControls の markdown プレビューの表示・非表示の切り替え時に textarea の autosiz…
reiroop Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/assets/mdi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
mdiChevronDoubleLeft,
mdiChevronDoubleUp,
mdiChevronDoubleDown,
mdiChevronDown,
mdiChevronLeft,
mdiChevronRight,
mdiBookmark,
Expand Down Expand Up @@ -142,6 +143,7 @@
'chevron-double': mdiChevronDoubleLeft,
'chevron-double-up': mdiChevronDoubleUp,
'chevron-double-down': mdiChevronDoubleDown,
'chevron-down': mdiChevronDown,

Check warning on line 146 in src/assets/mdi.ts

View check run for this annotation

Codecov / codecov/patch

src/assets/mdi.ts#L146

Added line #L146 was not covered by tests
'chevron-left': mdiChevronLeft,
'chevron-right': mdiChevronRight,
'chevron-up': mdiChevronUp,
Expand Down
19 changes: 10 additions & 9 deletions src/components/Main/MainView/MessageElement/MessageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:class="$style.inputTextArea"
:is-posting="isPostingAttachment"
simple-padding
is-max-height-none

Check warning on line 15 in src/components/Main/MainView/MessageElement/MessageEditor.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageElement/MessageEditor.vue#L15

Added line #L15 was not covered by tests
@add-attachments="onAddAttachments"
@modifier-key-down="onModifierKeyDown"
@modifier-key-up="onModifierKeyUp"
Expand Down Expand Up @@ -43,17 +44,17 @@
</template>

<script lang="ts">
import type { AxiosProgressEvent } from 'axios'
import type { Ref } from 'vue'
import { computed, onMounted, ref } from 'vue'
import apis, { buildFilePathForPost, formatResizeError } from '/@/lib/apis'
import useModifierKey from '/@/components/Main/MainView/MessageInput/composables/useModifierKey'
import useTextStampPickerInvoker from '../composables/useTextStampPickerInvoker'
import { MESSAGE_MAX_LENGTH } from '/@/lib/validate'
import useAttachments from '/@/components/Main/MainView/MessageInput/composables/useAttachments'
import useModifierKey from '/@/components/Main/MainView/MessageInput/composables/useModifierKey'
import apis, { buildFilePathForPost, formatResizeError } from '/@/lib/apis'

Check warning on line 53 in src/components/Main/MainView/MessageElement/MessageEditor.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageElement/MessageEditor.vue#L51-L53

Added lines #L51 - L53 were not covered by tests
import { countLength } from '/@/lib/basic/string'
import { useToastStore } from '/@/store/ui/toast'
import { getResizedFile } from '/@/lib/resize'
import useAttachments from '/@/components/Main/MainView/MessageInput/composables/useAttachments'
import type { AxiosProgressEvent } from 'axios'
import { MESSAGE_MAX_LENGTH } from '/@/lib/validate'
import { useToastStore } from '/@/store/ui/toast'

Check warning on line 57 in src/components/Main/MainView/MessageElement/MessageEditor.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageElement/MessageEditor.vue#L56-L57

Added lines #L56 - L57 were not covered by tests

const useEditMessage = (
props: { messageId: string },
Expand Down Expand Up @@ -135,12 +136,12 @@
</script>

<script lang="ts" setup>
import MessageInputInsertStampButton from '/@/components/Main/MainView/MessageInput/MessageInputInsertStampButton.vue'

Check warning on line 139 in src/components/Main/MainView/MessageElement/MessageEditor.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageElement/MessageEditor.vue#L139

Added line #L139 was not covered by tests
import MessageInputKeyGuide from '/@/components/Main/MainView/MessageInput/MessageInputKeyGuide.vue'
import MessageInputTextArea from '/@/components/Main/MainView/MessageInput/MessageInputTextArea.vue'
import FormButton from '/@/components/UI/FormButton.vue'
import MessageInputInsertStampButton from '/@/components/Main/MainView/MessageInput/MessageInputInsertStampButton.vue'
import MessageInputUploadProgress from '/@/components/Main/MainView/MessageInput/MessageInputUploadProgress.vue'
import MessageInputUploadButton from '/@/components/Main/MainView/MessageInput/MessageInputUploadButton.vue'
import MessageInputUploadProgress from '/@/components/Main/MainView/MessageInput/MessageInputUploadProgress.vue'
import FormButton from '/@/components/UI/FormButton.vue'

Check warning on line 144 in src/components/Main/MainView/MessageElement/MessageEditor.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageElement/MessageEditor.vue#L143-L144

Added lines #L143 - L144 were not covered by tests

const props = defineProps<{
rawContent: string
Expand Down
48 changes: 27 additions & 21 deletions src/components/Main/MainView/MessageInput/MessageInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,26 @@
</div>
<div v-else :class="$style.inputContainer">
<message-input-left-controls
v-model:is-expanded="isLeftControlsExpanded"
v-model:is-left-controls-expanded="isLeftControlsExpanded"

Check warning on line 29 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L29

Added line #L29 was not covered by tests
v-model:is-preview-shown="isPreviewShown"
v-model:is-input-text-area-expanded="isInputTextAreaExpanded"
:show-text-area-expand-button="showTextAreaExpandButton"

Check warning on line 32 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L31-L32

Added lines #L31 - L32 were not covered by tests
:class="$style.leftControls"
@click-add-attachment="addAttachment"
@toggle-left-controls-expanded="

Check warning on line 35 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L35

Added line #L35 was not covered by tests
textareaComponentRef?.textareaAutosizeRef?.autosizeUpdateTextarea
"
/>
<message-input-text-area
ref="textareaComponentRef"
v-model="state.text"
v-model:show-text-area-expand-button="showTextAreaExpandButton"

Check warning on line 42 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L42

Added line #L42 was not covered by tests
:channel-id="channelId"
:is-posting="isPosting"
:shrink-to-one-line="
(forceMobileStyle || isMobile) && isLeftControlsExpanded
"
:is-input-text-area-expanded="isInputTextAreaExpanded"

Check warning on line 48 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L48

Added line #L48 was not covered by tests
@focus="onFocus"
@blur="onBlur"
@add-attachments="onAddAttachments"
Expand All @@ -58,30 +65,30 @@
</template>

<script lang="ts" setup>
import MessageInputLeftControls from './MessageInputLeftControls.vue'
import MessageInputPreview from './MessageInputPreview.vue'
import MessageInputTypingUsers from './MessageInputTypingUsers.vue'
import MessageInputKeyGuide from './MessageInputKeyGuide.vue'
import MessageInputTextArea from './MessageInputTextArea.vue'
import MessageInputRightControls from './MessageInputRightControls.vue'
import MessageInputFileList from './MessageInputFileList.vue'
import MessageInputUploadProgress from './MessageInputUploadProgress.vue'
import AIcon from '/@/components/UI/AIcon.vue'
import { computed, ref, toRef, watch, watchEffect } from 'vue'
import type { ChannelId, DMChannelId, UserId } from '/@/types/entity-ids'
import { useResponsiveStore } from '/@/store/ui/responsive'
import useTextStampPickerInvoker from '../composables/useTextStampPickerInvoker'
import useAttachments from './composables/useAttachments'
import useModifierKey from './composables/useModifierKey'
import usePostMessage from './composables/usePostMessage'
import MessageInputFileList from './MessageInputFileList.vue'
import MessageInputKeyGuide from './MessageInputKeyGuide.vue'
import MessageInputLeftControls from './MessageInputLeftControls.vue'
import MessageInputPreview from './MessageInputPreview.vue'
import MessageInputRightControls from './MessageInputRightControls.vue'
import MessageInputTextArea from './MessageInputTextArea.vue'
import MessageInputTypingUsers from './MessageInputTypingUsers.vue'
import MessageInputUploadProgress from './MessageInputUploadProgress.vue'
import { $boolAttr } from '/@/bool-attr'
import AIcon from '/@/components/UI/AIcon.vue'

Check warning on line 82 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L73-L82

Added lines #L73 - L82 were not covered by tests
import useFocus from '/@/composables/dom/useFocus'
import { useToastStore } from '/@/store/ui/toast'
import useMessageInputState from '/@/composables/messageInputState/useMessageInputState'
import useMessageInputStateAttachment from '/@/composables/messageInputState/useMessageInputStateAttachment'
import { useBrowserSettings } from '/@/store/app/browserSettings'
import { useChannelsStore } from '/@/store/entities/channels'
import { useViewStateSenderStore } from '/@/store/domain/viewStateSenderStore'
import { $boolAttr } from '/@/bool-attr'
import { useChannelsStore } from '/@/store/entities/channels'
import { useResponsiveStore } from '/@/store/ui/responsive'
import { useToastStore } from '/@/store/ui/toast'

Check warning on line 90 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L88-L90

Added lines #L88 - L90 were not covered by tests
import type { ChannelId, DMChannelId, UserId } from '/@/types/entity-ids'

const props = defineProps<{
channelId: ChannelId | DMChannelId
Expand All @@ -108,6 +115,8 @@
const { channelsMap } = useChannelsStore()
const isLeftControlsExpanded = ref(false)
const isPreviewShown = ref(false)
const isInputTextAreaExpanded = ref(true)
const showTextAreaExpandButton = ref(false)

Check warning on line 119 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L118-L119

Added lines #L118 - L119 were not covered by tests

const isArchived = computed(
() => channelsMap.value.get(props.channelId)?.archived ?? false
Expand Down Expand Up @@ -147,13 +156,11 @@
(sendWithModifierKey.value !== 'modifier' || canPostMessage.value)
)

const textareaComponentRef = ref<{
textareaAutosizeRef: { $el: HTMLTextAreaElement }
}>()
const textareaComponentRef = ref<InstanceType<typeof MessageInputTextArea>>()

Check warning on line 159 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L159

Added line #L159 was not covered by tests
const containerEle = ref<HTMLDivElement>()
const { toggleStampPicker } = useTextStampPickerInvoker(
toRef(state, 'text'),
computed(() => textareaComponentRef.value?.textareaAutosizeRef.$el),
computed(() => textareaComponentRef.value?.textareaAutosizeRef?.$el),

Check warning on line 163 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L163

Added line #L163 was not covered by tests
containerEle
)

Expand Down Expand Up @@ -194,7 +201,6 @@
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: flex-end;

&[data-is-archived] {
@include color-ui-secondary-inactive;
Expand All @@ -219,7 +225,7 @@
}
}
.leftControls {
margin: 8px 8px 8px 0;
margin: 2px 8px 8px 0;
}
.rightControls {
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,63 @@
<template>
<div :class="$style.container" :data-is-mobile="$boolAttr(isMobile)">
<template v-if="!isMobile || isExpanded">
<message-input-upload-button
:class="$style.button"
@click="emit('clickAddAttachment')"
/>
<message-input-preview-button
v-model="isPreviewShownValue"
:class="$style.button"
/>
</template>
<div :class="$style.outerContainer" :style="outerContainerStyle">

Check warning on line 2 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L2

Added line #L2 was not covered by tests
<icon-button
v-if="isMobile"
:class="$style.button"
:icon-name="isExpanded ? 'chevron-left' : 'chevron-right'"
v-if="showTextAreaExpandButton"
:class="$style.textAreaExpandButton"
:icon-name="isInputTextAreaExpanded ? 'chevron-down' : 'chevron-up'"

Check warning on line 6 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L4-L6

Added lines #L4 - L6 were not covered by tests
icon-mdi
@click="toggleExpanded"
@click="toggleIsInputTextAreaExpanded"

Check warning on line 8 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L8

Added line #L8 was not covered by tests
/>
<div :class="$style.innerContainer" :data-is-mobile="$boolAttr(isMobile)">
<template v-if="!isMobile || isLeftControlsExpanded">
<message-input-upload-button
:class="$style.button"
@click="emit('clickAddAttachment')"
/>
<message-input-preview-button
v-model="isPreviewShownValue"
:class="$style.button"
/>
</template>
<icon-button
v-if="isMobile"
:class="$style.button"
:icon-name="isLeftControlsExpanded ? 'chevron-left' : 'chevron-right'"
icon-mdi
@click="toggleLeftControlsExpanded"
/>
</div>

Check warning on line 28 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L10-L28

Added lines #L10 - L28 were not covered by tests
</div>
</template>

<script lang="ts" setup>
import MessageInputUploadButton from './MessageInputUploadButton.vue'
import { computed } from 'vue'

Check warning on line 33 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L33

Added line #L33 was not covered by tests
import MessageInputPreviewButton from './MessageInputPreviewButton.vue'
import MessageInputUploadButton from './MessageInputUploadButton.vue'

Check warning on line 35 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L35

Added line #L35 was not covered by tests
import IconButton from '/@/components/UI/IconButton.vue'
import { computed } from 'vue'
import { useResponsiveStore } from '/@/store/ui/responsive'

const props = defineProps<{
isExpanded: boolean
isLeftControlsExpanded: boolean
isPreviewShown: boolean
isInputTextAreaExpanded: boolean
showTextAreaExpandButton: boolean
}>()

const emit = defineEmits<{
(e: 'update:isExpanded', _v: boolean): void
(e: 'update:isLeftControlsExpanded', _v: boolean): void
(e: 'update:isPreviewShown', _v: boolean): void
(e: 'clickAddAttachment'): void
(e: 'update:isInputTextAreaExpanded', _v: boolean): void
(e: 'toggleLeftControlsExpanded'): void
}>()

const { isMobile } = useResponsiveStore()
const toggleExpanded = () => {
emit('update:isExpanded', !props.isExpanded)
const toggleLeftControlsExpanded = () => {
emit('update:isLeftControlsExpanded', !props.isLeftControlsExpanded)
emit('toggleLeftControlsExpanded')
}
const toggleIsInputTextAreaExpanded = () => {
emit('update:isInputTextAreaExpanded', !props.isInputTextAreaExpanded)

Check warning on line 60 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L55-L60

Added lines #L55 - L60 were not covered by tests
}

const isPreviewShownValue = computed<boolean>({
Expand All @@ -49,17 +66,32 @@
},
set(v) {
emit('update:isPreviewShown', v)
emit('update:isExpanded', false)
emit('update:isLeftControlsExpanded', false)
emit('toggleLeftControlsExpanded')

Check warning on line 70 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L69-L70

Added lines #L69 - L70 were not covered by tests
}
})

const outerContainerStyle = computed(() => ({
'--justify-content': props.showTextAreaExpandButton
? 'space-between'
: 'flex-end'
}))

Check warning on line 78 in src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInputLeftControls.vue#L74-L78

Added lines #L74 - L78 were not covered by tests
</script>

<style lang="scss" module>
.container {
.outerContainer {
@include color-ui-secondary;
display: flex;
flex-direction: column;
align-items: end;
justify-content: var(--justify-content);
}
.innerContainer {
@include color-ui-secondary;
display: flex;
}
.button {
@include color-ui-secondary;
margin: 0 4px;

&:first-child:first-child {
Expand All @@ -69,4 +101,7 @@
margin-right: 0;
}
}
.textAreaExpandButton {
@include color-ui-secondary;
}
</style>
Loading