@atlaskit/editor-core 185.5.2 → 185.5.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 (70) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/plugins/breakout/ui/LayoutButton.js +5 -28
  3. package/dist/cjs/plugins/card/index.js +20 -6
  4. package/dist/cjs/plugins/card/nodeviews/datasource.js +39 -4
  5. package/dist/cjs/plugins/card/pm-plugins/actions.js +31 -1
  6. package/dist/cjs/plugins/card/pm-plugins/main.js +48 -3
  7. package/dist/cjs/plugins/card/pm-plugins/reducers.js +22 -0
  8. package/dist/cjs/plugins/card/styles.js +1 -1
  9. package/dist/cjs/plugins/card/ui/LayoutButton/index.js +113 -0
  10. package/dist/cjs/plugins/card/ui/LayoutButton/styled.js +17 -0
  11. package/dist/cjs/plugins/card/ui/LayoutButton/types.js +5 -0
  12. package/dist/cjs/plugins/card/ui/LayoutButton/utils.js +19 -0
  13. package/dist/cjs/plugins/media/pm-plugins/main.js +20 -1
  14. package/dist/cjs/version-wrapper.js +1 -1
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/plugins/breakout/ui/LayoutButton.js +3 -26
  17. package/dist/es2019/plugins/breakout/utils/get-breakout-mode.js +0 -1
  18. package/dist/es2019/plugins/card/index.js +20 -3
  19. package/dist/es2019/plugins/card/nodeviews/datasource.js +38 -1
  20. package/dist/es2019/plugins/card/pm-plugins/actions.js +16 -0
  21. package/dist/es2019/plugins/card/pm-plugins/main.js +55 -4
  22. package/dist/es2019/plugins/card/pm-plugins/reducers.js +25 -0
  23. package/dist/es2019/plugins/card/styles.js +6 -0
  24. package/dist/es2019/plugins/card/ui/LayoutButton/index.js +106 -0
  25. package/dist/es2019/plugins/card/ui/LayoutButton/styled.js +10 -0
  26. package/dist/es2019/plugins/card/ui/LayoutButton/types.js +1 -0
  27. package/dist/es2019/plugins/card/ui/LayoutButton/utils.js +15 -0
  28. package/dist/es2019/plugins/media/pm-plugins/main.js +25 -3
  29. package/dist/es2019/version-wrapper.js +1 -1
  30. package/dist/es2019/version.json +1 -1
  31. package/dist/esm/plugins/breakout/ui/LayoutButton.js +3 -26
  32. package/dist/esm/plugins/breakout/utils/get-breakout-mode.js +0 -1
  33. package/dist/esm/plugins/card/index.js +20 -3
  34. package/dist/esm/plugins/card/nodeviews/datasource.js +37 -3
  35. package/dist/esm/plugins/card/pm-plugins/actions.js +27 -0
  36. package/dist/esm/plugins/card/pm-plugins/main.js +49 -4
  37. package/dist/esm/plugins/card/pm-plugins/reducers.js +22 -0
  38. package/dist/esm/plugins/card/styles.js +1 -1
  39. package/dist/esm/plugins/card/ui/LayoutButton/index.js +102 -0
  40. package/dist/esm/plugins/card/ui/LayoutButton/styled.js +10 -0
  41. package/dist/esm/plugins/card/ui/LayoutButton/types.js +1 -0
  42. package/dist/esm/plugins/card/ui/LayoutButton/utils.js +12 -0
  43. package/dist/esm/plugins/media/pm-plugins/main.js +22 -3
  44. package/dist/esm/version-wrapper.js +1 -1
  45. package/dist/esm/version.json +1 -1
  46. package/dist/types/plugins/breakout/commands/set-breakout-mode.d.ts +1 -1
  47. package/dist/types/plugins/breakout/utils/get-breakout-mode.d.ts +1 -1
  48. package/dist/types/plugins/card/index.d.ts +3 -1
  49. package/dist/types/plugins/card/nodeviews/datasource.d.ts +18 -2
  50. package/dist/types/plugins/card/pm-plugins/actions.d.ts +7 -0
  51. package/dist/types/plugins/card/pm-plugins/plugin-key.d.ts +2 -1
  52. package/dist/types/plugins/card/pm-plugins/util/state.d.ts +2 -0
  53. package/dist/types/plugins/card/types.d.ts +17 -1
  54. package/dist/types/plugins/card/ui/LayoutButton/index.d.ts +9 -0
  55. package/dist/types/plugins/card/ui/LayoutButton/styled.d.ts +1 -0
  56. package/dist/types/plugins/card/ui/LayoutButton/types.d.ts +19 -0
  57. package/dist/types/plugins/card/ui/LayoutButton/utils.d.ts +5 -0
  58. package/dist/types-ts4.5/plugins/breakout/commands/set-breakout-mode.d.ts +1 -1
  59. package/dist/types-ts4.5/plugins/breakout/utils/get-breakout-mode.d.ts +1 -1
  60. package/dist/types-ts4.5/plugins/card/index.d.ts +3 -1
  61. package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +18 -2
  62. package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +7 -0
  63. package/dist/types-ts4.5/plugins/card/pm-plugins/plugin-key.d.ts +2 -1
  64. package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +2 -0
  65. package/dist/types-ts4.5/plugins/card/types.d.ts +17 -1
  66. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/index.d.ts +9 -0
  67. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/styled.d.ts +1 -0
  68. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/types.d.ts +19 -0
  69. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/utils.d.ts +5 -0
  70. package/package.json +2 -2
