2025-11-17 14:07:37 +05:30
|
|
|
import { useCallback, useMemo } from "react";
|
2024-12-20 13:41:25 +05:30
|
|
|
// plane editor
|
2025-08-15 13:10:26 +05:30
|
|
|
import type { TMentionSection } from "@plane/editor";
|
2024-12-20 13:41:25 +05:30
|
|
|
// plane types
|
2025-08-15 13:10:26 +05:30
|
|
|
import type { TSearchEntities, TSearchResponse } from "@plane/types";
|
2024-12-20 13:41:25 +05:30
|
|
|
|
2025-11-17 14:07:37 +05:30
|
|
|
export type TUseAdditionalEditorMentionArgs = {
|
|
|
|
|
enableAdvancedMentions: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
2024-12-20 13:41:25 +05:30
|
|
|
export type TAdditionalEditorMentionHandlerArgs = {
|
|
|
|
|
response: TSearchResponse;
|
2025-11-17 14:07:37 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type TAdditionalEditorMentionHandlerReturnType = {
|
2024-12-20 13:41:25 +05:30
|
|
|
sections: TMentionSection[];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type TAdditionalParseEditorContentArgs = {
|
|
|
|
|
id: string;
|
|
|
|
|
entityType: TSearchEntities;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type TAdditionalParseEditorContentReturnType =
|
|
|
|
|
| {
|
|
|
|
|
redirectionPath: string;
|
|
|
|
|
textContent: string;
|
|
|
|
|
}
|
|
|
|
|
| undefined;
|
|
|
|
|
|
2025-11-17 14:07:37 +05:30
|
|
|
export const useAdditionalEditorMention = (_args: TUseAdditionalEditorMentionArgs) => {
|
|
|
|
|
const updateAdditionalSections = useCallback(
|
|
|
|
|
(_args: TAdditionalEditorMentionHandlerArgs): TAdditionalEditorMentionHandlerReturnType => ({
|
|
|
|
|
sections: [],
|
|
|
|
|
}),
|
|
|
|
|
[]
|
|
|
|
|
);
|
2024-12-20 13:41:25 +05:30
|
|
|
|
|
|
|
|
const parseAdditionalEditorContent = useCallback(
|
2025-11-17 14:07:37 +05:30
|
|
|
(_args: TAdditionalParseEditorContentArgs): TAdditionalParseEditorContentReturnType => undefined,
|
2024-12-20 13:41:25 +05:30
|
|
|
[]
|
|
|
|
|
);
|
|
|
|
|
|
2025-11-17 14:07:37 +05:30
|
|
|
const editorMentionTypes: TSearchEntities[] = useMemo(() => ["user_mention"], []);
|
|
|
|
|
|
2024-12-20 13:41:25 +05:30
|
|
|
return {
|
|
|
|
|
updateAdditionalSections,
|
|
|
|
|
parseAdditionalEditorContent,
|
2025-11-17 14:07:37 +05:30
|
|
|
editorMentionTypes,
|
2024-12-20 13:41:25 +05:30
|
|
|
};
|
|
|
|
|
};
|