Fix: media editor nits
This commit is contained in:
parent
05a2286d94
commit
1d0157877a
3 changed files with 25 additions and 8 deletions
|
@ -5763,6 +5763,10 @@
|
||||||
"messageformat": "There was an error when saving your settings. Please try again.",
|
"messageformat": "There was an error when saving your settings. Please try again.",
|
||||||
"description": "Shown if there is an error when saving your preferred reaction settings. Should be very rare to see this message."
|
"description": "Shown if there is an error when saving your preferred reaction settings. Should be very rare to see this message."
|
||||||
},
|
},
|
||||||
|
"icu:MediaEditor__input-placeholder": {
|
||||||
|
"messageformat": "Message",
|
||||||
|
"description": "Placeholder for the input in the media editor"
|
||||||
|
},
|
||||||
"icu:MediaEditor__clock-more-styles": {
|
"icu:MediaEditor__clock-more-styles": {
|
||||||
"messageformat": "More styles",
|
"messageformat": "More styles",
|
||||||
"description": "Action button for switching up the clock styles"
|
"description": "Action button for switching up the clock styles"
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
|
|
||||||
&--input {
|
&--input {
|
||||||
margin-inline: 24px;
|
margin-inline: 24px;
|
||||||
min-width: 400px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--buttons {
|
&--buttons {
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React, {
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { fabric } from 'fabric';
|
import { fabric } from 'fabric';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
import { get, has, noop } from 'lodash';
|
import { get, has, noop } from 'lodash';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
|
@ -49,6 +56,8 @@ import { Theme } from '../util/theme';
|
||||||
import { ThemeType } from '../types/Util';
|
import { ThemeType } from '../types/Util';
|
||||||
import { arrow } from '../util/keyboard';
|
import { arrow } from '../util/keyboard';
|
||||||
import { canvasToBytes } from '../util/canvasToBytes';
|
import { canvasToBytes } from '../util/canvasToBytes';
|
||||||
|
import { getConversationSelector } from '../state/selectors/conversations';
|
||||||
|
import { hydrateRanges } from '../types/BodyRange';
|
||||||
import { useConfirmDiscard } from '../hooks/useConfirmDiscard';
|
import { useConfirmDiscard } from '../hooks/useConfirmDiscard';
|
||||||
import { useFabricHistory } from '../mediaEditor/useFabricHistory';
|
import { useFabricHistory } from '../mediaEditor/useFabricHistory';
|
||||||
import { usePortal } from '../hooks/usePortal';
|
import { usePortal } from '../hooks/usePortal';
|
||||||
|
@ -175,6 +184,12 @@ export function MediaEditor({
|
||||||
DraftBodyRanges | undefined
|
DraftBodyRanges | undefined
|
||||||
>(draftBodyRanges);
|
>(draftBodyRanges);
|
||||||
|
|
||||||
|
const conversationSelector = useSelector(getConversationSelector);
|
||||||
|
const hydratedBodyRanges = useMemo(
|
||||||
|
() => hydrateRanges(captionBodyRanges, conversationSelector),
|
||||||
|
[captionBodyRanges, conversationSelector]
|
||||||
|
);
|
||||||
|
|
||||||
const inputApiRef = useRef<InputApi | undefined>();
|
const inputApiRef = useRef<InputApi | undefined>();
|
||||||
|
|
||||||
const closeEmojiPickerAndFocusComposer = useCallback(() => {
|
const closeEmojiPickerAndFocusComposer = useCallback(() => {
|
||||||
|
@ -1285,8 +1300,8 @@ export function MediaEditor({
|
||||||
<div className="MediaEditor__tools-row-2">
|
<div className="MediaEditor__tools-row-2">
|
||||||
<div className="MediaEditor__tools--input dark-theme">
|
<div className="MediaEditor__tools--input dark-theme">
|
||||||
<CompositionInput
|
<CompositionInput
|
||||||
draftText={draftText}
|
draftText={caption}
|
||||||
draftBodyRanges={draftBodyRanges}
|
draftBodyRanges={hydratedBodyRanges}
|
||||||
getPreferredBadge={getPreferredBadge}
|
getPreferredBadge={getPreferredBadge}
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
inputApi={inputApiRef}
|
inputApi={inputApiRef}
|
||||||
|
@ -1302,11 +1317,9 @@ export function MediaEditor({
|
||||||
setCaption(messageText);
|
setCaption(messageText);
|
||||||
}}
|
}}
|
||||||
onPickEmoji={onPickEmoji}
|
onPickEmoji={onPickEmoji}
|
||||||
onSubmit={() => {
|
onSubmit={noop}
|
||||||
inputApiRef.current?.reset();
|
|
||||||
}}
|
|
||||||
onTextTooLong={onTextTooLong}
|
onTextTooLong={onTextTooLong}
|
||||||
placeholder="Message"
|
placeholder={i18n('icu:MediaEditor__input-placeholder')}
|
||||||
platform={platform}
|
platform={platform}
|
||||||
sendCounter={0}
|
sendCounter={0}
|
||||||
sortedGroupMembers={sortedGroupMembers}
|
sortedGroupMembers={sortedGroupMembers}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue