@atlaskit/editor-plugin-emoji 3.5.3 → 3.6.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,27 @@
1
1
  # @atlaskit/editor-plugin-emoji
2
2
 
3
+ ## 3.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#139089](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139089)
8
+ [`69dcdc0c4a543`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/69dcdc0c4a543) -
9
+ ED-26588 Start activity session and persist active session when type ahead and element broswer is
10
+ open
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 3.5.4
17
+
18
+ ### Patch Changes
19
+
20
+ - [#138298](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/138298)
21
+ [`cc7cc96e28407`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cc7cc96e28407) -
22
+ Cleans up FG to preload emoji picker, allowing it to work offline
23
+ - Updated dependencies
24
+
3
25
  ## 3.5.3
4
26
 
5
27
  ### Patch Changes
@@ -238,9 +238,7 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
238
238
  usePluginHook: function usePluginHook() {
239
239
  (0, _react.useEffect)(function () {
240
240
  delayUntilIdle(function () {
241
- if ((0, _platformFeatureFlags.fg)('platform_editor_preload_emoji_picker')) {
242
- (0, _emoji2.preloadEmojiPicker)();
243
- }
241
+ (0, _emoji2.preloadEmojiPicker)();
244
242
  });
245
243
  }, []);
246
244
  },
@@ -344,7 +342,7 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
344
342
  description: formatMessage(_messages.toolbarInsertBlockMessages.emojiDescription),
345
343
  priority: 500,
346
344
  keyshortcut: ':',
347
- isDisabledOffline: (0, _platformFeatureFlags.fg)('platform_editor_preload_emoji_picker') ? false : true,
345
+ isDisabledOffline: false,
348
346
  icon: function icon() {
349
347
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconEmoji, null);
350
348
  },
@@ -14,6 +14,7 @@ var _uiReact = require("@atlaskit/editor-common/ui-react");
14
14
  var _utils = require("@atlaskit/editor-prosemirror/utils");
15
15
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
16
16
  var _emoji = require("@atlaskit/emoji");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
20
  var PopupWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.Popup);
