@atlaskit/editor-common 93.4.2 → 93.4.4

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/UNSAFE_do_not_use_editor_context/package.json +15 -0
  3. package/dist/cjs/analytics/types/enums.js +4 -0
  4. package/dist/cjs/analytics/types/mention-events.js +5 -0
  5. package/dist/cjs/monitoring/error.js +1 -1
  6. package/dist/cjs/ui/DropList/index.js +1 -1
  7. package/dist/cjs/ui/EditorContext/index.js +9 -0
  8. package/dist/cjs/with-plugin-state/index.js +273 -18
  9. package/dist/es2019/analytics/types/enums.js +4 -0
  10. package/dist/es2019/analytics/types/mention-events.js +1 -0
  11. package/dist/es2019/monitoring/error.js +1 -1
  12. package/dist/es2019/ui/DropList/index.js +1 -1
  13. package/dist/es2019/ui/EditorContext/index.js +2 -0
  14. package/dist/es2019/with-plugin-state/index.js +217 -5
  15. package/dist/esm/analytics/types/enums.js +4 -0
  16. package/dist/esm/analytics/types/mention-events.js +1 -0
  17. package/dist/esm/monitoring/error.js +1 -1
  18. package/dist/esm/ui/DropList/index.js +1 -1
  19. package/dist/esm/ui/EditorContext/index.js +2 -0
  20. package/dist/esm/with-plugin-state/index.js +272 -17
  21. package/dist/types/analytics/types/enums.d.ts +4 -0
  22. package/dist/types/analytics/types/events.d.ts +2 -1
  23. package/dist/types/analytics/types/mention-events.d.ts +80 -0
  24. package/dist/types/ui/EditorContext/index.d.ts +2 -0
  25. package/dist/types/with-plugin-state/index.d.ts +35 -1
  26. package/dist/types-ts4.5/analytics/types/enums.d.ts +4 -0
  27. package/dist/types-ts4.5/analytics/types/events.d.ts +2 -1
  28. package/dist/types-ts4.5/analytics/types/mention-events.d.ts +80 -0
  29. package/dist/types-ts4.5/ui/EditorContext/index.d.ts +2 -0
  30. package/dist/types-ts4.5/with-plugin-state/index.d.ts +35 -1
  31. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 93.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#151676](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151676)
8
+ [`ed6d01983b0da`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ed6d01983b0da) -
9
+ ED-25183: Remediate WithEditorActions, WithPluginState & LegacyEditorContext context type
10
+
11
+ ## 93.4.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#152012](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152012)
16
+ [`30a69f02904da`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30a69f02904da) -
17
+ [ED-23460] Make sure that error analytics in editor-plugin-mentions can fire by using actions from
18
+ editor-plugin-analytics
19
+
20
+ - **@atlaskit/editor-common**: Add types for `@atlaskit/editor-plugin-mentions` analytics
21
+ - **@atlaskit/editor-plugin-mentions**: Switch to using `@atlaskit/editor-plugin-analytics`
22
+ actions so that error events can be queued and fired consistently
23
+ - **@atlaskit/mention**: Move some enums to the types file and export them so they can be used to
24
+ type analytics events
25
+
3
26
  ## 93.4.2
4
27
 
