Add MaxHeight props to SimplifiedEditor (#209)
Add MaxHeight props to SimplifiedEditor
This commit is contained in:
parent
3db98ac6cb
commit
59e7ba424a
|
@ -44,6 +44,7 @@ type Props = {
|
||||||
onChange?: (text: string) => void
|
onChange?: (text: string) => void
|
||||||
variant?: 'minimal' | 'bordered'
|
variant?: 'minimal' | 'bordered'
|
||||||
maxLength?: number
|
maxLength?: number
|
||||||
|
maxHeight?: number
|
||||||
submitButtonText?: string
|
submitButtonText?: string
|
||||||
quoteEnabled?: boolean
|
quoteEnabled?: boolean
|
||||||
imageEnabled?: boolean
|
imageEnabled?: boolean
|
||||||
|
@ -237,6 +238,11 @@ const SimplifiedEditor = (props: Props) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const maxHeightStyle = {
|
||||||
|
overflow: 'auto',
|
||||||
|
'max-height': `${props.maxHeight}px`
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={(el) => (wrapperEditorElRef.current = el)}
|
ref={(el) => (wrapperEditorElRef.current = el)}
|
||||||
|
@ -254,7 +260,7 @@ const SimplifiedEditor = (props: Props) => {
|
||||||
<Show when={props.label && counter() > 0}>
|
<Show when={props.label && counter() > 0}>
|
||||||
<div class={styles.label}>{props.label}</div>
|
<div class={styles.label}>{props.label}</div>
|
||||||
</Show>
|
</Show>
|
||||||
<div ref={(el) => (editorElRef.current = el)} />
|
<div style={props.maxHeight && maxHeightStyle} ref={(el) => (editorElRef.current = el)} />
|
||||||
<Show when={!props.onlyBubbleControls}>
|
<Show when={!props.onlyBubbleControls}>
|
||||||
<div class={clsx(styles.controls, { [styles.alwaysVisible]: props.controlsAlwaysVisible })}>
|
<div class={clsx(styles.controls, { [styles.alwaysVisible]: props.controlsAlwaysVisible })}>
|
||||||
<div class={styles.actions}>
|
<div class={styles.actions}>
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
.TextBubbleMenu {
|
.TextBubbleMenu {
|
||||||
background: var(--editor-bubble-menu-background);
|
background: var(--editor-bubble-menu-background);
|
||||||
box-shadow: 0 4px 10px rgba(#000, 0.25);
|
box-shadow: 0 4px 10px rgba(#000, 0.25);
|
||||||
max-height: 300px;
|
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
&.growWidth {
|
&.growWidth {
|
||||||
min-width: 460px;
|
min-width: 460px;
|
||||||
|
|
|
@ -113,6 +113,7 @@ export const TextBubbleMenu = (props: BubbleMenuProps) => {
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={footnoteEditorOpen()}>
|
<Match when={footnoteEditorOpen()}>
|
||||||
<SimplifiedEditor
|
<SimplifiedEditor
|
||||||
|
maxHeight={180}
|
||||||
controlsAlwaysVisible={true}
|
controlsAlwaysVisible={true}
|
||||||
imageEnabled={true}
|
imageEnabled={true}
|
||||||
placeholder={t('Enter footnote text')}
|
placeholder={t('Enter footnote text')}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user