{ this.container = el; @@ -455,7 +454,7 @@ class CompositionBoxInner extends React.Component { {typingEnabled && showEmojiPanel && ( - + { private renderTextArea() { const { i18n } = window; - const { draft, htmlDirection } = this.state; + const { draft } = this.state; + const { htmlDirection } = this.props; if (!this.props.selectedConversation) { return null; diff --git a/ts/state/selectors/user.ts b/ts/state/selectors/user.ts index 69535cfda..c4a75a5de 100644 --- a/ts/state/selectors/user.ts +++ b/ts/state/selectors/user.ts @@ -4,6 +4,7 @@ import { LocalizerType } from '../../types/Util'; import { StateType } from '../reducer'; import { UserStateType } from '../ducks/user'; +import { HTMLDirection, isRtlBody } from '../../util/i18n'; export const getUser = (state: StateType): UserStateType => state.user; @@ -13,3 +14,8 @@ export const getOurNumber = createSelector( ); export const getIntl = createSelector(getUser, (): LocalizerType => window.i18n); + +export const getHTMLDirection = createSelector( + getUser, + (): HTMLDirection => (isRtlBody() ? 'rtl' : 'ltr') +); diff --git a/ts/state/smart/SessionConversation.ts b/ts/state/smart/SessionConversation.ts index c5850f2f1..09d1b5174 100644 --- a/ts/state/smart/SessionConversation.ts +++ b/ts/state/smart/SessionConversation.ts @@ -17,7 +17,7 @@ import { } from '../selectors/selectedConversation'; import { getStagedAttachmentsForCurrentConversation } from '../selectors/stagedAttachments'; import { getTheme } from '../selectors/theme'; -import { getOurNumber } from '../selectors/user'; +import { getHTMLDirection, getOurNumber } from '../selectors/user'; const mapStateToProps = (state: StateType) => { return { @@ -33,6 +33,7 @@ const mapStateToProps = (state: StateType) => { stagedAttachments: getStagedAttachmentsForCurrentConversation(state), hasOngoingCallWithFocusedConvo: getHasOngoingCallWithFocusedConvo(state), isSelectedConvoInitialLoadingInProgress: getIsSelectedConvoInitialLoadingInProgress(state), + htmlDirection: getHTMLDirection(state), }; }; diff --git a/ts/util/i18n.ts b/ts/util/i18n.ts index 1ad307250..135f1d48e 100644 --- a/ts/util/i18n.ts +++ b/ts/util/i18n.ts @@ -73,7 +73,3 @@ export function isRtlBody(): boolean { return body?.classList.contains('rtl') || false; } - -export function getHTMLDirection(): HTMLDirection { - return isRtlBody() ? 'rtl' : 'ltr'; -}