mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
feat(app): prompt to delete when clearing a message edit (#2687)
This commit is contained in:
1 parent
ab07fd23cf
commit
e490be2f35
48 files changed
+5228
-3724
No files matched your search
@@ -92,7 +92,11 @@ import {CloudUpload} from '@app/features/messaging/upload/CloudUpload';
|
||||
import {canAttachFilesInChannel} from '@app/features/messaging/utils/AttachmentPermissionUtils';
|
||||
import {openFilePicker} from '@app/features/messaging/utils/FilePickerUtils';
|
||||
import * as FileUploadUtils from '@app/features/messaging/utils/FileUploadUtils';
|
||||
import {getComposerMessageContent, hasVisibleMessageContent} from '@app/features/messaging/utils/MessageRequestUtils';
|
||||
import {
|
||||
canSubmitComposerContent,
|
||||
getComposerMessageContent,
|
||||
hasVisibleMessageContent,
|
||||
} from '@app/features/messaging/utils/MessageRequestUtils';
|
||||
import type {MentionSegment} from '@app/features/messaging/utils/TextareaSegmentManager';
|
||||
import {
|
||||
resolveTypedEmojiShortcodes,
|
||||
@@ -715,11 +719,15 @@ export const LexicalChannelTextareaContent = observer(
|
||||
const showAttachments = hasAttachments;
|
||||
const showStickers = hasPendingSticker;
|
||||
const isOverCharacterLimit = composerMessageContent.length > maxMessageLength;
|
||||
const canSubmit =
|
||||
!textareaInputDisabled &&
|
||||
!isSubmissionBlockedBySlowmode &&
|
||||
!isOverCharacterLimit &&
|
||||
(hasMessageContent || hasAttachments || hasPendingSticker);
|
||||
const canSubmit = canSubmitComposerContent({
|
||||
inputDisabled: textareaInputDisabled,
|
||||
isSubmissionBlockedBySlowmode,
|
||||
isOverCharacterLimit,
|
||||
hasMessageContent,
|
||||
hasAttachments,
|
||||
hasPendingSticker,
|
||||
isEditingMessageOnMobile,
|
||||
});
|
||||
const {onSubmit} = useTextareaSubmit({
|
||||
channelId: channel.id,
|
||||
guildId: channel.guildId === undefined ? null : channel.guildId,
|
||||
|
||||
@@ -30,6 +30,7 @@ import {hasStyleableMessageText} from '@app/features/messaging/utils/FailedMessa
|
||||
import {
|
||||
buildExistingAttachmentEditReferences,
|
||||
canSubmitEmptyMessageEdit,
|
||||
isAttachmentOnlyMessage,
|
||||
} from '@app/features/messaging/utils/MessageEditContentUtils';
|
||||
import {retryFailedMessage} from '@app/features/messaging/utils/MessageRetryUtils';
|
||||
import {NodeType} from '@app/features/messaging/utils/markdown/parser/Enums';
|
||||
@@ -196,11 +197,11 @@ export const UserMessage = observer(() => {
|
||||
}
|
||||
const content = dropTrailingEmptyBlockquoteLines(actualContent ?? '').trim();
|
||||
if (!content) {
|
||||
if (isAttachmentOnlyMessage(message)) {
|
||||
finishEditing();
|
||||
return;
|
||||
}
|
||||
if (canSubmitEmptyMessageEdit(message)) {
|
||||
if (message.content.length === 0) {
|
||||
finishEditing();
|
||||
return;
|
||||
}
|
||||
finishEditing();
|
||||
void MessageCommands.edit(
|
||||
channel.id,
|
||||
|
||||
Reference in new issue
Block a user