mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
30 lines
966 B
TypeScript
30 lines
966 B
TypeScript
import React from "react";
|
|
// editor
|
|
import { EditorReadOnlyRefApi, IRichTextReadOnlyEditor, RichTextReadOnlyEditorWithRef } from "@plane/rich-text-editor";
|
|
// helpers
|
|
import { cn } from "@/helpers/common.helper";
|
|
// hooks
|
|
import { useMention } from "@/hooks/store";
|
|
|
|
interface RichTextReadOnlyEditorWrapperProps extends Omit<IRichTextReadOnlyEditor, "mentionHandler"> {}
|
|
|
|
export const RichTextReadOnlyEditor = React.forwardRef<EditorReadOnlyRefApi, RichTextReadOnlyEditorWrapperProps>(
|
|
({ ...props }, ref) => {
|
|
const { mentionHighlights } = useMention({});
|
|
|
|
return (
|
|
<RichTextReadOnlyEditorWithRef
|
|
ref={ref}
|
|
mentionHandler={{
|
|
highlights: mentionHighlights,
|
|
}}
|
|
{...props}
|
|
// overriding the containerClassName to add relative class passed
|
|
containerClassName={cn(props.containerClassName, "relative pl-3")}
|
|
/>
|
|
);
|
|
}
|
|
);
|
|
|
|
RichTextReadOnlyEditor.displayName = "RichTextReadOnlyEditor";
|