UNPKG

communication-react-19

Version:

React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)

34 lines 1.56 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import React, { useMemo } from 'react'; /* @conditional-compile-remove(rich-text-editor) */ import { Suspense } from 'react'; import { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox'; /* @conditional-compile-remove(rich-text-editor) */ import { _ErrorBoundary } from '../../ErrorBoundary'; /* @conditional-compile-remove(rich-text-editor) */ const ChatMessageComponentAsRichTextEditBox = React.lazy(() => import('./ChatMessageComponentAsRichTextEditBox')); /** * @private * Use this function to load RoosterJS dependencies early in the lifecycle. * It should be the same import as used for lazy loading. * * @conditional-compile-remove(rich-text-editor) */ export const loadChatMessageComponentAsRichTextEditBox = () => import('./ChatMessageComponentAsRichTextEditBox'); /** * @private */ export const ChatMessageComponentAsEditBoxPicker = (props) => { const simpleEditBox = useMemo(() => { return React.createElement(ChatMessageComponentAsEditBox, Object.assign({}, props)); }, [props]); /* @conditional-compile-remove(rich-text-editor) */ if (props.isRichTextEditorEnabled) { return (React.createElement(_ErrorBoundary, { fallback: simpleEditBox }, React.createElement(Suspense, { fallback: simpleEditBox }, React.createElement(ChatMessageComponentAsRichTextEditBox, Object.assign({}, props))))); } return simpleEditBox; }; //# sourceMappingURL=ChatMessageComponentAsEditBoxPicker.js.map