@atlaskit/editor-plugin-emoji 17.1.0 → 17.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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-emoji
2
2
 
3
+ ## 17.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0eeaf807b043b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0eeaf807b043b) -
8
+ Add an optional content ID to the inline emoji picker so Confluence users in the
9
+ `confluence_ai_generated_emojis` experiment can generate emojis from the editor.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 17.1.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 17.1.0
4
22
 
5
23
  ### Minor Changes
@@ -307,6 +307,7 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
307
307
  }
308
308
  return /*#__PURE__*/_react.default.createElement(_InlineEmojiPopup.InlineEmojiPopup, {
309
309
  api: api,
310
+ contentId: options === null || options === void 0 ? void 0 : options.contentId,
310
311
  editorView: editorView,
311
312
  popupsBoundariesElement: popupsBoundariesElement,
312
313
  popupsMountPoint: popupsMountPoint,
@@ -33,6 +33,7 @@ var InlineEmojiPopupOld = exports.InlineEmojiPopupOld = function InlineEmojiPopu
33
33
  popupsBoundariesElement = _ref.popupsBoundariesElement,
34
34
  popupsScrollableElement = _ref.popupsScrollableElement,
35
35
  editorView = _ref.editorView,
36
+ contentId = _ref.contentId,
36
37
  onClose = _ref.onClose;
37
38
  var _ref2 = (_useSharedPluginState = (_useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['emoji'])) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.emojiState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {},
38
39
  emojiProvider = _ref2.emojiProvider,
@@ -88,6 +89,7 @@ var InlineEmojiPopupOld = exports.InlineEmojiPopupOld = function InlineEmojiPopu
88
89
  captureClick: true
89
90
  }, /*#__PURE__*/_react.default.createElement(_uiReact.OutsideClickTargetRefContext.Consumer, null, function (setOutsideClickTargetRef) {
90
91
  return /*#__PURE__*/_react.default.createElement(_emoji.EmojiPicker, {
92
+ contentId: contentId,
91
93
  emojiProvider: Promise.resolve(emojiProvider),
92
94
  onPickerRef: setOutsideClickTargetRef,
93
95
  onSelection: handleSelection
@@ -100,7 +102,8 @@ var InlineEmojiPopupContent = function InlineEmojiPopupContent(_ref3) {
100
102
  popupsMountPoint = _ref3.popupsMountPoint,
101
103
  popupsBoundariesElement = _ref3.popupsBoundariesElement,
102
104
  popupsScrollableElement = _ref3.popupsScrollableElement,
103
- editorView = _ref3.editorView;
105
+ editorView = _ref3.editorView,
106
+ contentId = _ref3.contentId;
104
107
  var emojiProvider = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'emoji.emojiProvider');
105
108
  var intl = (0, _reactIntl.useIntl)();
106
109
  (0, _react.useEffect)(function () {
@@ -156,6 +159,7 @@ var InlineEmojiPopupContent = function InlineEmojiPopupContent(_ref3) {
156
159
  captureClick: true
157
160
  }, /*#__PURE__*/_react.default.createElement(_uiReact.OutsideClickTargetRefContext.Consumer, null, function (setOutsideClickTargetRef) {
158
161
  return /*#__PURE__*/_react.default.createElement(_emoji.EmojiPicker, {
162
+ contentId: contentId,
159
163
  emojiProvider: Promise.resolve(emojiProvider),
160
164
  onPickerRef: setOutsideClickTargetRef,
161
165
  onSelection: handleSelection
@@ -167,7 +171,8 @@ var InlineEmojiPopup = exports.InlineEmojiPopup = /*#__PURE__*/_react.default.me
167
171
  popupsMountPoint = _ref4.popupsMountPoint,
168
172
  popupsBoundariesElement = _ref4.popupsBoundariesElement,
169
173
  popupsScrollableElement = _ref4.popupsScrollableElement,
170
- editorView = _ref4.editorView;
174
+ editorView = _ref4.editorView,
175
+ contentId = _ref4.contentId;
171
176
  var isOpen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'emoji.inlineEmojiPopupOpen');
172
177
  if (!isOpen) {
173
178
  return null;
@@ -177,6 +182,7 @@ var InlineEmojiPopup = exports.InlineEmojiPopup = /*#__PURE__*/_react.default.me
177
182
  editorView: editorView,
178
183
  popupsBoundariesElement: popupsBoundariesElement,
179
184
  popupsMountPoint: popupsMountPoint,
180
- popupsScrollableElement: popupsScrollableElement
185
+ popupsScrollableElement: popupsScrollableElement,
186
+ contentId: contentId
181
187
  });
182
188
  });
@@ -274,6 +274,7 @@ export const emojiPlugin = ({
274
274
  }
275
275
  return /*#__PURE__*/React.createElement(InlineEmojiPopup, {
276
276
  api: api,
277
+ contentId: options === null || options === void 0 ? void 0 : options.contentId,
277
278
  editorView: editorView,
278
279
  popupsBoundariesElement: popupsBoundariesElement,
279
280
  popupsMountPoint: popupsMountPoint,
@@ -24,6 +24,7 @@ export const InlineEmojiPopupOld = ({
24
24
  popupsBoundariesElement,
25
25
  popupsScrollableElement,
26
26
  editorView,
27
+ contentId,
27
28
  onClose
28
29
  }) => {
29
30
  var _useSharedPluginState, _useSharedPluginState2, _api$analytics;
@@ -79,6 +80,7 @@ export const InlineEmojiPopupOld = ({
79
80
  handleEscapeKeydown: handleOnClose,
80
81
  captureClick: true
81
82
  }, /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Consumer, null, setOutsideClickTargetRef => /*#__PURE__*/React.createElement(EmojiPicker, {
83
+ contentId: contentId,
82
84
  emojiProvider: Promise.resolve(emojiProvider),
83
85
  onPickerRef: setOutsideClickTargetRef,
84
86
  onSelection: handleSelection
@@ -89,7 +91,8 @@ const InlineEmojiPopupContent = ({
89
91
  popupsMountPoint,
90
92
  popupsBoundariesElement,
91
93
  popupsScrollableElement,
92
- editorView
94
+ editorView,
95
+ contentId
93
96
  }) => {
94
97
  var _api$metrics4, _api$metrics6, _api$analytics3;
95
98
  const emojiProvider = useSharedPluginStateSelector(api, 'emoji.emojiProvider');
@@ -144,6 +147,7 @@ const InlineEmojiPopupContent = ({
144
147
  handleEscapeKeydown: handleOnClose,
145
148
  captureClick: true
146
149
  }, /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Consumer, null, setOutsideClickTargetRef => /*#__PURE__*/React.createElement(EmojiPicker, {
150
+ contentId: contentId,
147
151
  emojiProvider: Promise.resolve(emojiProvider),
148
152
  onPickerRef: setOutsideClickTargetRef,
149
153
  onSelection: handleSelection
@@ -154,7 +158,8 @@ export const InlineEmojiPopup = /*#__PURE__*/React.memo(({
154
158
  popupsMountPoint,
155
159
  popupsBoundariesElement,
156
160
  popupsScrollableElement,
157
- editorView
161
+ editorView,
162
+ contentId
158
163
  }) => {
159
164
  const isOpen = useSharedPluginStateSelector(api, 'emoji.inlineEmojiPopupOpen');
160
165
  if (!isOpen) {
@@ -165,6 +170,7 @@ export const InlineEmojiPopup = /*#__PURE__*/React.memo(({
165
170
  editorView: editorView,
166
171
  popupsBoundariesElement: popupsBoundariesElement,
167
172
  popupsMountPoint: popupsMountPoint,
168
- popupsScrollableElement: popupsScrollableElement
173
+ popupsScrollableElement: popupsScrollableElement,
174
+ contentId: contentId
169
175
  });
170
176
  });
@@ -296,6 +296,7 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
296
296
  }
297
297
  return /*#__PURE__*/React.createElement(InlineEmojiPopup, {
298
298
  api: api,
299
+ contentId: options === null || options === void 0 ? void 0 : options.contentId,
299
300
  editorView: editorView,
300
301
  popupsBoundariesElement: popupsBoundariesElement,
301
302
  popupsMountPoint: popupsMountPoint,
@@ -25,6 +25,7 @@ export var InlineEmojiPopupOld = function InlineEmojiPopupOld(_ref) {
25
25
  popupsBoundariesElement = _ref.popupsBoundariesElement,
26
26
  popupsScrollableElement = _ref.popupsScrollableElement,
27
27
  editorView = _ref.editorView,
28
+ contentId = _ref.contentId,
28
29
  onClose = _ref.onClose;
29
30
  var _ref2 = (_useSharedPluginState = (_useSharedPluginState2 = useSharedPluginState(api, ['emoji'])) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.emojiState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {},
30
31
  emojiProvider = _ref2.emojiProvider,
@@ -80,6 +81,7 @@ export var InlineEmojiPopupOld = function InlineEmojiPopupOld(_ref) {
80
81
  captureClick: true
81
82
  }, /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Consumer, null, function (setOutsideClickTargetRef) {
82
83
  return /*#__PURE__*/React.createElement(EmojiPicker, {
84
+ contentId: contentId,
83
85
  emojiProvider: Promise.resolve(emojiProvider),
84
86
  onPickerRef: setOutsideClickTargetRef,
85
87
  onSelection: handleSelection
@@ -92,7 +94,8 @@ var InlineEmojiPopupContent = function InlineEmojiPopupContent(_ref3) {
92
94
  popupsMountPoint = _ref3.popupsMountPoint,
93
95
  popupsBoundariesElement = _ref3.popupsBoundariesElement,
94
96
  popupsScrollableElement = _ref3.popupsScrollableElement,
95
- editorView = _ref3.editorView;
97
+ editorView = _ref3.editorView,
98
+ contentId = _ref3.contentId;
96
99
  var emojiProvider = useSharedPluginStateSelector(api, 'emoji.emojiProvider');
97
100
  var intl = useIntl();
98
101
  useEffect(function () {
@@ -148,6 +151,7 @@ var InlineEmojiPopupContent = function InlineEmojiPopupContent(_ref3) {
148
151
  captureClick: true
149
152
  }, /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Consumer, null, function (setOutsideClickTargetRef) {
150
153
  return /*#__PURE__*/React.createElement(EmojiPicker, {
154
+ contentId: contentId,
151
155
  emojiProvider: Promise.resolve(emojiProvider),
152
156
  onPickerRef: setOutsideClickTargetRef,
153
157
  onSelection: handleSelection
@@ -159,7 +163,8 @@ export var InlineEmojiPopup = /*#__PURE__*/React.memo(function (_ref4) {
159
163
  popupsMountPoint = _ref4.popupsMountPoint,
160
164
  popupsBoundariesElement = _ref4.popupsBoundariesElement,
161
165
  popupsScrollableElement = _ref4.popupsScrollableElement,
162
- editorView = _ref4.editorView;
166
+ editorView = _ref4.editorView,
167
+ contentId = _ref4.contentId;
163
168
  var isOpen = useSharedPluginStateSelector(api, 'emoji.inlineEmojiPopupOpen');
164
169
  if (!isOpen) {
165
170
  return null;
@@ -169,6 +174,7 @@ export var InlineEmojiPopup = /*#__PURE__*/React.memo(function (_ref4) {
169
174
  editorView: editorView,
170
175
  popupsBoundariesElement: popupsBoundariesElement,
171
176
  popupsMountPoint: popupsMountPoint,
172
- popupsScrollableElement: popupsScrollableElement
177
+ popupsScrollableElement: popupsScrollableElement,
178
+ contentId: contentId
173
179
  });
174
180
  });
@@ -29,6 +29,8 @@ type EditorViewModePluginType = NextEditorPlugin<'editorViewMode', {
29
29
  sharedState: EditorViewModePluginState;
30
30
  }>;
31
31
  export interface EmojiPluginOptions {
32
+ /** Content identifier forwarded to content-aware emoji picker experiences. */
33
+ contentId?: string;
32
34
  disableAutoformat?: boolean;
33
35
  emojiNodeDataProvider?: EmojiNodeDataProvider;
34
36
  emojiProvider?: Promise<EmojiProvider>;
@@ -4,9 +4,10 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { EmojiPlugin } from '../emojiPluginType';
5
5
  type InlineEmojiPopupProps = Pick<UiComponentFactoryParams, 'popupsBoundariesElement' | 'popupsMountPoint' | 'popupsScrollableElement'> & {
6
6
  api: ExtractInjectionAPI<EmojiPlugin>;
7
+ contentId?: string;
7
8
  editorView: EditorView;
8
9
  };
9
- export declare const InlineEmojiPopupOld: ({ api, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, editorView, onClose, }: InlineEmojiPopupProps & {
10
+ export declare const InlineEmojiPopupOld: ({ api, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, editorView, contentId, onClose, }: InlineEmojiPopupProps & {
10
11
  onClose: () => void;
11
12
  }) => React.JSX.Element | null;
12
13
  export declare const InlineEmojiPopup: React.MemoExoticComponent<({ api, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, editorView, }: InlineEmojiPopupProps) => React.JSX.Element | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-emoji",
3
- "version": "17.1.0",
3
+ "version": "17.2.0",
4
4
  "description": "Emoji plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,8 +41,8 @@
41
41
  "@atlaskit/platform-feature-experiments": "^0.3.0",
42
42
  "@atlaskit/platform-feature-flags": "^2.2.0",
43
43
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^168.0.0",
45
- "@atlaskit/tokens": "^16.10.0",
44
+ "@atlaskit/tmp-editor-statsig": "^170.0.0",
45
+ "@atlaskit/tokens": "^16.11.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1",
48
48
  "bind-event-listener": "^3.0.0",
@@ -50,7 +50,7 @@
50
50
  "react-loadable": "^5.1.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^120.9.0",
53
+ "@atlaskit/editor-common": "^120.10.0",
54
54
  "react": "^18.2.0 || ^19.2.0",
55
55
  "react-dom": "^18.2.0 || ^19.2.0",
56
56
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"