@@ -49,6 +50,22 @@ var InlineEmojiPopup = exports.InlineEmojiPopup = function InlineEmojiPopup(_ref
49
50
  emojiProvider = _ref2.emojiProvider,
50
51
  isOpen = _ref2.inlineEmojiPopupOpen;
51
52
  var intl = (0, _reactIntlNext.useIntl)();
53
+ var handleOnClose = (0, _react.useCallback)(function () {
54
+ if ((0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
55
+ var _api$metrics;
56
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.startActiveSessionTimer());
57
+ }
58
+ onClose();
59
+ }, [onClose, api]);
60
+ (0, _react.useEffect)(function () {
61
+ if (isOpen && (0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
62
+ var _api$metrics2;
63
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 ? void 0 : _api$metrics2.commands.handleIntentToStartEdit({
64
+ shouldStartTimer: false,
65
+ shouldPersistActiveSession: true
66
+ }));
67
+ }
68
+ }, [isOpen, api]);
52
69
  var focusEditor = (0, _react.useCallback)(function () {
53
70
  // use requestAnimationFrame to run this async after the call
54
71
  requestAnimationFrame(function () {
@@ -57,8 +74,8 @@ var InlineEmojiPopup = exports.InlineEmojiPopup = function InlineEmojiPopup(_ref
57
74
  }, [editorView]);
58
75
  var handleSelection = (0, _react.useCallback)(function (emojiId) {
59
76
  api.core.actions.execute(api.emoji.commands.insertEmoji(emojiId, _analytics.INPUT_METHOD.PICKER));
60
- onClose();
61
- }, [api.core.actions, api.emoji.commands, onClose]);
77
+ handleOnClose();
78
+ }, [api.core.actions, api.emoji.commands, handleOnClose]);
62
79
  if (!isOpen || !emojiProvider) {
63
80
  return null;
64
81
  }
@@ -76,8 +93,8 @@ var InlineEmojiPopup = exports.InlineEmojiPopup = function InlineEmojiPopup(_ref
76
93
  onUnmount: focusEditor,
77
94
  focusTrap: true,
78
95
  preventOverflow: true,
79
- handleClickOutside: onClose,
80
- handleEscapeKeydown: onClose,
96
+ handleClickOutside: handleOnClose,
97
+ handleEscapeKeydown: handleOnClose,
81
98
  captureClick: true
82
99
  }, /*#__PURE__*/_react.default.createElement(_uiReact.OutsideClickTargetRefContext.Consumer, null, function (setOutsideClickTargetRef) {
83
100
  return /*#__PURE__*/_react.default.createElement(_emoji.EmojiPicker, {
@@ -219,9 +219,7 @@ export const emojiPlugin = ({
219
219
  usePluginHook() {
220
220
  useEffect(() => {
221
221
  delayUntilIdle(() => {
222
- if (fg('platform_editor_preload_emoji_picker')) {
223
- preloadEmojiPicker();
224
- }
222
+ preloadEmojiPicker();
225
223
  });
226
224
  }, []);
227
225
  },
@@ -307,7 +305,7 @@ export const emojiPlugin = ({
307
305
  description: formatMessage(messages.emojiDescription),
308
306
  priority: 500,
309
307
  keyshortcut: ':',
310
- isDisabledOffline: fg('platform_editor_preload_emoji_picker') ? false : true,
308
+ isDisabledOffline: false,
311
309
  icon: () => /*#__PURE__*/React.createElement(IconEmoji, null),
312
310
  action(insert) {
313
311
  var _api$typeAhead;
@@ -1,4 +1,4 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useCallback, useEffect } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
@@ -7,6 +7,7 @@ import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as with
7
7
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
9
9
  import { EmojiPicker } from '@atlaskit/emoji';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  const PopupWithListeners = withOuterListeners(Popup);
11
12
  const getDomRefFromSelection = view => {
12
13
  const domRef = findDomRefAtPos(view.state.selection.from, view.domAtPos.bind(view));
@@ -42,14 +43,30 @@ export const InlineEmojiPopup = ({
42
43
  inlineEmojiPopupOpen: isOpen
43
44
  } = (_useSharedPluginState = (_useSharedPluginState2 = useSharedPluginState(api, ['emoji'])) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.emojiState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {};
44
45
  const intl = useIntl();
46
+ const handleOnClose = useCallback(() => {
47
+ if (fg('platform_editor_ease_of_use_metrics')) {
48
+ var _api$metrics;
49
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.startActiveSessionTimer());
50
+ }
51
+ onClose();
52
+ }, [onClose, api]);
53
+ useEffect(() => {
54
+ if (isOpen && fg('platform_editor_ease_of_use_metrics')) {
55
+ var _api$metrics2;
56
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 ? void 0 : _api$metrics2.commands.handleIntentToStartEdit({
57
+ shouldStartTimer: false,
58
+ shouldPersistActiveSession: true
59
+ }));
60
+ }
61
+ }, [isOpen, api]);
45
62
  const focusEditor = useCallback(() => {
46
63
  // use requestAnimationFrame to run this async after the call
47
64
  requestAnimationFrame(() => editorView.focus());
48
65
  }, [editorView]);
49
66
  const handleSelection = useCallback(emojiId => {
50
67
  api.core.actions.execute(api.emoji.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
51
- onClose();
52
- }, [api.core.actions, api.emoji.commands, onClose]);
68
+ handleOnClose();
69
+ }, [api.core.actions, api.emoji.commands, handleOnClose]);
53
70
  if (!isOpen || !emojiProvider) {
54
71
  return null;
55
72
  }
@@ -67,8 +84,8 @@ export const InlineEmojiPopup = ({
67
84
  onUnmount: focusEditor,
68
85
  focusTrap: true,
69
86
  preventOverflow: true,
70
- handleClickOutside: onClose,
71
- handleEscapeKeydown: onClose,
87
+ handleClickOutside: handleOnClose,
88
+ handleEscapeKeydown: handleOnClose,
72
89
  captureClick: true
73
90
  }, /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Consumer, null, setOutsideClickTargetRef => /*#__PURE__*/React.createElement(EmojiPicker, {
74
91
  emojiProvider: Promise.resolve(emojiProvider),
@@ -223,9 +223,7 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
223
223
  usePluginHook: function usePluginHook() {
224
224
  useEffect(function () {
225
225
  delayUntilIdle(function () {
226
- if (fg('platform_editor_preload_emoji_picker')) {
227
- preloadEmojiPicker();
228
- }
226
+ preloadEmojiPicker();
229
227
  });
230
228
  }, []);
231
229
  },
@@ -329,7 +327,7 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
329
327
  description: formatMessage(messages.emojiDescription),
330
328
  priority: 500,
331
329
  keyshortcut: ':',
332
- isDisabledOffline: fg('platform_editor_preload_emoji_picker') ? false : true,
330
+ isDisabledOffline: false,
333
331
  icon: function icon() {
334
332
  return /*#__PURE__*/React.createElement(IconEmoji, null);
335
333
  },
@@ -1,4 +1,4 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useCallback, useEffect } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
@@ -7,6 +7,7 @@ import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as with
7
7
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
9
9
  import { EmojiPicker } from '@atlaskit/emoji';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  var PopupWithListeners = withOuterListeners(Popup);
11
12
  var getDomRefFromSelection = function getDomRefFromSelection(view) {
12
13
  var domRef = findDomRefAtPos(view.state.selection.from, view.domAtPos.bind(view));
@@ -40,6 +41,22 @@ export var InlineEmojiPopup = function InlineEmojiPopup(_ref) {
40
41
  emojiProvider = _ref2.emojiProvider,
41
42
  isOpen = _ref2.inlineEmojiPopupOpen;
42
43
  var intl = useIntl();
44
+ var handleOnClose = useCallback(function () {
45
+ if (fg('platform_editor_ease_of_use_metrics')) {
46
+ var _api$metrics;
47
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.startActiveSessionTimer());
48
+ }
49
+ onClose();
50
+ }, [onClose, api]);
51
+ useEffect(function () {
52
+ if (isOpen && fg('platform_editor_ease_of_use_metrics')) {
53
+ var _api$metrics2;
54
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 ? void 0 : _api$metrics2.commands.handleIntentToStartEdit({
55
+ shouldStartTimer: false,
56
+ shouldPersistActiveSession: true
57
+ }));
58
+ }
59
+ }, [isOpen, api]);
43
60
  var focusEditor = useCallback(function () {
44
61
  // use requestAnimationFrame to run this async after the call
45
62
  requestAnimationFrame(function () {
@@ -48,8 +65,8 @@ export var InlineEmojiPopup = function InlineEmojiPopup(_ref) {
48
65
  }, [editorView]);
49
66
  var handleSelection = useCallback(function (emojiId) {
50
67
  api.core.actions.execute(api.emoji.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
51
- onClose();
52
- }, [api.core.actions, api.emoji.commands, onClose]);
68
+ handleOnClose();
69
+ }, [api.core.actions, api.emoji.commands, handleOnClose]);
53
70
  if (!isOpen || !emojiProvider) {
54
71
  return null;
55
72
  }
@@ -67,8 +84,8 @@ export var InlineEmojiPopup = function InlineEmojiPopup(_ref) {
67
84
  onUnmount: focusEditor,
68
85
  focusTrap: true,
69
86
  preventOverflow: true,
70
- handleClickOutside: onClose,
71
- handleEscapeKeydown: onClose,
87
+ handleClickOutside: handleOnClose,
88
+ handleEscapeKeydown: handleOnClose,
72
89
  captureClick: true
73
90
  }, /*#__PURE__*/React.createElement(OutsideClickTargetRefContext.Consumer, null, function (setOutsideClickTargetRef) {
74
91
  return /*#__PURE__*/React.createElement(EmojiPicker, {
@@ -4,6 +4,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { InlineCommentInputMethod, InlineCommentMap } from '@atlaskit/editor-plugin-annotation';
5
5
  import type { BasePlugin } from '@atlaskit/editor-plugin-base';
6
6
  import { type EditorViewModePluginState } from '@atlaskit/editor-plugin-editor-viewmode';
7
+ import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
7
8
  import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
8
9
  import type { SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
9
10
  import type { EmojiDescription, EmojiId, EmojiProvider, EmojiResourceConfig } from '@atlaskit/emoji';
@@ -51,7 +52,8 @@ export type EmojiPluginDependencies = [
51
52
  TypeAheadPlugin,
52
53
  OptionalPlugin<AnnotationPluginType>,
53
54
  OptionalPlugin<EditorViewModePluginType>,
54
- OptionalPlugin<BasePlugin>
55
+ OptionalPlugin<BasePlugin>,
56
+ OptionalPlugin<MetricsPlugin>
55
57
  ];
56
58
  export type EmojiPlugin = NextEditorPlugin<'emoji', {
57
59
  pluginConfiguration: EmojiPluginOptions | undefined;
@@ -4,6 +4,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { InlineCommentInputMethod, InlineCommentMap } from '@atlaskit/editor-plugin-annotation';
5
5
  import type { BasePlugin } from '@atlaskit/editor-plugin-base';
6
6
  import { type EditorViewModePluginState } from '@atlaskit/editor-plugin-editor-viewmode';
7
+ import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
7
8
  import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
8
9
  import type { SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
9
10
  import type { EmojiDescription, EmojiId, EmojiProvider, EmojiResourceConfig } from '@atlaskit/emoji';
@@ -51,7 +52,8 @@ export type EmojiPluginDependencies = [
51
52
  TypeAheadPlugin,
52
53
  OptionalPlugin<AnnotationPluginType>,
53
54
  OptionalPlugin<EditorViewModePluginType>,
54
- OptionalPlugin<BasePlugin>
55
+ OptionalPlugin<BasePlugin>,
56
+ OptionalPlugin<MetricsPlugin>
55
57
  ];
56
58
  export type EmojiPlugin = NextEditorPlugin<'emoji', {
57
59
  pluginConfiguration: EmojiPluginOptions | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-emoji",
3
- "version": "3.5.3",
3
+ "version": "3.6.0",
4
4
  "description": "Emoji plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -23,22 +23,23 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@atlaskit/adf-schema": "^47.6.0",
26
- "@atlaskit/editor-common": "^103.0.0",
26
+ "@atlaskit/editor-common": "^103.9.0",
27
27
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
28
- "@atlaskit/editor-plugin-annotation": "^2.2.0",
28
+ "@atlaskit/editor-plugin-annotation": "^2.6.0",
29
29
  "@atlaskit/editor-plugin-base": "^2.3.0",
30
- "@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
31
- "@atlaskit/editor-plugin-type-ahead": "^2.3.0",
30
+ "@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
31
+ "@atlaskit/editor-plugin-metrics": "^3.4.0",
32
+ "@atlaskit/editor-plugin-type-ahead": "^2.5.0",
32
33
  "@atlaskit/editor-prosemirror": "7.0.0",
33
34
  "@atlaskit/editor-shared-styles": "^3.4.0",
34
35
  "@atlaskit/emoji": "^69.0.0",
35
- "@atlaskit/icon": "^25.5.0",
36
+ "@atlaskit/icon": "^25.6.0",
36
37
  "@atlaskit/node-data-provider": "^4.1.0",
37
38
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
39
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
39
40
  "@atlaskit/theme": "^18.0.0",
40
- "@atlaskit/tmp-editor-statsig": "^4.6.0",
41
- "@atlaskit/tokens": "^4.7.0",
41
+ "@atlaskit/tmp-editor-statsig": "^4.11.0",
42
+ "@atlaskit/tokens": "^4.8.0",
42
43
  "@babel/runtime": "^7.0.0",
43
44
  "@emotion/react": "^11.7.1",
44
45
  "react-intl-next": "npm:react-intl@^5.18.1",
@@ -110,7 +111,7 @@
110
111
  "editor_inline_comments_paste_insert_nodes": {
111
112
  "type": "boolean"
112
113
  },
113
- "platform_editor_preload_emoji_picker": {
114
+ "platform_editor_ease_of_use_metrics": {
114
115
  "type": "boolean"
115
116
  }
116
117
  }