Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/web/ce/hooks/editor/use-extended-editor-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useCallback } from "react";
// plane imports
import type { TExtendedFileHandler } from "@plane/editor";

export type TExtendedEditorFileHandlersArgs = {
projectId?: string;
workspaceSlug: string;
};

export type TExtendedEditorConfig = {
getExtendedEditorFileHandlers: (args: TExtendedEditorFileHandlersArgs) => TExtendedFileHandler;
};

export const useExtendedEditorConfig = (): TExtendedEditorConfig => {
const getExtendedEditorFileHandlers: TExtendedEditorConfig["getExtendedEditorFileHandlers"] = useCallback(
() => ({}),
[]
);

return {
getExtendedEditorFileHandlers,
};
};
5 changes: 4 additions & 1 deletion apps/web/core/hooks/editor/use-editor-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getEditorAssetDownloadSrc, getEditorAssetSrc } from "@plane/utils";
// hooks
import { useEditorAsset } from "@/hooks/store/use-editor-asset";
// plane web hooks
import { useExtendedEditorConfig } from "@/plane-web/hooks/editor/use-extended-editor-config";
import { useFileSize } from "@/plane-web/hooks/use-file-size";
// services
import { FileService } from "@/services/file.service";
Expand All @@ -22,6 +23,7 @@ export const useEditorConfig = () => {
const { assetsUploadPercentage } = useEditorAsset();
// file size
const { maxFileSize } = useFileSize();
const { getExtendedEditorFileHandlers } = useExtendedEditorConfig();

const getEditorFileHandlers = useCallback(
(args: TArgs): TFileHandler => {
Expand Down Expand Up @@ -86,9 +88,10 @@ export const useEditorConfig = () => {
validation: {
maxFileSize,
},
...getExtendedEditorFileHandlers({ projectId, workspaceSlug }),
};
},
[assetsUploadPercentage, maxFileSize]
[assetsUploadPercentage, getExtendedEditorFileHandlers, maxFileSize]
);

return {
Expand Down
1 change: 0 additions & 1 deletion apps/web/core/services/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ export class FileService extends APIService {
throw err?.response?.data;
});
}

async getProjectCoverImages(): Promise<string[]> {
return this.get(`/api/project-covers/`)
.then((res) => res?.data)
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/ce/types/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type TExtendedFileHandler = object;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type of the variable is object because we are destructuring it to use.

1 change: 1 addition & 0 deletions packages/editor/src/ce/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./issue-embed";
export * from "./editor-extended";
export * from "./config";
1 change: 1 addition & 0 deletions packages/editor/src/core/plugins/drag-handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const generalSelectors = [
".image-upload-component",
".editor-callout-component",
".editor-embed-component",
".editor-drawio-component",
].join(", ");

const maxScrollSpeed = 20;
Expand Down
3 changes: 2 additions & 1 deletion packages/editor/src/core/types/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// plane imports
import { TWebhookConnectionQueryParams } from "@plane/types";
import { TExtendedFileHandler } from "@/plane-editor/types/config";

export type TFileHandler = {
assetsUploadStatus: Record<string, number>; // blockId => progress percentage
Expand All @@ -16,7 +17,7 @@ export type TFileHandler = {
* @example enter 5242880(5 * 1024 * 1024) for 5MB
*/
maxFileSize: number;
};
} & TExtendedFileHandler;
};

export type TEditorFontStyle = "sans-serif" | "serif" | "monospace";
Expand Down
Loading