@@ -1,18 +1,26 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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) { _defineProperty(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; }
4
- import React, { Fragment } from 'react';
4
+ import React from 'react';
5
5
  import { inlineCard, blockCard, embedCard } from '@atlaskit/adf-schema';
6
6
  import { createPlugin } from './pm-plugins/main';
7
7
  import { floatingToolbar } from './toolbar';
8
8
  import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
9
9
  import { cardKeymap } from './pm-plugins/keymap';
10
10
  import { EditorSmartCardEventsNext } from './ui/EditorSmartCardEventsNext';
11
+ import LayoutButton from './ui/LayoutButton';
12
+ import { pluginKey } from './pm-plugins/plugin-key';
11
13
  var cardPlugin = function cardPlugin(options, api) {
12
14
  var _api$dependencies, _api$dependencies$fea;
13
15
  var 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()) || {};
14
16
  return {
15
17
  name: 'card',
18
+ getSharedState: function getSharedState(editorState) {
19
+ if (!editorState) {
20
+ return null;
21
+ }
22
+ return pluginKey.getState(editorState);
23
+ },
16
24
  nodes: function nodes() {
17
25
  var nodes = [{
18
26
  name: 'inlineCard',
@@ -56,12 +64,21 @@ var cardPlugin = function cardPlugin(options, api) {
56
64
  return plugins;
57
65
  },
58
66
  contentComponent: function contentComponent(_ref2) {
59
- var editorView = _ref2.editorView;
67
+ var editorView = _ref2.editorView,
68
+ popupsMountPoint = _ref2.popupsMountPoint,
69
+ popupsScrollableElement = _ref2.popupsScrollableElement,
70
+ popupsBoundariesElement = _ref2.popupsBoundariesElement;
60
71
  var lpAnalyticsEventsNext = featureFlags.lpAnalyticsEventsNext;
61
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(EditorSmartCardEvents, {
72
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorSmartCardEvents, {
62
73
  editorView: editorView
63
74
  }), lpAnalyticsEventsNext && /*#__PURE__*/React.createElement(EditorSmartCardEventsNext, {
64
75
  editorView: editorView
76
+ }), /*#__PURE__*/React.createElement(LayoutButton, {
77
+ api: api,
78
+ editorView: editorView,
79
+ mountPoint: popupsMountPoint,
80
+ scrollableElement: popupsScrollableElement,
81
+ boundariesElement: popupsBoundariesElement
65
82
  }));
66
83
  },
67
84
  pluginsOptions: {
@@ -15,6 +15,9 @@ import PropTypes from 'prop-types';
15
15
  import { css, jsx } from '@emotion/react';
16
16
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
17
17
  import { DatasourceTableView } from '@atlaskit/link-datasource';
18
+ import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
19
+ import { calcBreakoutWidthPx } from '@atlaskit/editor-common/utils';
20
+ export var DATASOURCE_INNER_CONTAINER_CLASSNAME = 'datasourceView-content-inner-wrap';
18
21
  var containerStyles = css({
19
22
  height: '500px',
20
23
  overflow: 'auto'
@@ -111,15 +114,46 @@ _defineProperty(DatasourceComponent, "contextTypes", {
111
114
  export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
112
115
  _inherits(Datasource, _ReactNodeView);
113
116
  var _super2 = _createSuper(Datasource);
114
- function Datasource() {
117
+ function Datasource(props) {
118
+ var _props$pluginInjectio, _props$pluginInjectio2, _props$pluginInjectio3, _sharedState$currentS;
119
+ var _this2;
115
120
  _classCallCheck(this, Datasource);
116
- return _super2.apply(this, arguments);
121
+ _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
122
+ _defineProperty(_assertThisInitialized(_this2), "calcTableWidth", function (layout, containerWidth) {
123
+ if (layout === 'center') {
124
+ return 'inherit';
125
+ }
126
+ return calcBreakoutWidthPx(layout, containerWidth);
127
+ });
128
+ var sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.dependencies) === null || _props$pluginInjectio2 === void 0 ? void 0 : (_props$pluginInjectio3 = _props$pluginInjectio2.width) === null || _props$pluginInjectio3 === void 0 ? void 0 : _props$pluginInjectio3.sharedState;
129
+ _this2.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
130
+ sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(function (_ref2) {
131
+ var nextSharedState = _ref2.nextSharedState;
132
+ if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.width && _this2.tableWidth !== (nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width)) {
133
+ _this2.tableWidth = nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width;
134
+ _this2.update(_this2.node, []); // required to update the width when page is resized.
135
+ }
136
+ });
137
+ return _this2;
117
138
  }
118
139
  _createClass(Datasource, [{
140
+ key: "createDomRef",
141
+ value: function createDomRef() {
142
+ var domRef = document.createElement('div');
143
+ domRef.classList.add(SmartCardSharedCssClassName.DATASOURCE_CONTAINER);
144
+ return domRef;
145
+ }
146
+ }, {
119
147
  key: "render",
120
148
  value: function render() {
149
+ var attrs = this.node.attrs;
150
+ var calculatedWidth = this.calcTableWidth(attrs.layout, this.tableWidth);
121
151
  return jsx("div", {
122
- css: containerStyles
152
+ className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
153
+ css: containerStyles,
154
+ style: {
155
+ minWidth: calculatedWidth
156
+ }
123
157
  }, jsx(DatasourceComponent, {
124
158
  node: this.node,
125
159
  view: this.view,
@@ -50,6 +50,33 @@ export var setProvider = function setProvider(cardProvider) {
50
50
  });
51
51
  };
52
52
  };
53
+ export var setDatasourceTableRef = function setDatasourceTableRef(datasourceTableRef) {
54
+ return function (tr) {
55
+ return cardAction(tr, {
56
+ type: 'SET_DATASOURCE_TABLE_REF',
57
+ datasourceTableRef: datasourceTableRef
58
+ });
59
+ };
60
+ };
61
+ export var setCardLayout = function setCardLayout(layout) {
62
+ return function (tr) {
63
+ return cardAction(tr, {
64
+ type: 'SET_CARD_LAYOUT',
65
+ layout: layout
66
+ });
67
+ };
68
+ };
69
+ export var setCardLayoutAndDatasourceTableRef = function setCardLayoutAndDatasourceTableRef(_ref) {
70
+ var layout = _ref.layout,
71
+ datasourceTableRef = _ref.datasourceTableRef;
72
+ return function (tr) {
73
+ return cardAction(tr, {
74
+ type: 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF',
75
+ layout: layout,
76
+ datasourceTableRef: datasourceTableRef
77
+ });
78
+ };
79
+ };
53
80
  export var showLinkToolbar = function showLinkToolbar(tr) {
54
81
  return cardAction(tr, {
55
82
  type: 'SHOW_LINK_TOOLBAR'
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import { NodeSelection } from 'prosemirror-state';
3
4
  import rafSchedule from 'raf-schd';
4
5
  import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
5
6
  import { BlockCard } from '../nodeviews/blockCard';
@@ -10,7 +11,9 @@ import reducer from './reducers';
10
11
  import { handleProvider, resolveWithProvider } from './util/resolve';
11
12
  import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
12
13
  import { createAnalyticsQueue, eventsFromTransaction } from './analytics';
13
- import { Datasource } from '../nodeviews/datasource';
14
+ import { DATASOURCE_INNER_CONTAINER_CLASSNAME, Datasource } from '../nodeviews/datasource';
15
+ import { setDatasourceTableRef, setCardLayoutAndDatasourceTableRef } from './actions';
16
+ import { findDomRefAtPos } from 'prosemirror-utils';
14
17
  export { pluginKey } from './plugin-key';
15
18
  export var createPlugin = function createPlugin(options, pluginInjectionApi) {
16
19
  return function (pmPluginFactoryParams) {
@@ -34,7 +37,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
34
37
  smartLinkEvents: undefined,
35
38
  smartLinkEventsNext: undefined,
36
39
  createAnalyticsEvent: createAnalyticsEvent,
37
- editorAppearance: editorAppearance
40
+ editorAppearance: editorAppearance,
41
+ datasourceTableRef: undefined,
42
+ layout: undefined
38
43
  };
39
44
  },
40
45
  apply: function apply(tr, pluginState, prevEditorState) {
@@ -60,12 +65,42 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
60
65
  var subscriptionHandler = function subscriptionHandler(name, provider) {
61
66
  return handleProvider(name, provider, _view);
62
67
  };
68
+ var domAtPos = _view.domAtPos.bind(_view);
63
69
  var rafCancellationCallbacks = [];
64
70
  pmPluginFactoryParams.providerFactory.subscribe('cardProvider', subscriptionHandler);
65
71
  return {
66
72
  update: function update(view, prevState) {
73
+ var _selection$node;
67
74
  var currentState = getPluginState(view.state);
68
75
  var oldState = getPluginState(prevState);
76
+ var state = view.state,
77
+ dispatch = view.dispatch;
78
+ var selection = state.selection,
79
+ tr = state.tr,
80
+ schema = state.schema;
81
+ var isBlockCardSelected = selection instanceof NodeSelection && ((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type) === schema.nodes.blockCard;
82
+ if (isBlockCardSelected) {
83
+ var _findDomRefAtPos, _node$attrs;
84
+ var datasourceTableRef = (_findDomRefAtPos = findDomRefAtPos(selection.from, domAtPos)) === null || _findDomRefAtPos === void 0 ? void 0 : _findDomRefAtPos.querySelector(".".concat(DATASOURCE_INNER_CONTAINER_CLASSNAME));
85
+ var node = selection.node;
86
+ var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.datasource);
87
+ var shouldUpdateTableRef = datasourceTableRef && (currentState === null || currentState === void 0 ? void 0 : currentState.datasourceTableRef) !== datasourceTableRef;
88
+ if (isDatasource && shouldUpdateTableRef) {
89
+ var _node$attrs2;
90
+ // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
91
+ var layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
92
+
93
+ // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
94
+ dispatch(setCardLayoutAndDatasourceTableRef({
95
+ datasourceTableRef: datasourceTableRef,
96
+ layout: layout
97
+ })(tr));
98
+ }
99
+ } else {
100
+ if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
101
+ dispatch(setDatasourceTableRef(undefined)(tr));
102
+ }
103
+ }
69
104
  if (currentState && currentState.provider) {
70
105
  // Find requests in this state that weren't in the old one.
71
106
  var newRequests = getNewRequests(oldState, currentState);
@@ -111,6 +146,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
111
146
  }
112
147
  }),
113
148
  blockCard: function blockCard(node, view, getPos) {
149
+ var _node$attrs3;
114
150
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
115
151
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
116
152
  var reactComponentProps = {
@@ -118,8 +154,17 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
118
154
  showServerActions: showServerActions
119
155
  };
120
156
  var hasIntlContext = true;
121
- if (node.attrs.datasource) {
122
- return new Datasource(node, view, getPos, portalProviderAPI, eventDispatcher, undefined, undefined, true, undefined, hasIntlContext).init();
157
+ var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
158
+ if (isDatasource) {
159
+ return new Datasource({
160
+ node: node,
161
+ view: view,
162
+ getPos: getPos,
163
+ portalProviderAPI: portalProviderAPI,
164
+ eventDispatcher: eventDispatcher,
165
+ hasIntlContext: hasIntlContext,
166
+ pluginInjectionApi: pluginInjectionApi
167
+ }).init();
123
168
  }
124
169
  return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
125
170
  },
@@ -29,6 +29,22 @@ var setProvider = function setProvider(state, action) {
29
29
  provider: action.provider
30
30
  });
31
31
  };
32
+ var setCardLayout = function setCardLayout(state, action) {
33
+ return _objectSpread(_objectSpread({}, state), {}, {
34
+ layout: action.layout
35
+ });
36
+ };
37
+ var setDatasourceTableRef = function setDatasourceTableRef(state, action) {
38
+ return _objectSpread(_objectSpread({}, state), {}, {
39
+ datasourceTableRef: action.datasourceTableRef
40
+ });
41
+ };
42
+ var setCardLayoutDatasourceTableRef = function setCardLayoutDatasourceTableRef(state, action) {
43
+ return _objectSpread(_objectSpread({}, state), {}, {
44
+ datasourceTableRef: action.datasourceTableRef,
45
+ layout: action.layout
46
+ });
47
+ };
32
48
  var registerEvents = function registerEvents(state, action) {
33
49
  return _objectSpread(_objectSpread({}, state), {}, {
34
50
  smartLinkEvents: action.smartLinkEvents
@@ -58,6 +74,12 @@ export default (function (state, action) {
58
74
  return registerEvents(state, action);
59
75
  case 'REGISTER_EVENTS_NEXT':
60
76
  return registerEventsNext(state, action);
77
+ case 'SET_DATASOURCE_TABLE_REF':
78
+ return setDatasourceTableRef(state, action);
79
+ case 'SET_CARD_LAYOUT':
80
+ return setCardLayout(state, action);
81
+ case 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF':
82
+ return setCardLayoutDatasourceTableRef(state, action);
61
83
  case 'SHOW_LINK_TOOLBAR':
62
84
  case 'HIDE_LINK_TOOLBAR':
63
85
  return setLinkToolbar(state, action);
@@ -6,4 +6,4 @@ import { N20 } from '@atlaskit/theme/colors';
6
6
  import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
7
7
  import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
8
8
  export var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
9
- export var smartCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n padding-top: 0.5em;\n padding-bottom: 0.5em;\n margin-bottom: -0.5em;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n\n .", " {\n padding: 0;\n }\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")"), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
9
+ export var smartCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n padding-top: 0.5em;\n padding-bottom: 0.5em;\n margin-bottom: -0.5em;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", ".", " {\n max-width: 100%;\n display: flex;\n justify-content: center;\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n\n .", " {\n padding: 0;\n }\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")"), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.DATASOURCE_CONTAINER, SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
@@ -0,0 +1,102 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
3
+ 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) { _defineProperty(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; }
4
+ /** @jsx jsx */
5
+ import React, { useCallback, useMemo } from 'react';
6
+ import { jsx } from '@emotion/react';
7
+ import { Popup } from '@atlaskit/editor-common/ui';
8
+ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
9
+ import CollapseIcon from '@atlaskit/icon/glyph/editor/collapse';
10
+ import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
11
+ import { injectIntl } from 'react-intl-next';
12
+ import { toolbarButtonWrapper } from './styled';
13
+ import { getDatasource } from './utils';
14
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
15
+ import { setCardLayout } from '../../pm-plugins/actions';
16
+ import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
17
+ export var LayoutButton = function LayoutButton(_ref) {
18
+ var onLayoutChange = _ref.onLayoutChange,
19
+ _ref$layout = _ref.layout,
20
+ layout = _ref$layout === void 0 ? 'center' : _ref$layout,
21
+ formatMessage = _ref.intl.formatMessage,
22
+ mountPoint = _ref.mountPoint,
23
+ boundariesElement = _ref.boundariesElement,
24
+ scrollableElement = _ref.scrollableElement,
25
+ targetElement = _ref.targetElement,
26
+ _ref$testId = _ref.testId,
27
+ testId = _ref$testId === void 0 ? 'datasource-table-layout-button' : _ref$testId;
28
+ var handleClick = useCallback(function () {
29
+ onLayoutChange && onLayoutChange(getNextBreakoutMode(layout));
30
+ }, [layout, onLayoutChange]);
31
+ var title = useMemo(function () {
32
+ return formatMessage(getTitle(layout));
33
+ }, [formatMessage, layout]);
34
+ if (!targetElement) {
35
+ return null;
36
+ }
37
+ return jsx(Popup, {
38
+ mountTo: mountPoint,
39
+ boundariesElement: boundariesElement,
40
+ scrollableElement: scrollableElement,
41
+ target: targetElement,
42
+ alignY: "start",
43
+ alignX: "end",
44
+ forcePlacement: true,
45
+ stick: true,
46
+ ariaLabel: title
47
+ }, jsx(ToolbarButton, {
48
+ testId: testId,
49
+ css: toolbarButtonWrapper,
50
+ title: title,
51
+ onClick: handleClick,
52
+ iconBefore: layout === 'full-width' ? jsx(CollapseIcon, {
53
+ label: title
54
+ }) : jsx(ExpandIcon, {
55
+ label: title
56
+ })
57
+ }));
58
+ };
59
+ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
60
+ var _node$attrs, _node$attrs2;
61
+ var editorView = _ref2.editorView,
62
+ mountPoint = _ref2.mountPoint,
63
+ scrollableElement = _ref2.scrollableElement,
64
+ boundariesElement = _ref2.boundariesElement,
65
+ intl = _ref2.intl,
66
+ api = _ref2.api;
67
+ var _useSharedPluginState = useSharedPluginState(api, ['card']),
68
+ cardState = _useSharedPluginState.cardState;
69
+ var _getDatasource = getDatasource(editorView),
70
+ node = _getDatasource.node,
71
+ pos = _getDatasource.pos;
72
+ var _ref3 = cardState !== null && cardState !== void 0 ? cardState : {},
73
+ datasourceTableRef = _ref3.datasourceTableRef,
74
+ _ref3$layout = _ref3.layout,
75
+ layout = _ref3$layout === void 0 ? (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || 'center' : _ref3$layout;
76
+ var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
77
+ var onLayoutChange = function onLayoutChange(layout) {
78
+ if (pos === undefined) {
79
+ return;
80
+ }
81
+ var state = editorView.state,
82
+ dispatch = editorView.dispatch;
83
+ var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node === null || node === void 0 ? void 0 : node.attrs), {}, {
84
+ layout: layout
85
+ }));
86
+ tr.setMeta('scrollIntoView', false);
87
+ dispatch(setCardLayout(layout)(tr));
88
+ };
89
+ if (!isDatasource) {
90
+ return null;
91
+ }
92
+ return jsx(LayoutButton, {
93
+ mountPoint: mountPoint,
94
+ scrollableElement: scrollableElement,
95
+ boundariesElement: boundariesElement,
96
+ targetElement: datasourceTableRef,
97
+ layout: layout,
98
+ onLayoutChange: onLayoutChange,
99
+ intl: intl
100
+ });
101
+ };
102
+ export default injectIntl(LayoutButtonWrapper);
@@ -0,0 +1,10 @@
1
+ import { css } from '@emotion/react';
2
+ import { B300, N300, N20A } from '@atlaskit/theme/colors';
3
+ export var toolbarButtonWrapper = css({
4
+ background: "".concat("var(--ds-background-neutral, ".concat(N20A, ")")),
5
+ color: "".concat("var(--ds-icon, ".concat(N300, ")")),
6
+ ':hover': {
7
+ background: "".concat("var(--ds-background-neutral-hovered, ".concat(B300, ")")),
8
+ color: "var(--ds-icon, white)".concat(" !important")
9
+ }
10
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { findSelectedNodeOfType } from 'prosemirror-utils';
2
+ export var getDatasource = function getDatasource(editorView) {
3
+ var _findSelectedNodeOfTy;
4
+ var _editorView$state = editorView.state,
5
+ selection = _editorView$state.selection,
6
+ schema = _editorView$state.schema;
7
+ var blockCard = schema.nodes.blockCard;
8
+ return (_findSelectedNodeOfTy = findSelectedNodeOfType([blockCard])(selection)) !== null && _findSelectedNodeOfTy !== void 0 ? _findSelectedNodeOfTy : {
9
+ node: undefined,
10
+ pos: undefined
11
+ };
12
+ };
@@ -11,12 +11,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  import React from 'react';
12
12
  import ReactDOM from 'react-dom';
13
13
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
14
- import { NodeSelection, TextSelection, AllSelection } from 'prosemirror-state';
14
+ import { NodeSelection, TextSelection, AllSelection, Selection } from 'prosemirror-state';
15
15
  import { insertPoint } from 'prosemirror-transform';
16
16
  import { Decoration, DecorationSet } from 'prosemirror-view';
17
17
  import { ErrorReporter, browser } from '@atlaskit/editor-common/utils';
18
18
  import assert from 'assert';
19
- import { findDomRefAtPos, isNodeSelection } from 'prosemirror-utils';
19
+ import { findDomRefAtPos, isNodeSelection, findSelectedNodeOfType, findParentNodeOfType } from 'prosemirror-utils';
20
20
  import { insertMediaSingleNode, isMediaSingle } from '../utils/media-single';
21
21
  import DropPlaceholder from '../ui/Media/DropPlaceholder';
22
22
  import { insertMediaGroupNode, insertMediaInlineNode, canInsertMediaInline } from '../utils/media-files';
@@ -437,8 +437,27 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
437
437
  var _this$view = _this.view,
438
438
  dispatch = _this$view.dispatch,
439
439
  state = _this$view.state;
440
+ var tr = state.tr,
441
+ selection = state.selection,
442
+ doc = state.doc;
443
+ var _state$schema$nodes = state.schema.nodes,
444
+ media = _state$schema$nodes.media,
445
+ mediaGroup = _state$schema$nodes.mediaGroup;
446
+
447
+ // Workaround for wrong upload position
448
+ // @see https://product-fabric.atlassian.net/browse/MEX-2457
449
+ // If the media node is the last selectable item in the current cursor position and it is located within a mediaGroup,
450
+ // we relocate the cursor to the first child of the mediaGroup.
451
+ var sel = Selection.findFrom(doc.resolve(selection.$from.pos - 1), -1);
452
+ if (sel && findSelectedNodeOfType(media)(sel)) {
453
+ var parent = findParentNodeOfType(mediaGroup)(sel);
454
+ if (parent) {
455
+ tr.setSelection(NodeSelection.create(tr.doc, parent.start));
456
+ }
457
+ }
458
+
440
459
  // Trigger state change to be able to pick it up in the decorations handler
441
- dispatch(state.tr);
460
+ dispatch(tr);
442
461
  });
443
462
  this.options = options;
444
463
  this.mediaOptions = mediaOptions;
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "185.5.2";
2
+ export var version = "185.5.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.5.2",
3
+ "version": "185.5.5",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,3 @@
1
+ import { BreakoutMode } from '@atlaskit/editor-common/types';
1
2
  import { Command } from '../../../types';
2
- export type BreakoutMode = 'wide' | 'full-width' | 'center';
3
3
  export declare function setBreakoutMode(mode: BreakoutMode): Command;
@@ -1,5 +1,5 @@
1
1
  import { EditorState } from 'prosemirror-state';
2
- import { BreakoutMode } from '../commands/set-breakout-mode';
2
+ import { BreakoutMode } from '@atlaskit/editor-common/types';
3
3
  /**
4
4
  * Get the current mode of the breakout at the selection
5
5
  * @param state Current EditorState
@@ -1,4 +1,4 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
2
  import { CardPluginOptions } from './types';
3
3
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
4
4
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
@@ -6,6 +6,7 @@ import type { widthPlugin } from '@atlaskit/editor-plugin-width';
6
6
  import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
7
7
  import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
8
8
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
9
+ import { CardPluginState } from './types';
9
10
  declare const cardPlugin: NextEditorPlugin<'card', {
10
11
  pluginConfiguration: CardPluginOptions;
11
12
  dependencies: [
@@ -16,5 +17,6 @@ declare const cardPlugin: NextEditorPlugin<'card', {
16
17
  typeof gridPlugin,
17
18
  FloatingToolbarPlugin
18
19
  ];
20
+ sharedState: CardPluginState | null;
19
21
  }>;
20
22
  export default cardPlugin;
@@ -5,10 +5,22 @@ import { jsx } from '@emotion/react';
5
5
  import { Node as PMNode } from 'prosemirror-model';
6
6
  import { EditorView } from 'prosemirror-view';
7
7
  import ReactNodeView, { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
8
- interface DatasourceComponentProps extends ReactComponentProps {
8
+ import { DatasourceTableLayout } from '../ui/LayoutButton/types';
9
+ import { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
10
+ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
11
+ import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
12
+ import type cardPlugin from '../index';
13
+ export declare const DATASOURCE_INNER_CONTAINER_CLASSNAME = "datasourceView-content-inner-wrap";
14
+ interface DatasourceProps extends ReactComponentProps {
9
15
  node: PMNode;
10
16
  view: EditorView;
11
17
  getPos: getPosHandler;
18
+ portalProviderAPI: PortalProviderAPI;
19
+ eventDispatcher: EventDispatcher;
20
+ hasIntlContext: boolean;
21
+ pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
22
+ }
23
+ interface DatasourceComponentProps extends ReactComponentProps, Pick<DatasourceProps, 'node' | 'view' | 'getPos'> {
12
24
  }
13
25
  export declare class DatasourceComponent extends React.PureComponent<DatasourceComponentProps> {
14
26
  static contextTypes: {
@@ -21,7 +33,11 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
21
33
  handleColumnChange: (columnKeys: string[]) => void;
22
34
  render(): jsx.JSX.Element | null;
23
35
  }
24
- export declare class Datasource extends ReactNodeView<DatasourceComponentProps> {
36
+ export declare class Datasource extends ReactNodeView<DatasourceProps> {
37
+ private tableWidth;
38
+ constructor(props: DatasourceProps);
39
+ createDomRef(): HTMLElement;
40
+ calcTableWidth: (layout: DatasourceTableLayout, containerWidth?: number) => number | 'inherit';
25
41
  render(): jsx.JSX.Element;
26
42
  }
27
43
  export {};
@@ -2,6 +2,7 @@ import { Transaction } from 'prosemirror-state';
2
2
  import { CardProvider } from '@atlaskit/editor-common/provider-factory';
3
3
  import { CardPluginAction, Request, CardInfo, SmartLinkEventsNext } from '../types';
4
4
  import { SmartLinkEvents } from '@atlaskit/smart-card';
5
+ import { DatasourceTableLayout } from '../ui/LayoutButton/types';
5
6
  export declare const cardAction: (tr: Transaction, action: CardPluginAction) => Transaction;
6
7
  export declare const resolveCard: (url: string) => (tr: Transaction) => Transaction<any>;
7
8
  export declare const queueCards: (requests: Request[]) => (tr: Transaction) => Transaction<any>;
@@ -9,5 +10,11 @@ export declare const registerCard: (info: CardInfo) => (tr: Transaction) => Tran
9
10
  export declare const registerSmartCardEvents: (smartLinkEvents: SmartLinkEvents) => (tr: Transaction) => Transaction<any>;
10
11
  export declare const registerSmartCardEventsNext: (smartLinkEvents: SmartLinkEventsNext) => (tr: Transaction) => Transaction<any>;
11
12
  export declare const setProvider: (cardProvider: CardProvider | null) => (tr: Transaction) => Transaction<any>;
13
+ export declare const setDatasourceTableRef: (datasourceTableRef?: HTMLElement) => (tr: Transaction) => Transaction<any>;
14
+ export declare const setCardLayout: (layout: DatasourceTableLayout) => (tr: Transaction) => Transaction<any>;
15
+ export declare const setCardLayoutAndDatasourceTableRef: ({ layout, datasourceTableRef, }: {
16
+ layout: DatasourceTableLayout;
17
+ datasourceTableRef?: HTMLElement | undefined;
18
+ }) => (tr: Transaction) => Transaction<any>;
12
19
  export declare const showLinkToolbar: (tr: Transaction) => Transaction<any>;
13
20
  export declare const hideLinkToolbar: (tr: Transaction) => Transaction<any>;
@@ -1,2 +1,3 @@
1
1
  import { PluginKey } from 'prosemirror-state';
2
- export declare const pluginKey: PluginKey<any, any>;
2
+ import { CardPluginState } from '../types';
3
+ export declare const pluginKey: PluginKey<CardPluginState, any>;
@@ -24,5 +24,7 @@ export declare const getPluginStateWithUpdatedPos: (pluginState: CardPluginState
24
24
  smartLinkEventsNext?: import("../../types").SmartLinkEventsNext | undefined;
25
25
  createAnalyticsEvent?: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | undefined;
26
26
  editorAppearance?: import("@atlaskit/editor-common/types").EditorAppearance | undefined;
27
+ datasourceTableRef?: HTMLElement | undefined;
28
+ layout?: import("../../ui/LayoutButton/types").DatasourceTableLayout | undefined;
27
29
  };
28
30
  export declare const getNewRequests: (oldState: CardPluginState | undefined, currentState: CardPluginState) => Request[];
@@ -5,6 +5,7 @@ import { CreateUIAnalyticsEvent, UIAnalyticsEvent } from '@atlaskit/analytics-ne
5
5
  import { CardOptions } from '@atlaskit/editor-common/card';
6
6
  import type { EditorAppearance } from '@atlaskit/editor-common/types';
7
7
  import { LinkPickerOptions } from '@atlaskit/editor-common/types';
8
+ import { DatasourceTableLayout } from './ui/LayoutButton/types';
8
9
  export type CardInfo = {
9
10
  title?: string;
10
11
  url?: string;
@@ -100,6 +101,8 @@ export type CardPluginState = {
100
101
  smartLinkEventsNext?: SmartLinkEventsNext;
101
102
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
102
103
  editorAppearance?: EditorAppearance;
104
+ datasourceTableRef?: HTMLElement;
105
+ layout?: DatasourceTableLayout;
103
106
  };
104
107
  export type CardPluginOptions = CardOptions & {
105
108
  editorAppearance?: EditorAppearance;
@@ -138,6 +141,19 @@ export type RegisterSmartCardEventsNext = {
138
141
  type: 'REGISTER_EVENTS_NEXT';
139
142
  smartLinkEvents: SmartLinkEventsNext;
140
143
  };
141
- export type CardPluginAction = SetProvider | Queue | Resolve | Register | ShowLinkToolbar | HideLinkToolbar | RegisterSmartCardEvents | RegisterSmartCardEventsNext;
144
+ export type SetDatasourceTableRef = {
145
+ type: 'SET_DATASOURCE_TABLE_REF';
146
+ datasourceTableRef?: HTMLElement;
147
+ };
148
+ export type SetCardLayout = {
149
+ type: 'SET_CARD_LAYOUT';
150
+ layout: DatasourceTableLayout;
151
+ };
152
+ export type SetCardLayoutAndDatasourceTableRef = {
153
+ type: 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF';
154
+ layout: DatasourceTableLayout;
155
+ datasourceTableRef?: HTMLElement;
156
+ };
157
+ export type CardPluginAction = SetProvider | Queue | Resolve | Register | ShowLinkToolbar | HideLinkToolbar | RegisterSmartCardEvents | RegisterSmartCardEventsNext | SetDatasourceTableRef | SetCardLayout | SetCardLayoutAndDatasourceTableRef;
142
158
  export type CardReplacementInputMethod = INPUT_METHOD.CLIPBOARD | INPUT_METHOD.AUTO_DETECT | INPUT_METHOD.FORMATTING | INPUT_METHOD.MANUAL | INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.FLOATING_TB;
143
159
  export {};