mirror of
https://github.com/makeplane/plane.git
synced 2026-09-01 19:48:42 +02:00
refactor: flatten editor package folder structure (#9719)
Remove the ce/ee split in @plane/editor and consolidate everything under src/core, matching the layout used in the enterprise repository. - Move ce components, constants, extensions, helpers, and types into core - Rename ce/extensions/slash-commands.tsx to additional-slash-command-options.tsx to avoid clashing with the existing slash-commands/ directory - Merge ce type stubs and parser helpers into their core counterparts - Drop the ee re-export shim (no consumers) - Rewrite @/plane-editor/* imports to @/* and trim tsconfig path aliases
This commit is contained in:
committed by
GitHub
parent
effd0c5719
commit
fd4110e8aa
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
export * from "./core";
|
||||
export * from "./document-extensions";
|
||||
export * from "./slash-commands";
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description function to extract all additional assets from HTML content
|
||||
* @param htmlContent
|
||||
* @returns {string[]} array of additional asset sources
|
||||
*/
|
||||
export const extractAdditionalAssetsFromHTMLContent = (_htmlContent: string): string[] => [];
|
||||
|
||||
/**
|
||||
* @description function to replace additional assets in HTML content with new IDs
|
||||
* @param props
|
||||
* @returns {string} HTML content with replaced additional assets
|
||||
*/
|
||||
export const replaceAdditionalAssetsInHTMLContent = (props: {
|
||||
htmlContent: string;
|
||||
assetMap: Record<string, string>;
|
||||
}): string => {
|
||||
const { htmlContent } = props;
|
||||
return htmlContent;
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
export type TAdditionalEditorAsset = never;
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
export type TExtendedFileHandler = object;
|
||||
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
export * from "./issue-embed";
|
||||
export * from "./editor-extended";
|
||||
export * from "./config";
|
||||
@@ -20,7 +20,7 @@ import { getEditorClassNames } from "@/helpers/common";
|
||||
// hooks
|
||||
import { useEditor } from "@/hooks/use-editor";
|
||||
// plane editor extensions
|
||||
import { DocumentEditorAdditionalExtensions } from "@/plane-editor/extensions";
|
||||
import { DocumentEditorAdditionalExtensions } from "@/extensions/document-extensions";
|
||||
// types
|
||||
import type { EditorRefApi, IDocumentEditorProps } from "@/types";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { DEFAULT_DISPLAY_CONFIG } from "@/constants/config";
|
||||
import { CORE_EXTENSIONS } from "@/constants/extension";
|
||||
// components
|
||||
import type { TCollabValue } from "@/contexts";
|
||||
import { LinkContainer } from "@/plane-editor/components/link-container";
|
||||
import { LinkContainer } from "@/components/link-container";
|
||||
// plugins
|
||||
import { nodeHighlightPluginKey } from "@/plugins/highlight";
|
||||
// types
|
||||
|
||||
@@ -11,7 +11,7 @@ import { BlockMenu, EditorBubbleMenu } from "@/components/menus";
|
||||
// extensions
|
||||
import { SideMenuExtension } from "@/extensions";
|
||||
// plane editor imports
|
||||
import { RichTextEditorAdditionalExtensions } from "@/plane-editor/extensions/rich-text-extensions";
|
||||
import { RichTextEditorAdditionalExtensions } from "@/extensions/rich-text-extensions";
|
||||
// types
|
||||
import type { EditorRefApi, IRichTextEditorProps } from "@/types";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import type { ADDITIONAL_EXTENSIONS } from "@plane/utils";
|
||||
import { CORE_EXTENSIONS } from "@plane/utils";
|
||||
// plane editor imports
|
||||
import type { ExtensionFileSetStorageKey } from "@/plane-editor/types/storage";
|
||||
import type { ExtensionFileSetStorageKey } from "@/types/storage";
|
||||
|
||||
export type NodeFileMapType = Partial<
|
||||
Record<
|
||||
@@ -9,7 +9,7 @@ import TaskList from "@tiptap/extension-task-list";
|
||||
import { TextStyle } from "@tiptap/extension-text-style";
|
||||
import { Underline } from "@tiptap/extension-underline";
|
||||
// plane editor imports
|
||||
import { CoreEditorAdditionalExtensionsWithoutProps } from "@/plane-editor/extensions/core/without-props";
|
||||
import { CoreEditorAdditionalExtensionsWithoutProps } from "@/extensions/core/without-props";
|
||||
// extensions
|
||||
import { CustomCalloutExtensionConfig } from "./callout/extension-config";
|
||||
import { CustomCodeBlockExtensionWithoutProps } from "./code/without-props";
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
UtilityExtension,
|
||||
} from "@/extensions";
|
||||
// plane editor extensions
|
||||
import { CoreEditorAdditionalExtensions } from "@/plane-editor/extensions";
|
||||
import { CoreEditorAdditionalExtensions } from "@/extensions/core";
|
||||
// types
|
||||
import type { IEditorProps } from "@/types";
|
||||
// local imports
|
||||
|
||||
@@ -26,3 +26,6 @@ export * from "./quote";
|
||||
export * from "./side-menu";
|
||||
export * from "./text-align";
|
||||
export * from "./utility";
|
||||
export * from "./core";
|
||||
export * from "./document-extensions";
|
||||
export * from "./additional-slash-command-options";
|
||||
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
openEmojiPicker,
|
||||
} from "@/helpers/editor-commands";
|
||||
// plane editor extensions
|
||||
import { coreEditorAdditionalSlashCommandOptions } from "@/plane-editor/extensions";
|
||||
import { coreEditorAdditionalSlashCommandOptions } from "@/extensions/additional-slash-command-options";
|
||||
// types
|
||||
import type { CommandProps, ISlashCommandItem, TSlashCommandSectionKeys } from "@/types";
|
||||
// local types
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { Transaction } from "@tiptap/pm/state";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
// constants
|
||||
import { CORE_EXTENSIONS, BLOCK_NODE_TYPES } from "@/constants/extension";
|
||||
import { ADDITIONAL_BLOCK_NODE_TYPES } from "@/plane-editor/constants/extensions";
|
||||
import { ADDITIONAL_BLOCK_NODE_TYPES } from "@/constants/extensions";
|
||||
import { createUniqueIDPlugin } from "./plugin";
|
||||
import { createIdsForView } from "./utils";
|
||||
// plane imports
|
||||
|
||||
@@ -10,7 +10,7 @@ import codemark from "prosemirror-codemark";
|
||||
import { CORE_EXTENSIONS } from "@/constants/extension";
|
||||
import { restorePublicImages } from "@/helpers/image-helpers";
|
||||
// plugins
|
||||
import type { TAdditionalActiveDropbarExtensions } from "@/plane-editor/types/utils";
|
||||
import type { TAdditionalActiveDropbarExtensions } from "@/types/utils";
|
||||
import { DropHandlerPlugin } from "@/plugins/drop";
|
||||
import { FilePlugins } from "@/plugins/file/root";
|
||||
import { MarkdownClipboardPlugin } from "@/plugins/markdown-clipboard";
|
||||
|
||||
@@ -11,7 +11,7 @@ import { CORE_EXTENSIONS } from "@plane/utils";
|
||||
// extensions
|
||||
import { getImageBlockId } from "@/extensions/custom-image/utils";
|
||||
// plane editor imports
|
||||
import { ADDITIONAL_ASSETS_META_DATA_RECORD } from "@/plane-editor/constants/assets";
|
||||
import { ADDITIONAL_ASSETS_META_DATA_RECORD } from "@/constants/assets";
|
||||
// types
|
||||
import type { TEditorAsset } from "@/types";
|
||||
|
||||
|
||||
@@ -6,14 +6,29 @@
|
||||
|
||||
// plane imports
|
||||
import type { TDocumentPayload, TDuplicateAssetData, TDuplicateAssetResponse, TEditorAssetType } from "@plane/types";
|
||||
// plane web imports
|
||||
import {
|
||||
extractAdditionalAssetsFromHTMLContent,
|
||||
replaceAdditionalAssetsInHTMLContent,
|
||||
} from "@/plane-editor/helpers/parser";
|
||||
// local imports
|
||||
import { convertHTMLDocumentToAllFormats } from "./yjs-utils";
|
||||
|
||||
/**
|
||||
* @description function to extract all additional assets from HTML content
|
||||
* @param htmlContent
|
||||
* @returns {string[]} array of additional asset sources
|
||||
*/
|
||||
export const extractAdditionalAssetsFromHTMLContent = (_htmlContent: string): string[] => [];
|
||||
|
||||
/**
|
||||
* @description function to replace additional assets in HTML content with new IDs
|
||||
* @param props
|
||||
* @returns {string} HTML content with replaced additional assets
|
||||
*/
|
||||
export const replaceAdditionalAssetsInHTMLContent = (props: {
|
||||
htmlContent: string;
|
||||
assetMap: Record<string, string>;
|
||||
}): string => {
|
||||
const { htmlContent } = props;
|
||||
return htmlContent;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description function to extract all assets from HTML content
|
||||
* @param htmlContent
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
import { assetDuplicationHandlers } from "@/plane-editor/helpers/asset-duplication";
|
||||
import { assetDuplicationHandlers } from "@/helpers/asset-duplication";
|
||||
|
||||
// Utility function to process HTML content with all registered handlers
|
||||
export const processAssetDuplication = (htmlContent: string): { processedHtml: string } => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { HeadingListExtension, SideMenuExtension } from "@/extensions";
|
||||
// hooks
|
||||
import { useEditor } from "@/hooks/use-editor";
|
||||
// plane editor extensions
|
||||
import { DocumentEditorAdditionalExtensions } from "@/plane-editor/extensions";
|
||||
import { DocumentEditorAdditionalExtensions } from "@/extensions/document-extensions";
|
||||
// types
|
||||
import type {
|
||||
TCollaborativeEditorHookProps,
|
||||
|
||||
@@ -10,11 +10,11 @@ import type { EditorState, Transaction } from "@tiptap/pm/state";
|
||||
// constants
|
||||
import { CORE_EDITOR_META } from "@/constants/meta";
|
||||
// plane editor imports
|
||||
import { NODE_FILE_MAP } from "@/plane-editor/constants/utility";
|
||||
import { NODE_FILE_MAP } from "@/constants/utility";
|
||||
// types
|
||||
import type { TFileHandler } from "@/types";
|
||||
// local imports
|
||||
import type { NodeFileMapType } from "../../../ce/constants/utility";
|
||||
import type { NodeFileMapType } from "../../constants/utility";
|
||||
import type { TFileNode } from "./types";
|
||||
|
||||
const DELETE_PLUGIN_KEY = new PluginKey("delete-utility");
|
||||
|
||||
@@ -12,11 +12,11 @@ import { CORE_EXTENSIONS } from "@plane/utils";
|
||||
// helpers
|
||||
import { CORE_ASSETS_META_DATA_RECORD } from "@/helpers/assets";
|
||||
// plane editor imports
|
||||
import { NODE_FILE_MAP } from "@/plane-editor/constants/utility";
|
||||
import { NODE_FILE_MAP } from "@/constants/utility";
|
||||
// types
|
||||
import type { TFileHandler } from "@/types";
|
||||
// local imports
|
||||
import type { NodeFileMapType } from "../../../ce/constants/utility";
|
||||
import type { NodeFileMapType } from "../../constants/utility";
|
||||
import type { TFileNode } from "./types";
|
||||
|
||||
const RESTORE_PLUGIN_KEY = new PluginKey("restore-utility");
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
// constants
|
||||
import type { CORE_EXTENSIONS } from "@/constants/extension";
|
||||
// plane editor imports
|
||||
import type { TAdditionalEditorAsset } from "@/plane-editor/types/asset";
|
||||
|
||||
export type TAdditionalEditorAsset = never;
|
||||
|
||||
export type TEditorImageAsset = {
|
||||
href: string;
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
// plane imports
|
||||
import type { TExtendedFileHandler } from "@/plane-editor/types/config";
|
||||
export type TExtendedFileHandler = object;
|
||||
|
||||
export type TFileHandler = {
|
||||
assetsUploadStatus: Record<string, number>; // blockId => progress percentage
|
||||
|
||||
@@ -18,7 +18,7 @@ import type {
|
||||
IEditorPropsExtended,
|
||||
TExtendedEditorCommands,
|
||||
ICollaborativeDocumentEditorPropsExtended,
|
||||
} from "@/plane-editor/types/editor-extended";
|
||||
} from "@/types/editor-extended";
|
||||
// types
|
||||
import type {
|
||||
IMarking,
|
||||
|
||||
@@ -15,5 +15,5 @@ export * from "./hook";
|
||||
export * from "./mention";
|
||||
export * from "./slash-commands-suggestion";
|
||||
export * from "./document-collaborative-events";
|
||||
|
||||
export * from "@/plane-editor/types";
|
||||
export * from "./issue-embed";
|
||||
export * from "./editor-extended";
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
export * from "src/ce/extensions";
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
export * from "src/ce/types";
|
||||
@@ -20,7 +20,7 @@ export * from "@/helpers/common";
|
||||
export * from "@/helpers/yjs-utils";
|
||||
|
||||
export { CORE_EXTENSIONS } from "@/constants/extension";
|
||||
export { ADDITIONAL_EXTENSIONS } from "@/plane-editor/constants/extensions";
|
||||
export { ADDITIONAL_EXTENSIONS } from "@/constants/extensions";
|
||||
|
||||
// types
|
||||
export * from "@/types";
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"paths": {
|
||||
"src/*": ["./src/*"],
|
||||
"@/*": ["./src/core/*"],
|
||||
"@/plane-editor/*": ["./src/ce/*"],
|
||||
"@/styles/*": ["./src/styles/*"]
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user