@atlaskit/editor-plugin-emoji 0.4.12 → 1.0.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-emoji
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#61337](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/61337) [`2d827c1d6c40`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2d827c1d6c40) - Remove emojiProvider property from the sharedState of the emoji plugin. This avoids a performance degradation if the provider is not memoised. It can still be retrieved via the provider factory if required internally.
8
+
3
9
  ## 0.4.12
4
10
 
5
11
  ### Patch Changes
@@ -204,13 +204,18 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
204
204
  }];
205
205
  },
206
206
  getSharedState: function getSharedState(editorState) {
207
+ var _emojiPluginKey$getSt;
207
208
  if (!editorState) {
208
209
  return undefined;
209
210
  }
210
- var emojiPluginState = emojiPluginKey.getState(editorState);
211
- return _objectSpread(_objectSpread({}, emojiPluginState), {}, {
211
+ var _ref8 = (_emojiPluginKey$getSt = emojiPluginKey.getState(editorState)) !== null && _emojiPluginKey$getSt !== void 0 ? _emojiPluginKey$getSt : {},
212
+ emojiResourceConfig = _ref8.emojiResourceConfig,
213
+ asciiMap = _ref8.asciiMap;
214
+ return {
215
+ emojiResourceConfig: emojiResourceConfig,
216
+ asciiMap: asciiMap,
212
217
  typeAheadHandler: typeAhead
213
- });
218
+ };
214
219
  },
215
220
  actions: {
216
221
  openTypeAhead: function openTypeAhead(inputMethod) {
@@ -225,8 +230,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
225
230
  insertEmoji: (0, _insertEmoji.insertEmoji)(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)
226
231
  },
227
232
  pluginsOptions: {
228
- quickInsert: function quickInsert(_ref8) {
229
- var formatMessage = _ref8.formatMessage;
233
+ quickInsert: function quickInsert(_ref9) {
234
+ var formatMessage = _ref9.formatMessage;
230
235
  return [{
231
236
  id: 'emoji',
232
237
  title: formatMessage(_messages.toolbarInsertBlockMessages.emoji),
@@ -339,12 +344,12 @@ function createEmojiPlugin(pmPluginFactoryParams) {
339
344
  return {};
340
345
  },
341
346
  apply: function apply(tr, pluginState) {
342
- var _ref9 = tr.getMeta(emojiPluginKey) || {
347
+ var _ref10 = tr.getMeta(emojiPluginKey) || {
343
348
  action: null,
344
349
  params: null
345
350
  },
346
- action = _ref9.action,
347
- params = _ref9.params;
351
+ action = _ref10.action,
352
+ params = _ref10.params;
348
353
  var newPluginState = pluginState;
349
354
  switch (action) {
350
355
  case ACTIONS.SET_PROVIDER:
@@ -185,12 +185,17 @@ export const emojiPlugin = ({
185
185
  }];
186
186
  },
187
187
  getSharedState(editorState) {
188
+ var _emojiPluginKey$getSt;
188
189
  if (!editorState) {
189
190
  return undefined;
190
191
  }
191
- const emojiPluginState = emojiPluginKey.getState(editorState);
192
+ const {
193
+ emojiResourceConfig,
194
+ asciiMap
195
+ } = (_emojiPluginKey$getSt = emojiPluginKey.getState(editorState)) !== null && _emojiPluginKey$getSt !== void 0 ? _emojiPluginKey$getSt : {};
192
196
  return {
193
- ...emojiPluginState,
197
+ emojiResourceConfig,
198
+ asciiMap,
194
199
  typeAheadHandler: typeAhead
195
200
  };
196
201
  },
@@ -191,13 +191,18 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
191
191
  }];
192
192
  },
193
193
  getSharedState: function getSharedState(editorState) {
194
+ var _emojiPluginKey$getSt;
194
195
  if (!editorState) {
195
196
  return undefined;
196
197
  }
197
- var emojiPluginState = emojiPluginKey.getState(editorState);
198
- return _objectSpread(_objectSpread({}, emojiPluginState), {}, {
198
+ var _ref8 = (_emojiPluginKey$getSt = emojiPluginKey.getState(editorState)) !== null && _emojiPluginKey$getSt !== void 0 ? _emojiPluginKey$getSt : {},
199
+ emojiResourceConfig = _ref8.emojiResourceConfig,
200
+ asciiMap = _ref8.asciiMap;
201
+ return {
202
+ emojiResourceConfig: emojiResourceConfig,
203
+ asciiMap: asciiMap,
199
204
  typeAheadHandler: typeAhead
200
- });
205
+ };
201
206
  },
202
207
  actions: {
203
208
  openTypeAhead: function openTypeAhead(inputMethod) {
@@ -212,8 +217,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
212
217
  insertEmoji: insertEmoji(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)
213
218
  },
214
219
  pluginsOptions: {
215
- quickInsert: function quickInsert(_ref8) {
216
- var formatMessage = _ref8.formatMessage;
220
+ quickInsert: function quickInsert(_ref9) {
221
+ var formatMessage = _ref9.formatMessage;
217
222
  return [{
218
223
  id: 'emoji',
219
224
  title: formatMessage(messages.emoji),
@@ -326,12 +331,12 @@ export function createEmojiPlugin(pmPluginFactoryParams) {
326
331
  return {};
327
332
  },
328
333
  apply: function apply(tr, pluginState) {
329
- var _ref9 = tr.getMeta(emojiPluginKey) || {
334
+ var _ref10 = tr.getMeta(emojiPluginKey) || {
330
335
  action: null,
331
336
  params: null
332
337
  },
333
- action = _ref9.action,
334
- params = _ref9.params;
338
+ action = _ref10.action,
339
+ params = _ref10.params;
335
340
  var newPluginState = pluginState;
336
341
  switch (action) {
337
342
  case ACTIONS.SET_PROVIDER:
@@ -17,7 +17,7 @@ export type EmojiPluginSharedState = EmojiPluginState & {
17
17
  export type EmojiPlugin = NextEditorPlugin<'emoji', {
18
18
  pluginConfiguration: EmojiPluginOptions | undefined;
19
19
  dependencies: [OptionalPlugin<AnalyticsPlugin>, TypeAheadPlugin];
20
- sharedState: EmojiPluginSharedState | undefined;
20
+ sharedState: Omit<EmojiPluginSharedState, 'emojiProvider'> | undefined;
21
21
  commands: {
22
22
  insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
23
23
  };
@@ -20,7 +20,7 @@ export type EmojiPlugin = NextEditorPlugin<'emoji', {
20
20
  OptionalPlugin<AnalyticsPlugin>,
21
21
  TypeAheadPlugin
22
22
  ];
23
- sharedState: EmojiPluginSharedState | undefined;
23
+ sharedState: Omit<EmojiPluginSharedState, 'emojiProvider'> | undefined;
24
24
  commands: {
25
25
  insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
26
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-emoji",
3
- "version": "0.4.12",
3
+ "version": "1.0.0",
4
4
  "description": "Emoji plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@atlaskit/adf-schema": "^35.1.1",
24
- "@atlaskit/editor-common": "^76.26.0",
24
+ "@atlaskit/editor-common": "^76.27.0",
25
25
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
26
26
  "@atlaskit/editor-plugin-type-ahead": "^0.8.0",
27
27
  "@atlaskit/editor-prosemirror": "1.1.0",