(
{
className = {},
inputId,
footer,
textareaProps = {},
submitCopy,
submitButtonVariant = ButtonVariant.Float,
showUserAvatar,
isUpdatingDraft,
timeline,
isLoading,
disabledSubmit,
maxInputLength,
onClose,
postId,
sourceId,
onSubmit,
onValueUpdate,
initialContent = '',
enabledCommand = {},
editCommentId,
parentCommentId,
mentionSuggestions,
allowBlockFormatting = true,
minHeightClassName = 'min-h-[8rem]',
markdownToHtml = markdownToHtmlBasic,
hideToolbar = false,
toolbarPosition = 'top',
toolbarLeading,
toolbarRightActions,
hideMarkdownToggle = false,
hideMarkdownHeader = false,
hideFooter = false,
onMarkdownModeChange,
}: RichTextInputProps,
ref: ForwardedRef<RichTextInputRef>,
)
| 168 | } |
| 169 | |
| 170 | function RichTextInput( |
| 171 | { |
| 172 | className = {}, |
| 173 | inputId, |
| 174 | footer, |
| 175 | textareaProps = {}, |
| 176 | submitCopy, |
| 177 | submitButtonVariant = ButtonVariant.Float, |
| 178 | showUserAvatar, |
| 179 | isUpdatingDraft, |
| 180 | timeline, |
| 181 | isLoading, |
| 182 | disabledSubmit, |
| 183 | maxInputLength, |
| 184 | onClose, |
| 185 | postId, |
| 186 | sourceId, |
| 187 | onSubmit, |
| 188 | onValueUpdate, |
| 189 | initialContent = '', |
| 190 | enabledCommand = {}, |
| 191 | editCommentId, |
| 192 | parentCommentId, |
| 193 | mentionSuggestions, |
| 194 | allowBlockFormatting = true, |
| 195 | minHeightClassName = 'min-h-[8rem]', |
| 196 | markdownToHtml = markdownToHtmlBasic, |
| 197 | hideToolbar = false, |
| 198 | toolbarPosition = 'top', |
| 199 | toolbarLeading, |
| 200 | toolbarRightActions, |
| 201 | hideMarkdownToggle = false, |
| 202 | hideMarkdownHeader = false, |
| 203 | hideFooter = false, |
| 204 | onMarkdownModeChange, |
| 205 | }: RichTextInputProps, |
| 206 | ref: ForwardedRef<RichTextInputRef>, |
| 207 | ): ReactElement { |
| 208 | const shouldShowSubmit = !!submitCopy; |
| 209 | const { user } = useAuthContext(); |
| 210 | const { displayToast } = useToastNotification(); |
| 211 | const { parentSelector } = usePopupSelector(); |
| 212 | const toolbarRef = useRef<RichTextToolbarRef>(null); |
| 213 | const editorContainerRef = useRef<HTMLDivElement>(null); |
| 214 | const editorRef = useRef<Editor | null>(null); |
| 215 | const markdownTextareaRef = useRef<HTMLTextAreaElement>(null); |
| 216 | const dirtyRef = useRef(false); |
| 217 | const isSyncingRef = useRef(false); |
| 218 | const inputRef = useRef(''); |
| 219 | const [offset, setOffset] = useState([0, 0]); |
| 220 | const [isMarkdownMode, setIsMarkdownMode] = useState(false); |
| 221 | const [submitShortcut, setSubmitShortcut] = useState('Ctrl + Enter'); |
| 222 | useEffect(() => { |
| 223 | setSubmitShortcut(isAppleDevice() ? '⌘ + Enter' : 'Ctrl + Enter'); |
| 224 | }, []); |
| 225 | |
| 226 | const isUploadEnabled = enabledCommand[MarkdownCommand.Upload]; |
| 227 | const isLinkEnabled = enabledCommand[MarkdownCommand.Link]; |
nothing calls this directly
no test coverage detected