@atlaskit/editor-plugin-breakout 5.2.0 → 5.2.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,21 @@
1
1
  # @atlaskit/editor-plugin-breakout
2
2
 
3
+ ## 5.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6b6eca9cee16d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6b6eca9cee16d) -
8
+ Switch to use editorExperiment to use productKey for responsive preview panel changes.
9
+ - Updated dependencies
10
+
11
+ ## 5.2.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`8339b4553cc39`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8339b4553cc39) -
16
+ Hydration fixes for breakout plugin
17
+ - Updated dependencies
18
+
3
19
  ## 5.2.0
4
20
 
5
21
  ### Minor Changes
@@ -145,18 +145,26 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
145
145
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
146
146
  breakoutNodePresent = _useState2[0],
147
147
  setBreakoutNodePresent = _useState2[1];
148
- var _useState3 = (0, _react.useState)((0, _getBreakoutMode.getBreakoutMode)(editorView.state)),
148
+ var _useState3 = (0, _react.useState)((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView ? undefined :
149
+ // Remove ! during platform_editor_hydratable_ui cleanup
150
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
151
+ (0, _getBreakoutMode.getBreakoutMode)(editorView.state)),
149
152
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
150
153
  breakoutMode = _useState4[0],
151
154
  setBreakoutMode = _useState4[1];
152
155
  (0, _usePluginStateEffect.usePluginStateEffect)(api, ['breakout'], function (_ref3) {
153
156
  var breakoutState = _ref3.breakoutState;
157
+ if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
158
+ return;
159
+ }
154
160
  if (breakoutState !== null && breakoutState !== void 0 && breakoutState.breakoutNode && !breakoutNodePresent) {
155
161
  setBreakoutNodePresent(true);
156
162
  }
157
163
  if (!(breakoutState !== null && breakoutState !== void 0 && breakoutState.breakoutNode) && breakoutNodePresent) {
158
164
  setBreakoutNodePresent(false);
159
165
  }
166
+ // Remove ! during platform_editor_hydratable_ui cleanup
167
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
160
168
  var nextBreakoutMode = (0, _getBreakoutMode.getBreakoutMode)(editorView.state);
161
169
  if (nextBreakoutMode !== breakoutMode) {
162
170
  setBreakoutMode(nextBreakoutMode);
@@ -9,7 +9,7 @@ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
9
9
  var _styles = require("@atlaskit/editor-common/styles");
10
10
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
13
  var WIDTHS = {
14
14
  MIN: _editorSharedStyles.akEditorDefaultLayoutWidth,
15
15
  WIDE: _editorSharedStyles.akEditorCalculatedWideLayoutWidth,
@@ -49,7 +49,9 @@ var getGuidelines = exports.getGuidelines = (0, _memoizeOne.default)(function (i
49
49
  var _ref = getEditorWidth() || {},
50
50
  width = _ref.width,
51
51
  lineLength = _ref.lineLength;
52
- var padding = width && width <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
52
+ var padding = width && width <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
53
+ exposure: true
54
+ }) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
53
55
  var fullWidth = width ? Math.min(WIDTHS.MAX, width - 2 * padding - _editorSharedStyles.akEditorGutterPadding) : undefined;
54
56
  if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
55
57
  guidelines.push({
@@ -7,7 +7,7 @@ exports.createResizerCallbacks = createResizerCallbacks;
7
7
  exports.getProposedWidth = getProposedWidth;
8
8
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
9
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
10
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
11
11
  var _setBreakoutWidth = require("../editor-commands/set-breakout-width");
12
12
  var _getGuidelines = require("./get-guidelines");
13
13
  var _resizingMarkView = require("./resizing-mark-view");
@@ -30,7 +30,9 @@ function getProposedWidth(_ref) {
30
30
  var directionMultiplier = source.data.handleSide === 'left' ? -1 : 1;
31
31
  var diffX = (location.current.input.clientX - location.initial.input.clientX) * RESIZE_RATIO * directionMultiplier;
32
32
  var width = (api === null || api === void 0 || (_api$width$sharedStat = api.width.sharedState) === null || _api$width$sharedStat === void 0 || (_api$width$sharedStat = _api$width$sharedStat.currentState()) === null || _api$width$sharedStat === void 0 ? void 0 : _api$width$sharedStat.width) || 0;
33
- var padding = width <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
33
+ var padding = width <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
34
+ exposure: true
35
+ }) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
34
36
  var containerWidth = width - 2 * padding - _editorSharedStyles.akEditorGutterPadding;
35
37
 
36
38
  // the node width may be greater than the container width so we resize using the smaller value
@@ -23,7 +23,8 @@ 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 _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
26
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
27
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
27
28
  var _removeBreakout = require("../editor-commands/remove-breakout");
28
29
  var _setBreakoutMode = require("../editor-commands/set-breakout-mode");
29
30
  var _pluginKey = require("../pm-plugins/plugin-key");
@@ -82,8 +83,14 @@ var LayoutButton = function LayoutButton(_ref) {
82
83
  api = _ref.api;
83
84
  var handleClick = (0, _react.useCallback)(function (breakoutMode) {
84
85
  var _getPluginState;
85
- var state = editorView.state,
86
- dispatch = editorView.dispatch;
86
+ if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
87
+ return;
88
+ }
89
+ // Remove ! during platform_editor_hydratable_ui cleanup
90
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
91
+ var _ref2 = editorView,
92
+ state = _ref2.state,
93
+ dispatch = _ref2.dispatch;
87
94
  var breakoutNode = (_getPluginState = (0, _pluginKey.getPluginState)(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.breakoutNode;
88
95
  if (['wide', 'full-width'].indexOf(breakoutMode) !== -1) {
89
96
  var _api$analytics;
@@ -111,8 +118,13 @@ var LayoutButton = function LayoutButton(_ref) {
111
118
  });
112
119
  }
113
120
  }, [api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage]);
114
- var state = editorView.state;
115
- if (!isBreakoutNodePresent || !(0, _isBreakoutMarkAllowed.isBreakoutMarkAllowed)(state)) {
121
+ if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
122
+ return null;
123
+ }
124
+
125
+ // Remove ! during platform_editor_hydratable_ui cleanup
126
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
127
+ if (!isBreakoutNodePresent || !(0, _isBreakoutMarkAllowed.isBreakoutMarkAllowed)(editorView.state)) {
116
128
  return null;
117
129
  }
118
130
  var breakoutMode = breakoutModeProp;
@@ -120,11 +132,17 @@ var LayoutButton = function LayoutButton(_ref) {
120
132
  var title = formatMessage(titleMessage);
121
133
  var nextBreakoutMode = (0, _utils.getNextBreakoutMode)(breakoutMode);
122
134
  var belowOtherPopupsZIndex = _constants.layers.layer() - 1;
123
- var pluginState = (0, _pluginKey.getPluginState)(state);
135
+
136
+ // Remove ! during platform_editor_hydratable_ui cleanup
137
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
138
+ var pluginState = (0, _pluginKey.getPluginState)(editorView.state);
124
139
  if (!pluginState) {
125
140
  return null;
126
141
  }
127
- var element = getBreakoutNodeElement(pluginState, state.selection, editorView);
142
+
143
+ // Remove ! during platform_editor_hydratable_ui cleanup
144
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
145
+ var element = getBreakoutNodeElement(pluginState, editorView.state.selection, editorView);
128
146
  if (!element) {
129
147
  return null;
130
148
  }
@@ -147,7 +165,7 @@ var LayoutButton = function LayoutButton(_ref) {
147
165
  forcePlacement: true,
148
166
  zIndex: belowOtherPopupsZIndex
149
167
  }, (0, _react2.jsx)("div", {
150
- css: [toolbarButtonWrapperStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) && toolbarButtonNarrowScreenStyles]
168
+ css: [toolbarButtonWrapperStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && toolbarButtonNarrowScreenStyles]
151
169
  }, (0, _react2.jsx)(_uiMenu.ToolbarButton, {
152
170
  title: title,
153
171
  testId: titleMessage.id,
@@ -132,16 +132,24 @@ const LayoutButtonWrapper = ({
132
132
  };
133
133
  });
134
134
  const [breakoutNodePresent, setBreakoutNodePresent] = useState(false);
135
- const [breakoutMode, setBreakoutMode] = useState(getBreakoutMode(editorView.state));
135
+ const [breakoutMode, setBreakoutMode] = useState(expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView ? undefined :
136
+ // Remove ! during platform_editor_hydratable_ui cleanup
137
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
138
+ getBreakoutMode(editorView.state));
136
139
  usePluginStateEffect(api, ['breakout'], ({
137
140
  breakoutState
138
141
  }) => {
142
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
143
+ return;
144
+ }
139
145
  if (breakoutState !== null && breakoutState !== void 0 && breakoutState.breakoutNode && !breakoutNodePresent) {
140
146
  setBreakoutNodePresent(true);
141
147
  }
142
148
  if (!(breakoutState !== null && breakoutState !== void 0 && breakoutState.breakoutNode) && breakoutNodePresent) {
143
149
  setBreakoutNodePresent(false);
144
150
  }
151
+ // Remove ! during platform_editor_hydratable_ui cleanup
152
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
145
153
  const nextBreakoutMode = getBreakoutMode(editorView.state);
146
154
  if (nextBreakoutMode !== breakoutMode) {
147
155
  setBreakoutMode(nextBreakoutMode);
@@ -2,7 +2,7 @@ import memoizeOne from 'memoize-one';
2
2
  import { EXPAND_CONTAINER_PADDING, LAYOUT_COLUMN_PADDING, resizerHandleThumbWidth } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorGutterPaddingDynamic, akEditorGutterPadding, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorCalculatedWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
6
  const WIDTHS = {
7
7
  MIN: akEditorDefaultLayoutWidth,
8
8
  WIDE: akEditorCalculatedWideLayoutWidth,
@@ -40,7 +40,9 @@ export const getGuidelines = memoizeOne((isResizing, newWidth, getEditorWidth, n
40
40
  width,
41
41
  lineLength
42
42
  } = getEditorWidth() || {};
43
- const padding = width && width <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
43
+ const padding = width && width <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
44
+ exposure: true
45
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
44
46
  const fullWidth = width ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
45
47
  if (fg('platform_editor_breakout_resizing_hello_release')) {
46
48
  guidelines.push({
@@ -1,6 +1,6 @@
1
1
  import { akEditorGutterPaddingDynamic, akEditorGutterPadding, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorCalculatedWideLayoutWidth } from '@atlaskit/editor-shared-styles';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
4
  import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
5
5
  import { getGuidelines } from './get-guidelines';
6
6
  import { LOCAL_RESIZE_PROPERTY } from './resizing-mark-view';
@@ -24,7 +24,9 @@ export function getProposedWidth({
24
24
  const directionMultiplier = source.data.handleSide === 'left' ? -1 : 1;
25
25
  const diffX = (location.current.input.clientX - location.initial.input.clientX) * RESIZE_RATIO * directionMultiplier;
26
26
  const width = (api === null || api === void 0 ? void 0 : (_api$width$sharedStat = api.width.sharedState) === null || _api$width$sharedStat === void 0 ? void 0 : (_api$width$sharedStat2 = _api$width$sharedStat.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width) || 0;
27
- const padding = width <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
27
+ const padding = width <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
28
+ exposure: true
29
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
28
30
  const containerWidth = width - 2 * padding - akEditorGutterPadding;
29
31
 
30
32
  // the node width may be greater than the container width so we resize using the smaller value
@@ -21,7 +21,8 @@ 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 { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
24
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
25
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
25
26
  import { removeBreakout } from '../editor-commands/remove-breakout';
26
27
  import { setBreakoutMode } from '../editor-commands/set-breakout-mode';
27
28
  import { getPluginState } from '../pm-plugins/plugin-key';
@@ -79,6 +80,11 @@ const LayoutButton = ({
79
80
  var _api$analytics3;
80
81
  const handleClick = useCallback(breakoutMode => {
81
82
  var _getPluginState;
83
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
84
+ return;
85
+ }
86
+ // Remove ! during platform_editor_hydratable_ui cleanup
87
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
82
88
  const {
83
89
  state,
84
90
  dispatch
@@ -110,10 +116,13 @@ const LayoutButton = ({
110
116
  });
111
117
  }
112
118
  }, [api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage]);
113
- const {
114
- state
115
- } = editorView;
116
- if (!isBreakoutNodePresent || !isBreakoutMarkAllowed(state)) {
119
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
120
+ return null;
121
+ }
122
+
123
+ // Remove ! during platform_editor_hydratable_ui cleanup
124
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
125
+ if (!isBreakoutNodePresent || !isBreakoutMarkAllowed(editorView.state)) {
117
126
  return null;
118
127
  }
119
128
  const breakoutMode = breakoutModeProp;
@@ -121,11 +130,17 @@ const LayoutButton = ({
121
130
  const title = formatMessage(titleMessage);
122
131
  const nextBreakoutMode = getNextBreakoutMode(breakoutMode);
123
132
  const belowOtherPopupsZIndex = layers.layer() - 1;
124
- const pluginState = getPluginState(state);
133
+
134
+ // Remove ! during platform_editor_hydratable_ui cleanup
135
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
136
+ const pluginState = getPluginState(editorView.state);
125
137
  if (!pluginState) {
126
138
  return null;
127
139
  }
128
- let element = getBreakoutNodeElement(pluginState, state.selection, editorView);
140
+
141
+ // Remove ! during platform_editor_hydratable_ui cleanup
142
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
143
+ let element = getBreakoutNodeElement(pluginState, editorView.state.selection, editorView);
129
144
  if (!element) {
130
145
  return null;
131
146
  }
@@ -148,7 +163,7 @@ const LayoutButton = ({
148
163
  forcePlacement: true,
149
164
  zIndex: belowOtherPopupsZIndex
150
165
  }, jsx("div", {
151
- css: [toolbarButtonWrapperStyles, expValEqualsNoExposure('platform_editor_preview_panel_responsiveness', 'isEnabled', true) && toolbarButtonNarrowScreenStyles]
166
+ css: [toolbarButtonWrapperStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && toolbarButtonNarrowScreenStyles]
152
167
  }, jsx(ToolbarButton, {
153
168
  title: title,
154
169
  testId: titleMessage.id,
@@ -136,18 +136,26 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
136
136
  _useState2 = _slicedToArray(_useState, 2),
137
137
  breakoutNodePresent = _useState2[0],
138
138
  setBreakoutNodePresent = _useState2[1];
139
- var _useState3 = useState(getBreakoutMode(editorView.state)),
139
+ var _useState3 = useState(expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView ? undefined :
140
+ // Remove ! during platform_editor_hydratable_ui cleanup
141
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
142
+ getBreakoutMode(editorView.state)),
140
143
  _useState4 = _slicedToArray(_useState3, 2),
141
144
  breakoutMode = _useState4[0],
142
145
  setBreakoutMode = _useState4[1];
143
146
  usePluginStateEffect(api, ['breakout'], function (_ref3) {
144
147
  var breakoutState = _ref3.breakoutState;
148
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
149
+ return;
150
+ }
145
151
  if (breakoutState !== null && breakoutState !== void 0 && breakoutState.breakoutNode && !breakoutNodePresent) {
146
152
  setBreakoutNodePresent(true);
147
153
  }
148
154
  if (!(breakoutState !== null && breakoutState !== void 0 && breakoutState.breakoutNode) && breakoutNodePresent) {
149
155
  setBreakoutNodePresent(false);
150
156
  }
157
+ // Remove ! during platform_editor_hydratable_ui cleanup
158
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
151
159
  var nextBreakoutMode = getBreakoutMode(editorView.state);
152
160
  if (nextBreakoutMode !== breakoutMode) {
153
161
  setBreakoutMode(nextBreakoutMode);
@@ -2,7 +2,7 @@ import memoizeOne from 'memoize-one';
2
2
  import { EXPAND_CONTAINER_PADDING, LAYOUT_COLUMN_PADDING, resizerHandleThumbWidth } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorGutterPaddingDynamic, akEditorGutterPadding, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorCalculatedWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
6
  var WIDTHS = {
7
7
  MIN: akEditorDefaultLayoutWidth,
8
8
  WIDE: akEditorCalculatedWideLayoutWidth,
@@ -42,7 +42,9 @@ export var getGuidelines = memoizeOne(function (isResizing, newWidth, getEditorW
42
42
  var _ref = getEditorWidth() || {},
43
43
  width = _ref.width,
44
44
  lineLength = _ref.lineLength;
45
- var padding = width && width <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
45
+ var padding = width && width <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
46
+ exposure: true
47
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
46
48
  var fullWidth = width ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
47
49
  if (fg('platform_editor_breakout_resizing_hello_release')) {
48
50
  guidelines.push({
@@ -1,6 +1,6 @@
1
1
  import { akEditorGutterPaddingDynamic, akEditorGutterPadding, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorCalculatedWideLayoutWidth } from '@atlaskit/editor-shared-styles';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
4
  import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
5
5
  import { getGuidelines } from './get-guidelines';
6
6
  import { LOCAL_RESIZE_PROPERTY } from './resizing-mark-view';
@@ -23,7 +23,9 @@ export function getProposedWidth(_ref) {
23
23
  var directionMultiplier = source.data.handleSide === 'left' ? -1 : 1;
24
24
  var diffX = (location.current.input.clientX - location.initial.input.clientX) * RESIZE_RATIO * directionMultiplier;
25
25
  var width = (api === null || api === void 0 || (_api$width$sharedStat = api.width.sharedState) === null || _api$width$sharedStat === void 0 || (_api$width$sharedStat = _api$width$sharedStat.currentState()) === null || _api$width$sharedStat === void 0 ? void 0 : _api$width$sharedStat.width) || 0;
26
- var padding = width <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
26
+ var padding = width <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
27
+ exposure: true
28
+ }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
27
29
  var containerWidth = width - 2 * padding - akEditorGutterPadding;
28
30
 
29
31
  // the node width may be greater than the container width so we resize using the smaller value
@@ -22,7 +22,8 @@ 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 { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
25
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
26
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
26
27
  import { removeBreakout } from '../editor-commands/remove-breakout';
27
28
  import { setBreakoutMode } from '../editor-commands/set-breakout-mode';
28
29
  import { getPluginState } from '../pm-plugins/plugin-key';
@@ -74,8 +75,14 @@ var LayoutButton = function LayoutButton(_ref) {
74
75
  api = _ref.api;
75
76
  var handleClick = useCallback(function (breakoutMode) {
76
77
  var _getPluginState;
77
- var state = editorView.state,
78
- dispatch = editorView.dispatch;
78
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
79
+ return;
80
+ }
81
+ // Remove ! during platform_editor_hydratable_ui cleanup
82
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
83
+ var _ref2 = editorView,
84
+ state = _ref2.state,
85
+ dispatch = _ref2.dispatch;
79
86
  var breakoutNode = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.breakoutNode;
80
87
  if (['wide', 'full-width'].indexOf(breakoutMode) !== -1) {
81
88
  var _api$analytics;
@@ -103,8 +110,13 @@ var LayoutButton = function LayoutButton(_ref) {
103
110
  });
104
111
  }
105
112
  }, [api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, editorView, isLivePage]);
106
- var state = editorView.state;
107
- if (!isBreakoutNodePresent || !isBreakoutMarkAllowed(state)) {
113
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
114
+ return null;
115
+ }
116
+
117
+ // Remove ! during platform_editor_hydratable_ui cleanup
118
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
119
+ if (!isBreakoutNodePresent || !isBreakoutMarkAllowed(editorView.state)) {
108
120
  return null;
109
121
  }
110
122
  var breakoutMode = breakoutModeProp;
@@ -112,11 +124,17 @@ var LayoutButton = function LayoutButton(_ref) {
112
124
  var title = formatMessage(titleMessage);
113
125
  var nextBreakoutMode = getNextBreakoutMode(breakoutMode);
114
126
  var belowOtherPopupsZIndex = layers.layer() - 1;
115
- var pluginState = getPluginState(state);
127
+
128
+ // Remove ! during platform_editor_hydratable_ui cleanup
129
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
130
+ var pluginState = getPluginState(editorView.state);
116
131
  if (!pluginState) {
117
132
  return null;
118
133
  }
119
- var element = getBreakoutNodeElement(pluginState, state.selection, editorView);
134
+
135
+ // Remove ! during platform_editor_hydratable_ui cleanup
136
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
137
+ var element = getBreakoutNodeElement(pluginState, editorView.state.selection, editorView);
120
138
  if (!element) {
121
139
  return null;
122
140
  }
@@ -139,7 +157,7 @@ var LayoutButton = function LayoutButton(_ref) {
139
157
  forcePlacement: true,
140
158
  zIndex: belowOtherPopupsZIndex
141
159
  }, jsx("div", {
142
- css: [toolbarButtonWrapperStyles, expValEqualsNoExposure('platform_editor_preview_panel_responsiveness', 'isEnabled', true) && toolbarButtonNarrowScreenStyles]
160
+ css: [toolbarButtonWrapperStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && toolbarButtonNarrowScreenStyles]
143
161
  }, jsx(ToolbarButton, {
144
162
  title: title,
145
163
  testId: titleMessage.id,
@@ -6,7 +6,7 @@ export interface Props {
6
6
  api: ExtractInjectionAPI<BreakoutPlugin> | undefined;
7
7
  boundariesElement?: HTMLElement;
8
8
  breakoutMode: BreakoutMode | undefined;
9
- editorView: EditorView;
9
+ editorView: EditorView | undefined;
10
10
  handleClick?: Function;
11
11
  isBreakoutNodePresent: boolean;
12
12
  isLivePage?: boolean;
@@ -6,7 +6,7 @@ export interface Props {
6
6
  api: ExtractInjectionAPI<BreakoutPlugin> | undefined;
7
7
  boundariesElement?: HTMLElement;
8
8
  breakoutMode: BreakoutMode | undefined;
9
- editorView: EditorView;
9
+ editorView: EditorView | undefined;
10
10
  handleClick?: Function;
11
11
  isBreakoutNodePresent: boolean;
12
12
  isLivePage?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-breakout",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "Breakout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
32
  "@atlaskit/adf-schema": "^51.1.2",
33
- "@atlaskit/editor-plugin-block-controls": "^6.2.0",
33
+ "@atlaskit/editor-plugin-block-controls": "^6.3.0",
34
34
  "@atlaskit/editor-plugin-editor-disabled": "^5.0.0",
35
35
  "@atlaskit/editor-plugin-editor-viewmode": "^7.0.0",
36
36
  "@atlaskit/editor-plugin-guideline": "^5.0.0",
@@ -39,11 +39,11 @@
39
39
  "@atlaskit/editor-plugin-width": "^6.0.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/editor-shared-styles": "^3.6.0",
42
- "@atlaskit/icon": "^28.1.0",
42
+ "@atlaskit/icon": "^28.2.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
45
45
  "@atlaskit/theme": "^21.0.0",
46
- "@atlaskit/tmp-editor-statsig": "^12.18.0",
46
+ "@atlaskit/tmp-editor-statsig": "^12.25.0",
47
47
  "@atlaskit/tokens": "^6.3.0",
48
48
  "@atlaskit/tooltip": "^20.4.0",
49
49
  "@babel/runtime": "^7.0.0",
@@ -53,7 +53,7 @@
53
53
  "uuid": "^3.1.0"
54
54
  },
55
55
  "peerDependencies": {
56
- "@atlaskit/editor-common": "^109.5.0",
56
+ "@atlaskit/editor-common": "^109.10.0",
57
57
  "react": "^18.2.0",
58
58
  "react-dom": "^18.2.0",
59
59
  "react-intl-next": "npm:react-intl@^5.18.1"