@atlaskit/editor-plugin-card 1.6.0 → 1.6.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 1.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#88724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88724) [`df44cd13bfac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/df44cd13bfac) - Fix datasources breakout layout button to refresh node reference when making a layout change transaction
8
+
3
9
  ## 1.6.0
4
10
 
5
11
  ### Minor Changes
@@ -210,6 +210,7 @@ var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
210
210
  "data-testid": "confluence-search-config-modal"
211
211
  }, /*#__PURE__*/_react.default.createElement(_linkDatasource.ConfluenceSearchConfigModal, {
212
212
  datasourceId: _datasourceId2,
213
+ viewMode: isRegularCardNode ? 'inline' : 'table',
213
214
  visibleColumnKeys: _visibleColumnKeys2,
214
215
  parameters: _parameters2,
215
216
  url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
@@ -89,12 +89,15 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
89
89
  layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || 'center' : _ref3$layout;
90
90
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
91
91
  var onLayoutChange = function onLayoutChange(layout) {
92
+ var _getDatasource$node;
92
93
  if (pos === undefined) {
93
94
  return;
94
95
  }
95
96
  var state = editorView.state,
96
97
  dispatch = editorView.dispatch;
97
- var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node === null || node === void 0 ? void 0 : node.attrs), {}, {
98
+ // If the button does not re-render due to no card state change, node reference will be stale
99
+ var datasourceNode = (_getDatasource$node = (0, _utils2.getDatasource)(editorView).node) !== null && _getDatasource$node !== void 0 ? _getDatasource$node : node;
100
+ var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, datasourceNode === null || datasourceNode === void 0 ? void 0 : datasourceNode.attrs), {}, {
98
101
  layout: layout
99
102
  }));
100
103
  tr.setMeta('scrollIntoView', false);
@@ -170,6 +170,7 @@ export const DatasourceModal = ({
170
170
  "data-testid": "confluence-search-config-modal"
171
171
  }, /*#__PURE__*/React.createElement(ConfluenceSearchConfigModal, {
172
172
  datasourceId: datasourceId,
173
+ viewMode: isRegularCardNode ? 'inline' : 'table',
173
174
  visibleColumnKeys: visibleColumnKeys,
174
175
  parameters: parameters,
175
176
  url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
@@ -84,6 +84,7 @@ const LayoutButtonWrapper = ({
84
84
  } = cardState !== null && cardState !== void 0 ? cardState : {};
85
85
  const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
86
86
  const onLayoutChange = layout => {
87
+ var _getDatasource$node;
87
88
  if (pos === undefined) {
88
89
  return;
89
90
  }
@@ -91,8 +92,10 @@ const LayoutButtonWrapper = ({
91
92
  state,
92
93
  dispatch
93
94
  } = editorView;
95
+ // If the button does not re-render due to no card state change, node reference will be stale
96
+ const datasourceNode = (_getDatasource$node = getDatasource(editorView).node) !== null && _getDatasource$node !== void 0 ? _getDatasource$node : node;
94
97
  const tr = state.tr.setNodeMarkup(pos, undefined, {
95
- ...(node === null || node === void 0 ? void 0 : node.attrs),
98
+ ...(datasourceNode === null || datasourceNode === void 0 ? void 0 : datasourceNode.attrs),
96
99
  layout
97
100
  });
98
101
  tr.setMeta('scrollIntoView', false);
@@ -200,6 +200,7 @@ export var DatasourceModal = function DatasourceModal(_ref) {
200
200
  "data-testid": "confluence-search-config-modal"
201
201
  }, /*#__PURE__*/React.createElement(ConfluenceSearchConfigModal, {
202
202
  datasourceId: _datasourceId2,
203
+ viewMode: isRegularCardNode ? 'inline' : 'table',
203
204
  visibleColumnKeys: _visibleColumnKeys2,
204
205
  parameters: _parameters2,
205
206
  url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
@@ -83,12 +83,15 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
83
83
  layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || 'center' : _ref3$layout;
84
84
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
85
85
  var onLayoutChange = function onLayoutChange(layout) {
86
+ var _getDatasource$node;
86
87
  if (pos === undefined) {
87
88
  return;
88
89
  }
89
90
  var state = editorView.state,
90
91
  dispatch = editorView.dispatch;
91
- var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node === null || node === void 0 ? void 0 : node.attrs), {}, {
92
+ // If the button does not re-render due to no card state change, node reference will be stale
93
+ var datasourceNode = (_getDatasource$node = getDatasource(editorView).node) !== null && _getDatasource$node !== void 0 ? _getDatasource$node : node;
94
+ var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, datasourceNode === null || datasourceNode === void 0 ? void 0 : datasourceNode.attrs), {}, {
92
95
  layout: layout
93
96
  }));
94
97
  tr.setMeta('scrollIntoView', false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -49,12 +49,12 @@
49
49
  "@atlaskit/icon": "^22.1.0",
50
50
  "@atlaskit/link-analytics": "^8.3.0",
51
51
  "@atlaskit/link-client-extension": "^1.8.0",
52
- "@atlaskit/link-datasource": "^1.26.0",
52
+ "@atlaskit/link-datasource": "^1.27.0",
53
53
  "@atlaskit/linking-common": "^5.6.0",
54
54
  "@atlaskit/linking-types": "^8.8.0",
55
55
  "@atlaskit/platform-feature-flags": "^0.2.0",
56
56
  "@atlaskit/primitives": "^5.5.0",
57
- "@atlaskit/smart-card": "^26.53.0",
57
+ "@atlaskit/smart-card": "^26.54.0",
58
58
  "@atlaskit/theme": "^12.7.0",
59
59
  "@atlaskit/tokens": "^1.43.0",
60
60
  "@babel/runtime": "^7.0.0",