feat: Integrate forum layout support across various components and enhance room handling logic
This commit is contained in:
@@ -85,6 +85,8 @@ type CustomEditorProps = {
|
||||
before?: ReactNode;
|
||||
after?: ReactNode;
|
||||
maxHeight?: string;
|
||||
/** Stretch the editable area to fill the parent (e.g. post modal). */
|
||||
fillHeight?: boolean;
|
||||
editor: Editor;
|
||||
placeholder?: string;
|
||||
onKeyDown?: KeyboardEventHandler;
|
||||
@@ -101,6 +103,7 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
before,
|
||||
after,
|
||||
maxHeight = '50vh',
|
||||
fillHeight = false,
|
||||
editor,
|
||||
placeholder,
|
||||
onKeyDown,
|
||||
@@ -223,11 +226,27 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
[]
|
||||
);
|
||||
|
||||
const scrollStyle = fillHeight
|
||||
? { flex: '1 1 auto', minHeight: maxHeight, height: '100%' }
|
||||
: { maxHeight };
|
||||
|
||||
return (
|
||||
<div className={css.Editor} ref={ref}>
|
||||
<div
|
||||
className={css.Editor}
|
||||
ref={ref}
|
||||
style={
|
||||
fillHeight
|
||||
? { display: 'flex', flexDirection: 'column', height: '100%', minHeight: maxHeight }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<Slate editor={editor} initialValue={initialValue} onChange={onChange}>
|
||||
{top}
|
||||
<Box alignItems="Start">
|
||||
<Box
|
||||
alignItems="Start"
|
||||
grow={fillHeight ? 'Yes' : undefined}
|
||||
style={fillHeight ? { width: '100%', minHeight: 0, flex: '1 1 auto' } : undefined}
|
||||
>
|
||||
{before && (
|
||||
<Box className={css.EditorOptions} alignItems="Center" gap="100" shrink="No">
|
||||
{before}
|
||||
@@ -236,7 +255,7 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
<Scroll
|
||||
className={css.EditorTextareaScroll}
|
||||
variant="SurfaceVariant"
|
||||
style={{ maxHeight }}
|
||||
style={scrollStyle}
|
||||
size="300"
|
||||
visibility="Hover"
|
||||
hideTrack
|
||||
|
||||
Reference in New Issue
Block a user