@draft-js-plugins/emoji
Advanced tools
@@ -16,2 +16,4 @@ # Change Log | ||
- use the setEditorState and getEditorState functions from props.store in EmojiSuggestionsPortal | ||
- update emojione to emoji-toolkit | ||
- remove defaultImagePath, defaultImageType and cacheBust to customize components | ||
@@ -18,0 +20,0 @@ ## 2.1.3 |
@@ -1,13 +0,10 @@ | ||
import { ReactElement, ReactNode } from 'react'; | ||
import { EmojiPluginTheme } from '../../index'; | ||
import { ComponentType, ReactElement, ReactNode } from 'react'; | ||
import { EmojiInlineTextProps, EmojiPluginTheme } from '../../index'; | ||
export interface EmojiProps { | ||
children: ReactNode; | ||
theme: EmojiPluginTheme; | ||
cacheBustParam: string; | ||
imagePath: string; | ||
imageType: string; | ||
className: string; | ||
decoratedText: string; | ||
useNativeArt: boolean; | ||
emojiInlineText: ComponentType<EmojiInlineTextProps>; | ||
} | ||
export default function Emoji({ theme, cacheBustParam, imagePath, imageType, className, decoratedText, useNativeArt, children, }: EmojiProps): ReactElement; | ||
export default function Emoji({ theme, className, decoratedText, emojiInlineText: EmojiInlineText, children, }: EmojiProps): ReactElement; |
@@ -1,9 +0,6 @@ | ||
import { Component, MouseEvent, ReactElement, ReactNode } from 'react'; | ||
import { Component, ComponentType, MouseEvent, ReactElement, ReactNode } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { EmojiPluginStore, EmojiPluginTheme, EmojiSelectGroup } from '../../index'; | ||
import { EmojiImageProps, EmojiPluginStore, EmojiPluginTheme, EmojiSelectGroup } from '../../index'; | ||
export declare type EmojiSelectPubParams = Record<string, unknown>; | ||
interface EmojiSelectParams extends EmojiSelectPubParams { | ||
cacheBustParam: string; | ||
imagePath: string; | ||
imageType: string; | ||
theme: EmojiPluginTheme; | ||
@@ -14,9 +11,6 @@ store: EmojiPluginStore; | ||
toneSelectOpenDelay?: number; | ||
useNativeArt?: boolean; | ||
emojiImage: ComponentType<EmojiImageProps>; | ||
} | ||
export default class EmojiSelect extends Component<EmojiSelectParams> { | ||
static propTypes: { | ||
cacheBustParam: PropTypes.Validator<string>; | ||
imagePath: PropTypes.Validator<string>; | ||
imageType: PropTypes.Validator<string>; | ||
theme: PropTypes.Validator<object>; | ||
@@ -31,3 +25,2 @@ store: PropTypes.Validator<object>; | ||
toneSelectOpenDelay: PropTypes.Requireable<number>; | ||
useNativeArt: PropTypes.Requireable<boolean>; | ||
}; | ||
@@ -34,0 +27,0 @@ static defaultProps: { |
@@ -1,4 +0,4 @@ | ||
import { Component, ReactElement } from 'react'; | ||
import { Component, ComponentType, ReactElement } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { EmojiPluginTheme } from '../../../../index'; | ||
import { EmojiImageProps, EmojiPluginTheme } from '../../../../index'; | ||
interface EntryProps { | ||
@@ -8,5 +8,2 @@ isFocused?: boolean; | ||
theme: EmojiPluginTheme; | ||
cacheBustParam: string; | ||
imagePath: string; | ||
imageType: string; | ||
emoji: string; | ||
@@ -16,10 +13,7 @@ checkMouseDown(): boolean; | ||
onEmojiMouseDown?(entryComponent: Entry, toneSet: string[] | null): void; | ||
useNativeArt?: boolean; | ||
toneSet?: string[] | null; | ||
emojiImage: ComponentType<EmojiImageProps>; | ||
} | ||
export default class Entry extends Component<EntryProps> { | ||
static propTypes: { | ||
cacheBustParam: PropTypes.Validator<string>; | ||
imagePath: PropTypes.Validator<string>; | ||
imageType: PropTypes.Validator<string>; | ||
theme: PropTypes.Validator<object>; | ||
@@ -31,3 +25,2 @@ emoji: PropTypes.Validator<string>; | ||
onEmojiMouseDown: PropTypes.Requireable<(...args: any[]) => any>; | ||
useNativeArt: PropTypes.Requireable<boolean>; | ||
}; | ||
@@ -34,0 +27,0 @@ static defaultProps: { |
@@ -1,11 +0,8 @@ | ||
import { Component, ReactElement } from 'react'; | ||
import { Component, ComponentType, ReactElement } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Entry from '../../Entry'; | ||
import { EmojiPluginTheme, EmojiSelectGroup } from '../../../../../index'; | ||
import { EmojiImageProps, EmojiPluginTheme, EmojiSelectGroup } from '../../../../../index'; | ||
import { EmojiStrategy } from '../../../../../utils/createEmojisFromStrategy'; | ||
interface GroupProps { | ||
hasRenderedEmoji?: boolean; | ||
cacheBustParam: string; | ||
imagePath: string; | ||
imageType: string; | ||
theme: EmojiPluginTheme; | ||
@@ -17,3 +14,3 @@ group: EmojiSelectGroup; | ||
onEmojiMouseDown(entryComponent: Entry, toneSet: string[] | null): void; | ||
useNativeArt?: boolean; | ||
emojiImage: ComponentType<EmojiImageProps>; | ||
isActive?: boolean; | ||
@@ -23,5 +20,2 @@ } | ||
static propTypes: { | ||
cacheBustParam: PropTypes.Validator<string>; | ||
imagePath: PropTypes.Validator<string>; | ||
imageType: PropTypes.Validator<string>; | ||
theme: PropTypes.Validator<object>; | ||
@@ -33,3 +27,2 @@ group: PropTypes.Validator<object>; | ||
onEmojiMouseDown: PropTypes.Validator<(...args: any[]) => any>; | ||
useNativeArt: PropTypes.Requireable<boolean>; | ||
isActive: PropTypes.Requireable<boolean>; | ||
@@ -36,0 +29,0 @@ }; |
@@ -1,5 +0,5 @@ | ||
import { Component, ReactElement, WheelEvent } from 'react'; | ||
import { Component, ComponentType, ReactElement, WheelEvent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Scrollbars, positionValues } from 'react-custom-scrollbars'; | ||
import { EmojiPluginTheme, EmojiSelectGroup } from '../../../../index'; | ||
import { EmojiImageProps, EmojiPluginTheme, EmojiSelectGroup } from '../../../../index'; | ||
import { EmojiStrategy } from '../../../../utils/createEmojisFromStrategy'; | ||
@@ -9,5 +9,2 @@ import Entry from '../Entry'; | ||
activeGroup?: number; | ||
cacheBustParam: string; | ||
imagePath: string; | ||
imageType: string; | ||
theme: EmojiPluginTheme; | ||
@@ -20,3 +17,3 @@ groups: EmojiSelectGroup[]; | ||
onGroupScroll(activeGroup: number): void; | ||
useNativeArt?: boolean; | ||
emojiImage: ComponentType<EmojiImageProps>; | ||
isOpen: boolean; | ||
@@ -26,5 +23,2 @@ } | ||
static propTypes: { | ||
cacheBustParam: PropTypes.Validator<string>; | ||
imagePath: PropTypes.Validator<string>; | ||
imageType: PropTypes.Validator<string>; | ||
theme: PropTypes.Validator<object>; | ||
@@ -37,3 +31,2 @@ groups: PropTypes.Validator<(object | null | undefined)[]>; | ||
onGroupScroll: PropTypes.Validator<(...args: any[]) => any>; | ||
useNativeArt: PropTypes.Requireable<boolean>; | ||
isOpen: PropTypes.Requireable<boolean>; | ||
@@ -40,0 +33,0 @@ }; |
@@ -1,11 +0,8 @@ | ||
import { Component, ReactElement, WheelEvent } from 'react'; | ||
import { Component, ComponentType, ReactElement, WheelEvent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Groups from './Groups'; | ||
import { EmojiPluginStore, EmojiPluginTheme, EmojiSelectGroup } from '../../../index'; | ||
import { EmojiImageProps, EmojiPluginStore, EmojiPluginTheme, EmojiSelectGroup } from '../../../index'; | ||
import { EmojiStrategy } from '../../../utils/createEmojisFromStrategy'; | ||
import Entry from './Entry'; | ||
interface PopoverProps { | ||
cacheBustParam: string; | ||
imagePath: string; | ||
imageType: string; | ||
theme: EmojiPluginTheme; | ||
@@ -17,9 +14,6 @@ store: EmojiPluginStore; | ||
isOpen?: boolean; | ||
useNativeArt?: boolean; | ||
emojiImage: ComponentType<EmojiImageProps>; | ||
} | ||
export default class Popover extends Component<PopoverProps> { | ||
static propTypes: { | ||
cacheBustParam: PropTypes.Validator<string>; | ||
imagePath: PropTypes.Validator<string>; | ||
imageType: PropTypes.Validator<string>; | ||
theme: PropTypes.Validator<object>; | ||
@@ -31,3 +25,2 @@ store: PropTypes.Validator<object>; | ||
isOpen: PropTypes.Requireable<boolean>; | ||
useNativeArt: PropTypes.Requireable<boolean>; | ||
}; | ||
@@ -34,0 +27,0 @@ activeEmoji: Entry | null; |
@@ -1,4 +0,4 @@ | ||
import { Component, ReactElement } from 'react'; | ||
import { Component, ComponentType, ReactElement } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { EmojiPluginTheme } from '../../../../index'; | ||
import { EmojiImageProps, EmojiPluginTheme } from '../../../../index'; | ||
interface Boundaries { | ||
@@ -13,5 +13,2 @@ left: number; | ||
interface ToneSelectParams { | ||
cacheBustParam: string; | ||
imagePath: string; | ||
imageType: string; | ||
theme: EmojiPluginTheme; | ||
@@ -24,8 +21,6 @@ bounds: { | ||
toneSet: string[] | null; | ||
emojiImage: ComponentType<EmojiImageProps>; | ||
} | ||
export default class ToneSelect extends Component<ToneSelectParams> { | ||
static propTypes: { | ||
cacheBustParam: PropTypes.Validator<string>; | ||
imagePath: PropTypes.Validator<string>; | ||
imageType: PropTypes.Validator<string>; | ||
theme: PropTypes.Validator<object>; | ||
@@ -32,0 +27,0 @@ bounds: PropTypes.Validator<PropTypes.InferProps<{ |
@@ -1,2 +0,3 @@ | ||
import { Component, MouseEvent, ReactElement } from 'react'; | ||
import { EmojiImageProps } from 'packages/emoji/src'; | ||
import { Component, ComponentType, MouseEvent, ReactElement } from 'react'; | ||
import { EmojiPluginTheme } from '../../../theme'; | ||
@@ -9,8 +10,5 @@ interface EntryProps { | ||
theme: EmojiPluginTheme; | ||
imagePath: string; | ||
imageType: string; | ||
cacheBustParam: string; | ||
useNativeArt?: boolean; | ||
isFocused: boolean; | ||
id: string; | ||
emojiImage: ComponentType<EmojiImageProps>; | ||
} | ||
@@ -17,0 +15,0 @@ export default class Entry extends Component<EntryProps> { |
@@ -1,6 +0,6 @@ | ||
import { Component, CSSProperties, KeyboardEvent, ReactElement } from 'react'; | ||
import { Component, ComponentType, CSSProperties, KeyboardEvent, ReactElement } from 'react'; | ||
import { DraftHandleValue, EditorState, SelectionState } from 'draft-js'; | ||
import { AriaProps } from '@draft-js-plugins/editor'; | ||
import { List } from 'immutable'; | ||
import { EmojiPLuginCallbacks, EmojiPluginStore } from '../..'; | ||
import { EmojiImageProps, EmojiPLuginCallbacks, EmojiPluginStore } from '../..'; | ||
import { PositionSuggestionsParams } from '../../utils/positionSuggestions'; | ||
@@ -24,6 +24,3 @@ import { EmojiPluginTheme } from '../../theme'; | ||
theme: EmojiPluginTheme; | ||
cacheBustParam: string; | ||
imagePath: string; | ||
imageType: string; | ||
useNativeArt?: boolean; | ||
emojiImage: ComponentType<EmojiImageProps>; | ||
} | ||
@@ -30,0 +27,0 @@ export default class EmojiSuggestions extends Component<EmojiSuggestionsParams> { |
@@ -13,2 +13,12 @@ import { ComponentType, CSSProperties, KeyboardEvent, ReactNode } from 'react'; | ||
export type { EmojiPluginTheme }; | ||
export interface EmojiImageProps { | ||
emoji: string; | ||
theme: EmojiPluginTheme; | ||
} | ||
export interface EmojiInlineTextProps { | ||
theme: EmojiPluginTheme; | ||
decoratedText: string; | ||
children: ReactNode; | ||
className?: string; | ||
} | ||
export interface EmojiSuggestionsState { | ||
@@ -34,5 +44,2 @@ isActive?: boolean; | ||
theme?: EmojiPluginTheme; | ||
imagePath?: string; | ||
imageType?: string; | ||
allowImageCache?: boolean; | ||
positionSuggestions?: (arg: PositionSuggestionsParams) => CSSProperties; | ||
@@ -46,2 +53,4 @@ priorityList?: { | ||
useNativeArt?: boolean; | ||
emojiImage?: ComponentType<EmojiImageProps>; | ||
emojiInlineText?: ComponentType<EmojiInlineTextProps>; | ||
} | ||
@@ -48,0 +57,0 @@ interface GetClientRectFn { |
@@ -6,7 +6,2 @@ export interface EmojiStrategy { | ||
} | ||
export default function createEmojisFromStrategy(strategy: { | ||
[x: string]: { | ||
category: string; | ||
shortname: string; | ||
}; | ||
}): EmojiStrategy; | ||
export default function createEmojisFromStrategy(): EmojiStrategy; |
{ | ||
"name": "@draft-js-plugins/emoji", | ||
"version": "4.0.0-beta4", | ||
"version": "4.0.0-beta5", | ||
"description": "Emoji Plugin for DraftJS", | ||
@@ -42,3 +42,5 @@ "author": { | ||
"clsx": "^1.0.4", | ||
"emojione": "^2.2.7", | ||
"emoji-toolkit": "^6.0.1", | ||
"emojibase": "^5.0.0", | ||
"emojibase-data": "^6.0.0", | ||
"find-with-regex": "^1.1.3", | ||
@@ -58,3 +60,2 @@ "immutable": "~3.8.2", | ||
"devDependencies": { | ||
"@types/emojione": "^2.2.6", | ||
"@types/react-custom-scrollbars": "^4.0.7", | ||
@@ -61,0 +62,0 @@ "@types/react-icons": "3.0.0" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2
-33.33%36
5.88%173906
-4.25%16
14.29%4151
-3.93%