@atlaskit/editor-core 185.2.2 → 185.2.5

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 (56) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/plugins/card/nodeviews/embedCard.js +2 -2
  3. package/dist/cjs/plugins/card/nodeviews/genericCard.js +2 -1
  4. package/dist/cjs/plugins/card/toolbar.js +1 -1
  5. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +15 -12
  6. package/dist/cjs/plugins/floating-toolbar/index.js +7 -1
  7. package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  8. package/dist/cjs/plugins/media/toolbar/index.js +1 -1
  9. package/dist/cjs/plugins/media/toolbar/linking.js +3 -3
  10. package/dist/cjs/version-wrapper.js +1 -1
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/plugins/card/nodeviews/embedCard.js +2 -2
  13. package/dist/es2019/plugins/card/nodeviews/genericCard.js +2 -1
  14. package/dist/es2019/plugins/card/toolbar.js +1 -1
  15. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +7 -4
  16. package/dist/es2019/plugins/floating-toolbar/index.js +4 -1
  17. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  18. package/dist/es2019/plugins/media/toolbar/index.js +1 -1
  19. package/dist/es2019/plugins/media/toolbar/linking.js +3 -3
  20. package/dist/es2019/version-wrapper.js +1 -1
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/esm/plugins/card/nodeviews/embedCard.js +2 -2
  23. package/dist/esm/plugins/card/nodeviews/genericCard.js +2 -1
  24. package/dist/esm/plugins/card/toolbar.js +1 -1
  25. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +15 -12
  26. package/dist/esm/plugins/floating-toolbar/index.js +4 -1
  27. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  28. package/dist/esm/plugins/media/toolbar/index.js +1 -1
  29. package/dist/esm/plugins/media/toolbar/linking.js +3 -3
  30. package/dist/esm/version-wrapper.js +1 -1
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/labs/next/presets/cxhtml.d.ts +6 -0
  33. package/dist/types/labs/next/presets/default.d.ts +12 -0
  34. package/dist/types/labs/next/presets/mobile.d.ts +6 -0
  35. package/dist/types/plugins/card/index.d.ts +3 -1
  36. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +6 -3
  37. package/dist/types/plugins/floating-toolbar/index.d.ts +2 -6
  38. package/dist/types/plugins/media/index.d.ts +3 -1
  39. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +1 -1
  40. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -1
  41. package/dist/types/plugins/media/nodeviews/types.d.ts +1 -1
  42. package/dist/types/plugins/media/toolbar/linking.d.ts +3 -1
  43. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +6 -0
  44. package/dist/types-ts4.5/labs/next/presets/default.d.ts +12 -0
  45. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +6 -0
  46. package/dist/types-ts4.5/plugins/card/index.d.ts +3 -1
  47. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +6 -3
  48. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +2 -9
  49. package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
  50. package/dist/types-ts4.5/plugins/media/nodeviews/mediaInline.d.ts +1 -1
  51. package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -1
  52. package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +1 -1
  53. package/dist/types-ts4.5/plugins/media/toolbar/linking.d.ts +3 -1
  54. package/package.json +9 -11
  55. package/report.api.md +2 -0
  56. package/tmp/api-report-tmp.d.ts +3 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 185.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`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.
8
+ - Updated dependencies
9
+
3
10
  ## 185.2.2
4
11
 
5
12
  ### Patch Changes
@@ -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.5";
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.5",
4
4
  "sideEffects": false
5
5
  }
@@ -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.5";
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.5",
4
4
  "sideEffects": false
5
5
  }
@@ -71,8 +71,8 @@ var CardInner = function CardInner(_ref) {
71
71
  }), smartCard);
72
72
  }
73
73
  var displayGrid = function displayGrid(visible, gridType, highlight) {
74
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
75
- 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)({
74
+ var _pluginInjectionApi$d;
75
+ 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)({
76
76
  visible: visible,
77
77
  gridType: gridType,
78
78
  highlight: highlight
@@ -80,6 +80,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
80
80
  // (2) Render a blue link whilst downgrading to `link` in the ADF (fatal errs).
81
81
 
82
82
  if (maybeAPIError.kind && maybeAPIError.kind === 'fatal') {
83
+ var _pluginInjectionApi$d;
83
84
  this.setState({
84
85
  isError: true
85
86
  });
@@ -93,7 +94,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
93
94
  if (!getPos || typeof getPos === 'boolean') {
94
95
  return;
95
96
  }
96
- changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.analytics.actions)(view.state, view.dispatch);
97
+ 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);
97
98
  return null;
98
99
  } else {
99
100
  // Otherwise, render a blue link as fallback (above in render()).
@@ -189,7 +189,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
189
189
  linkPicker: linkPicker,
190
190
  node: node,
191
191
  featureFlags: featureFlags,
192
- editorAnalyticsApi: editorAnalyticsApi
192
+ pluginInjectionApi: pluginInjectionApi
193
193
  })];
194
194
  } else {
195
195
  var inlineCard = state.schema.nodes.inlineCard;
@@ -17,7 +17,6 @@ import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDT
17
17
  import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
18
18
  import { findCardInfo, displayInfoForCard } from '../utils';
19
19
  import { NodeSelection } from 'prosemirror-state';
20
- import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
21
20
  import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
22
21
  var HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkToolbar);
23
22
  export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
@@ -34,7 +33,8 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
34
33
  * and not close the floating toolbar.
35
34
  */
36
35
  _defineProperty(_assertThisInitialized(_this), "handleEsc", function (e) {
37
- forceFocusSelector("[aria-label=\"".concat(linkToolbarMessages.editLink.defaultMessage, "\"]"), _this.props.view);
36
+ var _this$props$forceFocu, _this$props;
37
+ (_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(linkToolbarMessages.editLink.defaultMessage, "\"]"), _this.props.view);
38
38
  });
39
39
  return _this;
40
40
  }
@@ -60,14 +60,14 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
60
60
  key: "render",
61
61
  value: function render() {
62
62
  var _this2 = this;
63
- var _this$props = this.props,
64
- linkPickerOptions = _this$props.linkPickerOptions,
65
- providerFactory = _this$props.providerFactory,
66
- url = _this$props.url,
67
- text = _this$props.text,
68
- view = _this$props.view,
69
- featureFlags = _this$props.featureFlags,
70
- _onSubmit = _this$props.onSubmit;
63
+ var _this$props2 = this.props,
64
+ linkPickerOptions = _this$props2.linkPickerOptions,
65
+ providerFactory = _this$props2.providerFactory,
66
+ url = _this$props2.url,
67
+ text = _this$props2.text,
68
+ view = _this$props2.view,
69
+ featureFlags = _this$props2.featureFlags,
70
+ _onSubmit = _this$props2.onSubmit;
71
71
  return /*#__PURE__*/React.createElement(HyperLinkToolbarWithListeners, {
72
72
  view: view,
73
73
  linkPickerOptions: linkPickerOptions,
@@ -112,12 +112,13 @@ export var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
112
112
  node = _ref.node,
113
113
  linkPicker = _ref.linkPicker,
114
114
  featureFlags = _ref.featureFlags,
115
- editorAnalyticsApi = _ref.editorAnalyticsApi;
115
+ pluginInjectionApi = _ref.pluginInjectionApi;
116
116
  return {
117
117
  type: 'custom',
118
118
  disableArrowNavigation: true,
119
119
  fallback: [],
120
120
  render: function render(view, idx) {
121
+ var _pluginInjectionApi$d;
121
122
  if (!view || !providerFactory) {
122
123
  return null;
123
124
  }
@@ -131,6 +132,7 @@ export var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
131
132
  text: displayInfo.title || '',
132
133
  node: node,
133
134
  featureFlags: featureFlags,
135
+ forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector,
134
136
  onSubmit: function onSubmit(newHref, newText, analytic) {
135
137
  var urlChanged = newHref !== displayInfo.url;
136
138
  var titleChanged = newText !== displayInfo.title;
@@ -138,7 +140,8 @@ export var buildEditLinkToolbar = function buildEditLinkToolbar(_ref) {
138
140
  // If the title is changed in a smartlink, convert to standard blue hyperlink
139
141
  // (even if the url was also changed) - we don't want to lose the custom title.
140
142
  if (titleChanged) {
141
- return commandWithMetadata(changeSelectedCardToLink(newText, newHref, undefined, undefined, undefined, editorAnalyticsApi), {
143
+ var _pluginInjectionApi$d2;
144
+ 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), {
142
145
  action: ACTION.UPDATED,
143
146
  sourceEvent: analytic
144
147
  })(view.state, view.dispatch);
@@ -22,7 +22,7 @@ import { ToolbarLoader } from './ui/ToolbarLoader';
22
22
  import { findNode } from './utils';
23
23
  import { ErrorBoundary } from '../../ui/ErrorBoundary';
24
24
  import { processCopyButtonItems } from '../copy-button/toolbar';
25
- import forceFocusPlugin from './pm-plugins/force-focus';
25
+ import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
26
26
  export var getRelevantConfig = function getRelevantConfig(selection, configs) {
27
27
  // node selections always take precedence, see if
28
28
  var configPair;
@@ -146,6 +146,9 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
146
146
  }
147
147
  }];
148
148
  },
149
+ actions: {
150
+ forceFocusSelector: forceFocusSelector
151
+ },
149
152
  contentComponent: function contentComponent(_ref3) {
150
153
  var popupsMountPoint = _ref3.popupsMountPoint,
151
154
  popupsBoundariesElement = _ref3.popupsBoundariesElement,
@@ -6,7 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import uuidV4 from 'uuid/v4';
7
7
  import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
8
8
  import { getMediaClient, isMediaBlobUrl as _isMediaBlobUrl, getAttrsFromUrl, isImageRepresentationReady } from '@atlaskit/media-client';
9
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
9
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
10
10
  import { replaceExternalMedia, updateAllMediaSingleNodesAttrs, updateCurrentMediaNodeAttrs, updateMediaSingleNodeAttrs } from '../commands/helpers';
11
11
  export var MediaNodeUpdater = /*#__PURE__*/function () {
12
12
  function MediaNodeUpdater(props) {
@@ -338,7 +338,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
338
338
  }
339
339
  };
340
340
  if (allowLinking && mediaLinkingState && mediaLinkingState.visible && shouldShowMediaLinkToolbar(state)) {
341
- var linkingToolbar = getLinkingToolbar(baseToolbar, mediaLinkingState, state, intl, providerFactory);
341
+ var linkingToolbar = getLinkingToolbar(baseToolbar, mediaLinkingState, state, intl, pluginInjectionApi, providerFactory);
342
342
  if (linkingToolbar) {
343
343
  return linkingToolbar;
344
344
  }
@@ -6,7 +6,6 @@ import { hideLinkingToolbar, setUrlToMedia, unlink } from '../commands/linking';
6
6
  import { getMediaLinkingState } from '../pm-plugins/linking';
7
7
  import MediaLinkingToolbar from '../ui/MediaLinkingToolbar';
8
8
  import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
9
- import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
10
9
  var FORCE_FOCUS_SELECTOR = '[data-testid="add-link-button"],[data-testid="edit-link-button"]';
11
10
  export function shouldShowMediaLinkToolbar(editorState) {
12
11
  var mediaLinkingState = getMediaLinkingState(editorState);
@@ -24,7 +23,7 @@ export function shouldShowMediaLinkToolbar(editorState) {
24
23
  parent = _editorState$doc$reso.parent;
25
24
  return parent && parent.type.allowsMarkType(link);
26
25
  }
27
- export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinkingState, state, intl, providerFactory) {
26
+ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinkingState, state, intl, pluginInjectionApi, providerFactory) {
28
27
  var link = mediaLinkingState.link,
29
28
  visible = mediaLinkingState.visible,
30
29
  editing = mediaLinkingState.editable,
@@ -60,11 +59,12 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
60
59
  hideLinkingToolbar(view.state, view.dispatch, view);
61
60
  },
62
61
  onCancel: function onCancel() {
62
+ var _pluginInjectionApi$d;
63
63
  hideLinkingToolbar(view.state, view.dispatch, view, true);
64
64
  /** Focus should move to the 'Add link' button when the toolbar closes
65
65
  * and not close the floating toolbar.
66
66
  */
67
- forceFocusSelector(FORCE_FOCUS_SELECTOR, view);
67
+ 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);
68
68
  },
69
69
  onSubmit: function onSubmit(href, meta) {
70
70
  setUrlToMedia(href, meta.inputMethod)(view.state, view.dispatch, view);
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "185.2.2";
2
+ export var version = "185.2.5";
3
3
  export var nextMajorVersion = function 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.5",
4
4
  "sideEffects": false
5
5
  }