import React from "react"; // editor import { EditorRefApi, ILiteTextEditor, LiteTextEditorWithRef } from "@plane/lite-text-editor"; // components import { IssueCommentToolbar } from "@/components/editor"; // helpers import { cn } from "@/helpers/common.helper"; import { isEmptyHtmlString } from "@/helpers/string.helper"; // hooks import { useMention } from "@/hooks/use-mention"; // services import fileService from "@/services/file.service"; interface LiteTextEditorWrapperProps extends Omit { workspaceSlug: string; workspaceId: string; isSubmitting?: boolean; showSubmitButton?: boolean; } export const LiteTextEditor = React.forwardRef((props, ref) => { const { containerClassName, workspaceSlug, workspaceId, isSubmitting = false, showSubmitButton = true, ...rest } = props; // use-mention const { mentionHighlights } = useMention(); function isMutableRefObject(ref: React.ForwardedRef): ref is React.MutableRefObject { return !!ref && typeof ref === "object" && "current" in ref; } const isEmpty = props.initialValue?.trim() === "" || props.initialValue === "

" || (isEmptyHtmlString(props.initialValue ?? "") && !props.initialValue?.includes("mention-component")); return (
{ if (isMutableRefObject(ref)) { ref.current?.executeMenuItemCommand(key); } }} isSubmitting={isSubmitting} showSubmitButton={showSubmitButton} handleSubmit={(e) => rest.onEnterKeyPress?.(e)} isCommentEmpty={isEmpty} editorRef={isMutableRefObject(ref) ? ref : null} />
); }); LiteTextEditor.displayName = "LiteTextEditor";