@atlaskit/editor-core 185.2.2 → 185.2.7

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 (61) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/plugins/block-type/index.js +12 -9
  3. package/dist/cjs/plugins/card/nodeviews/embedCard.js +2 -2
  4. package/dist/cjs/plugins/card/nodeviews/genericCard.js +2 -1
  5. package/dist/cjs/plugins/card/toolbar.js +1 -1
  6. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +15 -12
  7. package/dist/cjs/plugins/floating-toolbar/index.js +7 -1
  8. package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  9. package/dist/cjs/plugins/media/toolbar/index.js +1 -1
  10. package/dist/cjs/plugins/media/toolbar/linking.js +3 -3
  11. package/dist/cjs/version-wrapper.js +1 -1
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/es2019/plugins/block-type/index.js +12 -9
  14. package/dist/es2019/plugins/card/nodeviews/embedCard.js +2 -2
  15. package/dist/es2019/plugins/card/nodeviews/genericCard.js +2 -1
  16. package/dist/es2019/plugins/card/toolbar.js +1 -1
  17. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +7 -4
  18. package/dist/es2019/plugins/floating-toolbar/index.js +4 -1
  19. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  20. package/dist/es2019/plugins/media/toolbar/index.js +1 -1
  21. package/dist/es2019/plugins/media/toolbar/linking.js +3 -3
  22. package/dist/es2019/version-wrapper.js +1 -1
  23. package/dist/es2019/version.json +1 -1
  24. package/dist/esm/plugins/block-type/index.js +12 -9
  25. package/dist/esm/plugins/card/nodeviews/embedCard.js +2 -2
  26. package/dist/esm/plugins/card/nodeviews/genericCard.js +2 -1
  27. package/dist/esm/plugins/card/toolbar.js +1 -1
  28. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +15 -12
  29. package/dist/esm/plugins/floating-toolbar/index.js +4 -1
  30. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  31. package/dist/esm/plugins/media/toolbar/index.js +1 -1
  32. package/dist/esm/plugins/media/toolbar/linking.js +3 -3
  33. package/dist/esm/version-wrapper.js +1 -1
  34. package/dist/esm/version.json +1 -1
  35. package/dist/types/labs/next/presets/cxhtml.d.ts +6 -0
  36. package/dist/types/labs/next/presets/default.d.ts +12 -0
  37. package/dist/types/labs/next/presets/mobile.d.ts +6 -0
  38. package/dist/types/plugins/block-type/index.d.ts +3 -1
  39. package/dist/types/plugins/card/index.d.ts +3 -1
  40. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +6 -3
  41. package/dist/types/plugins/floating-toolbar/index.d.ts +2 -6
  42. package/dist/types/plugins/media/index.d.ts +3 -1
  43. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +1 -1
  44. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -1
  45. package/dist/types/plugins/media/nodeviews/types.d.ts +1 -1
  46. package/dist/types/plugins/media/toolbar/linking.d.ts +3 -1
  47. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +6 -0
  48. package/dist/types-ts4.5/labs/next/presets/default.d.ts +12 -0
  49. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +6 -0
  50. package/dist/types-ts4.5/plugins/block-type/index.d.ts +5 -1
  51. package/dist/types-ts4.5/plugins/card/index.d.ts +3 -1
  52. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +6 -3
  53. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +2 -9
  54. package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
  55. package/dist/types-ts4.5/plugins/media/nodeviews/mediaInline.d.ts +1 -1
  56. package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -1
  57. package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +1 -1
  58. package/dist/types-ts4.5/plugins/media/toolbar/linking.d.ts +3 -1
  59. package/package.json +10 -12
  60. package/report.api.md +2 -0
  61. package/tmp/api-report-tmp.d.ts +3 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 185.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1259df9a9ef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1259df9a9ef) - converted some of block-type's analytics to use new EditorAnalyticsAPI
8
+
9
+ ## 185.2.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b48d0a5f88f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b48d0a5f88f) - Create new placeholder for the floating toolbar plugin and use a new action to replace the forceFocusSelector action.
14
+ - Updated dependencies
15
+
3
16
  ## 185.2.2
4
17
 