5
28
  ### Patch Changes
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/UNSAFE_do_not_use_editor_context",
3
+ "main": "../dist/cjs/ui/EditorContext/index.js",
4
+ "module": "../dist/esm/ui/EditorContext/index.js",
5
+ "module:es2019": "../dist/es2019/ui/EditorContext/index.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/ui/EditorContext/index.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.4": {
10
+ "*": [
11
+ "../dist/types-ts4.5/ui/EditorContext/index.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -83,6 +83,7 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
83
83
  ACTION["PASTED"] = "pasted";
84
84
  ACTION["PASTED_AS_PLAIN"] = "pastedAsPlain";
85
85
  ACTION["PASTED_TIMED"] = "pastedTimed";
86
+ ACTION["PRESSED"] = "pressed";
86
87
  ACTION["PROSEMIRROR_RENDERED"] = "proseMirrorRendered";
87
88
  ACTION["REACT_NODEVIEW_RENDERED"] = "reactNodeViewRendered";
88
89
  ACTION["REPLACED_ALL"] = "replacedAll";
@@ -221,11 +222,13 @@ var ACTION_SUBJECT = exports.ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJ
221
222
  ACTION_SUBJECT["FLOATING_CONTEXTUAL_BUTTON"] = "floatingContextualButton";
222
223
  ACTION_SUBJECT["FLOATING_TOOLBAR_PLUGIN"] = "floatingToolbarPlugin";
223
224
  ACTION_SUBJECT["HELP"] = "help";
225
+ ACTION_SUBJECT["INVITE_ITEM"] = "inviteItem";
224
226
  ACTION_SUBJECT["LAYOUT"] = "layout";
225
227
  ACTION_SUBJECT["LIST"] = "list";
226
228
  ACTION_SUBJECT["MEDIA"] = "media";
227
229
  ACTION_SUBJECT["MEDIA_SINGLE"] = "mediaSingle";
228
230
  ACTION_SUBJECT["MENTION"] = "mention";
231
+ ACTION_SUBJECT["MENTION_TYPEAHEAD"] = "mentionTypeahead";
229
232
  ACTION_SUBJECT["NESTED_EXPAND"] = "nestedExpand";
230
233
  ACTION_SUBJECT["PANEL"] = "panel";
231
234
  ACTION_SUBJECT["PICKER"] = "picker";
@@ -238,6 +241,7 @@ var ACTION_SUBJECT = exports.ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJ
238
241
  ACTION_SUBJECT["HYPERLINK"] = "hyperlink";
239
242
  ACTION_SUBJECT["TABLE"] = "table";
240
243
  ACTION_SUBJECT["TABLES_PLUGIN"] = "tablesPlugin";
244
+ ACTION_SUBJECT["TEAM_MENTION_TYPEAHEAD"] = "teamMentionTypeahead";
241
245
  ACTION_SUBJECT["TEXT"] = "text";
242
246
  ACTION_SUBJECT["TOOLBAR"] = "toolbar";
243
247
  ACTION_SUBJECT["TYPEAHEAD"] = "typeAhead";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  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; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "93.4.2";
20
+ var packageVersion = "93.4.4";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "93.4.2";
27
+ var packageVersion = "93.4.4";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.EditorContext = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var EditorContext = exports.EditorContext = /*#__PURE__*/_react.default.createContext({});
@@ -4,19 +4,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.WithPluginState = void 0;
7
+ exports.WithPluginStateOld = exports.WithPluginStateInner = exports.WithPluginState = void 0;
8
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
14
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
16
  var _react = _interopRequireDefault(require("react"));
16
17
  var _propTypes = _interopRequireDefault(require("prop-types"));
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
19
  var _analytics = require("../analytics");
18
20
  var _eventDispatcher = require("../event-dispatcher");
19
21
  var _performanceMeasures = require("../performance-measures");
22
+ var _EditorContext = require("../ui/EditorContext");
20
23
  var _utils = require("../utils");
21
24
  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; }
22
25
  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; }
@@ -68,10 +71,34 @@ var DEFAULT_SLOW_THRESHOLD = 4;
68
71
  var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Component) {
69
72
  (0, _inherits2.default)(WithPluginState, _React$Component);
70
73
  var _super = _createSuper(WithPluginState);
71
- function WithPluginState(props, context) {
72
- var _this;
74
+ function WithPluginState(props) {
73
75
  (0, _classCallCheck2.default)(this, WithPluginState);
74
- _this = _super.call(this, props, context);
76
+ return _super.call(this, props);
77
+ }
78
+ (0, _createClass2.default)(WithPluginState, [{
79
+ key: "render",
80
+ value: function render() {
81
+ if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2')) {
82
+ return /*#__PURE__*/_react.default.createElement(WithPluginStateNew, this.props);
83
+ }
84
+ return /*#__PURE__*/_react.default.createElement(WithPluginStateOld, this.props);
85
+ }
86
+ }]);
87
+ return WithPluginState;
88
+ }(_react.default.Component);
89
+ function WithPluginStateNew(props) {
90
+ var context = _react.default.useContext(_EditorContext.EditorContext);
91
+ return /*#__PURE__*/_react.default.createElement(WithPluginStateInner, (0, _extends2.default)({}, props, {
92
+ editorActions: context === null || context === void 0 ? void 0 : context.editorActions
93
+ }));
94
+ }
95
+ var WithPluginStateInner = exports.WithPluginStateInner = /*#__PURE__*/function (_React$Component2) {
96
+ (0, _inherits2.default)(WithPluginStateInner, _React$Component2);
97
+ var _super2 = _createSuper(WithPluginStateInner);
98
+ function WithPluginStateInner(props) {
99
+ var _this;
100
+ (0, _classCallCheck2.default)(this, WithPluginStateInner);
101
+ _this = _super2.call(this, props);
75
102
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "listeners", {});
76
103
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "debounce", null);
77
104
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "notAppliedState", {});
@@ -137,24 +164,22 @@ var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Co
137
164
  });
