@atlaskit/editor-plugin-layout 10.3.0 → 10.3.2

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,20 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 10.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 10.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`4c22fe79f104e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4c22fe79f104e) -
14
+ Guard against undefined plugin state when reading shared state in floating-toolbar handler
15
+ (layout) and useEffect deps array (block-controls drag handle); fixes intermittent crash during
16
+ editor reconfigure / partial-preset transitions.
17
+
3
18
  ## 10.3.0
4
19
 
5
20
  ### Minor Changes
@@ -121,20 +121,23 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
121
121
  },
122
122
  pluginsOptions: {
123
123
  floatingToolbar: function floatingToolbar(state, intl) {
124
- var _ref3 = _pluginKey.pluginKey.getState(state),
125
- pos = _ref3.pos,
126
- allowBreakout = _ref3.allowBreakout,
127
- addSidebarLayouts = _ref3.addSidebarLayouts,
128
- allowSingleColumnLayout = _ref3.allowSingleColumnLayout,
129
- isResizing = _ref3.isResizing;
124
+ var layoutState = _pluginKey.pluginKey.getState(state);
125
+ if (!layoutState) {
126
+ return undefined;
127
+ }
128
+ var pos = layoutState.pos,
129
+ allowBreakout = layoutState.allowBreakout,
130
+ addSidebarLayouts = layoutState.addSidebarLayouts,
131
+ allowSingleColumnLayout = layoutState.allowSingleColumnLayout,
132
+ isResizing = layoutState.isResizing;
130
133
  var shouldHideToolbar = isResizing && (0, _experiments.editorExperiment)('single_column_layouts', true);
131
134
  if (pos !== null && !shouldHideToolbar) {
132
135
  return (0, _toolbar.buildToolbar)(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, allowAdvancedSingleColumnLayout, api);
133
136
  }
134
137
  return undefined;
135
138
  },
136
- quickInsert: function quickInsert(_ref4) {
137
- var formatMessage = _ref4.formatMessage;
139
+ quickInsert: function quickInsert(_ref3) {
140
+ var formatMessage = _ref3.formatMessage;
138
141
  var withInsertLayoutAnalytics = function withInsertLayoutAnalytics(tr, columnCount) {
139
142
  var _api$analytics2;
140
143
  api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.attachAnalyticsEvent({
@@ -283,11 +286,11 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
283
286
  }
284
287
  }
285
288
  },
286
- contentComponent: function contentComponent(_ref5) {
287
- var editorView = _ref5.editorView,
288
- popupsMountPoint = _ref5.popupsMountPoint,
289
- popupsBoundariesElement = _ref5.popupsBoundariesElement,
290
- popupsScrollableElement = _ref5.popupsScrollableElement;
289
+ contentComponent: function contentComponent(_ref4) {
290
+ var editorView = _ref4.editorView,
291
+ popupsMountPoint = _ref4.popupsMountPoint,
292
+ popupsBoundariesElement = _ref4.popupsBoundariesElement,
293
+ popupsScrollableElement = _ref4.popupsScrollableElement;
291
294
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _experiments.editorExperiment)('advanced_layouts', true) ? /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null) : null, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true) && editorView ? /*#__PURE__*/_react.default.createElement(_LayoutColumnMenu.LayoutColumnMenu, {
292
295
  api: api,
293
296
  editorView: editorView,
@@ -110,13 +110,17 @@ export const layoutPlugin = ({
110
110
  },
111
111
  pluginsOptions: {
112
112
  floatingToolbar(state, intl) {
113
+ const layoutState = pluginKey.getState(state);
114
+ if (!layoutState) {
115
+ return undefined;
116
+ }
113
117
  const {
114
118
  pos,
115
119
  allowBreakout,
116
120
  addSidebarLayouts,
117
121
  allowSingleColumnLayout,
118
122
  isResizing
119
- } = pluginKey.getState(state);
123
+ } = layoutState;
120
124
  const shouldHideToolbar = isResizing && editorExperiment('single_column_layouts', true);
121
125
  if (pos !== null && !shouldHideToolbar) {
122
126
  return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, allowAdvancedSingleColumnLayout, api);
@@ -114,20 +114,23 @@ export var layoutPlugin = function layoutPlugin(_ref) {
114
114
  },
115
115
  pluginsOptions: {
116
116
  floatingToolbar: function floatingToolbar(state, intl) {
117
- var _ref3 = pluginKey.getState(state),
118
- pos = _ref3.pos,
119
- allowBreakout = _ref3.allowBreakout,
120
- addSidebarLayouts = _ref3.addSidebarLayouts,
121
- allowSingleColumnLayout = _ref3.allowSingleColumnLayout,
122
- isResizing = _ref3.isResizing;
117
+ var layoutState = pluginKey.getState(state);
118
+ if (!layoutState) {
119
+ return undefined;
120
+ }
121
+ var pos = layoutState.pos,
122
+ allowBreakout = layoutState.allowBreakout,
123
+ addSidebarLayouts = layoutState.addSidebarLayouts,
124
+ allowSingleColumnLayout = layoutState.allowSingleColumnLayout,
125
+ isResizing = layoutState.isResizing;
123
126
  var shouldHideToolbar = isResizing && editorExperiment('single_column_layouts', true);
124
127
  if (pos !== null && !shouldHideToolbar) {
125
128
  return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, allowAdvancedSingleColumnLayout, api);
126
129
  }
127
130
  return undefined;
128
131
  },
129
- quickInsert: function quickInsert(_ref4) {
130
- var formatMessage = _ref4.formatMessage;
132
+ quickInsert: function quickInsert(_ref3) {
133
+ var formatMessage = _ref3.formatMessage;
131
134
  var withInsertLayoutAnalytics = function withInsertLayoutAnalytics(tr, columnCount) {
132
135
  var _api$analytics2;
133
136
  api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.attachAnalyticsEvent({
@@ -276,11 +279,11 @@ export var layoutPlugin = function layoutPlugin(_ref) {
276
279
  }
277
280
  }
278
281
  },
279
- contentComponent: function contentComponent(_ref5) {
280
- var editorView = _ref5.editorView,
281
- popupsMountPoint = _ref5.popupsMountPoint,
282
- popupsBoundariesElement = _ref5.popupsBoundariesElement,
283
- popupsScrollableElement = _ref5.popupsScrollableElement;
282
+ contentComponent: function contentComponent(_ref4) {
283
+ var editorView = _ref4.editorView,
284
+ popupsMountPoint = _ref4.popupsMountPoint,
285
+ popupsBoundariesElement = _ref4.popupsBoundariesElement,
286
+ popupsScrollableElement = _ref4.popupsScrollableElement;
284
287
  return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('advanced_layouts', true) ? /*#__PURE__*/React.createElement(GlobalStylesWrapper, null) : null, expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true) && editorView ? /*#__PURE__*/React.createElement(LayoutColumnMenu, {
285
288
  api: api,
286
289
  editorView: editorView,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "10.3.0",
3
+ "version": "10.3.2",
4
4
  "description": "Layout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,8 +31,8 @@
31
31
  "dependencies": {
32
32
  "@atlaskit/adf-schema": "^52.11.0",
33
33
  "@atlaskit/css": "^0.19.0",
34
- "@atlaskit/editor-plugin-analytics": "^10.0.0",
35
- "@atlaskit/editor-plugin-block-menu": "^9.1.0",
34
+ "@atlaskit/editor-plugin-analytics": "^10.1.0",
35
+ "@atlaskit/editor-plugin-block-menu": "^9.2.0",
36
36
  "@atlaskit/editor-plugin-decorations": "^10.1.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^10.1.0",
38
38
  "@atlaskit/editor-plugin-guideline": "^10.1.0",
@@ -42,20 +42,20 @@
42
42
  "@atlaskit/editor-plugin-ui-control-registry": "^4.1.0",
43
43
  "@atlaskit/editor-plugin-width": "^11.1.0",
44
44
  "@atlaskit/editor-prosemirror": "^7.3.0",
45
- "@atlaskit/editor-shared-styles": "^3.10.0",
46
- "@atlaskit/editor-toolbar": "^1.3.0",
47
- "@atlaskit/editor-ui-control-model": "^1.1.0",
45
+ "@atlaskit/editor-shared-styles": "^3.11.0",
46
+ "@atlaskit/editor-toolbar": "^1.5.0",
47
+ "@atlaskit/editor-ui-control-model": "^1.2.0",
48
48
  "@atlaskit/icon": "^34.5.0",
49
49
  "@atlaskit/icon-lab": "^6.9.0",
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
- "@atlaskit/tmp-editor-statsig": "^80.0.0",
51
+ "@atlaskit/tmp-editor-statsig": "^81.0.0",
52
52
  "@atlaskit/tokens": "^13.0.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "@emotion/react": "^11.7.1",
55
55
  "bind-event-listener": "^3.0.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^114.30.0",
58
+ "@atlaskit/editor-common": "^114.32.0",
59
59
  "react": "^18.2.0",
60
60
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
61
61
  },