5
18
  ### Patch Changes
@@ -21,14 +21,14 @@ var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
21
21
  var _ToolbarBlockType = _interopRequireDefault(require("./ui/ToolbarBlockType"));
22
22
  var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
23
23
  var _commands = require("./commands");
24
- var _analytics = require("../analytics");
24
+ var _analytics = require("@atlaskit/editor-common/analytics");
25
25
  var keymaps = _interopRequireWildcard(require("../../keymaps"));
26
26
  var _assets = require("../quick-insert/assets");
27
27
  var _messages = require("./messages");
28
28
  var _types = require("../../ui/Toolbar/types");
29
29
  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
30
  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
- var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
31
+ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
32
32
  var formatMessage = _ref.formatMessage;
33
33
  if (!isAllowed) {
34
34
  return [];
@@ -56,7 +56,7 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
56
56
  var tr = insert(state.schema.nodes.heading.createChecked({
57
57
  level: level
58
58
  }));
59
- return (0, _analytics.addAnalytics)(state, tr, {
59
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
60
60
  action: _analytics.ACTION.FORMATTED,
61
61
  actionSubject: _analytics.ACTION_SUBJECT.TEXT,
62
62
  eventType: _analytics.EVENT_TYPE.TRACK,
@@ -65,12 +65,13 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed) {
65
65
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT,
66
66
  newHeadingLevel: level
67
67
  }
68
- });
68
+ })(tr);
69
+ return tr;
69
70
  }
70
71
  };
71
72
  });
72
73
  };
73
- var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed) {
74
+ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed, editorAnalyticsApi) {
74
75
  var formatMessage = _ref2.formatMessage;
75
76
  if (!isAllowed) {
76
77
  return [];
@@ -86,7 +87,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed)
86
87
  },
87
88
  action: function action(insert, state) {
88
89
  var tr = insert(state.schema.nodes.blockquote.createChecked({}, state.schema.nodes.paragraph.createChecked()));
89
- return (0, _analytics.addAnalytics)(state, tr, {
90
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
90
91
  action: _analytics.ACTION.FORMATTED,
91
92
  actionSubject: _analytics.ACTION_SUBJECT.TEXT,
92
93
  eventType: _analytics.EVENT_TYPE.TRACK,
@@ -94,11 +95,12 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed)
94
95
  attributes: {
95
96
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
96
97
  }
97
- });
98
+ })(tr);
99
+ return tr;
98
100
  }
99
101
  }];
100
102
  };
101
- var blockTypePlugin = function blockTypePlugin(options) {
103
+ var blockTypePlugin = function blockTypePlugin(options, api) {
102
104
  return {
103
105
  name: 'blockType',
104
106
  nodes: function nodes() {
@@ -182,8 +184,9 @@ var blockTypePlugin = function blockTypePlugin(options) {
182
184
  },
183
185
  pluginsOptions: {
184
186
  quickInsert: function quickInsert(intl) {
187
+ var _api$dependencies$ana, _api$dependencies$ana2;
185
188
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
186
- return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1)));
189
+ return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions)));
187
190
  }
188
191
  }
189
192
  };
@@ -78,8 +78,8 @@ var CardInner = function CardInner(_ref) {
78
78
  }), smartCard);
79
79
  }
