@atlaskit/editor-plugin-breakout 3.1.11 → 3.1.13

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-breakout
2
2
 
3
+ ## 3.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a118c054692f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a118c054692f3) -
8
+ PR to cleanup platform_editor_usesharedpluginstatewithselector for breakout
9
+
10
+ ## 3.1.12
11
+
12
+ ### Patch Changes
13
+
14
+ - [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
15
+ EDITOR-1442 Bump adf-schema
16
+ - Updated dependencies
17
+
3
18
  ## 3.1.11
4
19
 
5
20
  ### Patch Changes
@@ -122,7 +122,12 @@ function createPlugin(api, _ref, appearance) {
122
122
  }
123
123
  });
124
124
  }
125
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
125
+ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
126
+ var api = _ref2.api,
127
+ editorView = _ref2.editorView,
128
+ boundariesElement = _ref2.boundariesElement,
129
+ scrollableElement = _ref2.scrollableElement,
130
+ mountPoint = _ref2.mountPoint;
126
131
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorViewMode', 'editorDisabled', 'blockControls'], function (states) {
127
132
  var _states$blockControls, _states$blockControls2, _states$editorViewMod, _states$editorDisable;
128
133
  return {
@@ -136,41 +141,6 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
136
141
  isDragging = _useSharedPluginState.isDragging,
137
142
  isPMDragging = _useSharedPluginState.isPMDragging,
138
143
  mode = _useSharedPluginState.mode;
139
- return {
140
- breakoutNode: undefined,
141
- isDragging: isDragging,
142
- isPMDragging: isPMDragging,
143
- mode: mode,
144
- editorDisabled: editorDisabled
145
- };
146
- }, function (api) {
147
- // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
148
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['width', 'breakout', 'editorViewMode', 'editorDisabled', 'blockControls']),
149
- breakoutState = _useSharedPluginState2.breakoutState,
150
- editorViewModeState = _useSharedPluginState2.editorViewModeState,
151
- editorDisabledState = _useSharedPluginState2.editorDisabledState,
152
- blockControlsState = _useSharedPluginState2.blockControlsState;
153
- return {
154
- breakoutNode: breakoutState === null || breakoutState === void 0 ? void 0 : breakoutState.breakoutNode,
155
- isDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging,
156
- isPMDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isPMDragging,
157
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
158
- editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
159
- };
160
- });
161
- var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
162
- var _breakoutNode$node;
163
- var api = _ref2.api,
164
- editorView = _ref2.editorView,
165
- boundariesElement = _ref2.boundariesElement,
166
- scrollableElement = _ref2.scrollableElement,
167
- mountPoint = _ref2.mountPoint;
168
- var _useSharedState = useSharedState(api),
169
- breakoutNode = _useSharedState.breakoutNode,
170
- isDragging = _useSharedState.isDragging,
171
- isPMDragging = _useSharedState.isPMDragging,
172
- mode = _useSharedState.mode,
173
- editorDisabled = _useSharedState.editorDisabled;
174
144
  var _useState = (0, _react.useState)(false),
175
145
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
176
146
  breakoutNodePresent = _useState2[0],
@@ -208,7 +178,6 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
208
178
  mountPoint: mountPoint,
209
179
  boundariesElement: boundariesElement,
210
180
  scrollableElement: scrollableElement,
211
- node: (_breakoutNode$node = breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node) !== null && _breakoutNode$node !== void 0 ? _breakoutNode$node : null,
212
181
  isLivePage: isEditMode,
213
182
  isBreakoutNodePresent: breakoutNodePresent,
214
183
  breakoutMode: breakoutMode,
@@ -23,12 +23,10 @@ var _collapse = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/coll
23
23
  var _expand = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/expand"));
24
24
  var _colors = require("@atlaskit/theme/colors");
25
25
  var _constants = require("@atlaskit/theme/constants");
26
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
27
26
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
28
27
  var _removeBreakout = require("../editor-commands/remove-breakout");
29
28
  var _setBreakoutMode = require("../editor-commands/set-breakout-mode");
30
29
  var _pluginKey = require("../pm-plugins/plugin-key");
31
- var _getBreakoutMode = require("../pm-plugins/utils/get-breakout-mode");
32
30
  var _isBreakoutMarkAllowed = require("../pm-plugins/utils/is-breakout-mark-allowed");
33
31
  var _isSupportedNode = require("../pm-plugins/utils/is-supported-node");
34
32
  /**
@@ -78,14 +76,15 @@ var LayoutButton = function LayoutButton(_ref) {
78
76
  boundariesElement = _ref.boundariesElement,
79
77
  scrollableElement = _ref.scrollableElement,
80
78
  editorView = _ref.editorView,
81
- node = _ref.node,
82
79
  isLivePage = _ref.isLivePage,
83
80
  isBreakoutNodePresent = _ref.isBreakoutNodePresent,
84
81
  breakoutModeProp = _ref.breakoutMode,
85
82
  api = _ref.api;
86
83
  var handleClick = (0, _react.useCallback)(function (breakoutMode) {
84
+ var _getPluginState;
87
85
  var state = editorView.state,
88
86
  dispatch = editorView.dispatch;
87
+ var breakoutNode = (_getPluginState = (0, _pluginKey.getPluginState)(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.breakoutNode;
89
88
  if (['wide', 'full-width'].indexOf(breakoutMode) !== -1) {
90
89
  var _api$analytics;
91
90
  (0, _setBreakoutMode.setBreakoutMode)(breakoutMode, isLivePage)(state, dispatch);
@@ -95,7 +94,7 @@ var LayoutButton = function LayoutButton(_ref) {
95
94
  eventType: _analytics.EVENT_TYPE.TRACK,
96
95
  attributes: {
97
96
  mode: breakoutMode,
98
- nodeType: node === null || node === void 0 ? void 0 : node.type.name
97
+ nodeType: breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node.type.name
99
98
  }
100
99
  });
101
100
  } else {
@@ -107,17 +106,16 @@ var LayoutButton = function LayoutButton(_ref) {
107
106
  eventType: _analytics.EVENT_TYPE.TRACK,
108
107
  attributes: {
109
108
  mode: 'center',
110
- nodeType: node === null || node === void 0 ? void 0 : node.type.name
109
+ nodeType: breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node.type.name
111
110
  }
112
111
  });
113
112
  }
114
- }, [api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage, node === null || node === void 0 ? void 0 : node.type.name]);
113
+ }, [api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage]);
115
114
  var state = editorView.state;
116
- var exitCondition = (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true) ? !isBreakoutNodePresent : !node;
117
- if (exitCondition || !(0, _isBreakoutMarkAllowed.isBreakoutMarkAllowed)(state)) {
115
+ if (!isBreakoutNodePresent || !(0, _isBreakoutMarkAllowed.isBreakoutMarkAllowed)(state)) {
118
116
  return null;
119
117
  }
120
- var breakoutMode = (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true) ? breakoutModeProp : (0, _getBreakoutMode.getBreakoutMode)(editorView.state);
118
+ var breakoutMode = breakoutModeProp;
121
119
  var titleMessage = (0, _utils.getTitle)(breakoutMode);
122
120
  var title = formatMessage(titleMessage);
123
121
  var nextBreakoutMode = (0, _utils.getNextBreakoutMode)(breakoutMode);
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { breakout } from '@atlaskit/adf-schema';
3
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
6
6
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
@@ -110,7 +110,13 @@ function createPlugin(api, {
110
110
  }
111
111
  });
112
112
  }
113
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
113
+ const LayoutButtonWrapper = ({
114
+ api,
115
+ editorView,
116
+ boundariesElement,
117
+ scrollableElement,
118
+ mountPoint
119
+ }) => {
114
120
  const {
115
121
  editorDisabled,
116
122
  isDragging,
@@ -125,44 +131,6 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
125
131
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
126
132
  };
127
133
  });
128
- return {
129
- breakoutNode: undefined,
130
- isDragging,
131
- isPMDragging,
132
- mode,
133
- editorDisabled
134
- };
135
- }, api => {
136
- // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
137
- const {
138
- breakoutState,
139
- editorViewModeState,
140
- editorDisabledState,
141
- blockControlsState
142
- } = useSharedPluginState(api, ['width', 'breakout', 'editorViewMode', 'editorDisabled', 'blockControls']);
143
- return {
144
- breakoutNode: breakoutState === null || breakoutState === void 0 ? void 0 : breakoutState.breakoutNode,
145
- isDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging,
146
- isPMDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isPMDragging,
147
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
148
- editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
149
- };
150
- });
151
- const LayoutButtonWrapper = ({
152
- api,
153
- editorView,
154
- boundariesElement,
155
- scrollableElement,
156
- mountPoint
157
- }) => {
158
- var _breakoutNode$node;
159
- const {
160
- breakoutNode,
161
- isDragging,
162
- isPMDragging,
163
- mode,
164
- editorDisabled
165
- } = useSharedState(api);
166
134
  const [breakoutNodePresent, setBreakoutNodePresent] = useState(false);
167
135
  const [breakoutMode, setBreakoutMode] = useState(getBreakoutMode(editorView.state));
168
136
  usePluginStateEffect(api, ['breakout'], ({
@@ -195,7 +163,6 @@ const LayoutButtonWrapper = ({
195
163
  mountPoint: mountPoint,
196
164
  boundariesElement: boundariesElement,
197
165
  scrollableElement: scrollableElement,
198
- node: (_breakoutNode$node = breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node) !== null && _breakoutNode$node !== void 0 ? _breakoutNode$node : null,
199
166
  isLivePage: isEditMode,
200
167
  isBreakoutNodePresent: breakoutNodePresent,
201
168
  breakoutMode: breakoutMode,
@@ -21,12 +21,10 @@ import CollapseIcon from '@atlaskit/icon/glyph/editor/collapse';
21
21
  import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
22
22
  import { B300, N20A, N300 } from '@atlaskit/theme/colors';
23
23
  import { layers } from '@atlaskit/theme/constants';
24
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
25
24
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
26
25
  import { removeBreakout } from '../editor-commands/remove-breakout';
27
26
  import { setBreakoutMode } from '../editor-commands/set-breakout-mode';
28
27
  import { getPluginState } from '../pm-plugins/plugin-key';
29
- import { getBreakoutMode } from '../pm-plugins/utils/get-breakout-mode';
30
28
  import { isBreakoutMarkAllowed } from '../pm-plugins/utils/is-breakout-mark-allowed';
31
29
  import { isSupportedNodeForBreakout } from '../pm-plugins/utils/is-supported-node';
32
30
  const toolbarButtonWrapperStyles = css({
@@ -73,7 +71,6 @@ const LayoutButton = ({
73
71
  boundariesElement,
74
72
  scrollableElement,
75
73
  editorView,
76
- node,
77
74
  isLivePage,
78
75
  isBreakoutNodePresent,
79
76
  breakoutMode: breakoutModeProp,
@@ -81,10 +78,12 @@ const LayoutButton = ({
81
78
  }) => {
82
79
  var _api$analytics3;
83
80
  const handleClick = useCallback(breakoutMode => {
81
+ var _getPluginState;
84
82
  const {
85
83
  state,
86
84
  dispatch
87
85
  } = editorView;
86
+ const breakoutNode = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.breakoutNode;
88
87
  if (['wide', 'full-width'].indexOf(breakoutMode) !== -1) {
89
88
  var _api$analytics;
90
89
  setBreakoutMode(breakoutMode, isLivePage)(state, dispatch);
@@ -94,7 +93,7 @@ const LayoutButton = ({
94
93
  eventType: EVENT_TYPE.TRACK,
95
94
  attributes: {
96
95
  mode: breakoutMode,
97
- nodeType: node === null || node === void 0 ? void 0 : node.type.name
96
+ nodeType: breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node.type.name
98
97
  }
99
98
  });
100
99
  } else {
@@ -106,19 +105,18 @@ const LayoutButton = ({
106
105
  eventType: EVENT_TYPE.TRACK,
107
106
  attributes: {
108
107
  mode: 'center',
109
- nodeType: node === null || node === void 0 ? void 0 : node.type.name
108
+ nodeType: breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node.type.name
110
109
  }
111
110
  });
112
111
  }
113
- }, [api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage, node === null || node === void 0 ? void 0 : node.type.name]);
112
+ }, [api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage]);
114
113
  const {
115
114
  state
116
115
  } = editorView;
117
- const exitCondition = expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true) ? !isBreakoutNodePresent : !node;
118
- if (exitCondition || !isBreakoutMarkAllowed(state)) {
116
+ if (!isBreakoutNodePresent || !isBreakoutMarkAllowed(state)) {
119
117
  return null;
120
118
  }
121
- const breakoutMode = expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true) ? breakoutModeProp : getBreakoutMode(editorView.state);
119
+ const breakoutMode = breakoutModeProp;
122
120
  const titleMessage = getTitle(breakoutMode);
123
121
  const title = formatMessage(titleMessage);
124
122
  const nextBreakoutMode = getNextBreakoutMode(breakoutMode);
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import React, { useState } from 'react';
8
8
  import { breakout } from '@atlaskit/adf-schema';
9
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
10
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
11
11
  import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
12
12
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
@@ -113,7 +113,12 @@ function createPlugin(api, _ref, appearance) {
113
113
  }
114
114
  });
115
115
  }
116
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
116
+ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
117
+ var api = _ref2.api,
118
+ editorView = _ref2.editorView,
119
+ boundariesElement = _ref2.boundariesElement,
120
+ scrollableElement = _ref2.scrollableElement,
121
+ mountPoint = _ref2.mountPoint;
117
122
  var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode', 'editorDisabled', 'blockControls'], function (states) {
118
123
  var _states$blockControls, _states$blockControls2, _states$editorViewMod, _states$editorDisable;
119
124
  return {
@@ -127,41 +132,6 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
127
132
  isDragging = _useSharedPluginState.isDragging,
128
133
  isPMDragging = _useSharedPluginState.isPMDragging,
129
134
  mode = _useSharedPluginState.mode;
130
- return {
131
- breakoutNode: undefined,
132
- isDragging: isDragging,
133
- isPMDragging: isPMDragging,
134
- mode: mode,
135
- editorDisabled: editorDisabled
136
- };
137
- }, function (api) {
138
- // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
139
- var _useSharedPluginState2 = useSharedPluginState(api, ['width', 'breakout', 'editorViewMode', 'editorDisabled', 'blockControls']),
140
- breakoutState = _useSharedPluginState2.breakoutState,
141
- editorViewModeState = _useSharedPluginState2.editorViewModeState,
142
- editorDisabledState = _useSharedPluginState2.editorDisabledState,
143
- blockControlsState = _useSharedPluginState2.blockControlsState;
144
- return {
145
- breakoutNode: breakoutState === null || breakoutState === void 0 ? void 0 : breakoutState.breakoutNode,
146
- isDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging,
147
- isPMDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isPMDragging,
148
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
149
- editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
150
- };
151
- });
152
- var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
153
- var _breakoutNode$node;
154
- var api = _ref2.api,
155
- editorView = _ref2.editorView,
156
- boundariesElement = _ref2.boundariesElement,
157
- scrollableElement = _ref2.scrollableElement,
158
- mountPoint = _ref2.mountPoint;
159
- var _useSharedState = useSharedState(api),
160
- breakoutNode = _useSharedState.breakoutNode,
161
- isDragging = _useSharedState.isDragging,
162
- isPMDragging = _useSharedState.isPMDragging,
163
- mode = _useSharedState.mode,
164
- editorDisabled = _useSharedState.editorDisabled;
165
135
  var _useState = useState(false),
166
136
  _useState2 = _slicedToArray(_useState, 2),
167
137
  breakoutNodePresent = _useState2[0],
@@ -199,7 +169,6 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
199
169
  mountPoint: mountPoint,
200
170
  boundariesElement: boundariesElement,
201
171
  scrollableElement: scrollableElement,
202
- node: (_breakoutNode$node = breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node) !== null && _breakoutNode$node !== void 0 ? _breakoutNode$node : null,
203
172
  isLivePage: isEditMode,
204
173
  isBreakoutNodePresent: breakoutNodePresent,
205
174
  breakoutMode: breakoutMode,
@@ -22,12 +22,10 @@ import CollapseIcon from '@atlaskit/icon/glyph/editor/collapse';
22
22
  import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
23
23
  import { B300, N20A, N300 } from '@atlaskit/theme/colors';
24
24
  import { layers } from '@atlaskit/theme/constants';
25
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
26
25
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
27
26
  import { removeBreakout } from '../editor-commands/remove-breakout';
28
27
  import { setBreakoutMode } from '../editor-commands/set-breakout-mode';
29
28
  import { getPluginState } from '../pm-plugins/plugin-key';
30
- import { getBreakoutMode } from '../pm-plugins/utils/get-breakout-mode';
31
29
  import { isBreakoutMarkAllowed } from '../pm-plugins/utils/is-breakout-mark-allowed';
32
30
  import { isSupportedNodeForBreakout } from '../pm-plugins/utils/is-supported-node';
33
31
  var toolbarButtonWrapperStyles = css({
@@ -70,14 +68,15 @@ var LayoutButton = function LayoutButton(_ref) {
70
68
  boundariesElement = _ref.boundariesElement,
71
69
  scrollableElement = _ref.scrollableElement,
72
70
  editorView = _ref.editorView,
73
- node = _ref.node,
74
71
  isLivePage = _ref.isLivePage,
75
72
  isBreakoutNodePresent = _ref.isBreakoutNodePresent,
76
73
  breakoutModeProp = _ref.breakoutMode,
77
74
  api = _ref.api;
78
75
  var handleClick = useCallback(function (breakoutMode) {
76
+ var _getPluginState;
79
77
  var state = editorView.state,
80
78
  dispatch = editorView.dispatch;
79
+ var breakoutNode = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.breakoutNode;
81
80
  if (['wide', 'full-width'].indexOf(breakoutMode) !== -1) {
82
81
  var _api$analytics;
83
82
  setBreakoutMode(breakoutMode, isLivePage)(state, dispatch);
@@ -87,7 +86,7 @@ var LayoutButton = function LayoutButton(_ref) {
87
86
  eventType: EVENT_TYPE.TRACK,
88
87
  attributes: {
89
88
  mode: breakoutMode,
90
- nodeType: node === null || node === void 0 ? void 0 : node.type.name
89
+ nodeType: breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node.type.name
91
90
  }
92
91
  });
93
92
  } else {
@@ -99,17 +98,16 @@ var LayoutButton = function LayoutButton(_ref) {
99
98
  eventType: EVENT_TYPE.TRACK,
100
99
  attributes: {
101
100
  mode: 'center',
102
- nodeType: node === null || node === void 0 ? void 0 : node.type.name
101
+ nodeType: breakoutNode === null || breakoutNode === void 0 ? void 0 : breakoutNode.node.type.name
103
102
  }
104
103
  });
105
104
  }
106
- }, [api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage, node === null || node === void 0 ? void 0 : node.type.name]);
105
+ }, [api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage]);
107
106
  var state = editorView.state;
108
- var exitCondition = expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true) ? !isBreakoutNodePresent : !node;
109
- if (exitCondition || !isBreakoutMarkAllowed(state)) {
107
+ if (!isBreakoutNodePresent || !isBreakoutMarkAllowed(state)) {
110
108
  return null;
111
109
  }
112
- var breakoutMode = expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true) ? breakoutModeProp : getBreakoutMode(editorView.state);
110
+ var breakoutMode = breakoutModeProp;
113
111
  var titleMessage = getTitle(breakoutMode);
114
112
  var title = formatMessage(titleMessage);
115
113
  var nextBreakoutMode = getNextBreakoutMode(breakoutMode);
@@ -1,6 +1,5 @@
1
1
  import type { WrappedComponentProps } from 'react-intl-next';
2
2
  import type { BreakoutMode, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
4
  import type { BreakoutPlugin } from '../breakoutPluginType';
6
5
  export interface Props {
@@ -12,7 +11,6 @@ export interface Props {
12
11
  isBreakoutNodePresent: boolean;
13
12
  isLivePage?: boolean;
14
13
  mountPoint?: HTMLElement;
15
- node: PMNode | null;
16
14
  scrollableElement?: HTMLElement;
17
15
  }
18
16
  declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
@@ -1,6 +1,5 @@
1
1
  import type { WrappedComponentProps } from 'react-intl-next';
2
2
  import type { BreakoutMode, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
4
  import type { BreakoutPlugin } from '../breakoutPluginType';
6
5
  export interface Props {
@@ -12,7 +11,6 @@ export interface Props {
12
11
  isBreakoutNodePresent: boolean;
13
12
  isLivePage?: boolean;
14
13
  mountPoint?: HTMLElement;
15
- node: PMNode | null;
16
14
  scrollableElement?: HTMLElement;
17
15
  }
18
16
  declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-breakout",
3
- "version": "3.1.11",
3
+ "version": "3.1.13",
4
4
  "description": "Breakout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,11 +28,8 @@
28
28
  "*.compiled.css"
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
- "af:exports": {
32
- ".": "./src/index.ts"
33
- },
34
31
  "dependencies": {
35
- "@atlaskit/adf-schema": "^50.2.2",
32
+ "@atlaskit/adf-schema": "^50.2.3",
36
33
  "@atlaskit/editor-plugin-block-controls": "^4.2.0",
37
34
  "@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
38
35
  "@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
@@ -46,7 +43,7 @@
46
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
44
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
48
45
  "@atlaskit/theme": "^20.0.0",
49
- "@atlaskit/tmp-editor-statsig": "^11.8.0",
46
+ "@atlaskit/tmp-editor-statsig": "^11.12.0",
50
47
  "@atlaskit/tokens": "^6.1.0",
51
48
  "@atlaskit/tooltip": "^20.4.0",
52
49
  "@babel/runtime": "^7.0.0",
@@ -56,7 +53,7 @@
56
53
  "uuid": "^3.1.0"
57
54
  },
58
55
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^107.31.0",
56
+ "@atlaskit/editor-common": "^107.35.0",
60
57
  "react": "^18.2.0",
61
58
  "react-dom": "^18.2.0",
62
59
  "react-intl-next": "npm:react-intl@^5.18.1"