@@ -13,7 +13,10 @@ import classNames from 'classnames';
1313import { createPortal } from 'react-dom' ;
1414import { fabric } from 'fabric' ;
1515import lodash from 'lodash' ;
16- import type { DraftBodyRanges } from '../types/BodyRange.std.js' ;
16+ import type {
17+ DraftBodyRanges ,
18+ HydratedBodyRangesType ,
19+ } from '../types/BodyRange.std.js' ;
1720import type { ImageStateType } from '../mediaEditor/ImageStateType.std.js' ;
1821import type {
1922 InputApi ,
@@ -47,7 +50,6 @@ import { ThemeType } from '../types/Util.std.js';
4750import { arrow } from '../util/keyboard.dom.js' ;
4851import { canvasToBytes } from '../util/canvasToBytes.std.js' ;
4952import { loadImage } from '../util/loadImage.std.js' ;
50- import { hydrateRanges } from '../types/BodyRange.std.js' ;
5153import { useConfirmDiscard } from '../hooks/useConfirmDiscard.dom.js' ;
5254import { useFabricHistory } from '../mediaEditor/useFabricHistory.dom.js' ;
5355import { usePortal } from '../hooks/usePortal.dom.js' ;
@@ -62,7 +64,6 @@ import type { FunStickerSelection } from './fun/panels/FunPanelStickers.dom.js';
6264import { drop } from '../util/drop.std.js' ;
6365import type { FunTimeStickerStyle } from './fun/constants.dom.js' ;
6466import * as Errors from '../types/errors.std.js' ;
65- import type { GetConversationByIdType } from '../state/selectors/conversations.dom.js' ;
6667
6768const { get, has, noop } = lodash ;
6869
@@ -85,7 +86,9 @@ export type PropsType = {
8586 imageToBlurHash : typeof imageToBlurHash ;
8687 onClose : ( ) => unknown ;
8788 onDone : ( result : MediaEditorResultType ) => unknown ;
88- conversationSelector : GetConversationByIdType ;
89+ convertDraftBodyRangesIntoHydrated : (
90+ bodyRanges : DraftBodyRanges | undefined
91+ ) => HydratedBodyRangesType | undefined ;
8992} & Pick <
9093 CompositionInputProps ,
9194 | 'draftText'
@@ -168,7 +171,7 @@ export function MediaEditor({
168171 ourConversationId,
169172 platform,
170173 sortedGroupMembers,
171- conversationSelector ,
174+ convertDraftBodyRangesIntoHydrated ,
172175 imageToBlurHash,
173176} : PropsType ) : JSX . Element | null {
174177 const [ fabricCanvas , setFabricCanvas ] = useState < fabric . Canvas | undefined > ( ) ;
@@ -181,8 +184,8 @@ export function MediaEditor({
181184 useState < DraftBodyRanges | null > ( draftBodyRanges ) ;
182185
183186 const hydratedBodyRanges = useMemo (
184- ( ) => hydrateRanges ( captionBodyRanges ?? undefined , conversationSelector ) ,
185- [ captionBodyRanges , conversationSelector ]
187+ ( ) => convertDraftBodyRangesIntoHydrated ( captionBodyRanges ?? undefined ) ,
188+ [ captionBodyRanges , convertDraftBodyRangesIntoHydrated ]
186189 ) ;
187190
188191 const inputApiRef = useRef < InputApi | undefined > ( ) ;
0 commit comments