80
80
  var displayGrid = function displayGrid(visible, gridType, highlight) {
81
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
82
- return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.grid) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.displayGrid(view)({
81
+ var _pluginInjectionApi$d;
82
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.grid.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.displayGrid(view)({
83
83
  visible: visible,
84
84
  gridType: gridType,
85
85
  highlight: highlight
@@ -87,6 +87,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
87
87
  // (2) Render a blue link whilst downgrading to `link` in the ADF (fatal errs).
88
88
 
89
89
  if (maybeAPIError.kind && maybeAPIError.kind === 'fatal') {
90
+ var _pluginInjectionApi$d;
90
91
  this.setState({
91
92
  isError: true
92
93
  });
@@ -100,7 +101,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
100
101
  if (!getPos || typeof getPos === 'boolean') {
101
102
  return;
102
103
  }
103
- (0, _doc.changeSelectedCardToLinkFallback)(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.analytics.actions)(view.state, view.dispatch);
104
+ (0, _doc.changeSelectedCardToLinkFallback)(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions)(view.state, view.dispatch);
104
105
  return null;
105
106
  } else {
106
107
  // Otherwise, render a blue link as fallback (above in render()).
@@ -202,7 +202,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
202
202
  linkPicker: linkPicker,
203
203
  node: node,
204
204
  featureFlags: featureFlags,
205
- editorAnalyticsApi: editorAnalyticsApi
205
+ pluginInjectionApi: pluginInjectionApi
206
206
  })];
207
207
  } else {
208
208
  var inlineCard = state.schema.nodes.inlineCard;
@@ -21,7 +21,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
21
21
  var _doc = require("../pm-plugins/doc");
22
22
  var _utils = require("../utils");
23
23
  var _prosemirrorState = require("prosemirror-state");
24
- var _forceFocus = require("../../floating-toolbar/pm-plugins/force-focus");
25
24
  var _messages = require("@atlaskit/editor-common/messages");
26
25
  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); }; }
27
26
  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; } }
@@ -40,7 +39,8 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
40
39
  * and not close the floating toolbar.
41
40
  */
42
41
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEsc", function (e) {
43
- (0, _forceFocus.forceFocusSelector)("[aria-label=\"".concat(_messages.linkToolbarMessages.editLink.defaultMessage, "\"]"), _this.props.view);
42
+ var _this$props$forceFocu, _this$props;
43
+ (_this$props$forceFocu = (_this$props = _this.props).forceFocusSelector) === null || _this$props$forceFocu === void 0 ? void 0 : _this$props$forceFocu.call(_this$props, "[aria-label=\"".concat(_messages.linkToolbarMessages.editLink.defaultMessage, "\"]"), _this.props.view);
44
44
  });
45
45
  return _this;
46
46
  }
@@ -66,14 +66,14 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
66
66
  key: "render",
67
67
  value: function render() {
68
68
  var _this2 = this;
69
- var _this$props = this.props,
70
- linkPickerOptions = _this$props.linkPickerOptions,
71
- providerFactory = _this$props.providerFactory,
72
- url = _this$props.url,
73
- text = _this$props.text,
74
- view = _this$props.view,
75
- featureFlags = _this$props.featureFlags,
76
- _onSubmit = _this$props.onSubmit;
69
+ var _this$props2 = this.props,
70
+ linkPickerOptions = _this$props2.linkPickerOptions,
71
+ providerFactory = _this$props2.providerFactory,
72
+ url = _this$props2.url,
73
+ text = _this$props2.text,
74
+ view = _this$props2.view,
75
+ featureFlags = _this$props2.featureFlags,
76
+ _onSubmit = _this$props2.onSubmit;
77
77
  return /*#__PURE__*/_react.default.createElement(HyperLinkToolbarWithListeners, {
78
78
  view: view,
79
79
  linkPickerOptions: linkPickerOptions,
@@ -120,12 +120,13 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
120
120
  node = _ref.node,
121
121
  linkPicker = _ref.linkPicker,
122
122
  featureFlags = _ref.featureFlags,
123
- editorAnalyticsApi = _ref.editorAnalyticsApi;
123
+ pluginInjectionApi = _ref.pluginInjectionApi;
124
124
  return {
125
125
  type: 'custom',
126
126
  disableArrowNavigation: true,
127
127
  fallback: [],
128
128
  render: function render(view, idx) {
129
+ var _pluginInjectionApi$d;
129
130
  if (!view || !providerFactory) {
130
131
  return null;
131
132
  }
@@ -139,6 +140,7 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
139
140
  text: displayInfo.title || '',
140
141
  node: node,
141
142
  featureFlags: featureFlags,
143
+ forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector,
142
144
  onSubmit: function onSubmit(newHref, newText, analytic) {
143
145
  var urlChanged = newHref !== displayInfo.url;
144
146
  var titleChanged = newText !== displayInfo.title;
@@ -146,7 +148,8 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
146
148
  // If the title is changed in a smartlink, convert to standard blue hyperlink
147
149
  // (even if the url was also changed) - we don't want to lose the custom title.
148
150
  if (titleChanged) {
149
- return (0, _card.commandWithMetadata)((0, _doc.changeSelectedCardToLink)(newText, newHref, undefined, undefined, undefined, editorAnalyticsApi), {
151
+ var _pluginInjectionApi$d2;
152
+ return (0, _card.commandWithMetadata)((0, _doc.changeSelectedCardToLink)(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions), {
150
153
  action: _analytics.ACTION.UPDATED,
151
154
  sourceEvent: analytic
152
155
  })(view.state, view.dispatch);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -25,7 +26,9 @@ var _ToolbarLoader = require("./ui/ToolbarLoader");
25
26
  var _utils = require("./utils");
26
27
  var _ErrorBoundary = require("../../ui/ErrorBoundary");
27
28
  var _toolbar = require("../copy-button/toolbar");
28
- var _forceFocus = _interopRequireDefault(require("./pm-plugins/force-focus"));
29
+ var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
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); }
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; }
29
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; }
30
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; } // AFP-2532 TODO: Fix automatic suppressions below
31
34
  // eslint-disable-next-line @atlassian/tangerine/import/entry-points
@@ -153,6 +156,9 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
153
156
  }
154
157
  }];
155
158
  },
