[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";
|
import React, { forwardRef } from "react";
|
||||||
// plane imports
|
// 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 { MakeOptional, TSearchEntityRequestPayload, TSearchResponse } from "@plane/types";
|
||||||
import { cn } from "@plane/utils";
|
import { cn } from "@plane/utils";
|
||||||
// hooks
|
// hooks
|
||||||
|
|
@ -8,15 +14,14 @@ import { useEditorConfig, useEditorMention } from "@/hooks/editor";
|
||||||
import { useMember } from "@/hooks/store/use-member";
|
import { useMember } from "@/hooks/store/use-member";
|
||||||
// plane web hooks
|
// plane web hooks
|
||||||
import { useEditorFlagging } from "@/plane-web/hooks/use-editor-flagging";
|
import { useEditorFlagging } from "@/plane-web/hooks/use-editor-flagging";
|
||||||
import { useIssueEmbed } from "@/plane-web/hooks/use-issue-embed";
|
|
||||||
// local imports
|
// local imports
|
||||||
import { EditorMentionsRoot } from "../embeds/mentions";
|
import { EditorMentionsRoot } from "../embeds/mentions";
|
||||||
|
|
||||||
type DocumentEditorWrapperProps = MakeOptional<
|
type DocumentEditorWrapperProps = MakeOptional<
|
||||||
Omit<IDocumentEditorProps, "fileHandler" | "mentionHandler" | "embedHandler" | "user" | "extendedEditorProps">,
|
Omit<IDocumentEditorProps, "fileHandler" | "mentionHandler" | "user" | "extendedEditorProps">,
|
||||||
"disabledExtensions" | "editable" | "flaggedExtensions"
|
"disabledExtensions" | "editable" | "flaggedExtensions"
|
||||||
> & {
|
> & {
|
||||||
embedHandler?: Partial<IDocumentEditorProps["embedHandler"]>;
|
extendedEditorProps?: Partial<IEditorPropsExtended>;
|
||||||
workspaceSlug: string;
|
workspaceSlug: string;
|
||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
projectId?: string;
|
projectId?: string;
|
||||||
|
|
@ -35,7 +40,7 @@ export const DocumentEditor = forwardRef<EditorRefApi, DocumentEditorWrapperProp
|
||||||
const {
|
const {
|
||||||
containerClassName,
|
containerClassName,
|
||||||
editable,
|
editable,
|
||||||
embedHandler,
|
extendedEditorProps,
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
projectId,
|
projectId,
|
||||||
|
|
@ -54,11 +59,6 @@ export const DocumentEditor = forwardRef<EditorRefApi, DocumentEditorWrapperProp
|
||||||
});
|
});
|
||||||
// editor config
|
// editor config
|
||||||
const { getEditorFileHandlers } = useEditorConfig();
|
const { getEditorFileHandlers } = useEditorConfig();
|
||||||
// issue-embed
|
|
||||||
const { issueEmbedProps } = useIssueEmbed({
|
|
||||||
projectId,
|
|
||||||
workspaceSlug,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DocumentEditorWithRef
|
<DocumentEditorWithRef
|
||||||
|
|
@ -81,11 +81,7 @@ export const DocumentEditor = forwardRef<EditorRefApi, DocumentEditorWrapperProp
|
||||||
renderComponent: EditorMentionsRoot,
|
renderComponent: EditorMentionsRoot,
|
||||||
getMentionedEntityDetails: (id: string) => ({ display_name: getUserDetails(id)?.display_name ?? "" }),
|
getMentionedEntityDetails: (id: string) => ({ display_name: getUserDetails(id)?.display_name ?? "" }),
|
||||||
}}
|
}}
|
||||||
embedHandler={{
|
extendedEditorProps={extendedEditorProps}
|
||||||
issue: issueEmbedProps,
|
|
||||||
...embedHandler,
|
|
||||||
}}
|
|
||||||
extendedEditorProps={{}}
|
|
||||||
{...rest}
|
{...rest}
|
||||||
containerClassName={cn("relative pl-3 pb-3", containerClassName)}
|
containerClassName={cn("relative pl-3 pb-3", containerClassName)}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Dispatch, SetStateAction, useCallback, useMemo } from "react";
|
import { Dispatch, SetStateAction, useCallback, useMemo } from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
// plane imports
|
||||||
import { LIVE_BASE_PATH, LIVE_BASE_URL } from "@plane/constants";
|
import { LIVE_BASE_PATH, LIVE_BASE_URL } from "@plane/constants";
|
||||||
import {
|
import {
|
||||||
CollaborativeDocumentEditorWithRef,
|
CollaborativeDocumentEditorWithRef,
|
||||||
|
|
@ -22,16 +23,11 @@ import { useMember } from "@/hooks/store/use-member";
|
||||||
import { useWorkspace } from "@/hooks/store/use-workspace";
|
import { useWorkspace } from "@/hooks/store/use-workspace";
|
||||||
import { useUser } from "@/hooks/store/user";
|
import { useUser } from "@/hooks/store/user";
|
||||||
import { usePageFilters } from "@/hooks/use-page-filters";
|
import { usePageFilters } from "@/hooks/use-page-filters";
|
||||||
// plane web components
|
// plane web imports
|
||||||
import { EditorAIMenu } from "@/plane-web/components/pages";
|
import { EditorAIMenu } from "@/plane-web/components/pages";
|
||||||
// plane web types
|
|
||||||
import type { TExtendedEditorExtensionsConfig } from "@/plane-web/hooks/pages";
|
import type { TExtendedEditorExtensionsConfig } from "@/plane-web/hooks/pages";
|
||||||
// plane web store
|
|
||||||
import { EPageStoreType } from "@/plane-web/hooks/store";
|
import { EPageStoreType } from "@/plane-web/hooks/store";
|
||||||
// plane web hooks
|
|
||||||
import { useEditorFlagging } from "@/plane-web/hooks/use-editor-flagging";
|
import { useEditorFlagging } from "@/plane-web/hooks/use-editor-flagging";
|
||||||
|
|
||||||
import { useIssueEmbed } from "@/plane-web/hooks/use-issue-embed";
|
|
||||||
// store
|
// store
|
||||||
import type { TPageInstance } from "@/store/pages/base-page";
|
import type { TPageInstance } from "@/store/pages/base-page";
|
||||||
// local imports
|
// local imports
|
||||||
|
|
@ -96,11 +92,6 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
||||||
editor: { editorRef, updateAssetsList },
|
editor: { editorRef, updateAssetsList },
|
||||||
} = page;
|
} = page;
|
||||||
const workspaceId = getWorkspaceBySlug(workspaceSlug)?.id ?? "";
|
const workspaceId = getWorkspaceBySlug(workspaceSlug)?.id ?? "";
|
||||||
// issue-embed
|
|
||||||
const { issueEmbedProps } = useIssueEmbed({
|
|
||||||
fetchEmbedSuggestions: handlers.fetchEntity,
|
|
||||||
workspaceSlug,
|
|
||||||
});
|
|
||||||
// use editor mention
|
// use editor mention
|
||||||
const { fetchMentions } = useEditorMention({
|
const { fetchMentions } = useEditorMention({
|
||||||
searchEntity: handlers.fetchEntity,
|
searchEntity: handlers.fetchEntity,
|
||||||
|
|
@ -244,9 +235,6 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
||||||
renderComponent: (props) => <EditorMentionsRoot {...props} />,
|
renderComponent: (props) => <EditorMentionsRoot {...props} />,
|
||||||
getMentionedEntityDetails: (id: string) => ({ display_name: getUserDetails(id)?.display_name ?? "" }),
|
getMentionedEntityDetails: (id: string) => ({ display_name: getUserDetails(id)?.display_name ?? "" }),
|
||||||
}}
|
}}
|
||||||
embedHandler={{
|
|
||||||
issue: issueEmbedProps,
|
|
||||||
}}
|
|
||||||
realtimeConfig={realtimeConfig}
|
realtimeConfig={realtimeConfig}
|
||||||
serverHandler={serverHandler}
|
serverHandler={serverHandler}
|
||||||
user={userConfig}
|
user={userConfig}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import type { IEditorProps } from "@/types";
|
||||||
|
|
||||||
export type TCoreAdditionalExtensionsProps = Pick<
|
export type TCoreAdditionalExtensionsProps = Pick<
|
||||||
IEditorProps,
|
IEditorProps,
|
||||||
"disabledExtensions" | "flaggedExtensions" | "fileHandler" | "embedHandler"
|
"disabledExtensions" | "flaggedExtensions" | "fileHandler" | "extendedEditorProps"
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export const CoreEditorAdditionalExtensions = (props: TCoreAdditionalExtensionsProps): Extensions => {
|
export const CoreEditorAdditionalExtensions = (props: TCoreAdditionalExtensionsProps): Extensions => {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
import type { HocuspocusProvider } from "@hocuspocus/provider";
|
import type { HocuspocusProvider } from "@hocuspocus/provider";
|
||||||
import type { AnyExtension } from "@tiptap/core";
|
import type { AnyExtension } from "@tiptap/core";
|
||||||
import { SlashCommands } from "@/extensions";
|
import { SlashCommands } from "@/extensions";
|
||||||
// plane editor types
|
|
||||||
import type { TEmbedConfig } from "@/plane-editor/types";
|
|
||||||
// types
|
// types
|
||||||
import type { IEditorProps, TExtensions, TUserDetails } from "@/types";
|
import type { IEditorProps, TExtensions, TUserDetails } from "@/types";
|
||||||
|
|
||||||
export type TDocumentEditorAdditionalExtensionsProps = Pick<
|
export type TDocumentEditorAdditionalExtensionsProps = Pick<
|
||||||
IEditorProps,
|
IEditorProps,
|
||||||
"disabledExtensions" | "flaggedExtensions" | "fileHandler"
|
"disabledExtensions" | "flaggedExtensions" | "fileHandler" | "extendedEditorProps"
|
||||||
> & {
|
> & {
|
||||||
embedConfig: TEmbedConfig | undefined;
|
|
||||||
isEditable: boolean;
|
isEditable: boolean;
|
||||||
provider?: HocuspocusProvider;
|
provider?: HocuspocusProvider;
|
||||||
userDetails: TUserDetails;
|
userDetails: TUserDetails;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
import type { Extensions } from "@tiptap/core";
|
import React from "react";
|
||||||
import React, { useMemo } from "react";
|
|
||||||
// plane imports
|
// plane imports
|
||||||
import { cn } from "@plane/utils";
|
import { cn } from "@plane/utils";
|
||||||
// components
|
// components
|
||||||
import { PageRenderer } from "@/components/editors";
|
import { PageRenderer } from "@/components/editors";
|
||||||
// constants
|
// constants
|
||||||
import { DEFAULT_DISPLAY_CONFIG } from "@/constants/config";
|
import { DEFAULT_DISPLAY_CONFIG } from "@/constants/config";
|
||||||
// extensions
|
|
||||||
import { WorkItemEmbedExtension } from "@/extensions";
|
|
||||||
// helpers
|
// helpers
|
||||||
import { getEditorClassNames } from "@/helpers/common";
|
import { getEditorClassNames } from "@/helpers/common";
|
||||||
// hooks
|
// hooks
|
||||||
|
|
@ -23,14 +20,13 @@ const CollaborativeDocumentEditor: React.FC<ICollaborativeDocumentEditorProps> =
|
||||||
bubbleMenuEnabled = true,
|
bubbleMenuEnabled = true,
|
||||||
containerClassName,
|
containerClassName,
|
||||||
documentLoaderClassName,
|
documentLoaderClassName,
|
||||||
extensions: externalExtensions = [],
|
extensions = [],
|
||||||
disabledExtensions,
|
disabledExtensions,
|
||||||
displayConfig = DEFAULT_DISPLAY_CONFIG,
|
displayConfig = DEFAULT_DISPLAY_CONFIG,
|
||||||
editable,
|
editable,
|
||||||
editorClassName = "",
|
editorClassName = "",
|
||||||
editorProps,
|
editorProps,
|
||||||
extendedEditorProps,
|
extendedEditorProps,
|
||||||
embedHandler,
|
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
forwardedRef,
|
forwardedRef,
|
||||||
|
|
@ -50,27 +46,13 @@ const CollaborativeDocumentEditor: React.FC<ICollaborativeDocumentEditorProps> =
|
||||||
user,
|
user,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const extensions: Extensions = useMemo(() => {
|
|
||||||
const allExtensions = [...externalExtensions];
|
|
||||||
|
|
||||||
if (embedHandler?.issue) {
|
|
||||||
allExtensions.push(
|
|
||||||
WorkItemEmbedExtension({
|
|
||||||
widgetCallback: embedHandler.issue.widgetCallback,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return allExtensions;
|
|
||||||
}, [externalExtensions, embedHandler.issue]);
|
|
||||||
|
|
||||||
// use document editor
|
// use document editor
|
||||||
const { editor, hasServerConnectionFailed, hasServerSynced } = useCollaborativeEditor({
|
const { editor, hasServerConnectionFailed, hasServerSynced } = useCollaborativeEditor({
|
||||||
disabledExtensions,
|
disabledExtensions,
|
||||||
editable,
|
editable,
|
||||||
editorClassName,
|
editorClassName,
|
||||||
editorProps,
|
editorProps,
|
||||||
embedHandler,
|
extendedEditorProps,
|
||||||
extensions,
|
extensions,
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { PageRenderer } from "@/components/editors";
|
||||||
// constants
|
// constants
|
||||||
import { DEFAULT_DISPLAY_CONFIG } from "@/constants/config";
|
import { DEFAULT_DISPLAY_CONFIG } from "@/constants/config";
|
||||||
// extensions
|
// extensions
|
||||||
import { HeadingListExtension, WorkItemEmbedExtension, SideMenuExtension } from "@/extensions";
|
import { HeadingListExtension, SideMenuExtension } from "@/extensions";
|
||||||
// helpers
|
// helpers
|
||||||
import { getEditorClassNames } from "@/helpers/common";
|
import { getEditorClassNames } from "@/helpers/common";
|
||||||
// hooks
|
// hooks
|
||||||
|
|
@ -25,7 +25,7 @@ const DocumentEditor = (props: IDocumentEditorProps) => {
|
||||||
displayConfig = DEFAULT_DISPLAY_CONFIG,
|
displayConfig = DEFAULT_DISPLAY_CONFIG,
|
||||||
editable,
|
editable,
|
||||||
editorClassName = "",
|
editorClassName = "",
|
||||||
embedHandler,
|
extendedEditorProps,
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
forwardedRef,
|
forwardedRef,
|
||||||
|
|
@ -39,13 +39,6 @@ const DocumentEditor = (props: IDocumentEditorProps) => {
|
||||||
} = props;
|
} = props;
|
||||||
const extensions: Extensions = useMemo(() => {
|
const extensions: Extensions = useMemo(() => {
|
||||||
const additionalExtensions: Extensions = [];
|
const additionalExtensions: Extensions = [];
|
||||||
if (embedHandler?.issue) {
|
|
||||||
additionalExtensions.push(
|
|
||||||
WorkItemEmbedExtension({
|
|
||||||
widgetCallback: embedHandler.issue.widgetCallback,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
additionalExtensions.push(
|
additionalExtensions.push(
|
||||||
SideMenuExtension({
|
SideMenuExtension({
|
||||||
aiEnabled: !disabledExtensions?.includes("ai"),
|
aiEnabled: !disabledExtensions?.includes("ai"),
|
||||||
|
|
@ -54,7 +47,7 @@ const DocumentEditor = (props: IDocumentEditorProps) => {
|
||||||
HeadingListExtension,
|
HeadingListExtension,
|
||||||
...DocumentEditorAdditionalExtensions({
|
...DocumentEditorAdditionalExtensions({
|
||||||
disabledExtensions,
|
disabledExtensions,
|
||||||
embedConfig: embedHandler,
|
extendedEditorProps,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
isEditable: editable,
|
isEditable: editable,
|
||||||
fileHandler,
|
fileHandler,
|
||||||
|
|
@ -73,6 +66,7 @@ const DocumentEditor = (props: IDocumentEditorProps) => {
|
||||||
editable,
|
editable,
|
||||||
editorClassName,
|
editorClassName,
|
||||||
enableHistory: true,
|
enableHistory: true,
|
||||||
|
extendedEditorProps,
|
||||||
extensions,
|
extensions,
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
|
|
@ -82,7 +76,6 @@ const DocumentEditor = (props: IDocumentEditorProps) => {
|
||||||
initialValue: value,
|
initialValue: value,
|
||||||
mentionHandler,
|
mentionHandler,
|
||||||
onChange,
|
onChange,
|
||||||
embedHandler,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const editorContainerClassName = getEditorClassNames({
|
const editorContainerClassName = getEditorClassNames({
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ export const EditorWrapper: React.FC<Props> = (props) => {
|
||||||
editable,
|
editable,
|
||||||
editorClassName = "",
|
editorClassName = "",
|
||||||
editorProps,
|
editorProps,
|
||||||
|
extendedEditorProps,
|
||||||
extensions,
|
extensions,
|
||||||
id,
|
id,
|
||||||
initialValue,
|
initialValue,
|
||||||
|
|
@ -41,7 +42,6 @@ export const EditorWrapper: React.FC<Props> = (props) => {
|
||||||
placeholder,
|
placeholder,
|
||||||
tabIndex,
|
tabIndex,
|
||||||
value,
|
value,
|
||||||
embedHandler,
|
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const editor = useEditor({
|
const editor = useEditor({
|
||||||
|
|
@ -50,6 +50,7 @@ export const EditorWrapper: React.FC<Props> = (props) => {
|
||||||
editorClassName,
|
editorClassName,
|
||||||
editorProps,
|
editorProps,
|
||||||
enableHistory: true,
|
enableHistory: true,
|
||||||
|
extendedEditorProps,
|
||||||
extensions,
|
extensions,
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
|
|
@ -66,7 +67,6 @@ export const EditorWrapper: React.FC<Props> = (props) => {
|
||||||
placeholder,
|
placeholder,
|
||||||
tabIndex,
|
tabIndex,
|
||||||
value,
|
value,
|
||||||
embedHandler,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const editorContainerClassName = getEditorClassNames({
|
const editorContainerClassName = getEditorClassNames({
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import {
|
||||||
// plane editor extensions
|
// plane editor extensions
|
||||||
import { CoreEditorAdditionalExtensions } from "@/plane-editor/extensions";
|
import { CoreEditorAdditionalExtensions } from "@/plane-editor/extensions";
|
||||||
// types
|
// types
|
||||||
import type { IEditorProps, TEmbedConfig } from "@/types";
|
import type { IEditorProps } from "@/types";
|
||||||
// local imports
|
// local imports
|
||||||
import { CustomImageExtension } from "./custom-image/extension";
|
import { CustomImageExtension } from "./custom-image/extension";
|
||||||
import { EmojiExtension } from "./emoji/extension";
|
import { EmojiExtension } from "./emoji/extension";
|
||||||
|
|
@ -45,11 +45,10 @@ type TArguments = Pick<
|
||||||
| "mentionHandler"
|
| "mentionHandler"
|
||||||
| "placeholder"
|
| "placeholder"
|
||||||
| "tabIndex"
|
| "tabIndex"
|
||||||
| "embedHandler"
|
| "extendedEditorProps"
|
||||||
> & {
|
> & {
|
||||||
enableHistory: boolean;
|
enableHistory: boolean;
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
embedHandler?: TEmbedConfig;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CoreEditorExtensions = (args: TArguments): Extensions => {
|
export const CoreEditorExtensions = (args: TArguments): Extensions => {
|
||||||
|
|
@ -62,8 +61,8 @@ export const CoreEditorExtensions = (args: TArguments): Extensions => {
|
||||||
mentionHandler,
|
mentionHandler,
|
||||||
placeholder,
|
placeholder,
|
||||||
tabIndex,
|
tabIndex,
|
||||||
embedHandler,
|
|
||||||
editable,
|
editable,
|
||||||
|
extendedEditorProps,
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
const extensions = [
|
const extensions = [
|
||||||
|
|
@ -118,7 +117,7 @@ export const CoreEditorExtensions = (args: TArguments): Extensions => {
|
||||||
disabledExtensions,
|
disabledExtensions,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
fileHandler,
|
fileHandler,
|
||||||
embedHandler,
|
extendedEditorProps,
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export const useCollaborativeEditor = (props: TCollaborativeEditorHookProps) =>
|
||||||
editable,
|
editable,
|
||||||
editorClassName = "",
|
editorClassName = "",
|
||||||
editorProps = {},
|
editorProps = {},
|
||||||
embedHandler,
|
extendedEditorProps,
|
||||||
extensions = [],
|
extensions = [],
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
|
|
@ -80,8 +80,8 @@ export const useCollaborativeEditor = (props: TCollaborativeEditorHookProps) =>
|
||||||
);
|
);
|
||||||
|
|
||||||
const editor = useEditor({
|
const editor = useEditor({
|
||||||
embedHandler,
|
|
||||||
disabledExtensions,
|
disabledExtensions,
|
||||||
|
extendedEditorProps,
|
||||||
id,
|
id,
|
||||||
editable,
|
editable,
|
||||||
editorProps,
|
editorProps,
|
||||||
|
|
@ -99,7 +99,7 @@ export const useCollaborativeEditor = (props: TCollaborativeEditorHookProps) =>
|
||||||
...extensions,
|
...extensions,
|
||||||
...DocumentEditorAdditionalExtensions({
|
...DocumentEditorAdditionalExtensions({
|
||||||
disabledExtensions,
|
disabledExtensions,
|
||||||
embedConfig: embedHandler,
|
extendedEditorProps,
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
isEditable: editable,
|
isEditable: editable,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ export const useEditor = (props: TEditorHookProps) => {
|
||||||
editorClassName = "",
|
editorClassName = "",
|
||||||
editorProps = {},
|
editorProps = {},
|
||||||
enableHistory,
|
enableHistory,
|
||||||
|
extendedEditorProps,
|
||||||
extensions = [],
|
extensions = [],
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
|
|
@ -32,7 +33,6 @@ export const useEditor = (props: TEditorHookProps) => {
|
||||||
onAssetChange,
|
onAssetChange,
|
||||||
onChange,
|
onChange,
|
||||||
onEditorFocus,
|
onEditorFocus,
|
||||||
embedHandler,
|
|
||||||
onTransaction,
|
onTransaction,
|
||||||
placeholder,
|
placeholder,
|
||||||
provider,
|
provider,
|
||||||
|
|
@ -55,16 +55,16 @@ export const useEditor = (props: TEditorHookProps) => {
|
||||||
},
|
},
|
||||||
extensions: [
|
extensions: [
|
||||||
...CoreEditorExtensions({
|
...CoreEditorExtensions({
|
||||||
editable,
|
|
||||||
disabledExtensions,
|
disabledExtensions,
|
||||||
|
editable,
|
||||||
enableHistory,
|
enableHistory,
|
||||||
|
extendedEditorProps,
|
||||||
fileHandler,
|
fileHandler,
|
||||||
flaggedExtensions,
|
flaggedExtensions,
|
||||||
isTouchDevice,
|
isTouchDevice,
|
||||||
mentionHandler,
|
mentionHandler,
|
||||||
placeholder,
|
placeholder,
|
||||||
tabIndex,
|
tabIndex,
|
||||||
embedHandler,
|
|
||||||
}),
|
}),
|
||||||
...extensions,
|
...extensions,
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,6 @@ export type IEditorProps = {
|
||||||
editorClassName?: string;
|
editorClassName?: string;
|
||||||
editorProps?: EditorProps;
|
editorProps?: EditorProps;
|
||||||
extensions?: Extensions;
|
extensions?: Extensions;
|
||||||
embedHandler?: TEmbedConfig;
|
|
||||||
flaggedExtensions: TExtensions[];
|
flaggedExtensions: TExtensions[];
|
||||||
fileHandler: TFileHandler;
|
fileHandler: TFileHandler;
|
||||||
forwardedRef?: React.MutableRefObject<EditorRefApi | null>;
|
forwardedRef?: React.MutableRefObject<EditorRefApi | null>;
|
||||||
|
|
@ -174,7 +173,6 @@ export type ICollaborativeDocumentEditorProps = Omit<IEditorProps, "initialValue
|
||||||
documentLoaderClassName?: string;
|
documentLoaderClassName?: string;
|
||||||
dragDropEnabled?: boolean;
|
dragDropEnabled?: boolean;
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
embedHandler: TEmbedConfig;
|
|
||||||
realtimeConfig: TRealtimeConfig;
|
realtimeConfig: TRealtimeConfig;
|
||||||
serverHandler?: TServerHandler;
|
serverHandler?: TServerHandler;
|
||||||
user: TUserDetails;
|
user: TUserDetails;
|
||||||
|
|
@ -182,7 +180,6 @@ export type ICollaborativeDocumentEditorProps = Omit<IEditorProps, "initialValue
|
||||||
|
|
||||||
export type IDocumentEditorProps = Omit<IEditorProps, "initialValue" | "onEnterKeyPress" | "value"> & {
|
export type IDocumentEditorProps = Omit<IEditorProps, "initialValue" | "onEnterKeyPress" | "value"> & {
|
||||||
aiHandler?: TAIHandler;
|
aiHandler?: TAIHandler;
|
||||||
embedHandler: TEmbedConfig;
|
|
||||||
user?: TUserDetails;
|
user?: TUserDetails;
|
||||||
value: Content;
|
value: Content;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@ type TCoreHookProps = Pick<
|
||||||
| "disabledExtensions"
|
| "disabledExtensions"
|
||||||
| "editorClassName"
|
| "editorClassName"
|
||||||
| "editorProps"
|
| "editorProps"
|
||||||
|
| "extendedEditorProps"
|
||||||
| "extensions"
|
| "extensions"
|
||||||
| "flaggedExtensions"
|
| "flaggedExtensions"
|
||||||
| "handleEditorReady"
|
| "handleEditorReady"
|
||||||
| "isTouchDevice"
|
| "isTouchDevice"
|
||||||
| "onEditorFocus"
|
| "onEditorFocus"
|
||||||
| "embedHandler"
|
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type TEditorHookProps = TCoreHookProps &
|
export type TEditorHookProps = TCoreHookProps &
|
||||||
|
|
@ -51,7 +51,4 @@ export type TCollaborativeEditorHookProps = TCoreHookProps &
|
||||||
| "placeholder"
|
| "placeholder"
|
||||||
| "tabIndex"
|
| "tabIndex"
|
||||||
> &
|
> &
|
||||||
Pick<
|
Pick<ICollaborativeDocumentEditorProps, "dragDropEnabled" | "realtimeConfig" | "serverHandler" | "user">;
|
||||||
ICollaborativeDocumentEditorProps,
|
|
||||||
"dragDropEnabled" | "embedHandler" | "realtimeConfig" | "serverHandler" | "user"
|
|
||||||
>;
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue