@atlaskit/editor-core 185.15.2 → 185.16.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 (149) hide show
  1. package/.eslintrc.js +2 -0
  2. package/CHANGELOG.md +16 -0
  3. package/dist/cjs/actions/index.js +1 -1
  4. package/dist/cjs/commands/index.js +1 -1
  5. package/dist/cjs/editor-next/editor-internal.js +17 -17
  6. package/dist/cjs/editor-next/hooks/useMeasureEditorMountTime.js +1 -1
  7. package/dist/cjs/editor-next/hooks/useProviderFactory.js +3 -3
  8. package/dist/cjs/editor-next/index.js +15 -15
  9. package/dist/cjs/editor-next/utils/editorMeasureTTICallback.js +2 -2
  10. package/dist/cjs/editor-next/utils/onEditorCreated.js +1 -1
  11. package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +1 -1
  12. package/dist/cjs/editor.js +5 -5
  13. package/dist/cjs/messages.js +4 -4
  14. package/dist/cjs/nodeviews/context-adapter.js +1 -1
  15. package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  16. package/dist/cjs/plugins/card/index.js +29 -1
  17. package/dist/cjs/plugins/card/messages.js +20 -0
  18. package/dist/cjs/plugins/card/pm-plugins/actions.js +7 -4
  19. package/dist/cjs/plugins/card/pm-plugins/doc.js +26 -7
  20. package/dist/cjs/plugins/card/pm-plugins/main.js +3 -2
  21. package/dist/cjs/plugins/card/pm-plugins/reducers.js +11 -3
  22. package/dist/cjs/plugins/card/toolbar.js +3 -9
  23. package/dist/cjs/plugins/card/ui/DatasourceModal/ModalWithState.js +25 -0
  24. package/dist/cjs/plugins/card/ui/DatasourceModal/index.js +60 -0
  25. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +8 -28
  26. package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +4 -4
  27. package/dist/cjs/test-utils.js +3 -3
  28. package/dist/cjs/version-wrapper.js +1 -1
  29. package/dist/cjs/version.json +1 -1
  30. package/dist/es2019/actions/index.js +2 -3
  31. package/dist/es2019/commands/index.js +1 -1
  32. package/dist/es2019/editor-next/editor-internal.js +6 -7
  33. package/dist/es2019/editor-next/hooks/useMeasureEditorMountTime.js +1 -1
  34. package/dist/es2019/editor-next/hooks/useProviderFactory.js +3 -3
  35. package/dist/es2019/editor-next/index.js +10 -11
  36. package/dist/es2019/editor-next/utils/editorMeasureTTICallback.js +2 -2
  37. package/dist/es2019/editor-next/utils/onEditorCreated.js +1 -1
  38. package/dist/es2019/editor-next/utils/sendDurationAnalytics.js +1 -1
  39. package/dist/es2019/editor.js +1 -1
  40. package/dist/es2019/messages.js +1 -1
  41. package/dist/es2019/nodeviews/context-adapter.js +1 -1
  42. package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  43. package/dist/es2019/plugins/card/index.js +29 -1
  44. package/dist/es2019/plugins/card/messages.js +13 -0
  45. package/dist/es2019/plugins/card/pm-plugins/actions.js +3 -2
  46. package/dist/es2019/plugins/card/pm-plugins/doc.js +27 -5
  47. package/dist/es2019/plugins/card/pm-plugins/main.js +3 -2
  48. package/dist/es2019/plugins/card/pm-plugins/reducers.js +12 -3
  49. package/dist/es2019/plugins/card/toolbar.js +4 -10
  50. package/dist/es2019/plugins/card/ui/DatasourceModal/ModalWithState.js +19 -0
  51. package/dist/es2019/plugins/card/ui/DatasourceModal/index.js +48 -0
  52. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +6 -26
  53. package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +5 -5
  54. package/dist/es2019/test-utils.js +3 -3
  55. package/dist/es2019/version-wrapper.js +1 -1
  56. package/dist/es2019/version.json +1 -1
  57. package/dist/esm/actions/index.js +2 -3
  58. package/dist/esm/commands/index.js +1 -1
  59. package/dist/esm/editor-next/editor-internal.js +6 -7
  60. package/dist/esm/editor-next/hooks/useMeasureEditorMountTime.js +1 -1
  61. package/dist/esm/editor-next/hooks/useProviderFactory.js +3 -3
  62. package/dist/esm/editor-next/index.js +10 -11
  63. package/dist/esm/editor-next/utils/editorMeasureTTICallback.js +2 -2
  64. package/dist/esm/editor-next/utils/onEditorCreated.js +1 -1
  65. package/dist/esm/editor-next/utils/sendDurationAnalytics.js +1 -1
  66. package/dist/esm/editor.js +1 -1
  67. package/dist/esm/messages.js +1 -1
  68. package/dist/esm/nodeviews/context-adapter.js +1 -1
  69. package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  70. package/dist/esm/plugins/card/index.js +30 -1
  71. package/dist/esm/plugins/card/messages.js +13 -0
  72. package/dist/esm/plugins/card/pm-plugins/actions.js +7 -4
  73. package/dist/esm/plugins/card/pm-plugins/doc.js +23 -5
  74. package/dist/esm/plugins/card/pm-plugins/main.js +3 -2
  75. package/dist/esm/plugins/card/pm-plugins/reducers.js +11 -3
  76. package/dist/esm/plugins/card/toolbar.js +4 -10
  77. package/dist/esm/plugins/card/ui/DatasourceModal/ModalWithState.js +17 -0
  78. package/dist/esm/plugins/card/ui/DatasourceModal/index.js +49 -0
  79. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +6 -25
  80. package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +5 -5
  81. package/dist/esm/test-utils.js +3 -3
  82. package/dist/esm/version-wrapper.js +1 -1
  83. package/dist/esm/version.json +1 -1
  84. package/dist/types/actions/index.d.ts +2 -2
  85. package/dist/types/commands/index.d.ts +2 -2
  86. package/dist/types/create-editor/get-plugins.d.ts +6 -6
  87. package/dist/types/editor-next/editor-internal.d.ts +5 -6
  88. package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +1 -1
  89. package/dist/types/editor-next/hooks/useProviderFactory.d.ts +3 -3
  90. package/dist/types/editor-next/index.d.ts +2 -1
  91. package/dist/types/editor-next/utils/deprecationWarnings.d.ts +1 -1
  92. package/dist/types/editor-next/utils/handleProviders.d.ts +1 -2
  93. package/dist/types/editor-next/utils/onEditorCreated.d.ts +3 -3
  94. package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +1 -1
  95. package/dist/types/editor-next/utils/trackEditorActions.d.ts +1 -1
  96. package/dist/types/editor.d.ts +1 -1
  97. package/dist/types/messages.d.ts +1 -1
  98. package/dist/types/plugins/card/messages.d.ts +12 -0
  99. package/dist/types/plugins/card/pm-plugins/actions.d.ts +2 -1
  100. package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -0
  101. package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
  102. package/dist/types/plugins/card/types.d.ts +3 -0
  103. package/dist/types/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +9 -0
  104. package/dist/{types-ts4.5/plugins/card/ui/DatasourceModal.d.ts → types/plugins/card/ui/DatasourceModal/index.d.ts} +3 -5
  105. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -7
  106. package/dist/types/selection-api/api.d.ts +1 -1
  107. package/dist/types/test-utils.d.ts +3 -3
  108. package/dist/types/types/editor-appearance-component.d.ts +8 -8
  109. package/dist/types/types/editor-config.d.ts +3 -3
  110. package/dist/types/types/editor-props.d.ts +10 -10
  111. package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
  112. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  113. package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
  114. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  115. package/dist/types-ts4.5/actions/index.d.ts +2 -2
  116. package/dist/types-ts4.5/commands/index.d.ts +2 -2
  117. package/dist/types-ts4.5/create-editor/get-plugins.d.ts +6 -6
  118. package/dist/types-ts4.5/editor-next/editor-internal.d.ts +5 -6
  119. package/dist/types-ts4.5/editor-next/hooks/useMeasureEditorMountTime.d.ts +1 -1
  120. package/dist/types-ts4.5/editor-next/hooks/useProviderFactory.d.ts +3 -3
  121. package/dist/types-ts4.5/editor-next/index.d.ts +2 -1
  122. package/dist/types-ts4.5/editor-next/utils/deprecationWarnings.d.ts +1 -1
  123. package/dist/types-ts4.5/editor-next/utils/handleProviders.d.ts +1 -2
  124. package/dist/types-ts4.5/editor-next/utils/onEditorCreated.d.ts +3 -3
  125. package/dist/types-ts4.5/editor-next/utils/sendDurationAnalytics.d.ts +1 -1
  126. package/dist/types-ts4.5/editor-next/utils/trackEditorActions.d.ts +1 -1
  127. package/dist/types-ts4.5/editor.d.ts +1 -1
  128. package/dist/types-ts4.5/messages.d.ts +1 -1
  129. package/dist/types-ts4.5/plugins/card/messages.d.ts +12 -0
  130. package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +2 -1
  131. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -0
  132. package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +1 -0
  133. package/dist/types-ts4.5/plugins/card/types.d.ts +3 -0
  134. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +9 -0
  135. package/dist/{types/plugins/card/ui/DatasourceModal.d.ts → types-ts4.5/plugins/card/ui/DatasourceModal/index.d.ts} +3 -5
  136. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -7
  137. package/dist/types-ts4.5/selection-api/api.d.ts +1 -1
  138. package/dist/types-ts4.5/test-utils.d.ts +3 -3
  139. package/dist/types-ts4.5/types/editor-appearance-component.d.ts +8 -8
  140. package/dist/types-ts4.5/types/editor-config.d.ts +3 -3
  141. package/dist/types-ts4.5/types/editor-props.d.ts +10 -10
  142. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
  143. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  144. package/dist/types-ts4.5/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
  145. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  146. package/package.json +3 -3
  147. package/dist/cjs/plugins/card/ui/DatasourceModal.js +0 -41
  148. package/dist/es2019/plugins/card/ui/DatasourceModal.js +0 -30
  149. package/dist/esm/plugins/card/ui/DatasourceModal.js +0 -31
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _hooks = require("@atlaskit/editor-common/hooks");
10
+ var _index = require("./index");
11
+ var ModalWithState = function ModalWithState(_ref) {
12
+ var api = _ref.api,
13
+ editorView = _ref.editorView;
14
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['card']),
15
+ cardState = _useSharedPluginState.cardState;
16
+ if (!(cardState !== null && cardState !== void 0 && cardState.showDatasourceModal)) {
17
+ return null;
18
+ }
19
+ return /*#__PURE__*/_react.default.createElement(_index.DatasourceModal, {
20
+ view: editorView,
21
+ modalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
22
+ });
23
+ };
24
+ var _default = ModalWithState;
25
+ exports.default = _default;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.DatasourceModal = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _linkDatasource = require("@atlaskit/link-datasource");
12
+ var _actions = require("../../pm-plugins/actions");
13
+ var _doc = require("../../pm-plugins/doc");
14
+ var _prosemirrorState = require("prosemirror-state");
15
+ 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); }
16
+ 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; }
17
+ var DatasourceModal = function DatasourceModal(_ref) {
18
+ var view = _ref.view,
19
+ modalType = _ref.modalType;
20
+ var dispatch = view.dispatch,
21
+ state = view.state;
22
+ var selection = state.selection;
23
+ var existingNode = selection instanceof _prosemirrorState.NodeSelection ? selection.node : undefined;
24
+ var onClose = (0, _react.useCallback)(function () {
25
+ dispatch((0, _actions.hideDatasourceModal)(state.tr));
26
+ }, [dispatch, state.tr]);
27
+ var onInsert = (0, _react.useCallback)(function (newAdf) {
28
+ if (existingNode) {
29
+ (0, _doc.updateExistingDatasource)(state, existingNode, newAdf, view);
30
+ } else {
31
+ (0, _doc.insertDatasource)(state, newAdf, view);
32
+ }
33
+ }, [existingNode, state, view]);
34
+ if (modalType === 'jira') {
35
+ var _existingNode$attrs, _tableView$properties;
36
+ var _ref2 = (existingNode === null || existingNode === void 0 ? void 0 : (_existingNode$attrs = existingNode.attrs) === null || _existingNode$attrs === void 0 ? void 0 : _existingNode$attrs.datasource) || {},
37
+ _ref2$id = _ref2.id,
38
+ datasourceId = _ref2$id === void 0 ? _linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID : _ref2$id,
39
+ parameters = _ref2.parameters,
40
+ _ref2$views = _ref2.views,
41
+ views = _ref2$views === void 0 ? [] : _ref2$views;
42
+ var _ref3 = views,
43
+ _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
44
+ tableView = _ref4[0];
45
+ var visibleColumnKeys = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (column) {
46
+ return column.key;
47
+ });
48
+ return /*#__PURE__*/_react.default.createElement("div", {
49
+ "data-testid": "jira-config-modal"
50
+ }, /*#__PURE__*/_react.default.createElement(_linkDatasource.JiraIssuesConfigModal, {
51
+ datasourceId: datasourceId,
52
+ visibleColumnKeys: visibleColumnKeys,
53
+ parameters: parameters,
54
+ onCancel: onClose,
55
+ onInsert: onInsert
56
+ }));
57
+ }
58
+ return null; // null for now until we have modal component that handles other datasources
59
+ };
60
+ exports.DatasourceModal = DatasourceModal;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.EditLinkToolbar = void 0;
8
8
  exports.HyperlinkAddToolbarWithState = HyperlinkAddToolbarWithState;