159
+ actions: {
160
+ forceFocusSelector: _forceFocus.forceFocusSelector
161
+ },
156
162
  contentComponent: function contentComponent(_ref3) {
157
163
  var popupsMountPoint = _ref3.popupsMountPoint,
158
164
  popupsBoundariesElement = _ref3.popupsBoundariesElement,
@@ -13,7 +13,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
13
13
  var _v = _interopRequireDefault(require("uuid/v4"));
14
14
  var _ui = require("@atlaskit/editor-common/ui");
15
15
  var _mediaClient = require("@atlaskit/media-client");
16
- var _analytics = require("../../analytics");
16
+ var _analytics = require("@atlaskit/editor-common/analytics");
17
17
  var _helpers = require("../commands/helpers");
18
18
  var MediaNodeUpdater = /*#__PURE__*/function () {
19
19
  function MediaNodeUpdater(props) {
@@ -345,7 +345,7 @@ var floatingToolbar = function floatingToolbar(state, intl) {
345
345
  }
346
346
  };
347
347
  if (allowLinking && mediaLinkingState && mediaLinkingState.visible && (0, _linking.shouldShowMediaLinkToolbar)(state)) {
348
- var linkingToolbar = (0, _linking.getLinkingToolbar)(baseToolbar, mediaLinkingState, state, intl, providerFactory);
348
+ var linkingToolbar = (0, _linking.getLinkingToolbar)(baseToolbar, mediaLinkingState, state, intl, pluginInjectionApi, providerFactory);
349
349
  if (linkingToolbar) {
350
350
  return linkingToolbar;
351
351
  }
@@ -12,7 +12,6 @@ var _linking = require("../commands/linking");
12
12
  var _linking2 = require("../pm-plugins/linking");
13
13
  var _MediaLinkingToolbar = _interopRequireDefault(require("../ui/MediaLinkingToolbar"));
14
14
  var _ui = require("@atlaskit/editor-common/ui");
15
- var _forceFocus = require("../../floating-toolbar/pm-plugins/force-focus");
16
15
  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; }
17
16
  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; }
18
17
  var FORCE_FOCUS_SELECTOR = '[data-testid="add-link-button"],[data-testid="edit-link-button"]';
@@ -32,7 +31,7 @@ function shouldShowMediaLinkToolbar(editorState) {
32
31
  parent = _editorState$doc$reso.parent;
33
32
  return parent && parent.type.allowsMarkType(link);
34
33
  }
35
- var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinkingState, state, intl, providerFactory) {
34
+ var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinkingState, state, intl, pluginInjectionApi, providerFactory) {
36
35
  var link = mediaLinkingState.link,
37
36
  visible = mediaLinkingState.visible,
38
37
  editing = mediaLinkingState.editable,
@@ -68,11 +67,12 @@ var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinki
68
67
  (0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
69
68
  },
70
69
  onCancel: function onCancel() {
70
+ var _pluginInjectionApi$d;
71
71
  (0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view, true);
72
72
  /** Focus should move to the 'Add link' button when the toolbar closes
73
73
  * and not close the floating toolbar.
74
74
  */
75
- (0, _forceFocus.forceFocusSelector)(FORCE_FOCUS_SELECTOR, view);
75
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector(FORCE_FOCUS_SELECTOR, view);
76
76
  },
77
77
  onSubmit: function onSubmit(href, meta) {
78
78
  (0, _linking.setUrlToMedia)(href, meta.inputMethod)(view.state, view.dispatch, view);
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "185.2.2";
9
+ var version = "185.2.7";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.2",
3
+ "version": "185.2.7",
4
4
  "sideEffects": false
5
5
  }
@@ -6,14 +6,14 @@ import inputRulePlugin from './pm-plugins/input-rule';
6
6
  import ToolbarBlockType from './ui/ToolbarBlockType';
7
7
  import WithPluginState from '../../ui/WithPluginState';
8
8
  import { setBlockTypeWithAnalytics } from './commands';
9
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
9
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
10
10
  import * as keymaps from '../../keymaps';
11
11
  import { IconHeading, IconQuote } from '../quick-insert/assets';
12
12
  import { messages } from './messages';
13
13
  import { ToolbarSize } from '../../ui/Toolbar/types';
14
14
  const headingPluginOptions = ({
15
15
  formatMessage
16
- }, isAllowed) => {
16
+ }, isAllowed, editorAnalyticsApi) => {
17
17
  if (!isAllowed) {
18
18
  return [];
19
19
  }
@@ -38,7 +38,7 @@ const headingPluginOptions = ({
38
38
  const tr = insert(state.schema.nodes.heading.createChecked({
39
39
  level
40
40
  }));
41
- return addAnalytics(state, tr, {
41
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
42
42
  action: ACTION.FORMATTED,
43
43
  actionSubject: ACTION_SUBJECT.TEXT,
44
44
  eventType: EVENT_TYPE.TRACK,
@@ -47,14 +47,15 @@ const headingPluginOptions = ({
47
47
  inputMethod: INPUT_METHOD.QUICK_INSERT,
48
48
  newHeadingLevel: level
49
49
  }
50
- });
50
+ })(tr);
51
+ return tr;
51
52
  }
52
53
  };
