@lumel/mention 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +286 -0
- package/LICENSE +7 -0
- package/README.md +9 -0
- package/lib/Mention.d.ts +22 -0
- package/lib/MentionSuggestions/Entry/Avatar/Avatar.d.ts +9 -0
- package/lib/MentionSuggestions/Entry/DefaultEntryComponent.d.ts +3 -0
- package/lib/MentionSuggestions/Entry/Entry.d.ts +38 -0
- package/lib/MentionSuggestions/MentionSuggestions.d.ts +80 -0
- package/lib/MentionSuggestions/Popover.d.ts +10 -0
- package/lib/MentionSuggestions/__test__/MentionSuggestions.test.d.ts +1 -0
- package/lib/MentionSuggestionsPortal.d.ts +11 -0
- package/lib/__test__/Mention.test.d.ts +1 -0
- package/lib/__test__/mentionSuggestionsStrategy.test.d.ts +1 -0
- package/lib/defaultRegExp.d.ts +2 -0
- package/lib/index.cjs.js +1215 -0
- package/lib/index.d.ts +66 -0
- package/lib/index.esm.js +1198 -0
- package/lib/mentionStrategy.d.ts +3 -0
- package/lib/mentionSuggestionsStrategy.d.ts +6 -0
- package/lib/modifiers/addMention.d.ts +3 -0
- package/lib/plugin.css +8 -0
- package/lib/theme.d.ts +12 -0
- package/lib/utils/__test__/getSearchTextAt.test.d.ts +1 -0
- package/lib/utils/__test__/getTriggerForMention.test.d.ts +1 -0
- package/lib/utils/__test__/getTypeByTrigger.test.d.ts +1 -0
- package/lib/utils/decodeOffsetKey.d.ts +7 -0
- package/lib/utils/defaultSuggestionsFilter.d.ts +3 -0
- package/lib/utils/getSearchText.d.ts +4 -0
- package/lib/utils/getSearchTextAt.d.ts +9 -0
- package/lib/utils/getTriggerForMention.d.ts +8 -0
- package/lib/utils/getTypeByTrigger.d.ts +1 -0
- package/lib/utils/positionSuggestions.d.ts +13 -0
- package/lib/utils/warning.d.ts +1 -0
- package/package.json +60 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as PopperJS from '@popperjs/core';
|
|
2
|
+
import { Modifier } from 'react-popper';
|
|
3
|
+
import { Map } from 'immutable';
|
|
4
|
+
import { ComponentType } from 'react';
|
|
5
|
+
import { EditorState } from 'draft-js';
|
|
6
|
+
import { EditorPlugin } from '@draft-js-plugins/editor';
|
|
7
|
+
import { SubMentionComponentProps } from './Mention';
|
|
8
|
+
import MentionSuggestions, { MentionSuggestionsPubProps } from './MentionSuggestions/MentionSuggestions';
|
|
9
|
+
import addMention from './modifiers/addMention';
|
|
10
|
+
import { PositionSuggestionsFn } from './utils/positionSuggestions';
|
|
11
|
+
import { defaultTheme, MentionPluginTheme } from './theme';
|
|
12
|
+
export { default as MentionSuggestions } from './MentionSuggestions/MentionSuggestions';
|
|
13
|
+
export { default as Popover } from './MentionSuggestions/Popover';
|
|
14
|
+
export { defaultTheme };
|
|
15
|
+
export { addMention };
|
|
16
|
+
export type { MentionPluginTheme };
|
|
17
|
+
export declare type PopperOptions = Omit<Partial<PopperJS.Options>, 'modifiers'> & {
|
|
18
|
+
createPopper?: typeof PopperJS.createPopper;
|
|
19
|
+
modifiers?: ReadonlyArray<Modifier<unknown>>;
|
|
20
|
+
};
|
|
21
|
+
export interface MentionData {
|
|
22
|
+
link?: string;
|
|
23
|
+
avatar?: string;
|
|
24
|
+
name: string;
|
|
25
|
+
id?: null | string | number;
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
}
|
|
28
|
+
export interface MultiMentionData {
|
|
29
|
+
[fieldName: string]: MentionData[];
|
|
30
|
+
}
|
|
31
|
+
export interface MentionPluginStore {
|
|
32
|
+
setEditorState?(editorState: EditorState): void;
|
|
33
|
+
getEditorState?(): EditorState;
|
|
34
|
+
getPortalClientRect(offsetKey: string): ClientRect;
|
|
35
|
+
getAllSearches(): Map<string, string>;
|
|
36
|
+
isEscaped(offsetKey: string): boolean;
|
|
37
|
+
escapeSearch(offsetKey: string): void;
|
|
38
|
+
resetEscapedSearch(): void;
|
|
39
|
+
register(offsetKey: string): void;
|
|
40
|
+
updatePortalClientRect(offsetKey: string, funct: ClientRectFunction): void;
|
|
41
|
+
unregister(offsetKey: string): void;
|
|
42
|
+
getIsOpened(): boolean;
|
|
43
|
+
setIsOpened(nextIsOpened: boolean): void;
|
|
44
|
+
getReferenceElement(): HTMLElement | null;
|
|
45
|
+
setReferenceElement(element: HTMLElement | null): void;
|
|
46
|
+
}
|
|
47
|
+
export interface MentionPluginConfig {
|
|
48
|
+
mentionPrefix?: string;
|
|
49
|
+
theme?: MentionPluginTheme;
|
|
50
|
+
positionSuggestions?: PositionSuggestionsFn;
|
|
51
|
+
mentionComponent?: ComponentType<SubMentionComponentProps>;
|
|
52
|
+
mentionSuggestionsComponent?: ComponentType;
|
|
53
|
+
entityMutability?: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE';
|
|
54
|
+
mentionTrigger?: string | string[];
|
|
55
|
+
mentionRegExp?: string;
|
|
56
|
+
supportWhitespace?: boolean;
|
|
57
|
+
popperOptions?: PopperOptions;
|
|
58
|
+
}
|
|
59
|
+
interface ClientRectFunction {
|
|
60
|
+
(): ClientRect;
|
|
61
|
+
}
|
|
62
|
+
declare const _default: (config?: MentionPluginConfig) => EditorPlugin & {
|
|
63
|
+
MentionSuggestions: ComponentType<MentionSuggestionsPubProps>;
|
|
64
|
+
};
|
|
65
|
+
export default _default;
|
|
66
|
+
export declare const defaultSuggestionsFilter: (searchValue: string, suggestions: MentionData[] | MultiMentionData, trigger?: string | undefined) => MentionData[];
|