@atlaskit/editor-plugin-emoji 7.6.6 → 7.6.8

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,22 @@
1
1
  # @atlaskit/editor-plugin-emoji
2
2
 
3
+ ## 7.6.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8281874c30443`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8281874c30443) -
8
+ [ux] [EDITOR-2917] scale emoji placeholders in the editor
9
+ - Updated dependencies
10
+
11
+ ## 7.6.7
12
+
13
+ ### Patch Changes
14
+
15
+ - [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
16
+ ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
17
+ project refs are setup
18
+ - Updated dependencies
19
+
3
20
  ## 7.6.6
4
21
 
5
22
  ### 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,10 @@ 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
+
169
+ items.find(function (item) {
162
170
  return item.title.toLowerCase() === normalizedQuery;
163
171
  }) : undefined;
164
172
  return matchedItem;
@@ -198,6 +206,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
198
206
  var emojiNodeType = schema.nodes.emoji;
199
207
  if (node.type === emojiNodeType) {
200
208
  var newText = node.attrs.text;
209
+ // @ts-ignore - Workaround for help-center local consumption
210
+
201
211
  var currentPos = tr.mapping.map(pos);
202
212
  tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
203
213
  }
@@ -377,6 +387,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
377
387
  items: function items(node) {
378
388
  var _api$annotation2;
379
389
  var annotationState = api === null || api === void 0 || (_api$annotation2 = api.annotation) === null || _api$annotation2 === void 0 ? void 0 : _api$annotation2.sharedState.currentState();
390
+ // @ts-ignore - Workaround for help-center local consumption
391
+
380
392
  var activeCommentMark = node.marks.find(function (mark) {
381
393
  return mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false;
382
394
  });
@@ -479,6 +491,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
479
491
  return new _safePlugin.SafePlugin({
480
492
  key: emojiPluginKey,
481
493
  state: {
494
+ // @ts-ignore - Workaround for help-center local consumption
482
495
  init: function init() {
483
496
  if (options !== null && options !== void 0 && options.emojiProvider && (0, _experiments.editorExperiment)('platform_editor_prevent_toolbar_layout_shifts', true)) {
484
497
  return {
@@ -487,6 +500,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
487
500
  }
488
501
  return {};
489
502
  },
503
+ // @ts-ignore - Workaround for help-center local consumption
490
504
  apply: function apply(tr, pluginState) {
491
505
  var _ref11 = tr.getMeta(emojiPluginKey) || {
492
506
  action: null,
@@ -520,7 +534,11 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
520
534
  }
521
535
  },
522
536
  props: {
537
+ // @ts-ignore - Workaround for help-center local consumption
538
+
523
539
  nodeViews: {
540
+ // @ts-ignore - Workaround for help-center local consumption
541
+
524
542
  emoji: function emoji(node) {
525
543
  return new _EmojiNodeView.EmojiNodeView(node, {
526
544
  intl: pmPluginFactoryParams.getIntl(),
@@ -530,6 +548,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
530
548
  }
531
549
  }
532
550
  },
551
+ // @ts-ignore - Workaround for help-center local consumption
533
552
  view: function view(editorView) {
534
553
  var providerHandler = function providerHandler(name, providerPromise) {
535
554
  switch (name) {
@@ -556,6 +575,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
556
575
  providerHandler('emojiProvider', options.emojiProvider);
557
576
  }
558
577
  return {
578
+ // @ts-ignore - Workaround for help-center local consumption
559
579
  destroy: function destroy() {
560
580
  if (pmPluginFactoryParams.providerFactory) {
561
581
  pmPluginFactoryParams.providerFactory.unsubscribe('emojiProvider', providerHandler);
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _adfSchema = require("@atlaskit/adf-schema");
11
11
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
12
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
15
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
16
  var isSSR = Boolean(process.env.REACT_SSR);
@@ -37,17 +38,23 @@ function emojiToDom(node) {
37
38
  shortName = _node$attrs.shortName,
38
39
  id = _node$attrs.id,
39
40
  text = _node$attrs.text;
41
+ var isEmojiScalingEnabled = (0, _expValEquals.expValEquals)('platform_editor_lovability_emoji_scaling', 'isEnabled', true);
40
42
  var attrs = {
41
43
  'data-emoji-short-name': shortName,
42
44
  'data-emoji-id': id,
43
45
  'data-emoji-text': text,
44
46
  contenteditable: 'false',
45
- style: (0, _lazyNodeView.convertToInlineCss)({
47
+ style: (0, _lazyNodeView.convertToInlineCss)(_objectSpread(_objectSpread({
46
48
  content: "''",
47
- fill: "var(--ds-background-neutral, #0515240F)",
49
+ fill: "var(--ds-background-neutral, #0515240F)"
50
+ }, isEmojiScalingEnabled ? {
51
+ minWidth: '16.25px',
52
+ minHeight: '16.25px'
53
+ } : {
48
54
  minWidth: "20px",
49
55
  width: "20px",
50
- height: "20px",
56
+ height: "20px"
57
+ }), {}, {
51
58
  position: 'relative',
52
59
  margin: '-1px 0',
53
60
  display: 'inline-block',
@@ -57,7 +64,7 @@ function emojiToDom(node) {
57
64
  verticalAlign: 'middle',
58
65
  whiteSpace: 'nowrap',
59
66
  textAlign: 'center'
60
- }),
67
+ })),
61
68
  'aria-busy': 'true',
62
69
  'aria-label': shortName,
63
70
  class: 'emoji-common-placeholder'
@@ -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,10 @@ 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
+
148
+ items.find(item => item.title.toLowerCase() === normalizedQuery) : undefined;
141
149
  return matchedItem;
142
150
  },
143
151
  selectItem(state, item, insert, {
@@ -183,6 +191,8 @@ export const emojiPlugin = ({
183
191
  } = schema.nodes;
184
192
  if (node.type === emojiNodeType) {
185
193
  const newText = node.attrs.text;
194
+ // @ts-ignore - Workaround for help-center local consumption
195
+
186
196
  const currentPos = tr.mapping.map(pos);
187
197
  tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
188
198
  }
@@ -341,6 +351,8 @@ export const emojiPlugin = ({
341
351
  items: node => {
342
352
  var _api$annotation2;
343
353
  const annotationState = api === null || api === void 0 ? void 0 : (_api$annotation2 = api.annotation) === null || _api$annotation2 === void 0 ? void 0 : _api$annotation2.sharedState.currentState();
354
+ // @ts-ignore - Workaround for help-center local consumption
355
+
344
356
  const activeCommentMark = node.marks.find(mark => mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false);
345
357
  const showAnnotation = annotationState && annotationState.isVisible && !annotationState.bookmark && !annotationState.mouseData.isSelecting && !activeCommentMark && isViewMode();
346
358
  if (showAnnotation) {
@@ -433,6 +445,8 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
433
445
  return new SafePlugin({
434
446
  key: emojiPluginKey,
435
447
  state: {
448
+ // @ts-ignore - Workaround for help-center local consumption
449
+
436
450
  init() {
437
451
  if (options !== null && options !== void 0 && options.emojiProvider && editorExperiment('platform_editor_prevent_toolbar_layout_shifts', true)) {
438
452
  return {
@@ -441,6 +455,8 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
441
455
  }
442
456
  return {};
443
457
  },
458
+ // @ts-ignore - Workaround for help-center local consumption
459
+
444
460
  apply(tr, pluginState) {
445
461
  const {
446
462
  action,
@@ -478,7 +494,11 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
478
494
  }
479
495
  },
480
496
  props: {
497
+ // @ts-ignore - Workaround for help-center local consumption
498
+
481
499
  nodeViews: {
500
+ // @ts-ignore - Workaround for help-center local consumption
501
+
482
502
  emoji: node => {
483
503
  return new EmojiNodeView(node, {
484
504
  intl: pmPluginFactoryParams.getIntl(),
@@ -488,6 +508,8 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
488
508
  }
489
509
  }
490
510
  },
511
+ // @ts-ignore - Workaround for help-center local consumption
512
+
491
513
  view(editorView) {
492
514
  const providerHandler = (name, providerPromise) => {
493
515
  switch (name) {
@@ -514,6 +536,8 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
514
536
  providerHandler('emojiProvider', options.emojiProvider);
515
537
  }
516
538
  return {
539
+ // @ts-ignore - Workaround for help-center local consumption
540
+
517
541
  destroy() {
518
542
  if (pmPluginFactoryParams.providerFactory) {
519
543
  pmPluginFactoryParams.providerFactory.unsubscribe('emojiProvider', providerHandler);
@@ -1,6 +1,7 @@
1
1
  import { emoji, emojiWithLocalId } from '@atlaskit/adf-schema';
2
2
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  const isSSR = Boolean(process.env.REACT_SSR);
5
6
 
6
7
  /**
@@ -26,6 +27,7 @@ export function emojiToDom(node) {
26
27
  id,
27
28
  text
28
29
  } = node.attrs;
30
+ const isEmojiScalingEnabled = expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true);
29
31
  const attrs = {
30
32
  'data-emoji-short-name': shortName,
31
33
  'data-emoji-id': id,
@@ -34,9 +36,14 @@ export function emojiToDom(node) {
34
36
  style: convertToInlineCss({
35
37
  content: "''",
36
38
  fill: "var(--ds-background-neutral, #0515240F)",
37
- minWidth: `20px`,
38
- width: `20px`,
39
- height: `20px`,
39
+ ...(isEmojiScalingEnabled ? {
40
+ minWidth: '16.25px',
41
+ minHeight: '16.25px'
42
+ } : {
43
+ minWidth: `20px`,
44
+ width: `20px`,
45
+ height: `20px`
46
+ }),
40
47
  position: 'relative',
41
48
  margin: '-1px 0',
42
49
  display: 'inline-block',
@@ -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,10 @@ 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
+
158
+ items.find(function (item) {
151
159
  return item.title.toLowerCase() === normalizedQuery;
152
160
  }) : undefined;
153
161
  return matchedItem;
@@ -187,6 +195,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
187
195
  var emojiNodeType = schema.nodes.emoji;
188
196
  if (node.type === emojiNodeType) {
189
197
  var newText = node.attrs.text;
198
+ // @ts-ignore - Workaround for help-center local consumption
199
+
190
200
  var currentPos = tr.mapping.map(pos);
191
201
  tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
192
202
  }
@@ -366,6 +376,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
366
376
  items: function items(node) {
367
377
  var _api$annotation2;
368
378
  var annotationState = api === null || api === void 0 || (_api$annotation2 = api.annotation) === null || _api$annotation2 === void 0 ? void 0 : _api$annotation2.sharedState.currentState();
379
+ // @ts-ignore - Workaround for help-center local consumption
380
+
369
381
  var activeCommentMark = node.marks.find(function (mark) {
370
382
  return mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false;
371
383
  });
@@ -468,6 +480,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
468
480
  return new SafePlugin({
469
481
  key: emojiPluginKey,
470
482
  state: {
483
+ // @ts-ignore - Workaround for help-center local consumption
471
484
  init: function init() {
472
485
  if (options !== null && options !== void 0 && options.emojiProvider && editorExperiment('platform_editor_prevent_toolbar_layout_shifts', true)) {
473
486
  return {
@@ -476,6 +489,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
476
489
  }
477
490
  return {};
478
491
  },
492
+ // @ts-ignore - Workaround for help-center local consumption
479
493
  apply: function apply(tr, pluginState) {
480
494
  var _ref11 = tr.getMeta(emojiPluginKey) || {
481
495
  action: null,
@@ -509,7 +523,11 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
509
523
  }
510
524
  },
511
525
  props: {
526
+ // @ts-ignore - Workaround for help-center local consumption
527
+
512
528
  nodeViews: {
529
+ // @ts-ignore - Workaround for help-center local consumption
530
+
513
531
  emoji: function emoji(node) {
514
532
  return new EmojiNodeView(node, {
515
533
  intl: pmPluginFactoryParams.getIntl(),
@@ -519,6 +537,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
519
537
  }
520
538
  }
521
539
  },
540
+ // @ts-ignore - Workaround for help-center local consumption
522
541
  view: function view(editorView) {
523
542
  var providerHandler = function providerHandler(name, providerPromise) {
524
543
  switch (name) {
@@ -545,6 +564,7 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
545
564
  providerHandler('emojiProvider', options.emojiProvider);
546
565
  }
547
566
  return {
567
+ // @ts-ignore - Workaround for help-center local consumption
548
568
  destroy: function destroy() {
549
569
  if (pmPluginFactoryParams.providerFactory) {
550
570
  pmPluginFactoryParams.providerFactory.unsubscribe('emojiProvider', providerHandler);
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { emoji, emojiWithLocalId } from '@atlaskit/adf-schema';
5
5
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  var isSSR = Boolean(process.env.REACT_SSR);
8
9
 
9
10
  /**
@@ -29,17 +30,23 @@ export function emojiToDom(node) {
29
30
  shortName = _node$attrs.shortName,
30
31
  id = _node$attrs.id,
31
32
  text = _node$attrs.text;
33
+ var isEmojiScalingEnabled = expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true);
32
34
  var attrs = {
33
35
  'data-emoji-short-name': shortName,
34
36
  'data-emoji-id': id,
35
37
  'data-emoji-text': text,
36
38
  contenteditable: 'false',
37
- style: convertToInlineCss({
39
+ style: convertToInlineCss(_objectSpread(_objectSpread({
38
40
  content: "''",
39
- fill: "var(--ds-background-neutral, #0515240F)",
41
+ fill: "var(--ds-background-neutral, #0515240F)"
42
+ }, isEmojiScalingEnabled ? {
43
+ minWidth: '16.25px',
44
+ minHeight: '16.25px'
45
+ } : {
40
46
  minWidth: "20px",
41
47
  width: "20px",
42
- height: "20px",
48
+ height: "20px"
49
+ }), {}, {
43
50
  position: 'relative',
44
51
  margin: '-1px 0',
45
52
  display: 'inline-block',
@@ -49,7 +56,7 @@ export function emojiToDom(node) {
49
56
  verticalAlign: 'middle',
50
57
  whiteSpace: 'nowrap',
51
58
  textAlign: 'center'
52
- }),
59
+ })),
53
60
  'aria-busy': 'true',
54
61
  'aria-label': shortName,
55
62
  class: 'emoji-common-placeholder'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-emoji",
3
- "version": "7.6.6",
3
+ "version": "7.6.8",
4
4
  "description": "Emoji plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,8 +36,8 @@
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.44.0",
40
+ "@atlaskit/tokens": "^8.4.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.32.0",
48
+ "@atlaskit/editor-common": "^110.35.0",
49
49
  "react": "^18.2.0",
50
50
  "react-dom": "^18.2.0"
51
51
  },