53
54
  });
54
55
  };
55
56
  const blockquotePluginOptions = ({
56
57
  formatMessage
57
- }, isAllowed) => {
58
+ }, isAllowed, editorAnalyticsApi) => {
58
59
  if (!isAllowed) {
59
60
  return [];
60
61
  }
@@ -67,7 +68,7 @@ const blockquotePluginOptions = ({
67
68
  icon: () => /*#__PURE__*/React.createElement(IconQuote, null),
68
69
  action(insert, state) {
69
70
  const tr = insert(state.schema.nodes.blockquote.createChecked({}, state.schema.nodes.paragraph.createChecked()));
70
- return addAnalytics(state, tr, {
71
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
71
72
  action: ACTION.FORMATTED,
72
73
  actionSubject: ACTION_SUBJECT.TEXT,
73
74
  eventType: EVENT_TYPE.TRACK,
@@ -75,11 +76,12 @@ const blockquotePluginOptions = ({
75
76
  attributes: {
76
77
  inputMethod: INPUT_METHOD.QUICK_INSERT
77
78
  }
78
- });
79
+ })(tr);
80
+ return tr;
79
81
  }
80
82
  }];
81
83
  };
82
- const blockTypePlugin = options => ({
84
+ const blockTypePlugin = (options, api) => ({
83
85
  name: 'blockType',
84
86
  nodes() {
85
87
  const nodes = [{
@@ -157,8 +159,9 @@ const blockTypePlugin = options => ({
157
159
  },
158
160
  pluginsOptions: {
159
161
  quickInsert: intl => {
162
+ var _api$dependencies$ana, _api$dependencies$ana2;
160
163
  const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
161
- return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1)];
164
+ return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions)];
162
165
  }
163
166
  }
164
167
  });
@@ -62,8 +62,8 @@ const CardInner = ({
62
62
  }), smartCard);
63
63
  }