138
165
  }
139
166
  });
140
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onContextUpdate", function () {
141
- _this.subscribe(_this.props);
142
- });
143
- _this.state = _this.getPluginsStates(_this.props.plugins, _this.getEditorView(props, context));
167
+ _this.state = _this.getPluginsStates(_this.props.plugins, _this.getEditorView(props));
144
168
  return _this;
145
169
  }
146
- (0, _createClass2.default)(WithPluginState, [{
170
+ (0, _createClass2.default)(WithPluginStateInner, [{
147
171
  key: "getEditorView",
148
- value: function getEditorView(maybeProps, maybeContext) {
172
+ value: function getEditorView(maybeProps) {
149
173
  var props = maybeProps || this.props;
150
- var context = maybeContext || this.context;
151
- return props.editorView || context && context.editorActions && context.editorActions._privateGetEditorView() || context && context.editorSharedConfig && context.editorSharedConfig.editorView;
174
+ var editorActions = props.editorActions;
175
+ return props.editorView || (editorActions === null || editorActions === void 0 ? void 0 : editorActions._privateGetEditorView());
152
176
  }
153
177
  }, {
154
178
  key: "getEventDispatcher",
155
179
  value: function getEventDispatcher(maybeProps) {
180
+ var _props$editorActions;
156
181
  var props = maybeProps || this.props;
157
- return props.eventDispatcher || this.context && this.context.editorActions && this.context.editorActions._privateGetEventDispatcher() || this.context && this.context.editorSharedConfig && this.context.editorSharedConfig.eventDispatcher;
182
+ return props.eventDispatcher || ((_props$editorActions = props.editorActions) === null || _props$editorActions === void 0 ? void 0 : _props$editorActions._privateGetEventDispatcher());
158
183
  }
159
184
  }, {
160
185
  key: "getPluginsStates",
@@ -245,6 +270,236 @@ var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Co
245
270
  });
246
271
  this.listeners = [];
247
272
  }
273
+ }, {
274
+ key: "subscribeToContextUpdates",
275
+ value: function subscribeToContextUpdates() {
276
+ var _this$props$editorAct,
277
+ _this4 = this;
278
+ (_this$props$editorAct = this.props.editorActions) === null || _this$props$editorAct === void 0 || _this$props$editorAct._privateSubscribe(function () {
279
+ return _this4.subscribe(_this4.props);
280
+ });
281
+ }
282
+ }, {
283
+ key: "unsubscribeFromContextUpdates",
284
+ value: function unsubscribeFromContextUpdates() {
285
+ var _this$props$editorAct2,
286
+ _this5 = this;
287
+ (_this$props$editorAct2 = this.props.editorActions) === null || _this$props$editorAct2 === void 0 || _this$props$editorAct2._privateUnsubscribe(function () {
288
+ return _this5.subscribe(_this5.props);
289
+ });
290
+ }
291
+ }, {
292
+ key: "componentDidMount",
293
+ value: function componentDidMount() {
294
+ this.subscribe(this.props);
295
+ this.subscribeToContextUpdates();
296
+ }
297
+ }, {
298
+ key: "UNSAFE_componentWillReceiveProps",
299
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
300
+ if (!this.isSubscribed) {
301
+ this.subscribe(nextProps);
302
+ }
303
+ }
304
+ }, {
305
+ key: "componentWillUnmount",
306
+ value: function componentWillUnmount() {
307
+ if (this.debounce) {
308
+ window.clearTimeout(this.debounce);
309
+ }
310
+ this.unsubscribeFromContextUpdates();
311
+ this.unsubscribe();
312
+ }
313
+ }, {
314
+ key: "render",
315
+ value: function render() {
316
+ var render = this.props.render;
317
+ return render(this.state);
318
+ }
319
+ }]);
320
+ return WithPluginStateInner;
321
+ }(_react.default.Component);
322
+ (0, _defineProperty2.default)(WithPluginStateInner, "displayName", 'WithPluginState');
323
+ var WithPluginStateOld = exports.WithPluginStateOld = /*#__PURE__*/function (_React$Component3) {
324
+ (0, _inherits2.default)(WithPluginStateOld, _React$Component3);
325
+ var _super3 = _createSuper(WithPluginStateOld);
326
+ function WithPluginStateOld(props, context) {
327
+ var _this6;
328
+ (0, _classCallCheck2.default)(this, WithPluginStateOld);
329
+ _this6 = _super3.call(this, props, context);
330
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "listeners", {});
331
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "debounce", null);
332
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "notAppliedState", {});
333
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "isSubscribed", false);
334
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "callsCount", 0);
335
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "handlePluginStateChange", function (propName, pluginName, performanceOptions, skipEqualityCheck) {
336
+ return function (pluginState) {
337
+ // skipEqualityCheck is being used for old plugins since they are mutating plugin state instead of creating a new one
338
+ if (_this6.state[propName] !== pluginState || skipEqualityCheck) {
339
+ _this6.updateState({
340
+ stateSubset: (0, _defineProperty2.default)({}, propName, pluginState),
341
+ pluginName: pluginName,
342
+ performanceOptions: performanceOptions
343
+ });
344
+ }
345
+ };
346
+ });
347
+ /**
348
+ * Debounces setState calls in order to reduce number of re-renders caused by several plugin state changes.
349
+ */
350
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "updateState", function (_ref2) {
351
+ var stateSubset = _ref2.stateSubset,
352
+ pluginName = _ref2.pluginName,
353
+ performanceOptions = _ref2.performanceOptions;
354
+ _this6.notAppliedState = _objectSpread(_objectSpread({}, _this6.notAppliedState), stateSubset);
355
+ if (_this6.debounce) {
356
+ window.clearTimeout(_this6.debounce);
357
+ }
358
+ var debounce = _this6.props.debounce !== false ? function (fn) {
359
+ return window.setTimeout(fn, 0);
360
+ } : function (fn) {
361
+ return fn();
362
+ };
363
+ _this6.debounce = debounce(function () {
364
+ var measure = "\uD83E\uDD89".concat(pluginName, "::WithPluginState");
365
+ performanceOptions.trackingEnabled && (0, _performanceMeasures.startMeasure)(measure);
366
+ _this6.setState(_this6.notAppliedState, function () {
367
+ performanceOptions.trackingEnabled && (0, _performanceMeasures.stopMeasure)(measure, function (duration) {
368
+ // Each WithPluginState component will fire analytics event no more than once every `samplingLimit` times
369
+ if (++_this6.callsCount % performanceOptions.samplingRate === 0 && duration > performanceOptions.slowThreshold) {
370
+ _this6.dispatchAnalyticsEvent({
371
+ action: _analytics.ACTION.WITH_PLUGIN_STATE_CALLED,
372
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
373
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
374
+ attributes: {
375
+ plugin: pluginName,
376
+ duration: duration
377
+ }
378
+ });
379
+ }
380
+ });
381
+ });
382
+ _this6.debounce = null;
383
+ _this6.notAppliedState = {};
384
+ });
385
+ });
386
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "dispatchAnalyticsEvent", function (payload) {
387
+ var eventDispatcher = _this6.getEventDispatcher();
388
+ if (eventDispatcher) {
389
+ var dispatch = (0, _eventDispatcher.createDispatch)(eventDispatcher);
390
+ dispatch(_utils.analyticsEventKey, {
391
+ payload: payload
392
+ });
393
+ }
394
+ });
395
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "onContextUpdate", function () {
396
+ _this6.subscribe(_this6.props);
397
+ });
398
+ _this6.state = _this6.getPluginsStates(_this6.props.plugins, _this6.getEditorView(props, context));
399
+ return _this6;
400
+ }
401
+ (0, _createClass2.default)(WithPluginStateOld, [{
402
+ key: "getEditorView",
403
+ value: function getEditorView(maybeProps, maybeContext) {
404
+ var props = maybeProps || this.props;
405
+ var context = maybeContext || this.context;
406
+ return props.editorView || context && context.editorActions && context.editorActions._privateGetEditorView() || context && context.editorSharedConfig && context.editorSharedConfig.editorView;
407
+ }
408
+ }, {
409
+ key: "getEventDispatcher",
410
+ value: function getEventDispatcher(maybeProps) {
411
+ var props = maybeProps || this.props;
412
+ return props.eventDispatcher || this.context && this.context.editorActions && this.context.editorActions._privateGetEventDispatcher() || this.context && this.context.editorSharedConfig && this.context.editorSharedConfig.eventDispatcher;
413
+ }
414
+ }, {
415
+ key: "getPluginsStates",
416
+ value: function getPluginsStates(plugins, editorView) {
417
+ if (!editorView || !plugins) {
418
+ return {};
419
+ }
420
+ var keys = Object.keys(plugins);
421
+ return keys.reduce(function (acc, propName) {
422
+ var pluginKey = plugins[propName];
423
+ if (!pluginKey) {
424
+ return acc;
425
+ }
426
+ acc[propName] = pluginKey.getState(editorView.state);
427
+ return acc;
428
+ }, {});
429
+ }
430
+ }, {
431
+ key: "subscribe",
432
+ value: function subscribe(props) {
433
+ var _uiTracking$samplingR2,
434
+ _uiTracking$slowThres2,
435
+ _this7 = this;
436
+ var plugins = props.plugins;
437
+ var eventDispatcher = this.getEventDispatcher(props);
438
+ var editorView = this.getEditorView(props);
439
+ if (!eventDispatcher || !editorView || this.isSubscribed) {
440
+ return;
441
+ }
442
+
443
+ // TODO: ED-15663
444
+ // Please, do not copy or use this kind of code below
445
+ // @ts-ignore
446
+ var fakePluginKey = {
447
+ key: 'analyticsPlugin$',
448
+ getState: function getState(state) {
449
+ return state['analyticsPlugin$'];
450
+ }
451
+ };
452
+ var analyticsPlugin = fakePluginKey.getState(editorView.state);
453
+ var uiTracking = analyticsPlugin && analyticsPlugin.performanceTracking ? analyticsPlugin.performanceTracking.uiTracking || {} : {};
454
+ var trackingEnabled = uiTracking.enabled === true;
455
+ var samplingRate = (_uiTracking$samplingR2 = uiTracking.samplingRate) !== null && _uiTracking$samplingR2 !== void 0 ? _uiTracking$samplingR2 : DEFAULT_SAMPLING_RATE;
456
+ var slowThreshold = (_uiTracking$slowThres2 = uiTracking.slowThreshold) !== null && _uiTracking$slowThres2 !== void 0 ? _uiTracking$slowThres2 : DEFAULT_SLOW_THRESHOLD;
457
+ this.isSubscribed = true;
458
+ var pluginsStates = this.getPluginsStates(plugins, editorView);
459
+ this.setState(pluginsStates);
460
+ Object.keys(plugins).forEach(function (propName) {
461
+ var pluginKey = plugins[propName];
462
+ if (!pluginKey) {
463
+ return;
464
+ }
465
+ var pluginName = pluginKey.key;
466
+ var pluginState = pluginsStates[propName];
467
+ var isPluginWithSubscribe = pluginState && pluginState.subscribe;
468
+ var handler = _this7.handlePluginStateChange(propName, pluginName, {
469
+ samplingRate: samplingRate,
470
+ slowThreshold: slowThreshold,
471
+ trackingEnabled: trackingEnabled
472
+ }, isPluginWithSubscribe);
473
+ if (isPluginWithSubscribe) {
474
+ pluginState.subscribe(handler);
475
+ } else {
476
+ eventDispatcher.on(pluginKey.key, handler);
477
+ }
478
+ _this7.listeners[pluginKey.key] = {
479
+ handler: handler,
480
+ pluginKey: pluginKey
481
+ };
482
+ });
483
+ }
484
+ }, {
485
+ key: "unsubscribe",
486
+ value: function unsubscribe() {
487
+ var _this8 = this;
488
+ var eventDispatcher = this.getEventDispatcher();
489
+ var editorView = this.getEditorView();
490
+ if (!eventDispatcher || !editorView || !this.isSubscribed) {
491
+ return;
492
+ }
493
+ Object.keys(this.listeners).forEach(function (key) {
494
+ var pluginState = _this8.listeners[key].pluginKey.getState(editorView.state);
495
+ if (pluginState && pluginState.unsubscribe) {
496
+ pluginState.unsubscribe(_this8.listeners[key].handler);
497
+ } else {
498
+ eventDispatcher.off(key, _this8.listeners[key].handler);
499
+ }
500
+ });
501
+ this.listeners = [];
502
+ }
248
503
  }, {
249
504
  key: "subscribeToContextUpdates",
250
505
  value: function subscribeToContextUpdates(context) {
@@ -288,10 +543,10 @@ var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Co
288
543
  return render(this.state);
289
544
  }
290
545
  }]);
