mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 13:29:56 +02:00
chore: renamed funcion name
This commit is contained in:
@@ -9,7 +9,7 @@ import { EMentionComponentAttributeNames, TMentionComponentAttributes } from "./
|
||||
|
||||
export type TMentionExtensionOptions = MentionOptions & {
|
||||
renderComponent: TMentionHandler["renderComponent"];
|
||||
getMentionComponentAttributes: TMentionHandler["getMentionComponentAttributes"];
|
||||
getMentionedEntityDetails: TMentionHandler["getMentionedEntityDetails"];
|
||||
};
|
||||
|
||||
export const CustomMentionExtensionConfig = Mention.extend<TMentionExtensionOptions>({
|
||||
@@ -63,6 +63,6 @@ export const CustomMentionExtensionConfig = Mention.extend<TMentionExtensionOpti
|
||||
function getMentionDisplayText(options: TMentionExtensionOptions, node: NodeType): string {
|
||||
const attrs = node.attrs as TMentionComponentAttributes;
|
||||
const mentionEntityId = attrs[EMentionComponentAttributeNames.ENTITY_IDENTIFIER];
|
||||
const mentionEntityDetails = options.getMentionComponentAttributes?.(mentionEntityId);
|
||||
return `~${mentionEntityDetails?.display_name ?? attrs[EMentionComponentAttributeNames.ID] ?? mentionEntityId}`;
|
||||
const mentionEntityDetails = options.getMentionedEntityDetails?.(mentionEntityId);
|
||||
return `@${mentionEntityDetails?.display_name ?? attrs[EMentionComponentAttributeNames.ID] ?? mentionEntityId}`;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ import { MentionNodeView } from "./mention-node-view";
|
||||
import { renderMentionsDropdown } from "./utils";
|
||||
|
||||
export const CustomMentionExtension = (props: TMentionHandler) => {
|
||||
const { searchCallback, renderComponent, getMentionComponentAttributes } = props;
|
||||
const { searchCallback, renderComponent, getMentionedEntityDetails } = props;
|
||||
return CustomMentionExtensionConfig.extend({
|
||||
addOptions(this) {
|
||||
return {
|
||||
...this.parent?.(),
|
||||
renderComponent,
|
||||
getMentionComponentAttributes,
|
||||
getMentionedEntityDetails,
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export type TMentionComponentProps = Pick<TMentionSuggestion, "entity_identifier
|
||||
|
||||
export type TReadOnlyMentionHandler = {
|
||||
renderComponent: (props: TMentionComponentProps) => React.ReactNode;
|
||||
getMentionComponentAttributes?: (entity_identifier: string) => IUserLite | undefined;
|
||||
getMentionedEntityDetails?: (entity_identifier: string) => IUserLite | undefined;
|
||||
};
|
||||
|
||||
export type TMentionHandler = TReadOnlyMentionHandler & {
|
||||
|
||||
@@ -190,7 +190,7 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
||||
return res;
|
||||
},
|
||||
renderComponent: (props) => <EditorMentionsRoot {...props} />,
|
||||
getMentionComponentAttributes: (id: string) => getUserDetails(id),
|
||||
getMentionedEntityDetails: (id: string) => getUserDetails(id),
|
||||
}}
|
||||
embedHandler={{
|
||||
issue: issueEmbedProps,
|
||||
|
||||
Reference in New Issue
Block a user