@lumel/mention 5.2.7 → 5.2.9
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/LICENSE +7 -7
- package/README.md +9 -9
- package/lib/Mention.d.ts +22 -22
- package/lib/MentionSuggestions/Entry/Avatar/Avatar.d.ts +9 -9
- package/lib/MentionSuggestions/Entry/DefaultEntryComponent.d.ts +3 -3
- package/lib/MentionSuggestions/Entry/Entry.d.ts +38 -38
- package/lib/MentionSuggestions/MentionSuggestions.d.ts +97 -97
- package/lib/MentionSuggestions/Popover.d.ts +11 -11
- package/lib/MentionSuggestions/__test__/MentionSuggestions.test.d.ts +1 -1
- package/lib/MentionSuggestionsPortal.d.ts +11 -11
- package/lib/__test__/Mention.test.d.ts +1 -1
- package/lib/__test__/mentionSuggestionsStrategy.test.d.ts +1 -1
- package/lib/defaultRegExp.d.ts +2 -2
- package/lib/index.cjs.js +10 -10
- package/lib/index.d.ts +68 -68
- package/lib/index.esm.js +10 -10
- package/lib/mentionStrategy.d.ts +3 -3
- package/lib/mentionSuggestionsStrategy.d.ts +6 -6
- package/lib/modifiers/addMention.d.ts +3 -3
- package/lib/plugin.css +8 -8
- package/lib/theme.d.ts +12 -12
- package/lib/utils/__test__/getSearchTextAt.test.d.ts +1 -1
- package/lib/utils/__test__/getTriggerForMention.test.d.ts +1 -1
- package/lib/utils/__test__/getTypeByTrigger.test.d.ts +1 -1
- package/lib/utils/decodeOffsetKey.d.ts +7 -7
- package/lib/utils/defaultSuggestionsFilter.d.ts +3 -3
- package/lib/utils/getSearchText.d.ts +4 -4
- package/lib/utils/getSearchTextAt.d.ts +9 -9
- package/lib/utils/getTriggerForMention.d.ts +8 -8
- package/lib/utils/getTypeByTrigger.d.ts +1 -1
- package/lib/utils/positionSuggestions.d.ts +13 -13
- package/lib/utils/warning.d.ts +1 -1
- package/package.json +73 -60
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright (c) 2016 Nikolaus Graf
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2016 Nikolaus Graf
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# DraftJS Mention Plugin
|
|
2
|
-
|
|
3
|
-
_This is a plugin for the `@draft-js-plugins/editor`._
|
|
4
|
-
|
|
5
|
-
This plugin allows you to add mentions to your editor!
|
|
6
|
-
|
|
7
|
-
Usage:
|
|
8
|
-
|
|
9
|
-
see https://www.draft-js-plugins.com/plugin/mention
|
|
1
|
+
# DraftJS Mention Plugin
|
|
2
|
+
|
|
3
|
+
_This is a plugin for the `@draft-js-plugins/editor`._
|
|
4
|
+
|
|
5
|
+
This plugin allows you to add mentions to your editor!
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
|
|
9
|
+
see https://www.draft-js-plugins.com/plugin/mention
|
package/lib/Mention.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ContentState } from 'draft-js';
|
|
2
|
-
import { ComponentType, ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { MentionData } from '.';
|
|
4
|
-
import { MentionPluginTheme } from './theme';
|
|
5
|
-
export interface SubMentionComponentProps {
|
|
6
|
-
mention: MentionData;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
className: string;
|
|
9
|
-
entityKey: string;
|
|
10
|
-
theme: MentionPluginTheme;
|
|
11
|
-
decoratedText: string;
|
|
12
|
-
}
|
|
13
|
-
export interface MentionProps {
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
className: string;
|
|
16
|
-
entityKey: string;
|
|
17
|
-
theme?: MentionPluginTheme;
|
|
18
|
-
mentionComponent?: ComponentType<SubMentionComponentProps>;
|
|
19
|
-
decoratedText: string;
|
|
20
|
-
contentState: ContentState;
|
|
21
|
-
}
|
|
22
|
-
export default function Mention(props: MentionProps): ReactElement;
|
|
1
|
+
import { ContentState } from 'draft-js';
|
|
2
|
+
import { ComponentType, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { MentionData } from '.';
|
|
4
|
+
import { MentionPluginTheme } from './theme';
|
|
5
|
+
export interface SubMentionComponentProps {
|
|
6
|
+
mention: MentionData;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className: string;
|
|
9
|
+
entityKey: string;
|
|
10
|
+
theme: MentionPluginTheme;
|
|
11
|
+
decoratedText: string;
|
|
12
|
+
}
|
|
13
|
+
export interface MentionProps {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
className: string;
|
|
16
|
+
entityKey: string;
|
|
17
|
+
theme?: MentionPluginTheme;
|
|
18
|
+
mentionComponent?: ComponentType<SubMentionComponentProps>;
|
|
19
|
+
decoratedText: string;
|
|
20
|
+
contentState: ContentState;
|
|
21
|
+
}
|
|
22
|
+
export default function Mention(props: MentionProps): ReactElement;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { MentionData } from '../../../';
|
|
3
|
-
import { MentionPluginTheme } from '../../../theme';
|
|
4
|
-
interface AvatarProps {
|
|
5
|
-
theme?: MentionPluginTheme;
|
|
6
|
-
mention: MentionData;
|
|
7
|
-
}
|
|
8
|
-
export default function Avatar({ mention, theme, }: AvatarProps): ReactElement | null;
|
|
9
|
-
export {};
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { MentionData } from '../../../';
|
|
3
|
+
import { MentionPluginTheme } from '../../../theme';
|
|
4
|
+
interface AvatarProps {
|
|
5
|
+
theme?: MentionPluginTheme;
|
|
6
|
+
mention: MentionData;
|
|
7
|
+
}
|
|
8
|
+
export default function Avatar({ mention, theme, }: AvatarProps): ReactElement | null;
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { EntryComponentProps } from './Entry';
|
|
3
|
-
export default function DefaultEntryComponent(props: EntryComponentProps): ReactElement;
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { EntryComponentProps } from './Entry';
|
|
3
|
+
export default function DefaultEntryComponent(props: EntryComponentProps): ReactElement;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { ComponentType, MouseEvent, ReactElement } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { MentionData } from '../../';
|
|
4
|
-
import { MentionPluginTheme } from '../../theme';
|
|
5
|
-
export interface EntryComponentProps {
|
|
6
|
-
className?: string;
|
|
7
|
-
onMouseDown(event: MouseEvent): void;
|
|
8
|
-
onMouseUp(event: MouseEvent): void;
|
|
9
|
-
onMouseEnter(event: MouseEvent): void;
|
|
10
|
-
role: string;
|
|
11
|
-
id: string;
|
|
12
|
-
'aria-selected'?: boolean | 'false' | 'true';
|
|
13
|
-
theme?: MentionPluginTheme;
|
|
14
|
-
mention: MentionData;
|
|
15
|
-
isFocused: boolean;
|
|
16
|
-
searchValue?: string;
|
|
17
|
-
selectMention(mention: MentionData | null): void;
|
|
18
|
-
}
|
|
19
|
-
interface EntryProps {
|
|
20
|
-
mention: MentionData;
|
|
21
|
-
entryComponent: ComponentType<EntryComponentProps>;
|
|
22
|
-
onMentionSelect(mention: MentionData | null): void;
|
|
23
|
-
theme: MentionPluginTheme;
|
|
24
|
-
id: string;
|
|
25
|
-
index: number;
|
|
26
|
-
onMentionFocus(index: number): void;
|
|
27
|
-
isFocused: boolean;
|
|
28
|
-
searchValue?: string;
|
|
29
|
-
}
|
|
30
|
-
declare const Entry: {
|
|
31
|
-
({ onMentionSelect, mention, theme, index, onMentionFocus, isFocused, id, searchValue, entryComponent: EntryComponent, }: EntryProps): ReactElement;
|
|
32
|
-
propTypes: {
|
|
33
|
-
entryComponent: PropTypes.Validator<any>;
|
|
34
|
-
searchValue: PropTypes.Requireable<string>;
|
|
35
|
-
onMentionSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export default Entry;
|
|
1
|
+
import { ComponentType, MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { MentionData } from '../../';
|
|
4
|
+
import { MentionPluginTheme } from '../../theme';
|
|
5
|
+
export interface EntryComponentProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
onMouseDown(event: MouseEvent): void;
|
|
8
|
+
onMouseUp(event: MouseEvent): void;
|
|
9
|
+
onMouseEnter(event: MouseEvent): void;
|
|
10
|
+
role: string;
|
|
11
|
+
id: string;
|
|
12
|
+
'aria-selected'?: boolean | 'false' | 'true';
|
|
13
|
+
theme?: MentionPluginTheme;
|
|
14
|
+
mention: MentionData;
|
|
15
|
+
isFocused: boolean;
|
|
16
|
+
searchValue?: string;
|
|
17
|
+
selectMention(mention: MentionData | null): void;
|
|
18
|
+
}
|
|
19
|
+
interface EntryProps {
|
|
20
|
+
mention: MentionData;
|
|
21
|
+
entryComponent: ComponentType<EntryComponentProps>;
|
|
22
|
+
onMentionSelect(mention: MentionData | null): void;
|
|
23
|
+
theme: MentionPluginTheme;
|
|
24
|
+
id: string;
|
|
25
|
+
index: number;
|
|
26
|
+
onMentionFocus(index: number): void;
|
|
27
|
+
isFocused: boolean;
|
|
28
|
+
searchValue?: string;
|
|
29
|
+
}
|
|
30
|
+
declare const Entry: {
|
|
31
|
+
({ onMentionSelect, mention, theme, index, onMentionFocus, isFocused, id, searchValue, entryComponent: EntryComponent, }: EntryProps): ReactElement;
|
|
32
|
+
propTypes: {
|
|
33
|
+
entryComponent: PropTypes.Validator<any>;
|
|
34
|
+
searchValue: PropTypes.Requireable<string>;
|
|
35
|
+
onMentionSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export default Entry;
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { AriaProps, EditorCommand } from '@draft-js-plugins/editor';
|
|
2
|
-
import { DraftHandleValue, EditorState, SelectionState } from 'draft-js';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { Iterable } from 'immutable';
|
|
5
|
-
import React, { Component, ComponentType, KeyboardEvent, ReactElement, RefAttributes } from 'react';
|
|
6
|
-
import { MentionData, MentionPluginStore, PopperOptions } from '..';
|
|
7
|
-
import { MentionPluginTheme } from '../theme';
|
|
8
|
-
import { PositionSuggestionsFn } from '../utils/positionSuggestions';
|
|
9
|
-
import { EntryComponentProps } from './Entry/Entry';
|
|
10
|
-
import { PopoverProps } from './Popover';
|
|
11
|
-
export interface MentionSuggestionCallbacks {
|
|
12
|
-
keyBindingFn?(event: KeyboardEvent): EditorCommand | null | undefined;
|
|
13
|
-
handleKeyCommand: undefined;
|
|
14
|
-
handleReturn?(event: KeyboardEvent): DraftHandleValue;
|
|
15
|
-
onChange?(editorState: EditorState): EditorState;
|
|
16
|
-
}
|
|
17
|
-
export interface PopoverComponentProps {
|
|
18
|
-
className: string;
|
|
19
|
-
role: string;
|
|
20
|
-
id: string;
|
|
21
|
-
}
|
|
22
|
-
export interface MentionSuggestionsPubProps {
|
|
23
|
-
suggestions: MentionData[];
|
|
24
|
-
open: boolean;
|
|
25
|
-
onOpenChange(open: boolean): void;
|
|
26
|
-
onSearchChange(event: {
|
|
27
|
-
trigger: string;
|
|
28
|
-
value: string;
|
|
29
|
-
}): void;
|
|
30
|
-
onAddMention?(Mention: MentionData): void;
|
|
31
|
-
popoverComponent?: ReactElement<PopoverComponentProps & RefAttributes<HTMLElement>>;
|
|
32
|
-
entryComponent?: ComponentType<EntryComponentProps>;
|
|
33
|
-
popoverContainer?: ComponentType<PopoverProps>;
|
|
34
|
-
renderEmptyPopup?: boolean;
|
|
35
|
-
handleScroll?: React.UIEventHandler<HTMLElement>;
|
|
36
|
-
isMentionLoading?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export interface MentionSuggestionsProps extends MentionSuggestionsPubProps {
|
|
39
|
-
callbacks: MentionSuggestionCallbacks;
|
|
40
|
-
store: MentionPluginStore;
|
|
41
|
-
positionSuggestions?: PositionSuggestionsFn;
|
|
42
|
-
ariaProps: AriaProps;
|
|
43
|
-
theme: MentionPluginTheme;
|
|
44
|
-
mentionPrefix: string;
|
|
45
|
-
mentionTriggers: string[];
|
|
46
|
-
entityMutability: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE';
|
|
47
|
-
popperOptions?: PopperOptions;
|
|
48
|
-
}
|
|
49
|
-
interface RenderSuggestionsProps {
|
|
50
|
-
suggestions: MentionData[];
|
|
51
|
-
focusedOptionIndex: number;
|
|
52
|
-
onMentionSelect: (mention: MentionData | null) => void;
|
|
53
|
-
onMentionFocus: (index: number) => void;
|
|
54
|
-
theme: MentionPluginTheme;
|
|
55
|
-
lastSearchValue?: string;
|
|
56
|
-
entryComponent?: ComponentType<EntryComponentProps>;
|
|
57
|
-
isMentionLoading?: boolean;
|
|
58
|
-
}
|
|
59
|
-
export declare class MentionSuggestions extends Component<MentionSuggestionsProps> {
|
|
60
|
-
static propTypes: {
|
|
61
|
-
open: PropTypes.Validator<boolean>;
|
|
62
|
-
onOpenChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
63
|
-
entityMutability: PropTypes.Requireable<string>;
|
|
64
|
-
entryComponent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
65
|
-
onAddMention: PropTypes.Requireable<(...args: any[]) => any>;
|
|
66
|
-
suggestions: PropTypes.Validator<any[]>;
|
|
67
|
-
handleScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
68
|
-
isMentionLoading: PropTypes.Requireable<boolean>;
|
|
69
|
-
};
|
|
70
|
-
state: {
|
|
71
|
-
focusedOptionIndex: number;
|
|
72
|
-
};
|
|
73
|
-
key: string;
|
|
74
|
-
popover?: HTMLElement;
|
|
75
|
-
activeOffsetKey?: string;
|
|
76
|
-
lastSearchValue?: string;
|
|
77
|
-
lastActiveTrigger?: string;
|
|
78
|
-
lastSelectionIsInsideWord?: Iterable<string, boolean>;
|
|
79
|
-
constructor(props: MentionSuggestionsProps);
|
|
80
|
-
componentDidUpdate(): void;
|
|
81
|
-
componentWillUnmount(): void;
|
|
82
|
-
onEditorStateChange: (editorState: EditorState) => EditorState;
|
|
83
|
-
onSearchChange: (editorState: EditorState, selection: SelectionState, activeOffsetKey: string | undefined, lastActiveOffsetKey: string | undefined, trigger: string) => void;
|
|
84
|
-
onDownArrow: (keyboardEvent: KeyboardEvent) => void;
|
|
85
|
-
onTab: (keyboardEvent: KeyboardEvent) => void;
|
|
86
|
-
onUpArrow: (keyboardEvent: KeyboardEvent) => void;
|
|
87
|
-
onEscape: (keyboardEvent: KeyboardEvent) => void;
|
|
88
|
-
onMentionSelect: (mention: MentionData | null) => void;
|
|
89
|
-
onMentionFocus: (index: number) => void;
|
|
90
|
-
commitSelection: () => DraftHandleValue;
|
|
91
|
-
openDropdown: () => void;
|
|
92
|
-
closeDropdown: () => void;
|
|
93
|
-
private getMentionKey;
|
|
94
|
-
renderSuggestionsList: (props: RenderSuggestionsProps) => ReactElement;
|
|
95
|
-
render(): ReactElement | null;
|
|
96
|
-
}
|
|
97
|
-
export default MentionSuggestions;
|
|
1
|
+
import { AriaProps, EditorCommand } from '@draft-js-plugins/editor';
|
|
2
|
+
import { DraftHandleValue, EditorState, SelectionState } from 'draft-js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Iterable } from 'immutable';
|
|
5
|
+
import React, { Component, ComponentType, KeyboardEvent, ReactElement, RefAttributes } from 'react';
|
|
6
|
+
import { MentionData, MentionPluginStore, PopperOptions } from '..';
|
|
7
|
+
import { MentionPluginTheme } from '../theme';
|
|
8
|
+
import { PositionSuggestionsFn } from '../utils/positionSuggestions';
|
|
9
|
+
import { EntryComponentProps } from './Entry/Entry';
|
|
10
|
+
import { PopoverProps } from './Popover';
|
|
11
|
+
export interface MentionSuggestionCallbacks {
|
|
12
|
+
keyBindingFn?(event: KeyboardEvent): EditorCommand | null | undefined;
|
|
13
|
+
handleKeyCommand: undefined;
|
|
14
|
+
handleReturn?(event: KeyboardEvent): DraftHandleValue;
|
|
15
|
+
onChange?(editorState: EditorState): EditorState;
|
|
16
|
+
}
|
|
17
|
+
export interface PopoverComponentProps {
|
|
18
|
+
className: string;
|
|
19
|
+
role: string;
|
|
20
|
+
id: string;
|
|
21
|
+
}
|
|
22
|
+
export interface MentionSuggestionsPubProps {
|
|
23
|
+
suggestions: MentionData[];
|
|
24
|
+
open: boolean;
|
|
25
|
+
onOpenChange(open: boolean): void;
|
|
26
|
+
onSearchChange(event: {
|
|
27
|
+
trigger: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}): void;
|
|
30
|
+
onAddMention?(Mention: MentionData): void;
|
|
31
|
+
popoverComponent?: ReactElement<PopoverComponentProps & RefAttributes<HTMLElement>>;
|
|
32
|
+
entryComponent?: ComponentType<EntryComponentProps>;
|
|
33
|
+
popoverContainer?: ComponentType<PopoverProps>;
|
|
34
|
+
renderEmptyPopup?: boolean;
|
|
35
|
+
handleScroll?: React.UIEventHandler<HTMLElement>;
|
|
36
|
+
isMentionLoading?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface MentionSuggestionsProps extends MentionSuggestionsPubProps {
|
|
39
|
+
callbacks: MentionSuggestionCallbacks;
|
|
40
|
+
store: MentionPluginStore;
|
|
41
|
+
positionSuggestions?: PositionSuggestionsFn;
|
|
42
|
+
ariaProps: AriaProps;
|
|
43
|
+
theme: MentionPluginTheme;
|
|
44
|
+
mentionPrefix: string;
|
|
45
|
+
mentionTriggers: string[];
|
|
46
|
+
entityMutability: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE';
|
|
47
|
+
popperOptions?: PopperOptions;
|
|
48
|
+
}
|
|
49
|
+
interface RenderSuggestionsProps {
|
|
50
|
+
suggestions: MentionData[];
|
|
51
|
+
focusedOptionIndex: number;
|
|
52
|
+
onMentionSelect: (mention: MentionData | null) => void;
|
|
53
|
+
onMentionFocus: (index: number) => void;
|
|
54
|
+
theme: MentionPluginTheme;
|
|
55
|
+
lastSearchValue?: string;
|
|
56
|
+
entryComponent?: ComponentType<EntryComponentProps>;
|
|
57
|
+
isMentionLoading?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare class MentionSuggestions extends Component<MentionSuggestionsProps> {
|
|
60
|
+
static propTypes: {
|
|
61
|
+
open: PropTypes.Validator<boolean>;
|
|
62
|
+
onOpenChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
63
|
+
entityMutability: PropTypes.Requireable<string>;
|
|
64
|
+
entryComponent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
65
|
+
onAddMention: PropTypes.Requireable<(...args: any[]) => any>;
|
|
66
|
+
suggestions: PropTypes.Validator<any[]>;
|
|
67
|
+
handleScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
68
|
+
isMentionLoading: PropTypes.Requireable<boolean>;
|
|
69
|
+
};
|
|
70
|
+
state: {
|
|
71
|
+
focusedOptionIndex: number;
|
|
72
|
+
};
|
|
73
|
+
key: string;
|
|
74
|
+
popover?: HTMLElement;
|
|
75
|
+
activeOffsetKey?: string;
|
|
76
|
+
lastSearchValue?: string;
|
|
77
|
+
lastActiveTrigger?: string;
|
|
78
|
+
lastSelectionIsInsideWord?: Iterable<string, boolean>;
|
|
79
|
+
constructor(props: MentionSuggestionsProps);
|
|
80
|
+
componentDidUpdate(): void;
|
|
81
|
+
componentWillUnmount(): void;
|
|
82
|
+
onEditorStateChange: (editorState: EditorState) => EditorState;
|
|
83
|
+
onSearchChange: (editorState: EditorState, selection: SelectionState, activeOffsetKey: string | undefined, lastActiveOffsetKey: string | undefined, trigger: string) => void;
|
|
84
|
+
onDownArrow: (keyboardEvent: KeyboardEvent) => void;
|
|
85
|
+
onTab: (keyboardEvent: KeyboardEvent) => void;
|
|
86
|
+
onUpArrow: (keyboardEvent: KeyboardEvent) => void;
|
|
87
|
+
onEscape: (keyboardEvent: KeyboardEvent) => void;
|
|
88
|
+
onMentionSelect: (mention: MentionData | null) => void;
|
|
89
|
+
onMentionFocus: (index: number) => void;
|
|
90
|
+
commitSelection: () => DraftHandleValue;
|
|
91
|
+
openDropdown: () => void;
|
|
92
|
+
closeDropdown: () => void;
|
|
93
|
+
private getMentionKey;
|
|
94
|
+
renderSuggestionsList: (props: RenderSuggestionsProps) => ReactElement;
|
|
95
|
+
render(): ReactElement | null;
|
|
96
|
+
}
|
|
97
|
+
export default MentionSuggestions;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { MentionPluginStore, PopperOptions } from '..';
|
|
3
|
-
import { MentionPluginTheme } from '../theme';
|
|
4
|
-
export interface PopoverProps {
|
|
5
|
-
store: MentionPluginStore;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
theme: MentionPluginTheme;
|
|
8
|
-
popperOptions?: PopperOptions;
|
|
9
|
-
handleScroll?: React.UIEventHandler<HTMLElement>;
|
|
10
|
-
}
|
|
11
|
-
export default function Popover({ store, children, theme, popperOptions, handleScroll, }: PopoverProps): ReactElement;
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { MentionPluginStore, PopperOptions } from '..';
|
|
3
|
+
import { MentionPluginTheme } from '../theme';
|
|
4
|
+
export interface PopoverProps {
|
|
5
|
+
store: MentionPluginStore;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
theme: MentionPluginTheme;
|
|
8
|
+
popperOptions?: PopperOptions;
|
|
9
|
+
handleScroll?: React.UIEventHandler<HTMLElement>;
|
|
10
|
+
}
|
|
11
|
+
export default function Popover({ store, children, theme, popperOptions, handleScroll, }: PopoverProps): ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { EditorState } from "draft-js";
|
|
2
|
-
import { ReactElement, ReactNode } from "react";
|
|
3
|
-
import { MentionPluginStore } from ".";
|
|
4
|
-
export interface MentionSuggestionsPortalProps {
|
|
5
|
-
offsetKey: string;
|
|
6
|
-
store: MentionPluginStore;
|
|
7
|
-
getEditorState(): EditorState;
|
|
8
|
-
setEditorState(state: EditorState): void;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
export default function MentionSuggestionsPortal(props: MentionSuggestionsPortalProps): ReactElement;
|
|
1
|
+
import { EditorState } from "draft-js";
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
import { MentionPluginStore } from ".";
|
|
4
|
+
export interface MentionSuggestionsPortalProps {
|
|
5
|
+
offsetKey: string;
|
|
6
|
+
store: MentionPluginStore;
|
|
7
|
+
getEditorState(): EditorState;
|
|
8
|
+
setEditorState(state: EditorState): void;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export default function MentionSuggestionsPortal(props: MentionSuggestionsPortalProps): ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/lib/defaultRegExp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: string;
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: string;
|
|
2
|
+
export default _default;
|
package/lib/index.cjs.js
CHANGED
|
@@ -108,8 +108,8 @@ function Mention(props) {
|
|
|
108
108
|
}, children);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
/**
|
|
112
|
-
* Return tail end of the string matching trigger upto the position.
|
|
111
|
+
/**
|
|
112
|
+
* Return tail end of the string matching trigger upto the position.
|
|
113
113
|
*/
|
|
114
114
|
function getSearchTextAt(blockText, position, triggers) {
|
|
115
115
|
var str = blockText.substr(0, position);
|
|
@@ -853,16 +853,16 @@ var defaultRegExp = '[' + '\\w-' +
|
|
|
853
853
|
"\xC0-\u1EF9" + ']';
|
|
854
854
|
|
|
855
855
|
var defaultTheme = {
|
|
856
|
-
mention: "
|
|
856
|
+
mention: "m5ulr2v",
|
|
857
857
|
// CSS class for suggestions component
|
|
858
|
-
mentionSuggestions: "
|
|
859
|
-
mentionSuggestionsPopup: "
|
|
860
|
-
mentionSuggestionsPopupVisible: "
|
|
858
|
+
mentionSuggestions: "m1xyry5h",
|
|
859
|
+
mentionSuggestionsPopup: "m1tc7w8m",
|
|
860
|
+
mentionSuggestionsPopupVisible: "m19zchyv",
|
|
861
861
|
// CSS classes for an entry in the suggestions component
|
|
862
|
-
mentionSuggestionsEntry: "
|
|
863
|
-
mentionSuggestionsEntryFocused: "
|
|
864
|
-
mentionSuggestionsEntryText: "
|
|
865
|
-
mentionSuggestionsEntryAvatar: "
|
|
862
|
+
mentionSuggestionsEntry: "m1br6kyv",
|
|
863
|
+
mentionSuggestionsEntryFocused: "m1gl1tzz",
|
|
864
|
+
mentionSuggestionsEntryText: "mttoqfr",
|
|
865
|
+
mentionSuggestionsEntryAvatar: "mz03dgo"
|
|
866
866
|
};
|
|
867
867
|
|
|
868
868
|
var findMentionEntities = function findMentionEntities(triggers) {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
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 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
|
-
/** Optional explicit React key – takes precedence over id/name. Must be unique. */
|
|
28
|
-
key?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface MultiMentionData {
|
|
31
|
-
[fieldName: string]: MentionData[];
|
|
32
|
-
}
|
|
33
|
-
export interface MentionPluginStore {
|
|
34
|
-
setEditorState?(editorState: EditorState): void;
|
|
35
|
-
getEditorState?(): EditorState;
|
|
36
|
-
getPortalClientRect(offsetKey: string): ClientRect;
|
|
37
|
-
getAllSearches(): Map<string, string>;
|
|
38
|
-
isEscaped(offsetKey: string): boolean;
|
|
39
|
-
escapeSearch(offsetKey: string): void;
|
|
40
|
-
resetEscapedSearch(): void;
|
|
41
|
-
register(offsetKey: string): void;
|
|
42
|
-
updatePortalClientRect(offsetKey: string, funct: ClientRectFunction): void;
|
|
43
|
-
unregister(offsetKey: string): void;
|
|
44
|
-
getIsOpened(): boolean;
|
|
45
|
-
setIsOpened(nextIsOpened: boolean): void;
|
|
46
|
-
getReferenceElement(): HTMLElement | null;
|
|
47
|
-
setReferenceElement(element: HTMLElement | null): void;
|
|
48
|
-
}
|
|
49
|
-
export interface MentionPluginConfig {
|
|
50
|
-
mentionPrefix?: string;
|
|
51
|
-
theme?: MentionPluginTheme;
|
|
52
|
-
positionSuggestions?: PositionSuggestionsFn;
|
|
53
|
-
mentionComponent?: ComponentType<SubMentionComponentProps>;
|
|
54
|
-
mentionSuggestionsComponent?: ComponentType;
|
|
55
|
-
entityMutability?: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE';
|
|
56
|
-
mentionTrigger?: string | string[];
|
|
57
|
-
mentionRegExp?: string;
|
|
58
|
-
supportWhitespace?: boolean;
|
|
59
|
-
popperOptions?: PopperOptions;
|
|
60
|
-
}
|
|
61
|
-
interface ClientRectFunction {
|
|
62
|
-
(): ClientRect;
|
|
63
|
-
}
|
|
64
|
-
declare const _default: (config?: MentionPluginConfig) => EditorPlugin & {
|
|
65
|
-
MentionSuggestions: ComponentType<MentionSuggestionsPubProps>;
|
|
66
|
-
};
|
|
67
|
-
export default _default;
|
|
68
|
-
export declare const defaultSuggestionsFilter: (searchValue: string, suggestions: MentionData[] | MultiMentionData, trigger?: string | undefined) => MentionData[];
|
|
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 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
|
+
/** Optional explicit React key – takes precedence over id/name. Must be unique. */
|
|
28
|
+
key?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface MultiMentionData {
|
|
31
|
+
[fieldName: string]: MentionData[];
|
|
32
|
+
}
|
|
33
|
+
export interface MentionPluginStore {
|
|
34
|
+
setEditorState?(editorState: EditorState): void;
|
|
35
|
+
getEditorState?(): EditorState;
|
|
36
|
+
getPortalClientRect(offsetKey: string): ClientRect;
|
|
37
|
+
getAllSearches(): Map<string, string>;
|
|
38
|
+
isEscaped(offsetKey: string): boolean;
|
|
39
|
+
escapeSearch(offsetKey: string): void;
|
|
40
|
+
resetEscapedSearch(): void;
|
|
41
|
+
register(offsetKey: string): void;
|
|
42
|
+
updatePortalClientRect(offsetKey: string, funct: ClientRectFunction): void;
|
|
43
|
+
unregister(offsetKey: string): void;
|
|
44
|
+
getIsOpened(): boolean;
|
|
45
|
+
setIsOpened(nextIsOpened: boolean): void;
|
|
46
|
+
getReferenceElement(): HTMLElement | null;
|
|
47
|
+
setReferenceElement(element: HTMLElement | null): void;
|
|
48
|
+
}
|
|
49
|
+
export interface MentionPluginConfig {
|
|
50
|
+
mentionPrefix?: string;
|
|
51
|
+
theme?: MentionPluginTheme;
|
|
52
|
+
positionSuggestions?: PositionSuggestionsFn;
|
|
53
|
+
mentionComponent?: ComponentType<SubMentionComponentProps>;
|
|
54
|
+
mentionSuggestionsComponent?: ComponentType;
|
|
55
|
+
entityMutability?: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE';
|
|
56
|
+
mentionTrigger?: string | string[];
|
|
57
|
+
mentionRegExp?: string;
|
|
58
|
+
supportWhitespace?: boolean;
|
|
59
|
+
popperOptions?: PopperOptions;
|
|
60
|
+
}
|
|
61
|
+
interface ClientRectFunction {
|
|
62
|
+
(): ClientRect;
|
|
63
|
+
}
|
|
64
|
+
declare const _default: (config?: MentionPluginConfig) => EditorPlugin & {
|
|
65
|
+
MentionSuggestions: ComponentType<MentionSuggestionsPubProps>;
|
|
66
|
+
};
|
|
67
|
+
export default _default;
|
|
68
|
+
export declare const defaultSuggestionsFilter: (searchValue: string, suggestions: MentionData[] | MultiMentionData, trigger?: string | undefined) => MentionData[];
|
package/lib/index.esm.js
CHANGED
|
@@ -104,8 +104,8 @@ function Mention(props) {
|
|
|
104
104
|
}, children);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
/**
|
|
108
|
-
* Return tail end of the string matching trigger upto the position.
|
|
107
|
+
/**
|
|
108
|
+
* Return tail end of the string matching trigger upto the position.
|
|
109
109
|
*/
|
|
110
110
|
function getSearchTextAt(blockText, position, triggers) {
|
|
111
111
|
var str = blockText.substr(0, position);
|
|
@@ -849,16 +849,16 @@ var defaultRegExp = '[' + '\\w-' +
|
|
|
849
849
|
"\xC0-\u1EF9" + ']';
|
|
850
850
|
|
|
851
851
|
var defaultTheme = {
|
|
852
|
-
mention: "
|
|
852
|
+
mention: "m5ulr2v",
|
|
853
853
|
// CSS class for suggestions component
|
|
854
|
-
mentionSuggestions: "
|
|
855
|
-
mentionSuggestionsPopup: "
|
|
856
|
-
mentionSuggestionsPopupVisible: "
|
|
854
|
+
mentionSuggestions: "m1xyry5h",
|
|
855
|
+
mentionSuggestionsPopup: "m1tc7w8m",
|
|
856
|
+
mentionSuggestionsPopupVisible: "m19zchyv",
|
|
857
857
|
// CSS classes for an entry in the suggestions component
|
|
858
|
-
mentionSuggestionsEntry: "
|
|
859
|
-
mentionSuggestionsEntryFocused: "
|
|
860
|
-
mentionSuggestionsEntryText: "
|
|
861
|
-
mentionSuggestionsEntryAvatar: "
|
|
858
|
+
mentionSuggestionsEntry: "m1br6kyv",
|
|
859
|
+
mentionSuggestionsEntryFocused: "m1gl1tzz",
|
|
860
|
+
mentionSuggestionsEntryText: "mttoqfr",
|
|
861
|
+
mentionSuggestionsEntryAvatar: "mz03dgo"
|
|
862
862
|
};
|
|
863
863
|
|
|
864
864
|
var findMentionEntities = function findMentionEntities(triggers) {
|
package/lib/mentionStrategy.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ContentBlock, ContentState } from 'draft-js';
|
|
2
|
-
declare const findMentionEntities: (triggers: string[]) => (contentBlock: ContentBlock, callback: (start: number, end: number) => void, contentState: ContentState) => void;
|
|
3
|
-
export default findMentionEntities;
|
|
1
|
+
import { ContentBlock, ContentState } from 'draft-js';
|
|
2
|
+
declare const findMentionEntities: (triggers: string[]) => (contentBlock: ContentBlock, callback: (start: number, end: number) => void, contentState: ContentState) => void;
|
|
3
|
+
export default findMentionEntities;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ContentBlock } from 'draft-js';
|
|
2
|
-
interface FindWithRegexCb {
|
|
3
|
-
(start: number, end: number): void;
|
|
4
|
-
}
|
|
5
|
-
declare const _default: (triggers: string[], supportWhiteSpace: boolean, regExp: string) => (contentBlock: ContentBlock, callback: FindWithRegexCb) => void;
|
|
6
|
-
export default _default;
|
|
1
|
+
import { ContentBlock } from 'draft-js';
|
|
2
|
+
interface FindWithRegexCb {
|
|
3
|
+
(start: number, end: number): void;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: (triggers: string[], supportWhiteSpace: boolean, regExp: string) => (contentBlock: ContentBlock, callback: FindWithRegexCb) => void;
|
|
6
|
+
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EditorState } from 'draft-js';
|
|
2
|
-
import { MentionData } from '..';
|
|
3
|
-
export default function addMention(editorState: EditorState, mention: MentionData, mentionPrefix: string, mentionTrigger: string, entityMutability: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE'): EditorState;
|
|
1
|
+
import { EditorState } from 'draft-js';
|
|
2
|
+
import { MentionData } from '..';
|
|
3
|
+
export default function addMention(editorState: EditorState, mention: MentionData, mentionPrefix: string, mentionTrigger: string, entityMutability: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE'): EditorState;
|
package/lib/plugin.css
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
3
|
-
.
|
|
4
|
-
.
|
|
5
|
-
.
|
|
6
|
-
.
|
|
7
|
-
.
|
|
8
|
-
.
|
|
1
|
+
.m5ulr2v,.m5ulr2v:visited{color:#575f67;cursor:pointer;display:inline-block;background:#e6f3ff;padding-left:2px;padding-right:2px;border-radius:2px;-webkit-text-decoration:none;text-decoration:none;}.m5ulr2v:hover,.m5ulr2v:focus{color:#677584;background:#edf5fd;outline:0;}.m5ulr2v:active{color:#222;background:#455261;}
|
|
2
|
+
.m1xyry5h{border:1px solid #eee;position:absolute;min-width:220px;max-width:440px;background:#fff;border-radius:2px;box-shadow:0px 4px 30px 0px rgba(220,220,220,1);cursor:pointer;padding-top:8px;padding-bottom:8px;z-index:2;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;box-sizing:border-box;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);}
|
|
3
|
+
.m1tc7w8m{opacity:0;-webkit-transition:opacity 0.25s cubic-bezier(0.3,1.2,0.2,1);transition:opacity 0.25s cubic-bezier(0.3,1.2,0.2,1);}
|
|
4
|
+
.m19zchyv{opacity:1;}
|
|
5
|
+
.m1br6kyv{padding:7px 10px 3px 10px;-webkit-transition:background-color 0.4s cubic-bezier(.27,1.27,.48,.56);transition:background-color 0.4s cubic-bezier(.27,1.27,.48,.56);}.m1br6kyv:active{background-color:#cce7ff;}
|
|
6
|
+
.m1gl1tzz{padding:7px 10px 3px 10px;-webkit-transition:background-color 0.4s cubic-bezier(.27,1.27,.48,.56);transition:background-color 0.4s cubic-bezier(.27,1.27,.48,.56);background-color:#e6f3ff;}.m1gl1tzz:active{background-color:#cce7ff;}
|
|
7
|
+
.mttoqfr{display:inline-block;margin-left:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:368px;font-size:0.9em;margin-bottom:0.2em;}
|
|
8
|
+
.mz03dgo{display:inline-block;width:24px;height:24px;border-radius:12px;}
|
package/lib/theme.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export interface MentionPluginTheme {
|
|
2
|
-
mention?: string;
|
|
3
|
-
mentionSuggestions?: string;
|
|
4
|
-
mentionSuggestionsPopup?: string;
|
|
5
|
-
mentionSuggestionsPopupVisible?: string;
|
|
6
|
-
mentionSuggestionsEntry?: string;
|
|
7
|
-
mentionSuggestionsEntryFocused?: string;
|
|
8
|
-
mentionSuggestionsEntryText?: string;
|
|
9
|
-
mentionSuggestionsEntryAvatar?: string;
|
|
10
|
-
[x: string]: string | undefined;
|
|
11
|
-
}
|
|
12
|
-
export declare const defaultTheme: MentionPluginTheme;
|
|
1
|
+
export interface MentionPluginTheme {
|
|
2
|
+
mention?: string;
|
|
3
|
+
mentionSuggestions?: string;
|
|
4
|
+
mentionSuggestionsPopup?: string;
|
|
5
|
+
mentionSuggestionsPopupVisible?: string;
|
|
6
|
+
mentionSuggestionsEntry?: string;
|
|
7
|
+
mentionSuggestionsEntryFocused?: string;
|
|
8
|
+
mentionSuggestionsEntryText?: string;
|
|
9
|
+
mentionSuggestionsEntryAvatar?: string;
|
|
10
|
+
[x: string]: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare const defaultTheme: MentionPluginTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface DecodedOffset {
|
|
2
|
-
blockKey: string;
|
|
3
|
-
decoratorKey: number;
|
|
4
|
-
leafKey: number;
|
|
5
|
-
}
|
|
6
|
-
declare const decodeOffsetKey: (offsetKey: string) => DecodedOffset;
|
|
7
|
-
export default decodeOffsetKey;
|
|
1
|
+
export interface DecodedOffset {
|
|
2
|
+
blockKey: string;
|
|
3
|
+
decoratorKey: number;
|
|
4
|
+
leafKey: number;
|
|
5
|
+
}
|
|
6
|
+
declare const decodeOffsetKey: (offsetKey: string) => DecodedOffset;
|
|
7
|
+
export default decodeOffsetKey;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MentionData, MultiMentionData } from '..';
|
|
2
|
-
declare const defaultSuggestionsFilter: (searchValue: string, suggestions: MultiMentionData | MentionData[], trigger?: string) => MentionData[];
|
|
3
|
-
export default defaultSuggestionsFilter;
|
|
1
|
+
import { MentionData, MultiMentionData } from '..';
|
|
2
|
+
declare const defaultSuggestionsFilter: (searchValue: string, suggestions: MultiMentionData | MentionData[], trigger?: string) => MentionData[];
|
|
3
|
+
export default defaultSuggestionsFilter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorState, SelectionState } from 'draft-js';
|
|
2
|
-
import { SearchTextAtResult } from './getSearchTextAt';
|
|
3
|
-
declare const _default: (editorState: EditorState, selection: SelectionState, triggers: string[]) => SearchTextAtResult;
|
|
4
|
-
export default _default;
|
|
1
|
+
import { EditorState, SelectionState } from 'draft-js';
|
|
2
|
+
import { SearchTextAtResult } from './getSearchTextAt';
|
|
3
|
+
declare const _default: (editorState: EditorState, selection: SelectionState, triggers: string[]) => SearchTextAtResult;
|
|
4
|
+
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export interface SearchTextAtResult {
|
|
2
|
-
begin: number;
|
|
3
|
-
end: number;
|
|
4
|
-
matchingString: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Return tail end of the string matching trigger upto the position.
|
|
8
|
-
*/
|
|
9
|
-
export default function getSearchTextAt(blockText: string, position: number, triggers: string[]): SearchTextAtResult;
|
|
1
|
+
export interface SearchTextAtResult {
|
|
2
|
+
begin: number;
|
|
3
|
+
end: number;
|
|
4
|
+
matchingString: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Return tail end of the string matching trigger upto the position.
|
|
8
|
+
*/
|
|
9
|
+
export default function getSearchTextAt(blockText: string, position: number, triggers: string[]): SearchTextAtResult;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EditorState } from 'draft-js';
|
|
2
|
-
import { Map } from 'immutable';
|
|
3
|
-
interface TriggerForMentionResult {
|
|
4
|
-
activeOffsetKey: string;
|
|
5
|
-
activeTrigger: string;
|
|
6
|
-
}
|
|
7
|
-
export default function getTriggerForMention(editorState: EditorState, searches: Map<string, string>, mentionTriggers: string[]): TriggerForMentionResult | null;
|
|
8
|
-
export {};
|
|
1
|
+
import { EditorState } from 'draft-js';
|
|
2
|
+
import { Map } from 'immutable';
|
|
3
|
+
interface TriggerForMentionResult {
|
|
4
|
+
activeOffsetKey: string;
|
|
5
|
+
activeTrigger: string;
|
|
6
|
+
}
|
|
7
|
+
export default function getTriggerForMention(editorState: EditorState, searches: Map<string, string>, mentionTriggers: string[]): TriggerForMentionResult | null;
|
|
8
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getTypeByTrigger(trigger: string): string;
|
|
1
|
+
export default function getTypeByTrigger(trigger: string): string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
import { MentionData, MentionPluginStore } from '..';
|
|
3
|
-
export interface PositionSuggestionsParams {
|
|
4
|
-
decoratorRect: ClientRect;
|
|
5
|
-
popover: HTMLElement;
|
|
6
|
-
props: {
|
|
7
|
-
open: boolean;
|
|
8
|
-
suggestions: MentionData[];
|
|
9
|
-
store: MentionPluginStore;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export default function positionSuggestions({ decoratorRect, popover, props, }: PositionSuggestionsParams): CSSProperties;
|
|
13
|
-
export type PositionSuggestionsFn = typeof positionSuggestions;
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { MentionData, MentionPluginStore } from '..';
|
|
3
|
+
export interface PositionSuggestionsParams {
|
|
4
|
+
decoratorRect: ClientRect;
|
|
5
|
+
popover: HTMLElement;
|
|
6
|
+
props: {
|
|
7
|
+
open: boolean;
|
|
8
|
+
suggestions: MentionData[];
|
|
9
|
+
store: MentionPluginStore;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export default function positionSuggestions({ decoratorRect, popover, props, }: PositionSuggestionsParams): CSSProperties;
|
|
13
|
+
export type PositionSuggestionsFn = typeof positionSuggestions;
|
package/lib/utils/warning.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const warning: (text: string) => void;
|
|
1
|
+
export declare const warning: (text: string) => void;
|
package/package.json
CHANGED
|
@@ -1,60 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lumel/mention",
|
|
3
|
-
"version": "5.2.
|
|
4
|
-
"sideEffects": [
|
|
5
|
-
"*.css"
|
|
6
|
-
],
|
|
7
|
-
"description": "Mention Plugin for DraftJS",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Nik Graf",
|
|
10
|
-
"email": "nik@nikgraf.com",
|
|
11
|
-
"url": "http://www.nikgraf.com"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "https://github.com/draft-js-plugins/draft-js-plugins.git"
|
|
16
|
-
},
|
|
17
|
-
"main": "lib/index.cjs.js",
|
|
18
|
-
"module": "lib/index.esm.js",
|
|
19
|
-
"types": "./lib/index.d.ts",
|
|
20
|
-
"files": [
|
|
21
|
-
"lib"
|
|
22
|
-
],
|
|
23
|
-
"keywords": [
|
|
24
|
-
"editor",
|
|
25
|
-
"wysiwyg",
|
|
26
|
-
"draft",
|
|
27
|
-
"react",
|
|
28
|
-
"ux",
|
|
29
|
-
"components",
|
|
30
|
-
"widget",
|
|
31
|
-
"react-component"
|
|
32
|
-
],
|
|
33
|
-
"scripts": {
|
|
34
|
-
"clean": "yarn rimraf lib",
|
|
35
|
-
"build": "yarn build:js && yarn build:dts && yarn build:css",
|
|
36
|
-
"build:js": "rollup --config ../../rollup.config.js",
|
|
37
|
-
"build:dts": "yarn run -T tsc -d",
|
|
38
|
-
"build:css": "node ../../scripts/build-css.js $(pwd)",
|
|
39
|
-
"test": "jest"
|
|
40
|
-
},
|
|
41
|
-
"license": "MIT",
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@popperjs/core": "^2.11.8",
|
|
44
|
-
"@types/lodash": "^4.14.195",
|
|
45
|
-
"clsx": "^2.0.0",
|
|
46
|
-
"immutable": "^3.8.3",
|
|
47
|
-
"lodash": "^4.18.1",
|
|
48
|
-
"lodash-es": "^4.18.1",
|
|
49
|
-
"prop-types": "^15.8.1",
|
|
50
|
-
"react-popper": "^2.3.0"
|
|
51
|
-
},
|
|
52
|
-
"peerDependencies": {
|
|
53
|
-
"draft-js": "^0.10.1 || ^0.11.0",
|
|
54
|
-
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
|
|
55
|
-
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
|
|
56
|
-
},
|
|
57
|
-
"publishConfig": {
|
|
58
|
-
"access": "public"
|
|
59
|
-
}
|
|
60
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@lumel/mention",
|
|
3
|
+
"version": "5.2.9",
|
|
4
|
+
"sideEffects": [
|
|
5
|
+
"*.css"
|
|
6
|
+
],
|
|
7
|
+
"description": "Mention Plugin for DraftJS",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Nik Graf",
|
|
10
|
+
"email": "nik@nikgraf.com",
|
|
11
|
+
"url": "http://www.nikgraf.com"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/draft-js-plugins/draft-js-plugins.git"
|
|
16
|
+
},
|
|
17
|
+
"main": "lib/index.cjs.js",
|
|
18
|
+
"module": "lib/index.esm.js",
|
|
19
|
+
"types": "./lib/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"lib"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"editor",
|
|
25
|
+
"wysiwyg",
|
|
26
|
+
"draft",
|
|
27
|
+
"react",
|
|
28
|
+
"ux",
|
|
29
|
+
"components",
|
|
30
|
+
"widget",
|
|
31
|
+
"react-component"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"clean": "yarn rimraf lib",
|
|
35
|
+
"build": "yarn build:js && yarn build:dts && yarn build:css",
|
|
36
|
+
"build:js": "rollup --config ../../rollup.config.js",
|
|
37
|
+
"build:dts": "yarn run -T tsc -d",
|
|
38
|
+
"build:css": "node ../../scripts/build-css.js $(pwd)",
|
|
39
|
+
"test": "jest"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@popperjs/core": "^2.11.8",
|
|
44
|
+
"@types/lodash": "^4.14.195",
|
|
45
|
+
"clsx": "^2.0.0",
|
|
46
|
+
"immutable": "^3.8.3",
|
|
47
|
+
"lodash": "^4.18.1",
|
|
48
|
+
"lodash-es": "^4.18.1",
|
|
49
|
+
"prop-types": "^15.8.1",
|
|
50
|
+
"react-popper": "^2.3.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"draft-js": "^0.10.1 || ^0.11.0",
|
|
54
|
+
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
|
|
55
|
+
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"resolutions": {
|
|
61
|
+
"postcss": "^8.5.10",
|
|
62
|
+
"serialize-javascript": "^7.0.5",
|
|
63
|
+
"micromatch": "^4.0.8",
|
|
64
|
+
"yaml": "^2.8.3",
|
|
65
|
+
"webpack-dev-middleware": "^5.3.4",
|
|
66
|
+
"braces": "^3.0.3",
|
|
67
|
+
"minimatch": "^9.0.9",
|
|
68
|
+
"esbuild": "^0.25.10",
|
|
69
|
+
"@tootallnate/once": "^2.0.1",
|
|
70
|
+
"get-intrinsic": "1.3.1",
|
|
71
|
+
"tar": "7.5.15"
|
|
72
|
+
}
|
|
73
|
+
}
|