Merge remote-tracking branch 'origin/develop' into chats
This commit is contained in:
commit
90c8096f9e
5 changed files with 21 additions and 5 deletions
Binary file not shown.
|
@ -18,7 +18,7 @@ import AutosuggestInput, { AutoSuggestion } from 'soapbox/components/autosuggest
|
|||
import AutosuggestTextarea from 'soapbox/components/autosuggest_textarea';
|
||||
import Icon from 'soapbox/components/icon';
|
||||
import { Button, Stack } from 'soapbox/components/ui';
|
||||
import { useAppDispatch, useAppSelector, useCompose, useFeatures } from 'soapbox/hooks';
|
||||
import { useAppDispatch, useAppSelector, useCompose, useFeatures, usePrevious } from 'soapbox/hooks';
|
||||
import { isMobile } from 'soapbox/is_mobile';
|
||||
|
||||
import EmojiPickerDropdown from '../components/emoji-picker/emoji-picker-dropdown';
|
||||
|
@ -76,6 +76,7 @@ const ComposeForm = <ID extends string>({ id, shouldCondense, autoFocus, clickab
|
|||
const features = useFeatures();
|
||||
|
||||
const { text, suggestions, spoiler, spoiler_text: spoilerText, privacy, focusDate, caretPosition, is_submitting: isSubmitting, is_changing_upload: isChangingUpload, is_uploading: isUploading, schedule: scheduledAt } = compose;
|
||||
const prevSpoiler = usePrevious(spoiler);
|
||||
|
||||
const hasPoll = !!compose.poll;
|
||||
const isEditing = compose.id !== null;
|
||||
|
@ -206,9 +207,10 @@ const ComposeForm = <ID extends string>({ id, shouldCondense, autoFocus, clickab
|
|||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
switch (spoiler) {
|
||||
case true: focusSpoilerInput(); break;
|
||||
case false: focusTextarea(); break;
|
||||
if (spoiler && !prevSpoiler) {
|
||||
focusSpoilerInput();
|
||||
} else if (!spoiler && prevSpoiler) {
|
||||
focusTextarea();
|
||||
}
|
||||
}, [spoiler]);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ export { useFeatures } from './useFeatures';
|
|||
export { useLocale } from './useLocale';
|
||||
export { useOnScreen } from './useOnScreen';
|
||||
export { useOwnAccount } from './useOwnAccount';
|
||||
export { usePrevious } from './usePrevious';
|
||||
export { useRefEventHandler } from './useRefEventHandler';
|
||||
export { useSettings } from './useSettings';
|
||||
export { useSoapboxConfig } from './useSoapboxConfig';
|
||||
|
|
13
app/soapbox/hooks/usePrevious.ts
Normal file
13
app/soapbox/hooks/usePrevious.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { useRef, useEffect } from 'react';
|
||||
|
||||
/** Get the last version of this value. */
|
||||
// https://usehooks.com/usePrevious/
|
||||
export const usePrevious = <T>(value: T): T | undefined => {
|
||||
const ref = useRef<T>();
|
||||
|
||||
useEffect(() => {
|
||||
ref.current = value;
|
||||
}, [value]);
|
||||
|
||||
return ref.current;
|
||||
};
|
|
@ -992,7 +992,7 @@
|
|||
"status.favourite": "Like",
|
||||
"status.filtered": "Filtered",
|
||||
"status.in_review_warning": "Content Under Review",
|
||||
"status.in_review_summary.summary": "This Truth has been sent to Moderation for review and is only visible to you.",
|
||||
"status.in_review_summary.summary": "This post has been sent to Moderation for review and is only visible to you.",
|
||||
"status.in_review_summary.contact": "If you believe this is in error please {link}.",
|
||||
"status.in_review_summary.link": "Contact Support",
|
||||
"status.load_more": "Load more",
|
||||
|
|
Loading…
Reference in a new issue