@atlaskit/editor-plugin-emoji 0.1.1 → 0.2.0
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 +12 -0
- package/dist/cjs/commands/insert-emoji.js +47 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/messages.js +15 -0
- package/dist/cjs/nodeviews/emoji.js +34 -0
- package/dist/cjs/plugin.js +409 -0
- package/dist/cjs/pm-plugins/ascii-input-rules.js +235 -0
- package/dist/cjs/ui/Emoji/index.js +19 -0
- package/dist/es2019/commands/insert-emoji.js +40 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/messages.js +8 -0
- package/dist/es2019/nodeviews/emoji.js +29 -0
- package/dist/es2019/plugin.js +381 -0
- package/dist/es2019/pm-plugins/ascii-input-rules.js +168 -0
- package/dist/es2019/ui/Emoji/index.js +13 -0
- package/dist/esm/commands/insert-emoji.js +39 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/messages.js +8 -0
- package/dist/esm/nodeviews/emoji.js +27 -0
- package/dist/esm/plugin.js +391 -0
- package/dist/esm/pm-plugins/ascii-input-rules.js +224 -0
- package/dist/esm/ui/Emoji/index.js +12 -0
- package/dist/types/commands/insert-emoji.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/messages.d.ts +7 -0
- package/dist/types/nodeviews/emoji.d.ts +7 -0
- package/dist/types/plugin.d.ts +38 -0
- package/dist/types/pm-plugins/ascii-input-rules.d.ts +10 -0
- package/dist/types/types.d.ts +3 -4
- package/dist/types/ui/Emoji/index.d.ts +4 -0
- package/dist/types-ts4.5/commands/insert-emoji.d.ts +4 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/messages.d.ts +7 -0
- package/dist/types-ts4.5/nodeviews/emoji.d.ts +7 -0
- package/dist/types-ts4.5/plugin.d.ts +38 -0
- package/dist/types-ts4.5/pm-plugins/ascii-input-rules.d.ts +10 -0
- package/dist/types-ts4.5/types.d.ts +3 -4
- package/dist/types-ts4.5/ui/Emoji/index.d.ts +4 -0
- package/package.json +29 -23
- package/report.api.md +5 -2
- package/tmp/api-report-tmp.d.ts +5 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { Command, PMPluginFactoryParams, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import type { EmojiDescription, EmojiProvider } from '@atlaskit/emoji';
|
|
6
|
+
import type { EmojiPlugin, EmojiPluginState } from './types';
|
|
7
|
+
export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
|
|
8
|
+
export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
|
|
9
|
+
call: ResultFn;
|
|
10
|
+
clear(): void;
|
|
11
|
+
};
|
|
12
|
+
export declare const defaultListLimit = 50;
|
|
13
|
+
export declare const emojiPlugin: EmojiPlugin;
|
|
14
|
+
/**
|
|
15
|
+
* Actions
|
|
16
|
+
*/
|
|
17
|
+
export declare const ACTIONS: {
|
|
18
|
+
SET_PROVIDER: string;
|
|
19
|
+
SET_RESULTS: string;
|
|
20
|
+
SET_ASCII_MAP: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* Wrapper to call `onLimitReached` when a specified number of calls of that function
|
|
25
|
+
* have been made within a time period.
|
|
26
|
+
*
|
|
27
|
+
* Note: It does not rate limit
|
|
28
|
+
*
|
|
29
|
+
* @param fn Function to wrap
|
|
30
|
+
* @param limitTime Time limit in milliseconds
|
|
31
|
+
* @param limitCount Number of function calls before `onRateReached` is called (per time period)
|
|
32
|
+
* @returns Wrapped function
|
|
33
|
+
*/
|
|
34
|
+
export declare function createRateLimitReachedFunction<LimitedFunction extends (...args: any[]) => any>(fn: Function, limitTime: number, limitCount: number, onLimitReached: () => void): (...args: Parameters<LimitedFunction>) => ReturnType<LimitedFunction> | undefined;
|
|
35
|
+
export declare const setProvider: ((provider?: EmojiProvider) => Command) | undefined;
|
|
36
|
+
export declare const emojiPluginKey: PluginKey<EmojiPluginState>;
|
|
37
|
+
export declare function getEmojiPluginState(state: EditorState): EmojiPluginState;
|
|
38
|
+
export declare function createEmojiPlugin(pmPluginFactoryParams: PMPluginFactoryParams): SafePlugin<EmojiPluginState>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
export declare function inputRulePlugin(schema: Schema, providerFactory: ProviderFactory, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
8
|
+
export declare const stateKey: PluginKey<any>;
|
|
9
|
+
declare const plugins: (schema: Schema, providerFactory: ProviderFactory, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin<any>[];
|
|
10
|
+
export default plugins;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
5
|
-
import type { EmojiId } from '@atlaskit/emoji';
|
|
6
|
-
import type { EmojiDescription, EmojiProvider, EmojiResourceConfig } from '@atlaskit/emoji';
|
|
5
|
+
import type { EmojiDescription, EmojiId, EmojiProvider, EmojiResourceConfig } from '@atlaskit/emoji';
|
|
7
6
|
export interface EmojiPluginOptions {
|
|
8
7
|
headless?: boolean;
|
|
9
8
|
}
|
|
@@ -14,7 +13,7 @@ export type EmojiPluginState = {
|
|
|
14
13
|
};
|
|
15
14
|
export type EmojiPlugin = NextEditorPlugin<'emoji', {
|
|
16
15
|
pluginConfiguration: EmojiPluginOptions | undefined;
|
|
17
|
-
dependencies: [OptionalPlugin<
|
|
16
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, TypeAheadPlugin];
|
|
18
17
|
sharedState: EmojiPluginState | undefined;
|
|
19
18
|
commands: {
|
|
20
19
|
insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EmojiId } from '@atlaskit/emoji';
|
|
4
|
+
export declare const insertEmoji: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
export type Props = InlineNodeViewComponentProps & {
|
|
5
|
+
providerFactory: ProviderFactory;
|
|
6
|
+
};
|
|
7
|
+
export declare function EmojiNodeView(props: Props): JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { Command, PMPluginFactoryParams, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import type { EmojiDescription, EmojiProvider } from '@atlaskit/emoji';
|
|
6
|
+
import type { EmojiPlugin, EmojiPluginState } from './types';
|
|
7
|
+
export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
|
|
8
|
+
export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
|
|
9
|
+
call: ResultFn;
|
|
10
|
+
clear(): void;
|
|
11
|
+
};
|
|
12
|
+
export declare const defaultListLimit = 50;
|
|
13
|
+
export declare const emojiPlugin: EmojiPlugin;
|
|
14
|
+
/**
|
|
15
|
+
* Actions
|
|
16
|
+
*/
|
|
17
|
+
export declare const ACTIONS: {
|
|
18
|
+
SET_PROVIDER: string;
|
|
19
|
+
SET_RESULTS: string;
|
|
20
|
+
SET_ASCII_MAP: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* Wrapper to call `onLimitReached` when a specified number of calls of that function
|
|
25
|
+
* have been made within a time period.
|
|
26
|
+
*
|
|
27
|
+
* Note: It does not rate limit
|
|
28
|
+
*
|
|
29
|
+
* @param fn Function to wrap
|
|
30
|
+
* @param limitTime Time limit in milliseconds
|
|
31
|
+
* @param limitCount Number of function calls before `onRateReached` is called (per time period)
|
|
32
|
+
* @returns Wrapped function
|
|
33
|
+
*/
|
|
34
|
+
export declare function createRateLimitReachedFunction<LimitedFunction extends (...args: any[]) => any>(fn: Function, limitTime: number, limitCount: number, onLimitReached: () => void): (...args: Parameters<LimitedFunction>) => ReturnType<LimitedFunction> | undefined;
|
|
35
|
+
export declare const setProvider: ((provider?: EmojiProvider) => Command) | undefined;
|
|
36
|
+
export declare const emojiPluginKey: PluginKey<EmojiPluginState>;
|
|
37
|
+
export declare function getEmojiPluginState(state: EditorState): EmojiPluginState;
|
|
38
|
+
export declare function createEmojiPlugin(pmPluginFactoryParams: PMPluginFactoryParams): SafePlugin<EmojiPluginState>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
export declare function inputRulePlugin(schema: Schema, providerFactory: ProviderFactory, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
8
|
+
export declare const stateKey: PluginKey<any>;
|
|
9
|
+
declare const plugins: (schema: Schema, providerFactory: ProviderFactory, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin<any>[];
|
|
10
|
+
export default plugins;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
5
|
-
import type { EmojiId } from '@atlaskit/emoji';
|
|
6
|
-
import type { EmojiDescription, EmojiProvider, EmojiResourceConfig } from '@atlaskit/emoji';
|
|
5
|
+
import type { EmojiDescription, EmojiId, EmojiProvider, EmojiResourceConfig } from '@atlaskit/emoji';
|
|
7
6
|
export interface EmojiPluginOptions {
|
|
8
7
|
headless?: boolean;
|
|
9
8
|
}
|
|
@@ -15,7 +14,7 @@ export type EmojiPluginState = {
|
|
|
15
14
|
export type EmojiPlugin = NextEditorPlugin<'emoji', {
|
|
16
15
|
pluginConfiguration: EmojiPluginOptions | undefined;
|
|
17
16
|
dependencies: [
|
|
18
|
-
OptionalPlugin<
|
|
17
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
19
18
|
TypeAheadPlugin
|
|
20
19
|
];
|
|
21
20
|
sharedState: EmojiPluginState | undefined;
|
package/package.json
CHANGED
|
@@ -1,47 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-emoji",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Emoji plugin for @atlaskit/editor-core",
|
|
5
|
-
"author": "Atlassian Pty Ltd",
|
|
6
|
-
"license": "Apache-2.0",
|
|
7
5
|
"publishConfig": {
|
|
8
6
|
"registry": "https://registry.npmjs.org/"
|
|
9
7
|
},
|
|
10
|
-
"atlassian": {
|
|
11
|
-
"team": "Editor",
|
|
12
|
-
"releaseModel": "continuous",
|
|
13
|
-
"singleton": true
|
|
14
|
-
},
|
|
15
8
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
9
|
+
"author": "Atlassian Pty Ltd",
|
|
10
|
+
"license": "Apache-2.0",
|
|
16
11
|
"main": "dist/cjs/index.js",
|
|
17
12
|
"module": "dist/esm/index.js",
|
|
18
13
|
"module:es2019": "dist/es2019/index.js",
|
|
19
14
|
"types": "dist/types/index.d.ts",
|
|
20
|
-
"typesVersions": {
|
|
21
|
-
">=4.5 <4.9": {
|
|
22
|
-
"*": [
|
|
23
|
-
"dist/types-ts4.5/*",
|
|
24
|
-
"dist/types-ts4.5/index.d.ts"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
15
|
"sideEffects": false,
|
|
29
16
|
"atlaskit:src": "src/index.ts",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
17
|
+
"atlassian": {
|
|
18
|
+
"team": "Editor",
|
|
19
|
+
"releaseModel": "continuous",
|
|
20
|
+
"singleton": true
|
|
32
21
|
},
|
|
33
22
|
"dependencies": {
|
|
34
|
-
"@atlaskit/
|
|
23
|
+
"@atlaskit/adf-schema": "^28.1.0",
|
|
24
|
+
"@atlaskit/editor-common": "^74.53.0",
|
|
35
25
|
"@atlaskit/editor-plugin-analytics": "^0.1.4",
|
|
36
26
|
"@atlaskit/editor-plugin-type-ahead": "^0.1.0",
|
|
37
|
-
"@
|
|
27
|
+
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
28
|
+
"@atlaskit/emoji": "^67.4.0",
|
|
29
|
+
"@atlaskit/prosemirror-input-rules": "^2.4.0",
|
|
30
|
+
"@babel/runtime": "^7.0.0",
|
|
31
|
+
"@emotion/react": "^11.7.1",
|
|
32
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
38
33
|
},
|
|
39
34
|
"peerDependencies": {
|
|
40
35
|
"react": "^16.8.0"
|
|
41
36
|
},
|
|
42
37
|
"devDependencies": {
|
|
43
38
|
"@af/visual-regression": "*",
|
|
39
|
+
"@atlaskit/editor-plugin-composition": "^0.0.2",
|
|
40
|
+
"@atlaskit/editor-plugin-decorations": "^0.1.0",
|
|
44
41
|
"@atlaskit/ssr": "*",
|
|
42
|
+
"@atlaskit/util-data-test": "^17.8.0",
|
|
45
43
|
"@atlaskit/visual-regression": "*",
|
|
46
44
|
"@atlaskit/webdriver-runner": "*",
|
|
47
45
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
@@ -52,9 +50,6 @@
|
|
|
52
50
|
},
|
|
53
51
|
"techstack": {
|
|
54
52
|
"@atlassian/frontend": {
|
|
55
|
-
"code-structure": [
|
|
56
|
-
"tangerine-next"
|
|
57
|
-
],
|
|
58
53
|
"import-structure": [
|
|
59
54
|
"atlassian-conventions"
|
|
60
55
|
],
|
|
@@ -88,5 +83,16 @@
|
|
|
88
83
|
]
|
|
89
84
|
}
|
|
90
85
|
},
|
|
86
|
+
"typesVersions": {
|
|
87
|
+
">=4.5 <4.9": {
|
|
88
|
+
"*": [
|
|
89
|
+
"dist/types-ts4.5/*",
|
|
90
|
+
"dist/types-ts4.5/index.d.ts"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"af:exports": {
|
|
95
|
+
".": "./src/index.ts"
|
|
96
|
+
},
|
|
91
97
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
92
98
|
}
|
package/report.api.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<!--SECTION START: Main Entry Types-->
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import type {
|
|
18
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
19
19
|
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
20
20
|
import type { EmojiDescription } from '@atlaskit/emoji';
|
|
21
21
|
import type { EmojiId } from '@atlaskit/emoji';
|
|
@@ -31,7 +31,7 @@ export type EmojiPlugin = NextEditorPlugin<
|
|
|
31
31
|
'emoji',
|
|
32
32
|
{
|
|
33
33
|
pluginConfiguration: EmojiPluginOptions | undefined;
|
|
34
|
-
dependencies: [OptionalPlugin<
|
|
34
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, TypeAheadPlugin];
|
|
35
35
|
sharedState: EmojiPluginState | undefined;
|
|
36
36
|
commands: {
|
|
37
37
|
insertEmoji: (
|
|
@@ -45,6 +45,9 @@ export type EmojiPlugin = NextEditorPlugin<
|
|
|
45
45
|
}
|
|
46
46
|
>;
|
|
47
47
|
|
|
48
|
+
// @public (undocumented)
|
|
49
|
+
export const emojiPlugin: EmojiPlugin;
|
|
50
|
+
|
|
48
51
|
// @public (undocumented)
|
|
49
52
|
export interface EmojiPluginOptions {
|
|
50
53
|
// (undocumented)
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
8
8
|
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
9
9
|
import type { EmojiDescription } from '@atlaskit/emoji';
|
|
10
10
|
import type { EmojiId } from '@atlaskit/emoji';
|
|
@@ -18,13 +18,16 @@ import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
|
18
18
|
// @public (undocumented)
|
|
19
19
|
export type EmojiPlugin = NextEditorPlugin<'emoji', {
|
|
20
20
|
pluginConfiguration: EmojiPluginOptions | undefined;
|
|
21
|
-
dependencies: [OptionalPlugin<
|
|
21
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, TypeAheadPlugin];
|
|
22
22
|
sharedState: EmojiPluginState | undefined;
|
|
23
23
|
commands: {
|
|
24
24
|
insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.ASCII | INPUT_METHOD.PICKER | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
|
|
25
25
|
};
|
|
26
26
|
}>;
|
|
27
27
|
|
|
28
|
+
// @public (undocumented)
|
|
29
|
+
export const emojiPlugin: EmojiPlugin;
|
|
30
|
+
|
|
28
31
|
// @public (undocumented)
|
|
29
32
|
export interface EmojiPluginOptions {
|
|
30
33
|
// (undocumented)
|