@atlaskit/editor-plugin-emoji 7.6.4 → 7.6.7

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,30 @@
1
1
  # @atlaskit/editor-plugin-emoji
2
2
 
3
+ ## 7.6.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
8
+ ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
9
+ project refs are setup
10
+ - Updated dependencies
11
+
12
+ ## 7.6.6
13
+
14
+ ### Patch Changes
15
+
16
+ - [`a05464ea42678`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a05464ea42678) -
17
+ EDITOR-2791 bump adf-schema
18
+ - Updated dependencies
19
+
20
+ ## 7.6.5
21
+
22
+ ### Patch Changes
23
+
24
+ - [`236fe86fc7b5e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/236fe86fc7b5e) -
25
+ NOISSUE: fix emoji node view error logging
26
+ - Updated dependencies
27
+
3
28
  ## 7.6.4
4
29
 
5
30
  ### Patch Changes
@@ -126,6 +126,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
126
126
  if (!emojiResult || !emojiResult.emojis) {
127
127
  resolve([]);
128
128
  } else {
129
+ // @ts-ignore - Workaround for help-center local consumption
130
+
129
131
  var emojiItems = emojiResult.emojis.map(function (emoji) {
130
132
  return memoizedToItem.call(emoji, emojiProvider);
131
133
  });
@@ -135,6 +137,9 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
135
137
  }
136
138
  };
137
139
  emojiProvider.subscribe(emojiProviderChangeHandler);
140
+
141
+ // @ts-ignore - Workaround for help-center local consumption
142
+
138
143
  emojiProvider.filter(TRIGGER.concat(query), {
139
144
  limit: defaultListLimit,
140
145
  skinTone: emojiProvider.getSelectedTone(),
@@ -158,7 +163,9 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
158
163
  emoji: _emoji
159
164
  };
160
165
  }
161
- var matchedItem = isFullShortName(normalizedQuery) ? items.find(function (item) {
166
+ var matchedItem = isFullShortName(normalizedQuery)
167
+ // @ts-ignore - Workaround for help-center local consumption
168
+ ? items.find(function (item) {
162
169
  return item.title.toLowerCase() === normalizedQuery;
163
170
  }) : undefined;
164
171
  return matchedItem;
@@ -198,6 +205,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
198
205
  var emojiNodeType = schema.nodes.emoji;
199
206
  if (node.type === emojiNodeType) {
200
207
  var newText = node.attrs.text;
208
+ // @ts-ignore - Workaround for help-center local consumption
209
+
201
210
  var currentPos = tr.mapping.map(pos);
202
211
  tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
203
212
  }
@@ -377,6 +386,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
377
386
  items: function items(node) {
378
387
  var _api$annotation2;
379
388
  var annotationState = api === null || api === void 0 || (_api$annotation2 = api.annotation) === null || _api$annotation2 === void 0 ? void 0 : _api$annotation2.sharedState.currentState();
389
+ // @ts-ignore - Workaround for help-center local consumption
390
+
380
391
  var activeCommentMark = node.marks.find(function (mark) {
381
392
  return mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false;
382
393
  });
@@ -479,6 +490,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
479
490
  return new _safePlugin.SafePlugin({
480
491
  key: emojiPluginKey,
481
492
  state: {
493
+ // @ts-ignore - Workaround for help-center local consumption
482
494
  init: function init() {
483
495
  if (options !== null && options !== void 0 && options.emojiProvider && (0, _experiments.editorExperiment)('platform_editor_prevent_toolbar_layout_shifts', true)) {
484
496
  return {
@@ -487,6 +499,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
487
499
  }
488
500
  return {};
489
501
  },
502
+ // @ts-ignore - Workaround for help-center local consumption
490
503
  apply: function apply(tr, pluginState) {
491
504
  var _ref11 = tr.getMeta(emojiPluginKey) || {
492
505
  action: null,
@@ -520,7 +533,11 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
520
533
  }
521
534
  },
522
535
  props: {
536
+ // @ts-ignore - Workaround for help-center local consumption
537
+
523
538
  nodeViews: {
539
+ // @ts-ignore - Workaround for help-center local consumption
540
+
524
541
  emoji: function emoji(node) {
525
542
  return new _EmojiNodeView.EmojiNodeView(node, {
526
543
  intl: pmPluginFactoryParams.getIntl(),
@@ -530,6 +547,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
530
547
  }
531
548
  }
532
549
  },
550
+ // @ts-ignore - Workaround for help-center local consumption
533
551
  view: function view(editorView) {
534
552
  var providerHandler = function providerHandler(name, providerPromise) {
535
553
  switch (name) {
@@ -556,6 +574,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
556
574
  providerHandler('emojiProvider', options.emojiProvider);
557
575
  }
558
576
  return {
577
+ // @ts-ignore - Workaround for help-center local consumption
559
578
  destroy: function destroy() {
560
579
  if (pmPluginFactoryParams.providerFactory) {
561
580
  pmPluginFactoryParams.providerFactory.unsubscribe('emojiProvider', providerHandler);
@@ -78,24 +78,22 @@ var EmojiNodeView = exports.EmojiNodeView = /*#__PURE__*/function () {
78
78
  _this.renderFallback();
79
79
  return;
80
80
  }
81
- var emojiDescription = payload.data;
82
- if (!emojiDescription) {
83
- EmojiNodeView.logError(new Error('Emoji description is not loaded'));
81
+ var optionalEmojiDescription = payload.data;
82
+ if (!optionalEmojiDescription) {
84
83
  _this.renderFallback();
85
84
  return;
86
85
  }
87
- var emojiRepresentation = emojiDescription === null || emojiDescription === void 0 ? void 0 : emojiDescription.representation;
86
+ var emojiRepresentation = optionalEmojiDescription === null || optionalEmojiDescription === void 0 ? void 0 : optionalEmojiDescription.representation;
88
87
  if (!EmojiNodeView.isEmojiRepresentationSupported(emojiRepresentation)) {
89
- EmojiNodeView.logError(new Error('Emoji representation is not supported'));
90
88
  _this.renderFallback();
91
89
  return;
92
90
  }
93
- if ((0, _isEqual.default)(previousEmojiDescription, emojiDescription)) {
91
+ if ((0, _isEqual.default)(previousEmojiDescription, optionalEmojiDescription)) {
94
92
  // Do not re-render if the emoji description is the same as before
95
93
  return;
96
94
  }
97
- previousEmojiDescription = emojiDescription;
98
- _this.renderEmoji(emojiDescription, emojiRepresentation);
95
+ previousEmojiDescription = optionalEmojiDescription;
96
+ _this.renderEmoji(optionalEmojiDescription, emojiRepresentation);
99
97
  });
100
98
  } else {
101
99
  var _api$emoji, _sharedState$currentS, _api$connectivity;
@@ -105,6 +105,8 @@ export const emojiPlugin = ({
105
105
  if (!emojiResult || !emojiResult.emojis) {
106
106
  resolve([]);
107
107
  } else {
108
+ // @ts-ignore - Workaround for help-center local consumption
109
+
108
110
  const emojiItems = emojiResult.emojis.map(emoji => memoizedToItem.call(emoji, emojiProvider));
109
111
  resolve(emojiItems);
110
112
  }
@@ -112,6 +114,9 @@ export const emojiPlugin = ({
112
114
  }
113
115
  };
114
116
  emojiProvider.subscribe(emojiProviderChangeHandler);
117
+
118
+ // @ts-ignore - Workaround for help-center local consumption
119
+
115
120
  emojiProvider.filter(TRIGGER.concat(query), {
116
121
  limit: defaultListLimit,
117
122
  skinTone: emojiProvider.getSelectedTone(),
@@ -137,7 +142,9 @@ export const emojiPlugin = ({
137
142
  emoji
138
143
  };
139
144
  }
140
- const matchedItem = isFullShortName(normalizedQuery) ? items.find(item => item.title.toLowerCase() === normalizedQuery) : undefined;
145
+ const matchedItem = isFullShortName(normalizedQuery)
146
+ // @ts-ignore - Workaround for help-center local consumption
147
+ ? items.find(item => item.title.toLowerCase() === normalizedQuery) : undefined;
141
148
  return matchedItem;
142
149
  },
143
150
  selectItem(state, item, insert, {
@@ -183,6 +190,8 @@ export const emojiPlugin = ({
183
190
  } = schema.nodes;
184
191
  if (node.type === emojiNodeType) {
185
192
  const newText = node.attrs.text;
193
+ // @ts-ignore - Workaround for help-center local consumption
194
+
186
195
  const currentPos = tr.mapping.map(pos);
187
196
  tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
188
197
  }
@@ -341,6 +350,8 @@ export const emojiPlugin = ({
341
350
  items: node => {
342
351
  var _api$annotation2;
343
352
  const annotationState = api === null || api === void 0 ? void 0 : (_api$annotation2 = api.annotation) === null || _api$annotation2 === void 0 ? void 0 : _api$annotation2.sharedState.currentState();
353
+ // @ts-ignore - Workaround for help-center local consumption
354
+
344
355
  const activeCommentMark = node.marks.find(mark => mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false);
345
356
  const showAnnotation = annotationState && annotationState.isVisible && !annotationState.bookmark && !annotationState.mouseData.isSelecting && !activeCommentMark && isViewMode();
346
357
  if (showAnnotation) {
@@ -433,6 +444,8 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
433
444
  return new SafePlugin({
434
445
  key: emojiPluginKey,
435
446
  state: {
447
+ // @ts-ignore - Workaround for help-center local consumption
448
+
436
449
  init() {
437
450
  if (options !== null && options !== void 0 && options.emojiProvider && editorExperiment('platform_editor_prevent_toolbar_layout_shifts', true)) {
438
451
  return {
@@ -441,6 +454,8 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
441
454
  }
442
455
  return {};
443
456
  },
457
+ // @ts-ignore - Workaround for help-center local consumption
458
+
444
459
  apply(tr, pluginState) {
445
460
  const {
446
461
  action,
@@ -478,7 +493,11 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
478
493
  }
479
494
  },
480
495
  props: {
496
+ // @ts-ignore - Workaround for help-center local consumption
497
+
481
498
  nodeViews: {
499
+ // @ts-ignore - Workaround for help-center local consumption
500
+
482
501
  emoji: node => {
483
502
  return new EmojiNodeView(node, {
484
503
  intl: pmPluginFactoryParams.getIntl(),
@@ -488,6 +507,8 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
488
507
  }
489
508
  }
490
509
  },
510
+ // @ts-ignore - Workaround for help-center local consumption
511
+
491
512
  view(editorView) {
492
513
  const providerHandler = (name, providerPromise) => {
493
514
  switch (name) {
@@ -514,6 +535,8 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
514
535
  providerHandler('emojiProvider', options.emojiProvider);
515
536
  }
516
537
  return {
538
+ // @ts-ignore - Workaround for help-center local consumption
539
+
517
540
  destroy() {
518
541
  if (pmPluginFactoryParams.providerFactory) {
519
542
  pmPluginFactoryParams.providerFactory.unsubscribe('emojiProvider', providerHandler);
@@ -72,24 +72,22 @@ export class EmojiNodeView {
72
72
  this.renderFallback();
73
73
  return;
74
74
  }
75
- const emojiDescription = payload.data;
76
- if (!emojiDescription) {
77
- EmojiNodeView.logError(new Error('Emoji description is not loaded'));
75
+ const optionalEmojiDescription = payload.data;
76
+ if (!optionalEmojiDescription) {
78
77
  this.renderFallback();
79
78
  return;
80
79
  }
81
- const emojiRepresentation = emojiDescription === null || emojiDescription === void 0 ? void 0 : emojiDescription.representation;
80
+ const emojiRepresentation = optionalEmojiDescription === null || optionalEmojiDescription === void 0 ? void 0 : optionalEmojiDescription.representation;
82
81
  if (!EmojiNodeView.isEmojiRepresentationSupported(emojiRepresentation)) {
83
- EmojiNodeView.logError(new Error('Emoji representation is not supported'));
84
82
  this.renderFallback();
85
83
  return;
86
84
  }
87
- if (isEqual(previousEmojiDescription, emojiDescription)) {
85
+ if (isEqual(previousEmojiDescription, optionalEmojiDescription)) {
88
86
  // Do not re-render if the emoji description is the same as before
89
87
  return;
90
88
  }
91
- previousEmojiDescription = emojiDescription;
92
- this.renderEmoji(emojiDescription, emojiRepresentation);
89
+ previousEmojiDescription = optionalEmojiDescription;
90
+ this.renderEmoji(optionalEmojiDescription, emojiRepresentation);
93
91
  });
94
92
  } else {
95
93
  var _api$emoji, _sharedState$currentS, _api$connectivity;
@@ -115,6 +115,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
115
115
  if (!emojiResult || !emojiResult.emojis) {
116
116
  resolve([]);
117
117
  } else {
118
+ // @ts-ignore - Workaround for help-center local consumption
119
+
118
120
  var emojiItems = emojiResult.emojis.map(function (emoji) {
119
121
  return memoizedToItem.call(emoji, emojiProvider);
120
122
  });
@@ -124,6 +126,9 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
124
126
  }
125
127
  };
126
128
  emojiProvider.subscribe(emojiProviderChangeHandler);
129
+
130
+ // @ts-ignore - Workaround for help-center local consumption
131
+
127
132
  emojiProvider.filter(TRIGGER.concat(query), {
128
133
  limit: defaultListLimit,
129
134
  skinTone: emojiProvider.getSelectedTone(),
@@ -147,7 +152,9 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
147
152
  emoji: _emoji
148
153
  };
149
154
  }
150
- var matchedItem = isFullShortName(normalizedQuery) ? items.find(function (item) {
155
+ var matchedItem = isFullShortName(normalizedQuery)
156
+ // @ts-ignore - Workaround for help-center local consumption
157
+ ? items.find(function (item) {
151
158
  return item.title.toLowerCase() === normalizedQuery;
152
159
  }) : undefined;
153
160
  return matchedItem;
@@ -187,6 +194,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
187
194
  var emojiNodeType = schema.nodes.emoji;
188
195
  if (node.type === emojiNodeType) {
189
196
  var newText = node.attrs.text;
197
+ // @ts-ignore - Workaround for help-center local consumption
198
+
190
199
  var currentPos = tr.mapping.map(pos);
191
200
  tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
192
201
  }
@@ -366,6 +375,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
366
375
  items: function items(node) {
367
376
  var _api$annotation2;
368
377
  var annotationState = api === null || api === void 0 || (_api$annotation2 = api.annotation) === null || _api$annotation2 === void 0 ? void 0 : _api$annotation2.sharedState.currentState();
378
+ // @ts-ignore - Workaround for help-center local consumption
379
+
369
380
  var activeCommentMark = node.marks.find(function (mark) {
370
381
  return mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false;
371
382
  });
@@ -468,6 +479,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
468
479
  return new SafePlugin({
469
480
  key: emojiPluginKey,
470
481
  state: {
482
+ // @ts-ignore - Workaround for help-center local consumption
471
483
  init: function init() {
472
484
  if (options !== null && options !== void 0 && options.emojiProvider && editorExperiment('platform_editor_prevent_toolbar_layout_shifts', true)) {
473
485
  return {
@@ -476,6 +488,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
476
488
  }
477
489
  return {};
478
490
  },
491
+ // @ts-ignore - Workaround for help-center local consumption
479
492
  apply: function apply(tr, pluginState) {
480
493
  var _ref11 = tr.getMeta(emojiPluginKey) || {
481
494
  action: null,
@@ -509,7 +522,11 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
509
522
  }
510
523
  },
511
524
  props: {
525
+ // @ts-ignore - Workaround for help-center local consumption
526
+
512
527
  nodeViews: {
528
+ // @ts-ignore - Workaround for help-center local consumption
529
+
513
530
  emoji: function emoji(node) {
514
531
  return new EmojiNodeView(node, {
515
532
  intl: pmPluginFactoryParams.getIntl(),
@@ -519,6 +536,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
519
536
  }
520
537
  }
521
538
  },
539
+ // @ts-ignore - Workaround for help-center local consumption
522
540
  view: function view(editorView) {
523
541
  var providerHandler = function providerHandler(name, providerPromise) {
524
542
  switch (name) {
@@ -545,6 +563,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
545
563
  providerHandler('emojiProvider', options.emojiProvider);
546
564
  }
547
565
  return {
566
+ // @ts-ignore - Workaround for help-center local consumption
548
567
  destroy: function destroy() {
549
568
  if (pmPluginFactoryParams.providerFactory) {
550
569
  pmPluginFactoryParams.providerFactory.unsubscribe('emojiProvider', providerHandler);
@@ -70,24 +70,22 @@ export var EmojiNodeView = /*#__PURE__*/function () {
70
70
  _this.renderFallback();
71
71
  return;
72
72
  }
73
- var emojiDescription = payload.data;
74
- if (!emojiDescription) {
75
- EmojiNodeView.logError(new Error('Emoji description is not loaded'));
73
+ var optionalEmojiDescription = payload.data;
74
+ if (!optionalEmojiDescription) {
76
75
  _this.renderFallback();
77
76
  return;
78
77
  }
79
- var emojiRepresentation = emojiDescription === null || emojiDescription === void 0 ? void 0 : emojiDescription.representation;
78
+ var emojiRepresentation = optionalEmojiDescription === null || optionalEmojiDescription === void 0 ? void 0 : optionalEmojiDescription.representation;
80
79
  if (!EmojiNodeView.isEmojiRepresentationSupported(emojiRepresentation)) {
81
- EmojiNodeView.logError(new Error('Emoji representation is not supported'));
82
80
  _this.renderFallback();
83
81
  return;
84
82
  }
85
- if (isEqual(previousEmojiDescription, emojiDescription)) {
83
+ if (isEqual(previousEmojiDescription, optionalEmojiDescription)) {
86
84
  // Do not re-render if the emoji description is the same as before
87
85
  return;
88
86
  }
89
- previousEmojiDescription = emojiDescription;
90
- _this.renderEmoji(emojiDescription, emojiRepresentation);
87
+ previousEmojiDescription = optionalEmojiDescription;
88
+ _this.renderEmoji(optionalEmojiDescription, emojiRepresentation);
91
89
  });
92
90
  } else {
93
91
  var _api$emoji, _sharedState$currentS, _api$connectivity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-emoji",
3
- "version": "7.6.4",
3
+ "version": "7.6.7",
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
  "singleton": true
22
22
  },
23
23
  "dependencies": {
24
- "@atlaskit/adf-schema": "^51.3.2",
24
+ "@atlaskit/adf-schema": "^51.4.0",
25
25
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
26
26
  "@atlaskit/editor-plugin-annotation": "^6.2.0",
27
27
  "@atlaskit/editor-plugin-base": "^7.2.0",
@@ -29,15 +29,15 @@
29
29
  "@atlaskit/editor-plugin-metrics": "^7.1.0",
30
30
  "@atlaskit/editor-plugin-type-ahead": "^6.5.0",
31
31
  "@atlaskit/editor-prosemirror": "7.0.0",
32
- "@atlaskit/editor-shared-styles": "^3.9.0",
32
+ "@atlaskit/editor-shared-styles": "^3.10.0",
33
33
  "@atlaskit/emoji": "^69.8.0",
34
34
  "@atlaskit/icon": "^29.0.0",
35
35
  "@atlaskit/node-data-provider": "^7.5.0",
36
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
37
37
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
38
38
  "@atlaskit/theme": "^21.0.0",
39
- "@atlaskit/tmp-editor-statsig": "^13.38.0",
40
- "@atlaskit/tokens": "^8.0.0",
39
+ "@atlaskit/tmp-editor-statsig": "^13.42.0",
40
+ "@atlaskit/tokens": "^8.3.0",
41
41
  "@babel/runtime": "^7.0.0",
42
42
  "@emotion/react": "^11.7.1",
43
43
  "lodash": "^4.17.21",
@@ -45,7 +45,7 @@
45
45
  "react-loadable": "^5.1.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "@atlaskit/editor-common": "^110.29.0",
48
+ "@atlaskit/editor-common": "^110.34.0",
49
49
  "react": "^18.2.0",
50
50
  "react-dom": "^18.2.0"
51
51
  },