mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +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
@@ -20,6 +20,7 @@ import {
|
||||
ExpressionAutocompleteControl,
|
||||
HideMutedChannelsByDefaultControl,
|
||||
InputButtonsControl,
|
||||
KeepAttachmentsOnEmptyEditAdvancedControl,
|
||||
MediaButtonsControl,
|
||||
MessageActionBarControl,
|
||||
PreuploadMessageAttachmentsControl,
|
||||
@@ -76,6 +77,7 @@ export const DIRECT_CONTROL_ITEM_IDS = new Set([
|
||||
'chat-settings-expression-autocomplete',
|
||||
'chat-settings-input-buttons',
|
||||
'chat-settings-convert-emoticons',
|
||||
'chat-settings-keep-attachments-on-empty-edit',
|
||||
'chat-settings-preupload-attachments',
|
||||
'chat-settings-sequential-file-send',
|
||||
'chat-settings-scroll-to-bottom-on-send',
|
||||
@@ -115,6 +117,7 @@ export const COMPACT_SWITCH_CONTROL_ITEM_IDS = new Set([
|
||||
'chat-settings-strip-tracking',
|
||||
'chat-settings-trust-domains',
|
||||
'chat-settings-convert-emoticons',
|
||||
'chat-settings-keep-attachments-on-empty-edit',
|
||||
'chat-settings-preupload-attachments',
|
||||
'chat-settings-sequential-file-send',
|
||||
'chat-settings-scroll-to-bottom-on-send',
|
||||
@@ -239,6 +242,10 @@ export const AdvancedSettingControl = observer(({item}: {item: SearchableSetting
|
||||
return (
|
||||
<ConvertEmoticonsAdvancedControl data-flx="user.advanced-setting-direct-controls.advanced-setting-control.convert-emoticons-advanced-control" />
|
||||
);
|
||||
case 'chat-settings-keep-attachments-on-empty-edit':
|
||||
return (
|
||||
<KeepAttachmentsOnEmptyEditAdvancedControl data-flx="user.advanced-setting-direct-controls.advanced-setting-control.keep-attachments-on-empty-edit-advanced-control" />
|
||||
);
|
||||
case 'chat-settings-preupload-attachments':
|
||||
return (
|
||||
<PreuploadMessageAttachmentsControl data-flx="user.advanced-setting-direct-controls.advanced-setting-control.preupload-message-attachments-control" />
|
||||
|
||||
+11
-1
@@ -16,7 +16,10 @@ import {SwitchGroup, SwitchGroupItem} from '@app/features/ui/components/SwitchGr
|
||||
import * as UserGuildSettingsCommands from '@app/features/user/commands/UserGuildSettingsCommands';
|
||||
import * as UserSettingsCommands from '@app/features/user/commands/UserSettingsCommands';
|
||||
import type {SearchEngineMode} from '@app/features/user/components/modals/tabs/chat_settings_tab/AddCustomSearchEngineModal';
|
||||
import {ConvertEmoticonsControl} from '@app/features/user/components/modals/tabs/chat_settings_tab/ChatSettingsTabInputTab';
|
||||
import {
|
||||
ConvertEmoticonsControl,
|
||||
KeepAttachmentsOnEmptyEditControl,
|
||||
} from '@app/features/user/components/modals/tabs/chat_settings_tab/ChatSettingsTabInputTab';
|
||||
import {
|
||||
StripTrackingParametersControl,
|
||||
TrustAllExternalLinksControl,
|
||||
@@ -280,6 +283,13 @@ export const ConvertEmoticonsAdvancedControl = observer(() => (
|
||||
<ConvertEmoticonsControl compact data-flx="user.advanced-settings-tab.convert-emoticons-control" />
|
||||
));
|
||||
|
||||
export const KeepAttachmentsOnEmptyEditAdvancedControl = observer(() => (
|
||||
<KeepAttachmentsOnEmptyEditControl
|
||||
compact
|
||||
data-flx="user.advanced-settings-tab.keep-attachments-on-empty-edit-control"
|
||||
/>
|
||||
));
|
||||
|
||||
interface SearchProviderSettingsModalProps {
|
||||
mode: SearchEngineMode;
|
||||
title: string;
|
||||
|
||||
+20
@@ -2,6 +2,7 @@
|
||||
|
||||
import ChatInputSettings from '@app/features/messaging/state/ChatInputSettings';
|
||||
import {Switch} from '@app/features/ui/components/form/FormSwitch';
|
||||
import AdvancedSettings from '@app/features/user/state/AdvancedSettings';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
@@ -11,6 +12,10 @@ const CONVERT_EMOTICONS_TO_EMOJI_DESCRIPTOR = msg({
|
||||
message: 'Turn text smileys into emoji',
|
||||
comment: 'Label in the input tab.',
|
||||
});
|
||||
const KEEP_ATTACHMENTS_WHEN_CLEARING_AN_EDIT_DESCRIPTOR = msg({
|
||||
message: 'Keep attachments when clearing an edit',
|
||||
comment: 'Label for an advanced message editing preference.',
|
||||
});
|
||||
|
||||
interface InputSwitchControlProps {
|
||||
compact?: boolean;
|
||||
@@ -31,6 +36,21 @@ export const ConvertEmoticonsControl: React.FC<InputSwitchControlProps> = observ
|
||||
);
|
||||
});
|
||||
|
||||
export const KeepAttachmentsOnEmptyEditControl: React.FC<InputSwitchControlProps> = observer(({compact = false}) => {
|
||||
const {i18n} = useLingui();
|
||||
const label = i18n._(KEEP_ATTACHMENTS_WHEN_CLEARING_AN_EDIT_DESCRIPTOR);
|
||||
return (
|
||||
<Switch
|
||||
ariaLabel={label}
|
||||
label={compact ? undefined : label}
|
||||
value={AdvancedSettings.keepAttachmentsOnEmptyMessageEdit}
|
||||
onChange={AdvancedSettings.setKeepAttachmentsOnEmptyMessageEdit}
|
||||
compact={compact}
|
||||
data-flx="user.chat-settings-tab.input-tab.keep-attachments-on-empty-edit-control.switch"
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
export const InputTabContent: React.FC = observer(() => {
|
||||
return <ConvertEmoticonsControl data-flx="user.chat-settings-tab.input-tab.input-tab-content.convert-emoticons" />;
|
||||
});
|
||||
Reference in new issue
Block a user