@atlaskit/editor-core 185.13.0 → 185.14.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/create-editor/create-plugins-list.js +4 -4
  3. package/dist/cjs/editor-next/index.js +29 -41
  4. package/dist/cjs/editor.js +3 -29
  5. package/dist/cjs/labs/next/presets/universal.js +6 -14
  6. package/dist/cjs/labs/next/presets/useUniversalPreset.js +2 -5
  7. package/dist/cjs/plugins/analytics/plugin.js +13 -7
  8. package/dist/cjs/plugins/card/pm-plugins/doc.js +2 -2
  9. package/dist/cjs/plugins/card/pm-plugins/main.js +27 -22
  10. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +4 -4
  11. package/dist/cjs/plugins/card/toolbar.js +8 -5
  12. package/dist/cjs/plugins/collab-edit/analytics.js +8 -6
  13. package/dist/cjs/plugins/collab-edit/events/handlers.js +4 -4
  14. package/dist/cjs/plugins/collab-edit/events/initialize.js +3 -2
  15. package/dist/cjs/plugins/collab-edit/index.js +3 -2
  16. package/dist/cjs/plugins/collab-edit/plugin.js +7 -4
  17. package/dist/cjs/plugins/emoji/index.js +17 -7
  18. package/dist/cjs/plugins/mentions/index.js +14 -12
  19. package/dist/cjs/version-wrapper.js +1 -1
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/create-editor/create-plugins-list.js +4 -4
  22. package/dist/es2019/editor-next/index.js +25 -39
  23. package/dist/es2019/editor.js +2 -25
  24. package/dist/es2019/labs/next/presets/universal.js +6 -16
  25. package/dist/es2019/labs/next/presets/useUniversalPreset.js +2 -6
  26. package/dist/es2019/plugins/analytics/plugin.js +13 -9
  27. package/dist/es2019/plugins/card/pm-plugins/doc.js +2 -3
  28. package/dist/es2019/plugins/card/pm-plugins/main.js +27 -22
  29. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +4 -4
  30. package/dist/es2019/plugins/card/toolbar.js +8 -5
  31. package/dist/es2019/plugins/collab-edit/analytics.js +17 -13
  32. package/dist/es2019/plugins/collab-edit/events/handlers.js +4 -4
  33. package/dist/es2019/plugins/collab-edit/events/initialize.js +3 -2
  34. package/dist/es2019/plugins/collab-edit/index.js +3 -2
  35. package/dist/es2019/plugins/collab-edit/plugin.js +7 -4
  36. package/dist/es2019/plugins/emoji/index.js +17 -7
  37. package/dist/es2019/plugins/mentions/index.js +7 -6
  38. package/dist/es2019/version-wrapper.js +1 -1
  39. package/dist/es2019/version.json +1 -1
  40. package/dist/esm/create-editor/create-plugins-list.js +4 -4
  41. package/dist/esm/editor-next/index.js +28 -42
  42. package/dist/esm/editor.js +3 -29
  43. package/dist/esm/labs/next/presets/universal.js +6 -14
  44. package/dist/esm/labs/next/presets/useUniversalPreset.js +2 -5
  45. package/dist/esm/plugins/analytics/plugin.js +13 -7
  46. package/dist/esm/plugins/card/pm-plugins/doc.js +2 -3
  47. package/dist/esm/plugins/card/pm-plugins/main.js +27 -22
  48. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +4 -4
  49. package/dist/esm/plugins/card/toolbar.js +8 -5
  50. package/dist/esm/plugins/collab-edit/analytics.js +8 -6
  51. package/dist/esm/plugins/collab-edit/events/handlers.js +4 -4
  52. package/dist/esm/plugins/collab-edit/events/initialize.js +3 -2
  53. package/dist/esm/plugins/collab-edit/index.js +3 -2
  54. package/dist/esm/plugins/collab-edit/plugin.js +7 -4
  55. package/dist/esm/plugins/emoji/index.js +17 -7
  56. package/dist/esm/plugins/mentions/index.js +14 -12
  57. package/dist/esm/version-wrapper.js +1 -1
  58. package/dist/esm/version.json +1 -1
  59. package/dist/types/create-editor/create-plugins-list.d.ts +2 -2
  60. package/dist/types/editor-next/index.d.ts +1 -0
  61. package/dist/types/editor.d.ts +0 -1
  62. package/dist/types/labs/next/presets/universal.d.ts +2 -2
  63. package/dist/types/plugins/card/pm-plugins/doc.d.ts +2 -1
  64. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  65. package/dist/types/plugins/card/pm-plugins/util/state.d.ts +0 -1
  66. package/dist/types/plugins/card/types.d.ts +1 -3
  67. package/dist/types/plugins/collab-edit/analytics.d.ts +4 -3
  68. package/dist/types/plugins/collab-edit/events/handlers.d.ts +3 -2
  69. package/dist/types/plugins/collab-edit/events/initialize.d.ts +4 -2
  70. package/dist/types/plugins/collab-edit/index.d.ts +6 -2
  71. package/dist/types/plugins/collab-edit/plugin.d.ts +3 -1
  72. package/dist/types/plugins/collab-edit/types.d.ts +0 -2
  73. package/dist/types/plugins/emoji/index.d.ts +3 -1
  74. package/dist/types/plugins/emoji/types.d.ts +1 -3
  75. package/dist/types/plugins/mentions/types.d.ts +2 -4
  76. package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +2 -2
  77. package/dist/types-ts4.5/editor-next/index.d.ts +1 -0
  78. package/dist/types-ts4.5/editor.d.ts +0 -1
  79. package/dist/types-ts4.5/labs/next/presets/universal.d.ts +2 -2
  80. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +2 -1
  81. package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  82. package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +0 -1
  83. package/dist/types-ts4.5/plugins/card/types.d.ts +1 -3
  84. package/dist/types-ts4.5/plugins/collab-edit/analytics.d.ts +4 -3
  85. package/dist/types-ts4.5/plugins/collab-edit/events/handlers.d.ts +3 -2
  86. package/dist/types-ts4.5/plugins/collab-edit/events/initialize.d.ts +4 -2
  87. package/dist/types-ts4.5/plugins/collab-edit/index.d.ts +4 -2
  88. package/dist/types-ts4.5/plugins/collab-edit/plugin.d.ts +3 -1
  89. package/dist/types-ts4.5/plugins/collab-edit/types.d.ts +0 -2
  90. package/dist/types-ts4.5/plugins/emoji/index.d.ts +5 -1
  91. package/dist/types-ts4.5/plugins/emoji/types.d.ts +1 -3
  92. package/dist/types-ts4.5/plugins/mentions/types.d.ts +2 -4
  93. package/package.json +10 -7
  94. package/report.api.md +2 -2
  95. package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +0 -79
  96. package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +0 -69
  97. package/dist/esm/labs/next/presets/create-stub-internal-apis.js +0 -72
  98. package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +0 -13
  99. package/dist/types-ts4.5/labs/next/presets/create-stub-internal-apis.d.ts +0 -13
  100. package/tmp/api-report-tmp.d.ts +0 -2364
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 185.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`91c4edcea5a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/91c4edcea5a) - The analytics plugin (`editor-plugin-analytics`) now creates the `createAnalyticsEvent` if none is supplied and shares it with other plugins internally.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 185.13.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [`202f8c2ee69`](https://bitbucket.org/atlassian/atlassian-frontend/commits/202f8c2ee69) - The changes here adds support for datasource feature flag for rollout.
18
+
3
19
  ## 185.13.0
4
20
 
5
21
  ### Patch Changes
@@ -117,8 +117,8 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
117
117
  * Note: The order that presets are added determines
118
118
  * their placement in the editor toolbar
119
119
  */
120
- function createPluginsList(props, prevProps, createAnalyticsEvent) {
121
- var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent);
120
+ function createPluginsList(props, prevProps) {
121
+ var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
122
122
  var excludes = new Set();
123
123
  if (!isCodeBlockAllowed({
124
124
  allowBlockType: props.allowBlockType
@@ -148,8 +148,8 @@ function withDangerouslyAppendPlugins(preset) {
148
148
  return presetWithAppendedPlugins;
149
149
  };
150
150
  }
151
- function createPreset(props, prevProps, createAnalyticsEvent) {
151
+ function createPreset(props, prevProps) {
152
152
  var _props$dangerouslyApp;
153
- var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent);
153
+ var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance);
154
154
  return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
155
155
  }
@@ -13,9 +13,13 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
13
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _ui = require("@atlaskit/editor-common/ui");
16
+ var _utils = require("@atlaskit/editor-common/utils");
16
17
  var _react = require("@emotion/react");
17
18
  var _propTypes = _interopRequireDefault(require("prop-types"));
18
19
  var _react2 = _interopRequireDefault(require("react"));
20
+ var _versionWrapper = require("../version-wrapper");
21
+ var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
22
+ var _v = _interopRequireDefault(require("uuid/v4"));
19
23
  var _actions = _interopRequireDefault(require("../actions"));
20
24
  var _analytics = require("@atlaskit/editor-common/analytics");
21
25
  var _editorInternal = _interopRequireDefault(require("./editor-internal"));
@@ -28,15 +32,10 @@ var _plugins = require("../plugins");
28
32
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
33
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
30
34
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
31
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */ // import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
32
- // import { name, version } from '../version-wrapper';
33
- // import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
34
- // import uuid from 'uuid/v4';
35
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
35
36
  var EditorNext = /*#__PURE__*/function (_React$Component) {
36
37
  (0, _inherits2.default)(EditorNext, _React$Component);
37
38
  var _super = _createSuper(EditorNext);
38
- // private editorSessionId: string;
39
-
40
39
  function EditorNext(props, context) {
41
40
  var _this;
42
41
  (0, _classCallCheck2.default)(this, EditorNext);
@@ -56,7 +55,7 @@ var EditorNext = /*#__PURE__*/function (_React$Component) {
56
55
  });
57
56
  (0, _deprecationWarnings.default)(props);
58
57
  _this.editorActions = (context || {}).editorActions || new _actions.default();
59
- // this.editorSessionId = uuid();
58
+ _this.editorSessionId = (0, _v.default)();
60
59
  _this.startTime = performance.now();
61
60
  _this.onEditorCreated = _this.onEditorCreated.bind((0, _assertThisInitialized2.default)(_this));
62
61
  _this.onEditorDestroyed = _this.onEditorDestroyed.bind((0, _assertThisInitialized2.default)(_this));
@@ -99,40 +98,29 @@ var EditorNext = /*#__PURE__*/function (_React$Component) {
99
98
  key: "render",
100
99
  value: function render() {
101
100
  var _this3 = this;
102
- // TODO: https://product-fabric.atlassian.net/browse/ED-16979
103
- // Move `FabricEditorAnalyticsContext` back into `EditorNext`
104
- // This was moved out here to workaround the issue that the analytics
105
- // context does not wrap the Preset (and therefore does not pass this context
106
- // information to analytics calls within plugins). After this cleanup task ^ we will
107
- // not have to generate the `createAnalyticsEvent` outside the Preset
108
- // and we can move this back into `EditorNext`.
109
- return (
110
- // <FabricEditorAnalyticsContext
111
- // data={{
112
- // packageName: name,
113
- // packageVersion: version,
114
- // componentName: 'editorCore',
115
- // appearance: getAnalyticsAppearance(this.props.appearance),
116
- // editorSessionId: this.editorSessionId,
117
- // }}
118
- // >
119
- (0, _react.jsx)(_ui.WithCreateAnalyticsEvent, {
120
- render: function render(createAnalyticsEvent) {
121
- return (_this3.createAnalyticsEvent = createAnalyticsEvent) && (0, _react.jsx)(_editorInternal.default, {
122
- props: _this3.props,
123
- handleAnalyticsEvent: _this3.handleAnalyticsEvent,
124
- createAnalyticsEvent: _this3.createAnalyticsEvent,
125
- preset: _this3.props.preset,
126
- handleSave: _this3.handleSave,
127
- editorActions: _this3.editorActions,
128
- getExperienceStore: _this3.getExperienceStore,
129
- onEditorCreated: _this3.onEditorCreated,
130
- onEditorDestroyed: _this3.onEditorDestroyed
131
- });
132
- }
133
- })
134
- // </FabricEditorAnalyticsContext>
135
- );
101
+ return (0, _react.jsx)(_analyticsNamespacedContext.FabricEditorAnalyticsContext, {
102
+ data: {
103
+ packageName: _versionWrapper.name,
104
+ packageVersion: _versionWrapper.version,
105
+ componentName: 'editorCore',
106
+ appearance: (0, _utils.getAnalyticsAppearance)(this.props.appearance),
107
+ editorSessionId: this.editorSessionId
108
+ }
109
+ }, (0, _react.jsx)(_ui.WithCreateAnalyticsEvent, {
110
+ render: function render(createAnalyticsEvent) {
111
+ return (_this3.createAnalyticsEvent = createAnalyticsEvent) && (0, _react.jsx)(_editorInternal.default, {
112
+ props: _this3.props,
113
+ handleAnalyticsEvent: _this3.handleAnalyticsEvent,
114
+ createAnalyticsEvent: _this3.createAnalyticsEvent,
115
+ preset: _this3.props.preset,
116
+ handleSave: _this3.handleSave,
117
+ editorActions: _this3.editorActions,
118
+ getExperienceStore: _this3.getExperienceStore,
119
+ onEditorCreated: _this3.onEditorCreated,
120
+ onEditorDestroyed: _this3.onEditorDestroyed
121
+ });
122
+ }
123
+ }));
136
124
  }
137
125
  }]);
138
126
  return EditorNext;
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
10
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
@@ -18,10 +17,6 @@ var _react2 = _interopRequireDefault(require("react"));
18
17
  var _editorPropTypes = require("./editor-next/utils/editorPropTypes");
19
18
  var _editorNext = _interopRequireDefault(require("./editor-next"));
20
19
  var _useUniversalPreset = _interopRequireDefault(require("./labs/next/presets/useUniversalPreset"));
21
- var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
22
- var _versionWrapper = require("./version-wrapper");
23
- var _utils = require("@atlaskit/editor-common/utils");
24
- var _v = _interopRequireDefault(require("uuid/v4"));
25
20
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
26
21
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
27
22
  var EditorNextWrapper = function EditorNextWrapper(_ref) {
@@ -37,36 +32,15 @@ var Editor = /*#__PURE__*/function (_React$Component) {
37
32
  (0, _inherits2.default)(Editor, _React$Component);
38
33
  var _super = _createSuper(Editor);
39
34
  function Editor() {
40
- var _this;
41
35
  (0, _classCallCheck2.default)(this, Editor);
42
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
- args[_key] = arguments[_key];
44
- }
45
- _this = _super.call.apply(_super, [this].concat(args));
46
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "editorSessionId", (0, _v.default)());
47
- return _this;
36
+ return _super.apply(this, arguments);
48
37
  }
49
38
  (0, _createClass2.default)(Editor, [{
50
39
  key: "render",
51
40
  value: function render() {
52
- // TODO: https://product-fabric.atlassian.net/browse/ED-16979
53
- // Move `FabricEditorAnalyticsContext` back into `EditorNext`
54
- // This was moved out here to workaround the issue that the analytics
55
- // context does not wrap the Preset (and therefore does not pass this context
56
- // information to analytics calls within plugins). After this cleanup task ^ we will
57
- // not have to generate the `createAnalyticsEvent` outside the Preset
58
- // and we can move this back into `EditorNext`.
59
- return (0, _react.jsx)(_analyticsNamespacedContext.FabricEditorAnalyticsContext, {
60
- data: {
61
- packageName: _versionWrapper.name,
62
- packageVersion: _versionWrapper.version,
63
- componentName: 'editorCore',
64
- appearance: (0, _utils.getAnalyticsAppearance)(this.props.appearance),
65
- editorSessionId: this.editorSessionId
66
- }
67
- }, (0, _react.jsx)(EditorNextWrapper, {
41
+ return (0, _react.jsx)(EditorNextWrapper, {
68
42
  props: this.props
69
- }));
43
+ });
70
44
  }
71
45
  }]);
72
46
  return Editor;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = createUniversalPreset;
8
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _api = require("../../../selection-api/api");
10
11
  var _plugins = require("../../../plugins");
11
12
  var _editorPluginContextPanel = require("@atlaskit/editor-plugin-context-panel");
12
13
  var _editorPluginGrid = require("@atlaskit/editor-plugin-grid");
@@ -17,7 +18,6 @@ var _isFullPage = require("../../../utils/is-full-page");
17
18
  var _mediaCommon = require("@atlaskit/media-common");
18
19
  var _default = require("./default");
19
20
  var _utils = require("@atlaskit/editor-common/utils");
20
- var _createStubInternalApis = require("./create-stub-internal-apis");
21
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
23
  /**
@@ -31,17 +31,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
31
31
  * @param prevAppearance The appearance of the editor in the previous render
32
32
  * @returns a full featured preset configured according to the provided props - basis for create-plugins-list
33
33
  */
34
- function createUniversalPreset(appearance, props, featureFlags, prevAppearance, maybeCreateAnalyticsEvent) {
34
+ function createUniversalPreset(appearance, props, featureFlags, prevAppearance, createAnalyticsEvent) {
35
35
  var isMobile = appearance === 'mobile';
36
36
  var isComment = appearance === 'comment';
37
37
  var isFullPage = (0, _isFullPage.isFullPage)(appearance);
38
38
  var getEditorFeatureFlags = function getEditorFeatureFlags() {
39
39
  return featureFlags;
40
40
  };
41
- var stubs = (0, _createStubInternalApis.createStubInternalApis)();
42
- var editorSelectionAPI = stubs.editorSelectionAPI,
43
- stubInternalApisPlugin = stubs.stubInternalApisPlugin;
44
- var createAnalyticsEvent = maybeCreateAnalyticsEvent ? maybeCreateAnalyticsEvent : stubs.createAnalyticsEvent;
41
+ var editorSelectionAPI = (0, _api.createEditorSelectionAPI)();
45
42
  var defaultPreset = (0, _default.createDefaultPreset)(_objectSpread(_objectSpread({}, props), {}, {
46
43
  createAnalyticsEvent: createAnalyticsEvent
47
44
  }));
@@ -52,7 +49,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
52
49
  }
53
50
  return false;
54
51
  };
55
- var finalPreset = defaultPreset.add(stubInternalApisPlugin).add(_plugins.dataConsumerMarkPlugin).add(_editorPluginContentInsertion.contentInsertionPlugin).maybeAdd(_plugins.breakoutPlugin, function (plugin, builder) {
52
+ var finalPreset = defaultPreset.add(_plugins.dataConsumerMarkPlugin).add(_editorPluginContentInsertion.contentInsertionPlugin).maybeAdd(_plugins.breakoutPlugin, function (plugin, builder) {
56
53
  if (props.allowBreakout && isFullPage) {
57
54
  return builder.add([plugin, {
58
55
  allowBreakoutButton: appearance === 'full-page'
@@ -128,7 +125,6 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
128
125
  if (props.mentionProvider) {
129
126
  var _props$mention$insert, _props$mention, _props$mention2;
130
127
  return builder.add([plugin, {
131
- createAnalyticsEvent: createAnalyticsEvent,
132
128
  sanitizePrivateContent: props.sanitizePrivateContent,
133
129
  insertDisplayName: (_props$mention$insert = (_props$mention = props.mention) === null || _props$mention === void 0 ? void 0 : _props$mention.insertDisplayName) !== null && _props$mention$insert !== void 0 ? _props$mention$insert : props.mentionInsertDisplayName,
134
130
  allowZeroWidthSpaceAfter: !isMobile,
@@ -138,9 +134,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
138
134
  return builder;
139
135
  }).maybeAdd(_plugins.emojiPlugin, function (plugin, builder) {
140
136
  if (props.emojiProvider) {
141
- return builder.add([plugin, {
142
- createAnalyticsEvent: createAnalyticsEvent
143
- }]);
137
+ return builder.add(plugin);
144
138
  }
145
139
  return builder;
146
140
  }).maybeAdd(_editorPluginTable.tablesPlugin, function (plugin, builder) {
@@ -202,8 +196,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
202
196
  if (props.collabEdit || props.collabEditProvider) {
203
197
  var _collabEditOptions$EX;
204
198
  var collabEditOptions = {
205
- sanitizePrivateContent: props.sanitizePrivateContent,
206
- createAnalyticsEvent: createAnalyticsEvent
199
+ sanitizePrivateContent: props.sanitizePrivateContent
207
200
  };
208
201
  if (props.collabEdit) {
209
202
  collabEditOptions = _objectSpread(_objectSpread({}, props.collabEdit), collabEditOptions);
@@ -292,7 +285,6 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
292
285
  return builder.add([plugin, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.UNSAFE_cards), props.smartLinks), (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.smartLinks), {}, {
293
286
  platform: isMobile ? 'mobile' : 'web',
294
287
  fullWidthMode: fullWidthMode,
295
- createAnalyticsEvent: createAnalyticsEvent,
296
288
  linkPicker: (_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.linkPicker,
297
289
  editorAppearance: appearance
298
290
  })]);
@@ -7,14 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = useUniversalPreset;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = require("react");
10
- var _analyticsNext = require("@atlaskit/analytics-next");
11
10
  var _hooks = require("@atlaskit/editor-common/hooks");
12
11
  var _createPluginsList = require("../../../create-editor/create-plugins-list");
13
12
  var _presetUtils = require("../../../create-editor/preset-utils");
14
13
  function useUniversalPreset(_ref) {
15
14
  var props = _ref.props;
16
- var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
17
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
18
15
  var previousEditorProps = (0, _hooks.usePreviousState)(props);
19
16
  var _useState = (0, _react.useState)(function () {
20
17
  return (0, _createPluginsList.createPreset)(props, previousEditorProps);
@@ -30,7 +27,7 @@ function useUniversalPreset(_ref) {
30
27
  if (!recreate) {
31
28
  return;
32
29
  }
33
- setPreset((0, _createPluginsList.createPreset)(props, previousEditorProps, createAnalyticsEvent));
34
- }, [props, previousEditorProps, createAnalyticsEvent]);
30
+ setPreset((0, _createPluginsList.createPreset)(props, previousEditorProps));
31
+ }, [props, previousEditorProps]);
35
32
  return preset;
36
33
  }
@@ -17,25 +17,32 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
17
17
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
19
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
- function createPlugin(options, featureFlags, editorAnalyticsApi) {
21
- if (!options || !options.createAnalyticsEvent) {
20
+ function createPlugin(options, featureFlags, pluginInjectionApi) {
21
+ if (!options) {
22
22
  return;
23
23
  }
24
24
  var hasRequiredPerformanceAPIs = (0, _utils.isPerformanceAPIAvailable)();
25
+ var getCreateAnalyticsEvent = function getCreateAnalyticsEvent() {
26
+ var _pluginInjectionApi$d, _pluginInjectionApi$d2;
27
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.sharedState.currentState()) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.createAnalyticsEvent;
28
+ };
25
29
  return new _safePlugin.SafePlugin({
26
30
  key: _pluginKey.analyticsPluginKey,
27
31
  state: {
28
32
  init: function init() {
33
+ var _pluginInjectionApi$d3;
29
34
  return _objectSpread(_objectSpread({}, options), {}, {
35
+ createAnalyticsEvent: getCreateAnalyticsEvent(),
30
36
  fireAnalytics: (0, _analytics.fireAnalyticsEvent)(options.createAnalyticsEvent),
31
- editorAnalyticsApi: editorAnalyticsApi
37
+ editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions
32
38
  });
33
39
  },
34
40
  apply: function apply(tr, pluginState, _, state) {
35
- if (pluginState.createAnalyticsEvent !== options.createAnalyticsEvent) {
41
+ if (pluginState.createAnalyticsEvent !== getCreateAnalyticsEvent()) {
42
+ var _options$createAnalyt;
36
43
  // When the plugin state is reconfigured, the init function isn't called again
37
44
  return _objectSpread(_objectSpread({}, pluginState), {}, {
38
- createAnalyticsEvent: options.createAnalyticsEvent
45
+ createAnalyticsEvent: (_options$createAnalyt = options.createAnalyticsEvent) !== null && _options$createAnalyt !== void 0 ? _options$createAnalyt : getCreateAnalyticsEvent()
39
46
  });
40
47
  }
41
48
  if (featureFlags.catchAllTracking) {
@@ -101,8 +108,7 @@ var analyticsPlugin = function analyticsPlugin(options, api) {
101
108
  return [{
102
109
  name: 'analyticsPlugin',
103
110
  plugin: function plugin() {
104
- var _api$dependencies, _api$dependencies$ana;
105
- return createPlugin(options, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$ana = _api$dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
111
+ return createPlugin(options, featureFlags, api);
106
112
  }
107
113
  }];
108
114
  }
@@ -50,7 +50,7 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
50
50
  tr.replaceWith(pos, pos + (node.text || url).length, nodes);
51
51
  return $pos.node($pos.depth - 1).type.name;
52
52
  }
53
- var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData, analyticsAction, editorAnalyticsApi) {
53
+ var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) {
54
54
  return function (editorState, dispatch) {
55
55
  var state = _pluginKey.pluginKey.getState(editorState);
56
56
  if (!state) {
@@ -86,7 +86,7 @@ var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData,
86
86
  _url$split2 = (0, _slicedToArray2.default)(_url$split, 3),
87
87
  domainName = _url$split2[2];
88
88
  if (state.smartLinkEvents) {
89
- state.smartLinkEvents.insertSmartLink(domainName, 'inline', state.createAnalyticsEvent);
89
+ state.smartLinkEvents.insertSmartLink(domainName, 'inline', createAnalyticsEvent);
90
90
  }
91
91
 
92
92
  /**
@@ -28,6 +28,7 @@ var _datasource = require("../nodeviews/datasource");
28
28
  var _styles = require("@atlaskit/editor-common/styles");
29
29
  var _actions = require("./actions");
30
30
  var _prosemirrorUtils = require("prosemirror-utils");
31
+ var _utils = require("@atlaskit/editor-common/utils");
31
32
  var createPlugin = function createPlugin(options, pluginInjectionApi) {
32
33
  return function (pmPluginFactoryParams) {
33
34
  var lpAnalyticsEventsNext = pmPluginFactoryParams.featureFlags.lpAnalyticsEventsNext;
@@ -37,8 +38,15 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
37
38
  allowResizing = options.allowResizing,
38
39
  useAlternativePreloader = options.useAlternativePreloader,
39
40
  fullWidthMode = options.fullWidthMode,
40
- createAnalyticsEvent = options.createAnalyticsEvent,
41
41
  showServerActions = options.showServerActions;
42
+ var inlineCardViewProducer = (0, _reactNodeView.getInlineNodeViewProducer)({
43
+ pmPluginFactoryParams: pmPluginFactoryParams,
44
+ Component: _inlineCard.InlineCardNodeView,
45
+ extraComponentProps: {
46
+ useAlternativePreloader: useAlternativePreloader,
47
+ showServerActions: showServerActions
48
+ }
49
+ });
42
50
  return new _safePlugin.SafePlugin({
43
51
  state: {
44
52
  init: function init() {
@@ -49,7 +57,6 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
49
57
  showLinkingToolbar: false,
50
58
  smartLinkEvents: undefined,
51
59
  smartLinkEventsNext: undefined,
52
- createAnalyticsEvent: createAnalyticsEvent,
53
60
  editorAppearance: editorAppearance,
54
61
  showDatasourceModal: false,
55
62
  datasourceTableRef: undefined,
@@ -131,8 +138,8 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
131
138
  * other tasks as per common implementations of the JavaScript event loop in browsers.
132
139
  */
133
140
  var invoke = (0, _rafSchd.default)(function () {
134
- var _pluginInjectionApi$d;
135
- return (0, _resolve.resolveWithProvider)(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions);
141
+ var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
142
+ return (0, _resolve.resolveWithProvider)(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.sharedState.currentState()) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.createAnalyticsEvent) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : undefined);
136
143
  });
137
144
  rafCancellationCallbacks.push(invoke.cancel);
138
145
  invoke();
@@ -151,15 +158,8 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
151
158
  },
152
159
  props: {
153
160
  nodeViews: {
154
- inlineCard: (0, _reactNodeView.getInlineNodeViewProducer)({
155
- pmPluginFactoryParams: pmPluginFactoryParams,
156
- Component: _inlineCard.InlineCardNodeView,
157
- extraComponentProps: {
158
- useAlternativePreloader: useAlternativePreloader,
159
- showServerActions: showServerActions
160
- }
161
- }),
162
- blockCard: function blockCard(node, view, getPos) {
161
+ inlineCard: inlineCardViewProducer,
162
+ blockCard: function blockCard(node, view, getPos, decorations) {
163
163
  var _node$attrs3;
164
164
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
165
165
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
@@ -170,15 +170,20 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
170
170
  var hasIntlContext = true;
171
171
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
172
172
  if (isDatasource) {
173
- return new _datasource.Datasource({
174
- node: node,
175
- view: view,
176
- getPos: getPos,
177
- portalProviderAPI: portalProviderAPI,
178
- eventDispatcher: eventDispatcher,
179
- hasIntlContext: hasIntlContext,
180
- pluginInjectionApi: pluginInjectionApi
181
- }).init();
173
+ var _node$attrs4;
174
+ if ((0, _utils.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.datasource)) {
175
+ return new _datasource.Datasource({
176
+ node: node,
177
+ view: view,
178
+ getPos: getPos,
179
+ portalProviderAPI: portalProviderAPI,
180
+ eventDispatcher: eventDispatcher,
181
+ hasIntlContext: hasIntlContext,
182
+ pluginInjectionApi: pluginInjectionApi
183
+ }).init();
184
+ } else {
185
+ return inlineCardViewProducer(node, view, getPos, decorations);
186
+ }
182
187
  }
183
188
  return new _blockCard.BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
184
189
  },
@@ -11,14 +11,14 @@ var _doc = require("../doc");
11
11
  // ============================================================================ //
12
12
  // Used for all interactions with the EditorCardProvider.
13
13
  // ============================================================================ //
14
- var resolveWithProvider = function resolveWithProvider(view, provider, request, options, editorAnalyticsApi) {
14
+ var resolveWithProvider = function resolveWithProvider(view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) {
15
15
  // When user manually changes appearance from blue link to smart link, we should respect that,
16
16
  var shouldForceAppearance =
17
17
  // This flag is set to true only in one place atm:
18
18
  // packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
19
19
  // Which is used when user switching from URL to smart link appearance.
20
20
  !!request.shouldReplaceLink;
21
- var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, options), handleRejected(view, request, editorAnalyticsApi));
21
+ var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
22
22
  return handleResolve;
23
23
  };
24
24
  exports.resolveWithProvider = resolveWithProvider;
@@ -31,10 +31,10 @@ var updateCardType = function updateCardType(resolvedCard, options) {
31
31
  resolvedCard.type = 'inlineCard';
32
32
  }
33
33
  };
34
- var handleResolved = function handleResolved(view, request, editorAnalyticsApi, options) {
34
+ var handleResolved = function handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options) {
35
35
  return function (resolvedCard) {
36
36
  updateCardType(resolvedCard, options);
37
- (0, _doc.replaceQueuedUrlWithCard)(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi)(view.state, view.dispatch);
37
+ (0, _doc.replaceQueuedUrlWithCard)(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi, createAnalyticsEvent)(view.state, view.dispatch);
38
38
  return resolvedCard;
39
39
  };
40
40
  };
@@ -26,6 +26,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
26
26
  var _LinkToolbarAppearance = require("./ui/LinkToolbarAppearance");
27
27
  var _analytics = require("@atlaskit/editor-common/analytics");
28
28
  var _SmallerEditIcon = require("./ui/SmallerEditIcon");
29
+ var _utils2 = require("@atlaskit/editor-common/utils");
29
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
31
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
32
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -173,7 +174,7 @@ var withToolbarMetadata = function withToolbarMetadata(command) {
173
174
  };
174
175
  var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
175
176
  return function (node) {
176
- var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs;
177
+ var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2;
177
178
  var _titleUrlPairFromNode2 = (0, _utils.titleUrlPairFromNode)(node),
178
179
  url = _titleUrlPairFromNode2.url;
179
180
  var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.analytics) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
@@ -194,6 +195,9 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
194
195
  var _ref2 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.decorations) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
195
196
  hoverDecoration = _ref2.hoverDecoration;
196
197
  var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
198
+ var shouldRenderDatasourceToolbar = isDatasource &&
199
+ // not showing toolbar in mobile for now since not sure what our plans are for it
200
+ platform !== 'mobile' && (0, _utils2.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.datasource);
197
201
 
198
202
  /* mobile builds toolbar natively using toolbarItems */
199
203
  if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
@@ -210,8 +214,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
210
214
  node: node,
211
215
  editorAnalyticsApi: editorAnalyticsApi
212
216
  })];
213
- // not showing toolbar in mobile for now since not sure what our plans are for it
214
- } else if (isDatasource && platform !== 'mobile') {
217
+ } else if (shouldRenderDatasourceToolbar) {
215
218
  return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
216
219
  } else {
217
220
  var inlineCard = state.schema.nodes.inlineCard;
@@ -325,7 +328,7 @@ var getSettingsButtonGroup = function getSettingsButtonGroup(state, featureFlags
325
328
  }] : [];
326
329
  };
327
330
  var getDatasourceButtonGroup = function getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration) {
328
- var _node$attrs2;
331
+ var _node$attrs3;
329
332
  var toolbarItems = [{
330
333
  id: 'editor.edit.datasource',
331
334
  type: 'button',
@@ -335,7 +338,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(state, metadata
335
338
  title: intl.formatMessage(_messages.linkToolbarMessages.editDatasource),
336
339
  onClick: (0, _EditLinkToolbar.editDatasource)(editorAnalyticsApi)
337
340
  }];
338
- if (node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.url) {
341
+ if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
339
342
  toolbarItems.push({
340
343
  type: 'separator'
341
344
  }, {
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addSynchronyErrorAnalytics = exports.addSynchronyEntityAnalytics = void 0;
7
- var _analytics = require("../analytics");
8
7
  var _documentLogger = require("../../utils/document-logger");
9
8
  var _utils = require("@atlaskit/editor-common/utils");
10
- var addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(state, tr, featureFlags) {
9
+ var _analytics = require("@atlaskit/editor-common/analytics");
10
+ var addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(state, tr, featureFlags, editorAnalyticsApi) {
11
11
  return function (error) {
12
12
  var browserExtensions = (0, _utils.sniffUserBrowserExtensions)({
13
13
  extensions: ['grammarly']
@@ -26,13 +26,14 @@ var addSynchronyErrorAnalytics = function addSynchronyErrorAnalytics(state, tr,
26
26
  compact: true
27
27
  });
28
28
  }
29
- return (0, _analytics.addAnalytics)(state, tr, payload);
29
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(payload)(tr);
30
+ return tr;
30
31
  };
31
32
  };
32
33
  exports.addSynchronyErrorAnalytics = addSynchronyErrorAnalytics;
33
34
  var addSynchronyEntityAnalytics = function addSynchronyEntityAnalytics(state, tr) {
34
- return function (type) {
35
- return (0, _analytics.addAnalytics)(state, tr, {
35
+ return function (type, editorAnalyticsApi) {
36
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
36
37
  action: type === 'error' ? _analytics.ACTION.SYNCHRONY_ENTITY_ERROR : _analytics.ACTION.SYNCHRONY_DISCONNECTED,
37
38
  actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
38
39
  eventType: _analytics.EVENT_TYPE.OPERATIONAL,
@@ -41,7 +42,8 @@ var addSynchronyEntityAnalytics = function addSynchronyEntityAnalytics(state, tr
41
42
  onLine: navigator.onLine,
42
43
  visibilityState: document.visibilityState
43
44
  }
44
- });
45
+ })(tr);
46
+ return tr;
45
47
  };
46
48
  };
47
49
  exports.addSynchronyEntityAnalytics = addSynchronyEntityAnalytics;