Merge remote-tracking branch 'origin/develop' into feat/add-message-edition-wysiwyg-composer

This commit is contained in:
Florian Duros 2022-10-19 16:34:22 +02:00
commit e77f333fb6
No known key found for this signature in database
GPG key ID: 9700AA5870258A0B
124 changed files with 4370 additions and 1039 deletions

View file

@ -15,32 +15,33 @@ limitations under the License.
*/
import React, { forwardRef, RefObject } from 'react';
import { FormattingFunctions } from '@matrix-org/matrix-wysiwyg';
import { useWysiwygSendActionHandler } from './hooks/useWysiwygSendActionHandler';
import { WysiwygComposer } from './components/WysiwygComposer';
import { Wysiwyg } from './types';
interface SendWysiwygComposerProps {
disabled?: boolean;
onChange?: (content: string) => void;
}
export function SendWysiwygComposer(props: SendWysiwygComposerProps) {
return (
<WysiwygComposer {...props}>{ (ref, wysiwyg) => (
<Content disabled={props.disabled} ref={ref} wysiwyg={wysiwyg} />
) }
</WysiwygComposer>);
onSend(): () => void;
}
interface ContentProps {
disabled: boolean;
wysiwyg: Wysiwyg;
formattingFunctions: FormattingFunctions;
}
const Content = forwardRef<HTMLElement, ContentProps>(
function Content({ disabled, wysiwyg }: ContentProps, forwardRef: RefObject<HTMLElement>) {
function Content({ disabled, formattingFunctions: wysiwyg }: ContentProps, forwardRef: RefObject<HTMLElement>) {
useWysiwygSendActionHandler(disabled, forwardRef, wysiwyg);
return null;
},
);
export function SendWysiwygComposer(props: SendWysiwygComposerProps) {
return (
<WysiwygComposer {...props}>{ (ref, wysiwyg) => (
<Content disabled={props.disabled} ref={ref} formattingFunctions={wysiwyg} />
) }
</WysiwygComposer>);
}