[WIKI-773] refactor: editor mention components and hooks (#8111)
This commit is contained in:
parent
c04ae51d20
commit
c65e2c4aab
17 changed files with 84 additions and 96 deletions
|
|
@ -1,11 +1,18 @@
|
|||
import { useCallback } from "react";
|
||||
import { useCallback, useMemo } from "react";
|
||||
// plane editor
|
||||
import type { TMentionSection } from "@plane/editor";
|
||||
// plane types
|
||||
import type { TSearchEntities, TSearchResponse } from "@plane/types";
|
||||
|
||||
export type TUseAdditionalEditorMentionArgs = {
|
||||
enableAdvancedMentions: boolean;
|
||||
};
|
||||
|
||||
export type TAdditionalEditorMentionHandlerArgs = {
|
||||
response: TSearchResponse;
|
||||
};
|
||||
|
||||
export type TAdditionalEditorMentionHandlerReturnType = {
|
||||
sections: TMentionSection[];
|
||||
};
|
||||
|
||||
|
|
@ -21,21 +28,24 @@ export type TAdditionalParseEditorContentReturnType =
|
|||
}
|
||||
| undefined;
|
||||
|
||||
export const useAdditionalEditorMention = () => {
|
||||
const updateAdditionalSections = useCallback((args: TAdditionalEditorMentionHandlerArgs) => {
|
||||
const {} = args;
|
||||
}, []);
|
||||
|
||||
const parseAdditionalEditorContent = useCallback(
|
||||
(args: TAdditionalParseEditorContentArgs): TAdditionalParseEditorContentReturnType => {
|
||||
const {} = args;
|
||||
return undefined;
|
||||
},
|
||||
export const useAdditionalEditorMention = (_args: TUseAdditionalEditorMentionArgs) => {
|
||||
const updateAdditionalSections = useCallback(
|
||||
(_args: TAdditionalEditorMentionHandlerArgs): TAdditionalEditorMentionHandlerReturnType => ({
|
||||
sections: [],
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
const parseAdditionalEditorContent = useCallback(
|
||||
(_args: TAdditionalParseEditorContentArgs): TAdditionalParseEditorContentReturnType => undefined,
|
||||
[]
|
||||
);
|
||||
|
||||
const editorMentionTypes: TSearchEntities[] = useMemo(() => ["user_mention"], []);
|
||||
|
||||
return {
|
||||
updateAdditionalSections,
|
||||
parseAdditionalEditorContent,
|
||||
editorMentionTypes,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue