[WIKI-644] fix: remove unnecessary props from the editor package #7726
This commit is contained in:
parent
88f194ca8e
commit
a1500c2206
12 changed files with 36 additions and 87 deletions
|
|
@ -1,6 +1,12 @@
|
|||
import React, { forwardRef } from "react";
|
||||
// plane imports
|
||||
import { DocumentEditorWithRef, type EditorRefApi, type IDocumentEditorProps, type TFileHandler } from "@plane/editor";
|
||||
import {
|
||||
DocumentEditorWithRef,
|
||||
IEditorPropsExtended,
|
||||
type EditorRefApi,
|
||||
type IDocumentEditorProps,
|
||||
type TFileHandler,
|
||||
} from "@plane/editor";
|
||||
import { MakeOptional, TSearchEntityRequestPayload, TSearchResponse } from "@plane/types";
|
||||
import { cn } from "@plane/utils";
|
||||
// hooks
|
||||
|
|
@ -8,15 +14,14 @@ import { useEditorConfig, useEditorMention } from "@/hooks/editor";
|
|||
import { useMember } from "@/hooks/store/use-member";
|
||||
// plane web hooks
|
||||
import { useEditorFlagging } from "@/plane-web/hooks/use-editor-flagging";
|
||||
import { useIssueEmbed } from "@/plane-web/hooks/use-issue-embed";
|
||||
// local imports
|
||||
import { EditorMentionsRoot } from "../embeds/mentions";
|
||||
|
||||
type DocumentEditorWrapperProps = MakeOptional<
|
||||
Omit<IDocumentEditorProps, "fileHandler" | "mentionHandler" | "embedHandler" | "user" | "extendedEditorProps">,
|
||||
Omit<IDocumentEditorProps, "fileHandler" | "mentionHandler" | "user" | "extendedEditorProps">,
|
||||
"disabledExtensions" | "editable" | "flaggedExtensions"
|
||||
> & {
|
||||
embedHandler?: Partial<IDocumentEditorProps["embedHandler"]>;
|
||||
extendedEditorProps?: Partial<IEditorPropsExtended>;
|
||||
workspaceSlug: string;
|
||||
workspaceId: string;
|
||||
projectId?: string;
|
||||
|
|
@ -35,7 +40,7 @@ export const DocumentEditor = forwardRef<EditorRefApi, DocumentEditorWrapperProp
|
|||
const {
|
||||
containerClassName,
|
||||
editable,
|
||||
embedHandler,
|
||||
extendedEditorProps,
|
||||
workspaceSlug,
|
||||
workspaceId,
|
||||
projectId,
|
||||
|
|
@ -54,11 +59,6 @@ export const DocumentEditor = forwardRef<EditorRefApi, DocumentEditorWrapperProp
|
|||
});
|
||||
// editor config
|
||||
const { getEditorFileHandlers } = useEditorConfig();
|
||||
// issue-embed
|
||||
const { issueEmbedProps } = useIssueEmbed({
|
||||
projectId,
|
||||
workspaceSlug,
|
||||
});
|
||||
|
||||
return (
|
||||
<DocumentEditorWithRef
|
||||
|
|
@ -81,11 +81,7 @@ export const DocumentEditor = forwardRef<EditorRefApi, DocumentEditorWrapperProp
|
|||
renderComponent: EditorMentionsRoot,
|
||||
getMentionedEntityDetails: (id: string) => ({ display_name: getUserDetails(id)?.display_name ?? "" }),
|
||||
}}
|
||||
embedHandler={{
|
||||
issue: issueEmbedProps,
|
||||
...embedHandler,
|
||||
}}
|
||||
extendedEditorProps={{}}
|
||||
extendedEditorProps={extendedEditorProps}
|
||||
{...rest}
|
||||
containerClassName={cn("relative pl-3 pb-3", containerClassName)}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { Dispatch, SetStateAction, useCallback, useMemo } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
// plane imports
|
||||
import { LIVE_BASE_PATH, LIVE_BASE_URL } from "@plane/constants";
|
||||
import {
|
||||
CollaborativeDocumentEditorWithRef,
|
||||
|
|
@ -22,16 +23,11 @@ import { useMember } from "@/hooks/store/use-member";
|
|||
import { useWorkspace } from "@/hooks/store/use-workspace";
|
||||
import { useUser } from "@/hooks/store/user";
|
||||
import { usePageFilters } from "@/hooks/use-page-filters";
|
||||
// plane web components
|
||||
// plane web imports
|
||||
import { EditorAIMenu } from "@/plane-web/components/pages";
|
||||
// plane web types
|
||||
import type { TExtendedEditorExtensionsConfig } from "@/plane-web/hooks/pages";
|
||||
// plane web store
|
||||
import { EPageStoreType } from "@/plane-web/hooks/store";
|
||||
// plane web hooks
|
||||
import { useEditorFlagging } from "@/plane-web/hooks/use-editor-flagging";
|
||||
|
||||
import { useIssueEmbed } from "@/plane-web/hooks/use-issue-embed";
|
||||
// store
|
||||
import type { TPageInstance } from "@/store/pages/base-page";
|
||||
// local imports
|
||||
|
|
@ -96,11 +92,6 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
|||
editor: { editorRef, updateAssetsList },
|
||||
} = page;
|
||||
const workspaceId = getWorkspaceBySlug(workspaceSlug)?.id ?? "";
|
||||
// issue-embed
|
||||
const { issueEmbedProps } = useIssueEmbed({
|
||||
fetchEmbedSuggestions: handlers.fetchEntity,
|
||||
workspaceSlug,
|
||||
});
|
||||
// use editor mention
|
||||
const { fetchMentions } = useEditorMention({
|
||||
searchEntity: handlers.fetchEntity,
|
||||
|
|
@ -244,9 +235,6 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
|||
renderComponent: (props) => <EditorMentionsRoot {...props} />,
|
||||
getMentionedEntityDetails: (id: string) => ({ display_name: getUserDetails(id)?.display_name ?? "" }),
|
||||
}}
|
||||
embedHandler={{
|
||||
issue: issueEmbedProps,
|
||||
}}
|
||||
realtimeConfig={realtimeConfig}
|
||||
serverHandler={serverHandler}
|
||||
user={userConfig}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue