MCPcopy Create free account
hub / github.com/dailydotdev/apps / RichTextInput

Function RichTextInput

packages/shared/src/components/fields/RichTextInput.tsx:175–1158  ·  view source on GitHub ↗
(
  {
    className = {},
    inputId,
    footer,
    textareaProps = {},
    submitCopy,
    submitButtonVariant = ButtonVariant.Float,
    showUserAvatar,
    isUpdatingDraft,
    header,
    inputPrefix,
    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,
    stackToolbarLeading = false,
    hideMarkdownToggle = false,
    hideMarkdownHeader = false,
    disallowLinks = false,
    hideFooter = false,
    onMarkdownModeChange,
    onImageUpload,
  }: RichTextInputProps,
  ref: ForwardedRef<RichTextInputRef>,
)

Source from the content-addressed store, hash-verified

173}
174
175function RichTextInput(
176 {
177 className = {},
178 inputId,
179 footer,
180 textareaProps = {},
181 submitCopy,
182 submitButtonVariant = ButtonVariant.Float,
183 showUserAvatar,
184 isUpdatingDraft,
185 header,
186 inputPrefix,
187 isLoading,
188 disabledSubmit,
189 maxInputLength,
190 onClose,
191 postId,
192 sourceId,
193 onSubmit,
194 onValueUpdate,
195 initialContent = '',
196 enabledCommand = {},
197 editCommentId,
198 parentCommentId,
199 mentionSuggestions,
200 allowBlockFormatting = true,
201 minHeightClassName = 'min-h-[8rem]',
202 markdownToHtml = markdownToHtmlBasic,
203 hideToolbar = false,
204 toolbarPosition = 'top',
205 toolbarLeading,
206 toolbarRightActions,
207 stackToolbarLeading = false,
208 hideMarkdownToggle = false,
209 hideMarkdownHeader = false,
210 disallowLinks = false,
211 hideFooter = false,
212 onMarkdownModeChange,
213 onImageUpload,
214 }: RichTextInputProps,
215 ref: ForwardedRef<RichTextInputRef>,
216): ReactElement {
217 const shouldShowSubmit = !!submitCopy;
218 const { user } = useAuthContext();
219 const { displayToast } = useToastNotification();
220 const { parentSelector } = usePopupSelector();
221 const toolbarRef = useRef<RichTextToolbarRef>(null);
222 const editorContainerRef = useRef<HTMLDivElement>(null);
223 const editorRef = useRef<Editor | null>(null);
224 const markdownTextareaRef = useRef<HTMLTextAreaElement>(null);
225 const scrollContainerRef = useRef<HTMLDivElement>(null);
226 const scrollOffsetRef = useRef(0);
227 const shouldRestoreScrollRef = useRef(false);
228 const pendingFocusRef = useRef(false);
229 const dirtyRef = useRef(false);
230 const isSyncingRef = useRef(false);
231 const inputRef = useRef('');
232 const [offset, setOffset] = useState([0, 0]);

Callers

nothing calls this directly

Calls 15

useAuthContextFunction · 0.90
useToastNotificationFunction · 0.90
usePopupSelectorFunction · 0.90
isAppleDeviceFunction · 0.90
useDraftStorageFunction · 0.90
useMentionAutocompleteFunction · 0.90
useEmojiAutocompleteFunction · 0.90
htmlToMarkdownBasicFunction · 0.90
looksLikeMarkdownFunction · 0.90
useImageUploadFunction · 0.90
getInitialValueFunction · 0.85
setInputFunction · 0.85

Tested by

no test coverage detected