fix(chat): fix chat input placeholder positioning. Closes #2991

This commit is contained in:
Gabe Kangas 2023-05-18 14:07:11 -07:00
parent 1f64f303ec
commit 1f1f48acb0
No known key found for this signature in database
GPG Key ID: 4345B2060657F330

View File

@ -2,7 +2,15 @@ import { Popover } from 'antd';
import React, { FC, useMemo, useState } from 'react';
import { useRecoilValue } from 'recoil';
import { Transforms, createEditor, BaseEditor, Text, Descendant, Editor } from 'slate';
import { Slate, Editable, withReact, ReactEditor, useSelected, useFocused } from 'slate-react';
import {
Slate,
DefaultPlaceholder,
Editable,
withReact,
ReactEditor,
useSelected,
useFocused,
} from 'slate-react';
import dynamic from 'next/dynamic';
import classNames from 'classnames';
import WebsocketService from '../../../services/websocket-service';
@ -247,6 +255,16 @@ export const ChatTextField: FC<ChatTextFieldProps> = ({ defaultText, enabled })
disabled={!enabled}
readOnly={!enabled}
renderElement={renderElement}
renderPlaceholder={({ children, attributes }) => (
<DefaultPlaceholder
attributes={{
...attributes,
style: { ...attributes.style, top: '15%' },
}}
>
{children}
</DefaultPlaceholder>
)}
placeholder={enabled ? 'Send a message to chat' : 'Chat is currently unavailable.'}
style={{ width: '100%' }}
role="textbox"