291
- return WithPluginState;
546
+ return WithPluginStateOld;
292
547
  }(_react.default.Component);
293
- (0, _defineProperty2.default)(WithPluginState, "displayName", 'WithPluginState');
294
- (0, _defineProperty2.default)(WithPluginState, "contextTypes", {
548
+ (0, _defineProperty2.default)(WithPluginStateOld, "displayName", 'WithPluginState');
549
+ (0, _defineProperty2.default)(WithPluginStateOld, "contextTypes", {
295
550
  editorActions: _propTypes.default.object,
296
551
  editorSharedConfig: _propTypes.default.object
297
552
  });
@@ -77,6 +77,7 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
77
77
  ACTION["PASTED"] = "pasted";
78
78
  ACTION["PASTED_AS_PLAIN"] = "pastedAsPlain";
79
79
  ACTION["PASTED_TIMED"] = "pastedTimed";
80
+ ACTION["PRESSED"] = "pressed";
80
81
  ACTION["PROSEMIRROR_RENDERED"] = "proseMirrorRendered";
81
82
  ACTION["REACT_NODEVIEW_RENDERED"] = "reactNodeViewRendered";
82
83
  ACTION["REPLACED_ALL"] = "replacedAll";
@@ -215,11 +216,13 @@ export let ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
215
216
  ACTION_SUBJECT["FLOATING_CONTEXTUAL_BUTTON"] = "floatingContextualButton";
216
217
  ACTION_SUBJECT["FLOATING_TOOLBAR_PLUGIN"] = "floatingToolbarPlugin";
217
218
  ACTION_SUBJECT["HELP"] = "help";
219
+ ACTION_SUBJECT["INVITE_ITEM"] = "inviteItem";
218
220
  ACTION_SUBJECT["LAYOUT"] = "layout";
219
221
  ACTION_SUBJECT["LIST"] = "list";
220
222
  ACTION_SUBJECT["MEDIA"] = "media";
221
223
  ACTION_SUBJECT["MEDIA_SINGLE"] = "mediaSingle";
222
224
  ACTION_SUBJECT["MENTION"] = "mention";
225
+ ACTION_SUBJECT["MENTION_TYPEAHEAD"] = "mentionTypeahead";
223
226
  ACTION_SUBJECT["NESTED_EXPAND"] = "nestedExpand";
224
227
  ACTION_SUBJECT["PANEL"] = "panel";
225
228
  ACTION_SUBJECT["PICKER"] = "picker";
@@ -232,6 +235,7 @@ export let ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
232
235
  ACTION_SUBJECT["HYPERLINK"] = "hyperlink";
233
236
  ACTION_SUBJECT["TABLE"] = "table";
234
237
  ACTION_SUBJECT["TABLES_PLUGIN"] = "tablesPlugin";
238
+ ACTION_SUBJECT["TEAM_MENTION_TYPEAHEAD"] = "teamMentionTypeahead";
235
239
  ACTION_SUBJECT["TEXT"] = "text";
236
240
  ACTION_SUBJECT["TOOLBAR"] = "toolbar";
237
241
  ACTION_SUBJECT["TYPEAHEAD"] = "typeAhead";
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "93.4.2";
4
+ const packageVersion = "93.4.4";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "93.4.2";
16
+ const packageVersion = "93.4.4";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export const EditorContext = /*#__PURE__*/React.createContext({});