9
- exports.openDatasourceModal = exports.editLinkToolbarConfig = exports.editLink = exports.editDatasource = exports.buildEditLinkToolbar = void 0;
9
+ exports.editLinkToolbarConfig = exports.editLink = exports.editDatasource = exports.buildEditLinkToolbar = void 0;
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
12
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
@@ -24,8 +24,8 @@ var _doc = require("../pm-plugins/doc");
24
24
  var _utils = require("../utils");
25
25
  var _prosemirrorState = require("prosemirror-state");
26
26
  var _messages = require("@atlaskit/editor-common/messages");
27
- var _DatasourceModal = require("./DatasourceModal");
28
27
  var _hooks = require("@atlaskit/editor-common/hooks");
28
+ var _linkDatasource = require("@atlaskit/link-datasource");
29
29
  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); }; }
30
30
  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; } }
31
31
  var HyperLinkToolbarWithListeners = (0, _ui.withOuterListeners)(HyperlinkAddToolbarWithState);
@@ -232,11 +232,13 @@ var editLinkToolbarConfig = function editLinkToolbarConfig(showLinkingToolbar, l
232
232
  } : {};
233
233
  };
234
234
  exports.editLinkToolbarConfig = editLinkToolbarConfig;
235
- var editDatasource = function editDatasource(editorAnalyticsApi) {
235
+ var editDatasource = function editDatasource(node, editorAnalyticsApi) {
236
236
  return function (state, dispatch) {
237
- if (dispatch) {
237
+ var _node$attrs;
238
+ var modalType = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id) === _linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID ? 'jira' : undefined;
239
+ if (dispatch && modalType) {
238
240
  var tr = state.tr;
239
- (0, _actions.showDatasourceModal)(tr);
241
+ (0, _actions.showDatasourceModal)(modalType)(tr);
240
242
  // editorAnalyticsApi?.attachAnalyticsEvent(
241
243
  // buildEditLinkPayload(
242
244
  // type as
@@ -251,26 +253,4 @@ var editDatasource = function editDatasource(editorAnalyticsApi) {
251
253
  return false;
252
254
  };
253
255
  };
254
- exports.editDatasource = editDatasource;
255
- var openDatasourceModal = function openDatasourceModal(_ref3) {
256
- var state = _ref3.state,
257
- node = _ref3.node,
258
- editorAnalyticsApi = _ref3.editorAnalyticsApi;
259
- return {
260
- type: 'custom',
261
- disableArrowNavigation: true,
262
- fallback: [],
263
- render: function render(view) {
264
- if (!view) {
265
- return null;
266
- }
267
- return /*#__PURE__*/_react.default.createElement(_DatasourceModal.DatasourceModal, {
268
- state: state,
269
- view: view,
270
- node: node,
271
- editorAnalyticsApi: editorAnalyticsApi
272
- });
273
- }
274
- };
275
- };
276
- exports.openDatasourceModal = openDatasourceModal;
256
+ exports.editDatasource = editDatasource;
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.insertTypeAheadItem = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var _prosemirrorHistory = require("prosemirror-history");
9
10
  var _prosemirrorModel = require("prosemirror-model");
10
11
  var _steps = require("@atlaskit/adf-schema/steps");
11
- var _prosemirrorHistory = require("prosemirror-history");
12
- var _key = require("../pm-plugins/key");
13
- var _insertUtils = require("../insert-utils");
14
- var _statsModifier = require("../stats-modifier");
15
12
  var _typeAhead = require("@atlaskit/editor-common/type-ahead");
13
+ var _insertUtils = require("../insert-utils");
16
14
  var _actions = require("../pm-plugins/actions");
15
+ var _key = require("../pm-plugins/key");
16
+ var _statsModifier = require("../stats-modifier");
17
17
  var _closeTypeAhead = require("../transforms/close-type-ahead");
18
18
  var _utils = require("../utils");
19
19
  var validateNode = function validateNode(_ref) {
@@ -35,12 +35,12 @@ exports.setTextSelection = setTextSelection;
35
35
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
36
36
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
37
37
  var _prosemirrorState = require("prosemirror-state");
38
- var _sortByOrder = require("./create-editor/sort-by-order");
38
+ var _preset = require("@atlaskit/editor-common/preset");
39
39
  var _createSchema = require("./create-editor/create-schema");
40
- var _base = _interopRequireDefault(require("./plugins/base"));
40
+ var _sortByOrder = require("./create-editor/sort-by-order");
41
41
  var _pluginKey = require("./plugins/analytics/plugin-key");
42
+ var _base = _interopRequireDefault(require("./plugins/base"));
42
43
  var _api = require("./plugins/type-ahead/api");
43
- var _preset = require("@atlaskit/editor-common/preset");
44
44
  var _eventDispatcher = require("./event-dispatcher");
45
45
  var _selection = require("./plugins/selection/gap-cursor/selection");
46
46
  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; }
@@ -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.15.2";
9
+ var version = "185.16.0";
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.15.2",
3
+ "version": "185.16.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,15 +1,14 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { Node } from 'prosemirror-model';
3
- import { analyticsEventKey } from '@atlaskit/editor-common/utils';
4
3
  import { NodeSelection, TextSelection } from 'prosemirror-state';
5
4
  import { findParentNode, safeInsert } from 'prosemirror-utils';
5
+ import { analyticsEventKey, isEmptyDocument, processRawValue } from '@atlaskit/editor-common/utils';
6
6
  import { createDispatch } from '../event-dispatcher';
7
7
  import { getCollabProvider } from '../plugins/collab-edit/native-collab-provider-plugin';
8
8
  import { findNodePosWithLocalId } from '../plugins/extension/utils';
9
9
  import { toJSON } from '../utils';
10
- import { getEditorValueWithMedia, __temporaryFixForConfigPanel } from '../utils/action';
10
+ import { __temporaryFixForConfigPanel, getEditorValueWithMedia } from '../utils/action';
11
11
  import deprecationWarnings from '../utils/deprecation-warnings';
12
- import { isEmptyDocument, processRawValue } from '@atlaskit/editor-common/utils';
13
12
  import { processRawFragmentValue } from '../utils/document';
14
13
  import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
15
14
  export default class EditorActions {
@@ -1,8 +1,8 @@
1
1
  import { Fragment } from 'prosemirror-model';
2
2
  import { NodeSelection, Selection, TextSelection } from 'prosemirror-state';
3
3
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
4
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, withAnalytics } from '../plugins/analytics';
4
5
  import { canMoveDown, canMoveUp } from '../utils';
5
- import { withAnalytics, EVENT_TYPE, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../plugins/analytics';
6
6
  export function preventDefault() {
7
7
  return function () {
8
8
  return true;
@@ -1,20 +1,19 @@
1
1
  /** @jsx jsx */
2
-
3
- import { BaseTheme, WidthProvider } from '@atlaskit/editor-common/ui';
4
- import { jsx, css } from '@emotion/react';
5
2
  import { Fragment } from 'react';
3
+ import { css, jsx } from '@emotion/react';
4
+ import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
5
+ import { PortalProviderWithThemeProviders, PortalRenderer } from '@atlaskit/editor-common/portal-provider';
6
+ import { BaseTheme, WidthProvider } from '@atlaskit/editor-common/ui';
6
7
  import { getUiComponent } from '../create-editor';
7
- import ReactEditorView from '../create-editor/ReactEditorViewNext';
8
8
  import ErrorBoundary from '../create-editor/ErrorBoundary';
9
9
  import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
10
+ import ReactEditorView from '../create-editor/ReactEditorViewNext';
10
11
  import { ContextAdapter } from '../nodeviews/context-adapter';
11
- import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
12
12
  import EditorContext from '../ui/EditorContext';
13
- import { PortalProviderWithThemeProviders, PortalRenderer } from '@atlaskit/editor-common/portal-provider';
14
13
  import { RenderTracking } from '../utils/performance/components/RenderTracking';
15
- import { getBaseFontSize } from './utils/getBaseFontSize';
16
14
  import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
17
15
  import useProviderFactory from './hooks/useProviderFactory';
16
+ import { getBaseFontSize } from './utils/getBaseFontSize';
18
17
  /**
19
18
  * EditorInternal is used for the internal editor react component
20
19
  * with the lifecycle methods extracted into hooks.
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { useEffect } from 'react';
3
- import { clearMeasure, stopMeasure } from '@atlaskit/editor-common/utils';
4
3
  import { ACTION } from '@atlaskit/editor-common/analytics';
4
+ import { clearMeasure, stopMeasure } from '@atlaskit/editor-common/utils';
5
5
  import measurements from '../../utils/performance/measure-enum';
6
6
  import sendDurationAnalytics from '../utils/sendDurationAnalytics';
7
7
  import useEditorConstructor from './useEditorMeasuresConstructor';
@@ -1,10 +1,10 @@
1
- import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
1
  import { useEffect, useRef, useState } from 'react';
3
2
  import { usePreviousState } from '@atlaskit/editor-common/hooks';
4
- import prepareQuickInsertProvider from '../../utils/prepare-quick-insert-provider';
3
+ import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
5
4
  import prepareExtensionProvider from '../../utils/prepare-extension-provider';
6
- import handleProviders from '../utils/handleProviders';
5
+ import prepareQuickInsertProvider from '../../utils/prepare-quick-insert-provider';
7
6
  import getProvidersFromEditorProps from '../utils/getProvidersFromEditorProps';
7
+ import handleProviders from '../utils/handleProviders';
8
8
  function createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent) {
9
9
  const extensionProvider = prepareExtensionProvider(() => editorActions)(extensionProviders);
10
10
  const quickInsertProvider = prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent);
@@ -1,23 +1,22 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  /** @jsx jsx */
3
-
4
- import { WithCreateAnalyticsEvent } from '@atlaskit/editor-common/ui';
5
- import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
3
+ import React from 'react';
6
4
  import { jsx } from '@emotion/react';
7
5
  import PropTypes from 'prop-types';
8
- import React from 'react';
9
- import { name, version } from '../version-wrapper';
10
- import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
11
6
  import uuid from 'uuid/v4';
12
- import EditorActions from '../actions';
7
+ import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
13
8
  import { fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
9
+ import { WithCreateAnalyticsEvent } from '@atlaskit/editor-common/ui';
10
+ import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
11
+ import EditorActions from '../actions';
12
+ import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
13
+ import { basePlugin } from '../plugins';
14
+ import { name, version } from '../version-wrapper';
14
15
  import EditorInternal from './editor-internal';
16
+ import deprecationWarnings from './utils/deprecationWarnings';
15
17
  import { propTypes } from './utils/editorPropTypes';
16
- import trackEditorActions from './utils/trackEditorActions';
17
18
  import onEditorCreated from './utils/onEditorCreated';
18
- import deprecationWarnings from './utils/deprecationWarnings';
19
- import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
20
- import { basePlugin } from '../plugins';
19
+ import trackEditorActions from './utils/trackEditorActions';
21
20
  export default class EditorNext extends React.Component {
22
21
  constructor(props, context) {
23
22
  super(props);
@@ -1,6 +1,6 @@
1
- import { getTTISeverity } from '@atlaskit/editor-common/utils';
2
- import { EditorExperience } from '@atlaskit/editor-common/ufo';
3
1
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
+ import { EditorExperience } from '@atlaskit/editor-common/ufo';
3
+ import { getTTISeverity } from '@atlaskit/editor-common/utils';
4
4
  export default function editorMeasureTTICallback(tti, ttiFromInvocation, canceled, performanceTracking, featureFlags, createAnalyticsEvent, experienceStore) {
5
5
  var _performanceTracking$;
6
6
  if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.ttiTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled && createAnalyticsEvent) {
@@ -1,6 +1,6 @@
1
+ import { ACTION } from '@atlaskit/editor-common/analytics';
1
2
  import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
2
3
  import { startMeasure, stopMeasure } from '@atlaskit/editor-common/utils';
3
- import { ACTION } from '@atlaskit/editor-common/analytics';
4
4
  import measurements from '../../utils/performance/measure-enum';
5
5
  import sendDurationAnalytics from './sendDurationAnalytics';
6
6
  export default function onEditorCreated(instance, props, setExperienceStore, getExperienceStore, getCreateAnalyticsEvent, editorActions, startTime, registerEditorForActions) {
@@ -1,5 +1,5 @@
1
- import { EditorExperience } from '@atlaskit/editor-common/ufo';
2
1
  import { ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
+ import { EditorExperience } from '@atlaskit/editor-common/ufo';
3
3
  /**
4
4
  *
5
5
  * Util function to be used with the Editor component to send duration analytics
@@ -1,8 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/react';
5
4
  import React from 'react';
5
+ import { jsx } from '@emotion/react';
6
6
  import { defaultProps } from './editor-next/utils/editorPropTypes';
7
7
  import EditorNext from './editor-next';
8
8
  import useUniversalPreset from './labs/next/presets/useUniversalPreset';
@@ -1,7 +1,7 @@
1
1
  // Common Translations will live here
2
2
  import commonMessages, { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messages';
3
- import { messages as statusMessages } from './plugins/status/nodeviews/messages';
4
3
  import { messages as dateMessages } from './plugins/date/nodeviews/messages';
4
+ import { messages as statusMessages } from './plugins/status/nodeviews/messages';
5
5
  export { linkMessages };
6
6
  export { statusMessages };
7
7
  export { dateMessages };
@@ -1,8 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { SmartCardContext } from '@atlaskit/link-provider';
5
4
  import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
5
+ import { SmartCardContext } from '@atlaskit/link-provider';
6
6
  function useContextMemoized(reactContext) {
7
7
  const value = React.useContext(reactContext);
8
8
  const context = React.useMemo(() => ({
@@ -1,6 +1,6 @@
1
1
  import { css } from '@emotion/react';
2
- import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
3
2
  import { inlineNodeViewClassname } from '@atlaskit/editor-common/react-node-view';
3
+ import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
4
4
 
5
5
  // For reasoning behind styles, see comments in:
6
6
  // ./getInlineNodeViewProducer -> portalChildren()
@@ -10,6 +10,12 @@ import { EditorSmartCardEventsNext } from './ui/EditorSmartCardEventsNext';
10
10
  import LayoutButton from './ui/LayoutButton';
11
11
  import { pluginKey } from './pm-plugins/plugin-key';
12
12
  import { mountHyperlinkPlugin } from './pm-plugins/mountHyperlink';
13
+ import { showDatasourceModal } from './pm-plugins/actions';
14
+ import DatasourceModalWithState from './ui/DatasourceModal/ModalWithState';
15
+ import { messages } from './messages';
16
+ import { IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
17
+ import { canRenderDatasource } from '@atlaskit/editor-common/utils';
18
+ import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
13
19
  const cardPlugin = (options, api) => {
14
20
  var _api$dependencies, _api$dependencies$fea;
15
21
  const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
@@ -87,6 +93,9 @@ const cardPlugin = (options, api) => {
87
93
  mountPoint: popupsMountPoint,
88
94
  scrollableElement: popupsScrollableElement,
89
95
  boundariesElement: popupsBoundariesElement
96
+ }), /*#__PURE__*/React.createElement(DatasourceModalWithState, {
97
+ api: api,
98
+ editorView: editorView
90
99
  }));
91
100
  },
92
101
  actions: {
@@ -96,7 +105,26 @@ const cardPlugin = (options, api) => {
96
105
  setSelectedCardAppearance
97
106
  },
98
107
  pluginsOptions: {
99
- floatingToolbar: floatingToolbar(options, featureFlags, options.platform, options.linkPicker, api)
108
+ floatingToolbar: floatingToolbar(options, featureFlags, options.platform, options.linkPicker, api),
109
+ quickInsert: ({
110
+ formatMessage
111
+ }) => {
112
+ if (canRenderDatasource(JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
113
+ return [{
114
+ id: 'datasource',
115
+ title: formatMessage(messages.datasourceJiraIssue),
116
+ description: formatMessage(messages.datasourceJiraIssueDescription),
117
+ keywords: ['jira'],
118
+ icon: () => /*#__PURE__*/React.createElement(IconDatasourceJiraIssue, null),
119
+ action(insert) {
120
+ const tr = insert(undefined);
121
+ showDatasourceModal('jira')(tr);
122
+ return tr;
123
+ }
124
+ }];
125
+ }
126
+ return [];
127
+ }
100
128
  }
101
129
  };
102
130
  };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export const messages = defineMessages({
3
+ datasourceJiraIssue: {
4
+ id: 'fabric.editor.datasource.jiraIssue',
5
+ defaultMessage: 'Jira Issues',
6
+ description: 'Insert a jira datasource table'
7
+ },
8
+ datasourceJiraIssueDescription: {
9
+ id: 'fabric.editor.datasource.jiraIssue.description',
10
+ defaultMessage: 'Insert issues from Jira Cloud with enhanced search, filtering, and configuration',
11
+ description: 'Insert a jira datasource table'
12
+ }
13
+ });
@@ -48,8 +48,9 @@ export const showLinkToolbar = tr => cardAction(tr, {
48
48
  export const hideLinkToolbar = tr => cardAction(tr, {
49
49
  type: 'HIDE_LINK_TOOLBAR'
50
50
  });
51
- export const showDatasourceModal = tr => cardAction(tr, {
52
- type: 'SHOW_DATASOURCE_MODAL'
51
+ export const showDatasourceModal = modalType => tr => cardAction(tr, {
52
+ type: 'SHOW_DATASOURCE_MODAL',
53
+ modalType
53
54
  });
54
55
  export const hideDatasourceModal = tr => cardAction(tr, {
55
56
  type: 'HIDE_DATASOURCE_MODAL'
@@ -407,11 +407,11 @@ export const updateExistingDatasource = (state, node, newAdf, view) => {
407
407
 
408
408
  // datasource to datasource
409
409
  if (newAdf.type === 'blockCard' && newAdf.attrs.datasource && node.attrs.datasource) {
410
- var _ref, _ref2, _newViews$, _newViews$$properties, _oldViews$, _oldViews$$properties, _newAdf$attrs, _node$attrs;
411
- const newViews = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
412
- const oldViews = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
413
- const newColumnKeys = (_newViews$ = newViews[0]) === null || _newViews$ === void 0 ? void 0 : (_newViews$$properties = _newViews$.properties) === null || _newViews$$properties === void 0 ? void 0 : _newViews$$properties.columns.map(column => column.key);
414
- const oldColumnKeys = (_oldViews$ = oldViews[0]) === null || _oldViews$ === void 0 ? void 0 : (_oldViews$$properties = _oldViews$.properties) === null || _oldViews$$properties === void 0 ? void 0 : _oldViews$$properties.columns.map(column => column.key);
410
+ var _ref, _ref2, _newViews$properties, _oldViews$properties, _newAdf$attrs, _node$attrs;
411
+ const [newViews] = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
412
+ const [oldViews] = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
413
+ const newColumnKeys = newViews === null || newViews === void 0 ? void 0 : (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(column => column.key);
414
+ const oldColumnKeys = oldViews === null || oldViews === void 0 ? void 0 : (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(column => column.key);
415
415
  const isColumnChange = !isEqual(oldColumnKeys, newColumnKeys);
416
416
  const isUrlChange = ((_newAdf$attrs = newAdf.attrs) === null || _newAdf$attrs === void 0 ? void 0 : _newAdf$attrs.url) !== ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url);
417
417
  if (isColumnChange || isUrlChange) {
@@ -423,4 +423,26 @@ export const updateExistingDatasource = (state, node, newAdf, view) => {
423
423
  }
424
424
  hideDatasourceModal(tr);
425
425
  view.dispatch(tr.scrollIntoView());
426
+ };
427
+ export const insertDatasource = (state, adf, view) => {
428
+ const {
429
+ tr,
430
+ selection: {
431
+ from
432
+ },
433
+ schema: {
434
+ nodes: schemaNodes
435
+ }
436
+ } = state;
437
+ const {
438
+ attrs,
439
+ type
440
+ } = adf;
441
+ const schemaNode = type === 'inlineCard' ? schemaNodes.inlineCard : schemaNodes.blockCard;
442
+ const newNode = schemaNode.createChecked(attrs);
443
+ // in future, if we decide to do datasource insertion from the main toolbar, we should probably consider editor-plugin-content-insertion instead of tr.insert
444
+ // this will allow us to deal with insertions from multiple paths in a more consistent way
445
+ newNode && tr.insert(from, newNode);
446
+ hideDatasourceModal(tr);
447
+ view.dispatch(tr.scrollIntoView());
426
448
  };
@@ -49,6 +49,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
49
49
  smartLinkEventsNext: undefined,
50
50
  editorAppearance,
51
51
  showDatasourceModal: false,
52
+ datasourceModalType: undefined,
52
53
  datasourceTableRef: undefined,
53
54
  layout: undefined
54
55
  };
@@ -166,8 +167,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
166
167
  const hasIntlContext = true;
167
168
  const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
168
169
  if (isDatasource) {
169
- var _node$attrs4;
170
- if (platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.datasource)) {
170
+ var _node$attrs4, _node$attrs4$datasour;
171
+ if (platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
171
172
  return new Datasource({
172
173
  node,
173
174
  view,
@@ -65,10 +65,18 @@ const setLinkToolbar = (state, action) => {
65
65
  showLinkingToolbar: action.type === 'SHOW_LINK_TOOLBAR'
66
66
  };
67
67
  };
68
- const setDatasourceModal = (state, action) => {
68
+ const showDatasourceModal = (state, action) => {
69
69
  return {
70
70
  ...state,
71
- showDatasourceModal: action.type === 'SHOW_DATASOURCE_MODAL'
71
+ showDatasourceModal: true,
72
+ datasourceModalType: action.type === 'SHOW_DATASOURCE_MODAL' ? action.modalType : undefined
73
+ };
74
+ };
75
+ const hideDatasourceModal = state => {
76
+ return {
77
+ ...state,
78
+ showDatasourceModal: false,
79
+ datasourceModalType: undefined
72
80
  };
73
81
  };
74
82
  export default ((state, action) => {
@@ -95,7 +103,8 @@ export default ((state, action) => {
95
103
  case 'HIDE_LINK_TOOLBAR':
96
104
  return setLinkToolbar(state, action);
97
105
  case 'SHOW_DATASOURCE_MODAL':
106
+ return showDatasourceModal(state, action);
98
107
  case 'HIDE_DATASOURCE_MODAL':
99
- return setDatasourceModal(state, action);
108
+ return hideDatasourceModal(state);
100
109
  }
101
110
  });
@@ -11,7 +11,7 @@ import { changeSelectedCardToText } from './pm-plugins/doc';
11
11
  import { commandWithMetadata } from '@atlaskit/editor-common/card';
12
12
  import { pluginKey } from './pm-plugins/main';
13
13
  import { richMediaClassName } from '@atlaskit/editor-common/styles';
14
- import { editDatasource, buildEditLinkToolbar, editLink, editLinkToolbarConfig, openDatasourceModal } from './ui/EditLinkToolbar';
14
+ import { editDatasource, buildEditLinkToolbar, editLink, editLinkToolbarConfig } from './ui/EditLinkToolbar';
15
15
  import { displayInfoForCard, findCardInfo, titleUrlPairFromNode, appearanceForNodeType } from './utils';
16
16
  import { isSafeUrl } from '@atlaskit/adf-schema';
17
17
  import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
@@ -165,7 +165,7 @@ const withToolbarMetadata = command => commandWithMetadata(command, {
165
165
  inputMethod: INPUT_METHOD.FLOATING_TB
166
166
  });
167
167
  const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) => node => {
168
- var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2;
168
+ var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2, _node$attrs2$datasour;
169
169
  const {
170
170
  url
171
171
  } = titleUrlPairFromNode(node);
@@ -192,7 +192,7 @@ const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOp
192
192
  const isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
193
193
  const shouldRenderDatasourceToolbar = isDatasource &&
194
194
  // not showing toolbar in mobile for now since not sure what our plans are for it
195
- platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.datasource);
195
+ platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
196
196
 
197
197
  /* mobile builds toolbar natively using toolbarItems */
198
198
  if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
@@ -203,12 +203,6 @@ const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOp
203
203
  featureFlags,
204
204
  pluginInjectionApi
205
205
  })];
206
- } else if (pluginState !== null && pluginState !== void 0 && pluginState.showDatasourceModal) {
207
- return [openDatasourceModal({
208
- state,
209
- node,
210
- editorAnalyticsApi
211
- })];
212
206
  } else if (shouldRenderDatasourceToolbar) {
213
207
  return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
214
208
  } else {
@@ -334,7 +328,7 @@ const getDatasourceButtonGroup = (state, metadata, intl, editorAnalyticsApi, nod
334
328
  metadata: metadata,
335
329
  className: 'datasource-edit',
336
330
  title: intl.formatMessage(linkToolbarMessages.editDatasource),
337
- onClick: editDatasource(editorAnalyticsApi)
331
+ onClick: editDatasource(node, editorAnalyticsApi)
338
332
  }];
339
333
  if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
340
334
  toolbarItems.push({