@atlaskit/editor-plugin-card 1.14.0 → 1.14.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,14 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 1.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#101042](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101042)
8
+ [`7775bd23868c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7775bd23868c) -
9
+ [ux] Change default layout of all datasources to be wide
10
+ - Updated dependencies
11
+
3
12
  ## 1.14.0
4
13
 
5
14
  ### Minor Changes
@@ -22,6 +22,7 @@ var _styles = require("@atlaskit/editor-common/styles");
22
22
  var _ui = require("@atlaskit/editor-common/ui");
23
23
  var _utils = require("@atlaskit/editor-common/utils");
24
24
  var _linkDatasource = require("@atlaskit/link-datasource");
25
+ var _linkingCommon = require("@atlaskit/linking-common");
25
26
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
27
  var _datasourceErrorBoundary = require("../datasourceErrorBoundary");
27
28
  var _EditorAnalyticsContext = require("../ui/EditorAnalyticsContext");
@@ -282,7 +283,7 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
282
283
  }, (0, _react2.jsx)("div", {
283
284
  className: _styles.DATASOURCE_INNER_CONTAINER_CLASSNAME,
284
285
  style: {
285
- minWidth: this.isNodeNested ? '100%' : (0, _utils.calcBreakoutWidth)(attrs.layout, this.tableWidth)
286
+ minWidth: this.isNodeNested ? '100%' : (0, _utils.calcBreakoutWidth)(attrs.layout || _linkingCommon.DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
286
287
  }
287
288
  }, (0, _react2.jsx)(DatasourceComponent, {
288
289
  node: this.node,
@@ -20,6 +20,7 @@ var _styles = require("@atlaskit/editor-common/styles");
20
20
  var _utils = require("@atlaskit/editor-common/utils");
21
21
  var _state = require("@atlaskit/editor-prosemirror/state");
22
22
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
23
+ var _linkingCommon = require("@atlaskit/linking-common");
23
24
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
25
  var _eventsFromTr = require("../analytics/events-from-tr");
25
26
  var _localStorage = require("../common/local-storage");
@@ -168,7 +169,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
168
169
  if (isDatasource && shouldUpdateTableRef) {
169
170
  var _node$attrs2;
170
171
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
171
- var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
172
+ var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || _linkingCommon.DATASOURCE_DEFAULT_LAYOUT;
172
173
  var isNested = selection.$anchor.depth > 0;
173
174
 
174
175
  // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
@@ -15,6 +15,7 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
15
15
  var _utils = require("@atlaskit/editor-common/utils");
16
16
  var _collapse = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/collapse"));
17
17
  var _expand = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/expand"));
18
+ var _linkingCommon = require("@atlaskit/linking-common");
18
19
  var _colors = require("@atlaskit/theme/colors");
19
20
  var _actions = require("../../pm-plugins/actions");
20
21
  var _utils2 = require("./utils");
@@ -31,7 +32,7 @@ var toolbarButtonWrapperStyles = (0, _react2.css)({
31
32
  var LayoutButton = exports.LayoutButton = function LayoutButton(_ref) {
32
33
  var onLayoutChange = _ref.onLayoutChange,
33
34
  _ref$layout = _ref.layout,
34
- layout = _ref$layout === void 0 ? 'center' : _ref$layout,
35
+ layout = _ref$layout === void 0 ? _linkingCommon.DATASOURCE_DEFAULT_LAYOUT : _ref$layout,
35
36
  formatMessage = _ref.intl.formatMessage,
36
37
  mountPoint = _ref.mountPoint,
37
38
  boundariesElement = _ref.boundariesElement,
@@ -83,10 +84,13 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
83
84
  var _getDatasource = (0, _utils2.getDatasource)(editorView),
84
85
  node = _getDatasource.node,
85
86
  pos = _getDatasource.pos;
87
+
88
+ // If layout doesn't exist in ADF it returns null, we want to change to undefined
89
+ // which results in default parameter value being used in LayoutButton.
86
90
  var _ref3 = cardState !== null && cardState !== void 0 ? cardState : {},
87
91
  datasourceTableRef = _ref3.datasourceTableRef,
88
92
  _ref3$layout = _ref3.layout,
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;
93
+ layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _ref3$layout;
90
94
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
91
95
  var onLayoutChange = function onLayoutChange(layout) {
92
96
  var _getDatasource$node;
@@ -8,6 +8,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } fro
8
8
  import { UnsupportedInline } from '@atlaskit/editor-common/ui';
9
9
  import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
10
10
  import { DatasourceTableView } from '@atlaskit/link-datasource';
11
+ import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
11
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
13
  import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
13
14
  import { EditorAnalyticsContext } from '../ui/EditorAnalyticsContext';
@@ -230,7 +231,7 @@ export class Datasource extends ReactNodeView {
230
231
  }, jsx("div", {
231
232
  className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
232
233
  style: {
233
- minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout, this.tableWidth)
234
+ minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout || DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
234
235
  }
235
236
  }, jsx(DatasourceComponent, {
236
237
  node: this.node,
@@ -5,6 +5,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
5
5
  import { canRenderDatasource } from '@atlaskit/editor-common/utils';
6
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
8
+ import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
8
9
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
10
  import { eventsFromTransaction } from '../analytics/events-from-tr';
10
11
  import { isLocalStorageKeyDiscovered } from '../common/local-storage';
@@ -158,7 +159,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
158
159
  if (isDatasource && shouldUpdateTableRef) {
159
160
  var _node$attrs2;
160
161
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
161
- const layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
162
+ const layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || DATASOURCE_DEFAULT_LAYOUT;
162
163
  const isNested = selection.$anchor.depth > 0;
163
164
 
164
165
  // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
@@ -8,6 +8,7 @@ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
8
8
  import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
9
9
  import CollapseIcon from '@atlaskit/icon/glyph/editor/collapse';
10
10
  import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
11
+ import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
11
12
  import { B300, N20A, N300 } from '@atlaskit/theme/colors';
12
13
  import { setCardLayout } from '../../pm-plugins/actions';
13
14
  import { getDatasource } from './utils';
@@ -21,7 +22,7 @@ const toolbarButtonWrapperStyles = css({
21
22
  });
22
23
  export const LayoutButton = ({
23
24
  onLayoutChange,
24
- layout = 'center',
25
+ layout = DATASOURCE_DEFAULT_LAYOUT,
25
26
  intl: {
26
27
  formatMessage
27
28
  },
@@ -78,9 +79,12 @@ const LayoutButtonWrapper = ({
78
79
  node,
79
80
  pos
80
81
  } = getDatasource(editorView);
82
+
83
+ // If layout doesn't exist in ADF it returns null, we want to change to undefined
84
+ // which results in default parameter value being used in LayoutButton.
81
85
  const {
82
86
  datasourceTableRef,
83
- layout = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || 'center'
87
+ layout = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined
84
88
  } = cardState !== null && cardState !== void 0 ? cardState : {};
85
89
  const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
86
90
  const onLayoutChange = layout => {
@@ -20,6 +20,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } fro
20
20
  import { UnsupportedInline } from '@atlaskit/editor-common/ui';
21
21
  import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
22
22
  import { DatasourceTableView } from '@atlaskit/link-datasource';
23
+ import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
23
24
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
24
25
  import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
25
26
  import { EditorAnalyticsContext } from '../ui/EditorAnalyticsContext';
@@ -276,7 +277,7 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
276
277
  }, jsx("div", {
277
278
  className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
278
279
  style: {
279
- minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout, this.tableWidth)
280
+ minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout || DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
280
281
  }
281
282
  }, jsx(DatasourceComponent, {
282
283
  node: this.node,
@@ -9,6 +9,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
9
9
  import { canRenderDatasource } from '@atlaskit/editor-common/utils';
10
10
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
12
+ import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
12
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
14
  import { eventsFromTransaction } from '../analytics/events-from-tr';
14
15
  import { isLocalStorageKeyDiscovered } from '../common/local-storage';
@@ -156,7 +157,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
156
157
  if (isDatasource && shouldUpdateTableRef) {
157
158
  var _node$attrs2;
158
159
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
159
- var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
160
+ var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || DATASOURCE_DEFAULT_LAYOUT;
160
161
  var isNested = selection.$anchor.depth > 0;
161
162
 
162
163
  // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
@@ -11,6 +11,7 @@ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
11
11
  import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
12
12
  import CollapseIcon from '@atlaskit/icon/glyph/editor/collapse';
13
13
  import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
14
+ import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
14
15
  import { B300, N20A, N300 } from '@atlaskit/theme/colors';
15
16
  import { setCardLayout } from '../../pm-plugins/actions';
16
17
  import { getDatasource } from './utils';
@@ -25,7 +26,7 @@ var toolbarButtonWrapperStyles = css({
25
26
  export var LayoutButton = function LayoutButton(_ref) {
26
27
  var onLayoutChange = _ref.onLayoutChange,
27
28
  _ref$layout = _ref.layout,
28
- layout = _ref$layout === void 0 ? 'center' : _ref$layout,
29
+ layout = _ref$layout === void 0 ? DATASOURCE_DEFAULT_LAYOUT : _ref$layout,
29
30
  formatMessage = _ref.intl.formatMessage,
30
31
  mountPoint = _ref.mountPoint,
31
32
  boundariesElement = _ref.boundariesElement,
@@ -77,10 +78,13 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
77
78
  var _getDatasource = getDatasource(editorView),
78
79
  node = _getDatasource.node,
79
80
  pos = _getDatasource.pos;
81
+
82
+ // If layout doesn't exist in ADF it returns null, we want to change to undefined
83
+ // which results in default parameter value being used in LayoutButton.
80
84
  var _ref3 = cardState !== null && cardState !== void 0 ? cardState : {},
81
85
  datasourceTableRef = _ref3.datasourceTableRef,
82
86
  _ref3$layout = _ref3.layout,
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;
87
+ layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _ref3$layout;
84
88
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
85
89
  var onLayoutChange = function onLayoutChange(layout) {
86
90
  var _getDatasource$node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -47,17 +47,17 @@
47
47
  "@atlaskit/editor-prosemirror": "4.0.1",
48
48
  "@atlaskit/editor-shared-styles": "^2.11.0",
49
49
  "@atlaskit/frontend-utilities": "^2.7.0",
50
- "@atlaskit/icon": "^22.2.0",
50
+ "@atlaskit/icon": "^22.3.0",
51
51
  "@atlaskit/link-analytics": "^8.3.0",
52
52
  "@atlaskit/link-client-extension": "^1.8.0",
53
53
  "@atlaskit/link-datasource": "^2.3.0",
54
- "@atlaskit/linking-common": "^5.6.0",
54
+ "@atlaskit/linking-common": "^5.7.0",
55
55
  "@atlaskit/linking-types": "^8.8.0",
56
56
  "@atlaskit/platform-feature-flags": "^0.2.0",
57
- "@atlaskit/primitives": "^6.2.0",
57
+ "@atlaskit/primitives": "^6.3.0",
58
58
  "@atlaskit/smart-card": "^26.69.0",
59
59
  "@atlaskit/theme": "^12.8.0",
60
- "@atlaskit/tokens": "^1.48.0",
60
+ "@atlaskit/tokens": "^1.49.0",
61
61
  "@babel/runtime": "^7.0.0",
62
62
  "@emotion/react": "^11.7.1",
63
63
  "lodash": "^4.17.21",