64
64
  const displayGrid = (visible, gridType, highlight) => {
65
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
66
- return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.grid) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.displayGrid(view)({
65
+ var _pluginInjectionApi$d;
66
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.grid.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.displayGrid(view)({
67
67
  visible,
68
68
  gridType,
69
69
  highlight: highlight
@@ -61,6 +61,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
61
61
  // (2) Render a blue link whilst downgrading to `link` in the ADF (fatal errs).
62
62
 
63
63
  if (maybeAPIError.kind && maybeAPIError.kind === 'fatal') {
64
+ var _pluginInjectionApi$d;
64
65
  this.setState({
65
66
  isError: true
66
67
  });
@@ -76,7 +77,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
76
77
  if (!getPos || typeof getPos === 'boolean') {
77
78
  return;
78
79
  }
79
- changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.analytics.actions)(view.state, view.dispatch);
80
+ changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions)(view.state, view.dispatch);
80
81
  return null;
81
82
  } else {
82
83
  // Otherwise, render a blue link as fallback (above in render()).
@@ -195,7 +195,7 @@ const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOp
195
195
  linkPicker,
196
196
  node,
197
197
  featureFlags,
198
- editorAnalyticsApi
198
+ pluginInjectionApi
199
199
  })];
200
200
  } else {
201
201
  const {
@@ -9,7 +9,6 @@ import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDT
9
9
  import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
10
10
  import { findCardInfo, displayInfoForCard } from '../utils';
11
11
  import { NodeSelection } from 'prosemirror-state';
12
- import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
13
12
  import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
14
13
  const HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkToolbar);
15
14
  export class EditLinkToolbar extends React.Component {
@@ -19,7 +18,8 @@ export class EditLinkToolbar extends React.Component {
19
18
  * and not close the floating toolbar.
20
19
  */
21
20
  _defineProperty(this, "handleEsc", e => {
22
- forceFocusSelector(`[aria-label="${linkToolbarMessages.editLink.defaultMessage}"]`, this.props.view);
21
+ var _this$props$forceFocu, _this$props;
22
+ (_this$props$forceFocu = (_this$props = this.props).forceFocusSelector) === null || _this$props$forceFocu === void 0 ? void 0 : _this$props$forceFocu.call(_this$props, `[aria-label="${linkToolbarMessages.editLink.defaultMessage}"]`, this.props.view);
23
23
  });
24
24
  }
25
25
  componentDidUpdate(prevProps) {
@@ -88,13 +88,14 @@ export const buildEditLinkToolbar = ({
88
88
  node,
89
89
  linkPicker,
90
90
  featureFlags,
91
- editorAnalyticsApi
91
+ pluginInjectionApi
92
92
  }) => {
93
93
  return {
94
94
  type: 'custom',
95
95
  disableArrowNavigation: true,
96
96
  fallback: [],
97
97
  render: (view, idx) => {
98
+ var _pluginInjectionApi$d;
98
99
  if (!view || !providerFactory) {
99
100
  return null;
100
101
  }
@@ -108,6 +109,7 @@ export const buildEditLinkToolbar = ({
108
109
  text: displayInfo.title || '',
109
110
  node: node,
110
111
  featureFlags: featureFlags,
112
+ forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector,
111
113
  onSubmit: (newHref, newText, analytic) => {
112
114
  const urlChanged = newHref !== displayInfo.url;
113
115
  const titleChanged = newText !== displayInfo.title;
@@ -115,7 +117,8 @@ export const buildEditLinkToolbar = ({
115
117
  // If the title is changed in a smartlink, convert to standard blue hyperlink
116
118
  // (even if the url was also changed) - we don't want to lose the custom title.
117
119
  if (titleChanged) {
118
- return commandWithMetadata(changeSelectedCardToLink(newText, newHref, undefined, undefined, undefined, editorAnalyticsApi), {
120
+ var _pluginInjectionApi$d2;
121
+ return commandWithMetadata(changeSelectedCardToLink(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions), {
119
122
  action: ACTION.UPDATED,
120
123
  sourceEvent: analytic
121
124
  })(view.state, view.dispatch);
@@ -19,7 +19,7 @@ import { ToolbarLoader } from './ui/ToolbarLoader';
19
19
  import { findNode } from './utils';
20
20
  import { ErrorBoundary } from '../../ui/ErrorBoundary';
21
21
  import { processCopyButtonItems } from '../copy-button/toolbar';
22
- import forceFocusPlugin from './pm-plugins/force-focus';
22
+ import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
23
23
  export const getRelevantConfig = (selection, configs) => {
24
24
  // node selections always take precedence, see if
25
25
  let configPair;
@@ -140,6 +140,9 @@ const floatingToolbarPlugin = (_, api) => {
140
140
  plugin: () => forceFocusPlugin()
141
141
  }];
142
142
  },
143
+ actions: {
144
+ forceFocusSelector
145
+ },
143
146
  contentComponent({
144
147
  popupsMountPoint,
145
148
  popupsBoundariesElement,
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import uuidV4 from 'uuid/v4';
3
3
  import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
4
4
  import { getMediaClient, isMediaBlobUrl, getAttrsFromUrl, isImageRepresentationReady } from '@atlaskit/media-client';
5
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
5
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
6
6
  import { replaceExternalMedia, updateAllMediaSingleNodesAttrs, updateCurrentMediaNodeAttrs, updateMediaSingleNodeAttrs } from '../commands/helpers';
7
7
  export class MediaNodeUpdater {
8
8
  constructor(props) {
@@ -351,7 +351,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
351
351
  getDomRef: () => mediaPluginState.element
352
352
  };
353
353
  if (allowLinking && mediaLinkingState && mediaLinkingState.visible && shouldShowMediaLinkToolbar(state)) {
354
- const linkingToolbar = getLinkingToolbar(baseToolbar, mediaLinkingState, state, intl, providerFactory);
354
+ const linkingToolbar = getLinkingToolbar(baseToolbar, mediaLinkingState, state, intl, pluginInjectionApi, providerFactory);
355
355
  if (linkingToolbar) {
356
356
  return linkingToolbar;
357
357
  }
@@ -3,7 +3,6 @@ import { hideLinkingToolbar, setUrlToMedia, unlink } from '../commands/linking';
3
3
  import { getMediaLinkingState } from '../pm-plugins/linking';
4
4
  import MediaLinkingToolbar from '../ui/MediaLinkingToolbar';
5
5
  import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
6
- import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
7
6
  const FORCE_FOCUS_SELECTOR = '[data-testid="add-link-button"],[data-testid="edit-link-button"]';
8
7
  export function shouldShowMediaLinkToolbar(editorState) {
9
8
  const mediaLinkingState = getMediaLinkingState(editorState);
@@ -27,7 +26,7 @@ export function shouldShowMediaLinkToolbar(editorState) {
27
26
  } = editorState.doc.resolve(mediaLinkingState.mediaPos);
28
27
  return parent && parent.type.allowsMarkType(link);
29
28
  }
30
- export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, intl, providerFactory) => {
29
+ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, intl, pluginInjectionApi, providerFactory) => {
31
30
  const {
32
31
  link,
33
32
  visible,
@@ -64,11 +63,12 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
64
63
  hideLinkingToolbar(view.state, view.dispatch, view);
65
64
  },
66
65
  onCancel: () => {
66
+ var _pluginInjectionApi$d;
67
67
  hideLinkingToolbar(view.state, view.dispatch, view, true);
68
68
  /** Focus should move to the 'Add link' button when the toolbar closes
69
69
  * and not close the floating toolbar.
70
70
  */
71
- forceFocusSelector(FORCE_FOCUS_SELECTOR, view);
71
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector(FORCE_FOCUS_SELECTOR, view);
72
72
  },
73
73
  onSubmit: (href, meta) => {
74
74
  setUrlToMedia(href, meta.inputMethod)(view.state, view.dispatch, view);
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "185.2.2";
2
+ export const version = "185.2.7";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.2",
3
+ "version": "185.2.7",
4
4
  "sideEffects": false
5
5
  }