@atlaskit/editor-plugin-layout 23.0.3 → 23.0.4

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,16 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 23.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a4fe8636fa0ec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a4fe8636fa0ec) -
8
+ Clean up the fully rolled out `platform_editor_layout_column_menu` experiment and the
9
+ `platform_editor_layout_column_menu_kill_switch_1` feature gate, retaining their shipped behavior.
10
+ Consumers must remove any direct `@atlaskit/tmp-editor-statsig` experiment override for
11
+ `platform_editor_layout_column_menu`.
12
+ - Updated dependencies
13
+
3
14
  ## 23.0.3
4
15
 
5
16
  ### Patch Changes
@@ -17,7 +17,6 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
17
17
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
18
18
  var _fg = require("@atlaskit/platform-feature-flags/fg");
19
19
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
20
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
20
  var _actions = require("./pm-plugins/actions");
22
21
  var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
23
22
  var _main = _interopRequireDefault(require("./pm-plugins/main"));
@@ -59,7 +58,7 @@ var selectIntoLayoutSection = exports.selectIntoLayoutSection = function selectI
59
58
  return tr;
60
59
  };
61
60
  var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
62
- var _api$blockMenu, _api$analytics2;
61
+ var _api$blockMenu, _api$uiControlRegistr, _api$analytics2;
63
62
  var _ref$config = _ref.config,
64
63
  options = _ref$config === void 0 ? {} : _ref$config,
65
64
  api = _ref.api;
@@ -82,12 +81,9 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
82
81
  return Boolean(api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(LAYOUT_SECTION_NODE_NAME));
83
82
  }
84
83
  }]);
85
- if ((0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
86
- var _api$uiControlRegistr;
87
- api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _components.getLayoutColumnMenuComponents)({
88
- api: api
89
- }));
90
- }
84
+ api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _components.getLayoutColumnMenuComponents)({
85
+ api: api
86
+ }));
91
87
  if (isRegisteredSlashCommandEnabled) {
92
88
  var _api$uiControlRegistr2;
93
89
  api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 || _api$uiControlRegistr2.actions.register((0, _getLayoutQuickInsertComponents.getLayoutQuickInsertComponents)({
@@ -113,16 +109,14 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
113
109
  return (0, _main.default)(options, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
114
110
  }
115
111
  }];
116
- if ((0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
117
- plugins.push({
118
- name: 'layoutKeymap',
119
- plugin: function plugin() {
120
- return (0, _keymap.default)({
121
- api: api
122
- });
123
- }
124
- });
125
- }
112
+ plugins.push({
113
+ name: 'layoutKeymap',
114
+ plugin: function plugin() {
115
+ return (0, _keymap.default)({
116
+ api: api
117
+ });
118
+ }
119
+ });
126
120
  if ((options.editorAppearance === 'full-page' || options.editorAppearance === 'full-width' || options.editorAppearance === 'max') && api && (0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
127
121
  plugins.push({
128
122
  name: 'layoutResizing',
@@ -291,7 +285,7 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
291
285
  popupsMountPoint = _ref5.popupsMountPoint,
292
286
  popupsBoundariesElement = _ref5.popupsBoundariesElement,
293
287
  popupsScrollableElement = _ref5.popupsScrollableElement;
294
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null) : null, (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true) && editorView ? /*#__PURE__*/_react.default.createElement(_LayoutColumnMenu.LayoutColumnMenu, {
288
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null) : null, editorView ? /*#__PURE__*/_react.default.createElement(_LayoutColumnMenu.LayoutColumnMenu, {
295
289
  api: api,
296
290
  editorView: editorView,
297
291
  mountTo: popupsMountPoint,
@@ -621,9 +621,6 @@ var insertLayoutColumnAt = function insertLayoutColumnAt(side, editorAnalyticsAP
621
621
  var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _analytics.INPUT_METHOD.LAYOUT_COLUMN_MENU;
622
622
  return function (_ref5) {
623
623
  var tr = _ref5.tr;
624
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
625
- return null;
626
- }
627
624
  var selectedLayoutColumnsResult = (0, _layoutColumnSelection.getLayoutColumnsFromContentSelection)(tr.selection);
628
625
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length === 0) {
629
626
  return null;
@@ -685,12 +682,10 @@ var insertLayoutColumnAt = function insertLayoutColumnAt(side, editorAnalyticsAP
685
682
 
686
683
  // Inserting left shifts positions at/after the new column right by its size; inserting
687
684
  // right leaves them unchanged. Remap the original selection through that mapping.
688
- if (!(0, _fg.fg)('platform_editor_layout_column_menu_kill_switch_1')) {
689
- var insertMapping = side === 'left' ? new _transform.Mapping([new _transform.StepMap([insertedColumnPos, 0, newColumn.nodeSize])]) : new _transform.Mapping();
690
- var restoredSelection = remapSelectionThroughMapping(originalSelection, insertMapping, tr.doc);
691
- if (restoredSelection) {
692
- tr.setSelection(restoredSelection);
693
- }
685
+ var insertMapping = side === 'left' ? new _transform.Mapping([new _transform.StepMap([insertedColumnPos, 0, newColumn.nodeSize])]) : new _transform.Mapping();
686
+ var restoredSelection = remapSelectionThroughMapping(originalSelection, insertMapping, tr.doc);
687
+ if (restoredSelection) {
688
+ tr.setSelection(restoredSelection);
694
689
  }
695
690
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
696
691
  action: _analytics.ACTION.INSERTED,
@@ -732,9 +727,6 @@ var setLayoutColumnValign = exports.setLayoutColumnValign = function setLayoutCo
732
727
  inputMethod = _ref8$inputMethod === void 0 ? _analytics.INPUT_METHOD.LAYOUT_COLUMN_MENU : _ref8$inputMethod;
733
728
  return function (_ref9) {
734
729
  var tr = _ref9.tr;
735
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
736
- return null;
737
- }
738
730
  var selectedLayoutColumnsResult = (0, _layoutColumnSelection.getSelectedLayoutColumnsFromSelection)(tr.selection);
739
731
  if (!selectedLayoutColumnsResult) {
740
732
  return null;
@@ -789,9 +781,6 @@ var distributeLayoutColumns = exports.distributeLayoutColumns = function distrib
789
781
  target = _ref10$target === void 0 ? 'selectedColumns' : _ref10$target;
790
782
  return function (_ref11) {
791
783
  var tr = _ref11.tr;
792
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
793
- return null;
794
- }
795
784
  var selectedLayoutColumnsResult = target === 'allColumns' ? (0, _layoutColumnSelection.getAllLayoutColumnsFromSelection)(tr.selection) : (0, _layoutColumnSelection.getSelectedLayoutColumnsFromSelection)(tr.selection);
796
785
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length < 2) {
797
786
  return null;
@@ -900,10 +889,6 @@ var deleteLayoutColumn = exports.deleteLayoutColumn = function deleteLayoutColum
900
889
  return function (_ref18) {
901
890
  var _api$blockControls4;
902
891
  var tr = _ref18.tr;
903
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
904
- return null;
905
- }
906
-
907
892
  // Only delete columns that are explicitly selected (a column NodeSelection or a selection
908
893
  // fully containing columns). This stops a bare caret inside a column — including inside
909
894
  // nested content such as a table — from deleting the whole column via the delete shortcut.
@@ -982,7 +967,7 @@ var deleteLayoutColumn = exports.deleteLayoutColumn = function deleteLayoutColum
982
967
  // last column when the deleted slot no longer exists. Otherwise the replace above maps
983
968
  // the caret out of the layout to the following paragraph.
984
969
  var remainingColumnCount = remainingColumns.length;
985
- if (hadTextSelection && !(0, _fg.fg)('platform_editor_layout_column_menu_kill_switch_1') && remainingColumnCount > 0) {
970
+ if (hadTextSelection && remainingColumnCount > 0) {
986
971
  var targetColumnIndex = Math.min(startIndex, remainingColumnCount - 1);
987
972
  var updatedSectionNode = tr.doc.nodeAt(layoutSectionPos);
988
973
  if (updatedSectionNode) {
@@ -12,7 +12,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
13
  var _view = require("@atlaskit/editor-prosemirror/view");
14
14
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
15
- var _fg = require("@atlaskit/platform-feature-flags/fg");
16
15
  var _consts = require("./consts");
17
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
17
  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) { (0, _defineProperty2.default)(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; }
@@ -84,8 +83,7 @@ var dispatchColumnWidths = function dispatchColumnWidths(view, sectionPos, leftC
84
83
 
85
84
  // Capture the selection before the replace below, which otherwise maps the caret out of
86
85
  // the layout to the following paragraph. Restored at the same positions afterwards.
87
- var shouldPreserveSelection = !(0, _fg.fg)('platform_editor_layout_column_menu_kill_switch_1');
88
- var selectionBeforeResize = shouldPreserveSelection ? state.selection : null;
86
+ var selectionBeforeResize = state.selection;
89
87
  tr.replaceWith(sectionPos + 1, sectionPos + sectionNode.nodeSize - 1, _model.Fragment.from(newColumns));
90
88
  tr.setMeta('layoutColumnResize', true);
91
89
  tr.setMeta('scrollIntoView', false);
@@ -17,7 +17,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
17
17
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
18
18
  var _view2 = require("@atlaskit/editor-prosemirror/view");
19
19
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
20
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
20
  var _actions = require("./actions");
22
21
  var _columnResizeDivider = require("./column-resize-divider");
23
22
  var _consts = require("./consts");
@@ -35,7 +34,7 @@ var DEFAULT_LAYOUT = exports.DEFAULT_LAYOUT = 'two_equal';
35
34
  * Returns `true` when it placed a selection and consumed the click, else `false`.
36
35
  */
37
36
  var applyBlankSpaceGapCursor = function applyBlankSpaceGapCursor(view, event) {
38
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true) || !(0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
37
+ if (!(0, _editorExperiment.editorExperiment)('advanced_layouts', true)) {
39
38
  return false;
40
39
  }
41
40
  var gapTarget = (0, _utils3.getGapCursorTargetForBlankSpaceClick)(view, event);
@@ -8,7 +8,6 @@ var _selection = require("@atlaskit/editor-common/selection");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _utils = require("@atlaskit/editor-prosemirror/utils");
10
10
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
11
- var _fg = require("@atlaskit/platform-feature-flags/fg");
12
11
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
13
12
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
13
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
@@ -71,18 +70,12 @@ var supportsBlankSpaceGapCursorFallback = function supportsBlankSpaceGapCursorFa
71
70
  /**
72
71
  * For a blank-space click inside a layout column — above the first child (middle/bottom-aligned
73
72
  * columns) or below the last child (any alignment) — return the ProseMirror position and side
74
- * for a gap cursor. Returns `undefined` when the kill switch is ON, the click is outside a
75
- * layoutColumn, or the Y coordinate is not in blank space.
76
- *
77
- * The `advanced_layouts` / `platform_editor_layout_column_menu` gates live in the caller
78
- * (`applyBlankSpaceGapCursor`); only the kill switch is checked here.
73
+ * for a gap cursor. Returns `undefined` when the click is outside a layoutColumn or the Y
74
+ * coordinate is not in blank space. The `advanced_layouts` gate lives in the caller
75
+ * (`applyBlankSpaceGapCursor`).
79
76
  */
80
77
  var getGapCursorTargetForBlankSpaceClick = exports.getGapCursorTargetForBlankSpaceClick = function getGapCursorTargetForBlankSpaceClick(view, event) {
81
78
  var _columnNode$attrs;
82
- if ((0, _fg.fg)('platform_editor_layout_column_menu_kill_switch_1')) {
83
- return undefined;
84
- }
85
-
86
79
  // Resolve the column from the DOM target so it works even when posAtCoords returns null
87
80
  // (nothing rendered at the clicked Y).
88
81
  var target = event.target;
@@ -21,11 +21,11 @@ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-ex
21
21
  var _layoutColumnSelection = require("../../pm-plugins/utils/layout-column-selection");
22
22
  var _components = require("./components");
23
23
  var _keys = require("./keys");
24
- var _utils = require("./utils");
25
24
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
26
25
  var PopupWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.Popup);
27
26
  var TOOLBAR_MENU_SELECTOR = '[data-toolbar-component="menu"]';
28
27
  var NESTED_DROPDOWN_MENU_SELECTOR = '[data-toolbar-nested-dropdown-menu]';
28
+ var LAYOUT_COLUMN_MENU_POPUP_OFFSET_BELOW = [0, 2];
29
29
 
30
30
  /**
31
31
  * Returns the drag handle button for the selected layout column.
@@ -139,34 +139,11 @@ var LayoutColumnMenu = exports.LayoutColumnMenu = /*#__PURE__*/_react.default.me
139
139
  }
140
140
  var target = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? surfaceTargetRef.current : legacyTarget;
141
141
  var hasValidTarget = target instanceof HTMLElement;
142
- var positionLayoutColumnMenu = (0, _react.useCallback)(function (position) {
143
- var _menuWrapperRef$curre;
144
- var popup = (_menuWrapperRef$curre = menuWrapperRef.current) === null || _menuWrapperRef$curre === void 0 ? void 0 : _menuWrapperRef$curre.parentElement;
145
- if (!(target instanceof HTMLElement) || !(popup instanceof HTMLElement)) {
146
- return position;
147
- }
148
- if ((0, _utils.shouldOpenLayoutColumnMenuBelow)({
149
- editorView: editorView,
150
- popup: popup,
151
- scrollableElement: scrollableElement,
152
- target: target
153
- })) {
154
- return (0, _utils.calculateFallbackBottomPosition)(position, target, popup);
155
- }
156
- return position;
157
- }, [editorView, scrollableElement, target]);
158
142
  (0, _react.useEffect)(function () {
159
143
  if (isLayoutColumnMenuOpen && (!hasValidMenuSelection || !hasValidTarget || components.length === 0)) {
160
144
  closeLayoutColumnMenu();
161
145
  }
162
146
  }, [closeLayoutColumnMenu, components.length, hasValidMenuSelection, hasValidTarget, isLayoutColumnMenuOpen]);
163
- var _useMemo = (0, _react.useMemo)(function () {
164
- return (0, _utils.getLayoutColumnMenuPositioningProps)();
165
- }, []),
166
- alignX = _useMemo.alignX,
167
- alignY = _useMemo.alignY,
168
- offset = _useMemo.offset,
169
- useManualBelowFlip = _useMemo.useManualBelowFlip;
170
147
  if (!isLayoutColumnMenuOpen || !hasValidMenuSelection || components.length === 0 || !hasValidTarget) {
171
148
  return null;
172
149
  }
@@ -176,13 +153,10 @@ var LayoutColumnMenu = exports.LayoutColumnMenu = /*#__PURE__*/_react.default.me
176
153
  boundariesElement: boundariesElement,
177
154
  scrollableElement: scrollableElement,
178
155
  zIndex: _editorSharedStyles.akEditorFloatingOverlapPanelZIndex,
179
- alignX: alignX,
180
- alignY: alignY,
181
156
  forcePlacement: true,
182
157
  preventOverflow: true,
183
158
  stick: true,
184
- offset: offset,
185
- onPositionCalculated: useManualBelowFlip ? positionLayoutColumnMenu : undefined,
159
+ offset: LAYOUT_COLUMN_MENU_POPUP_OFFSET_BELOW,
186
160
  handleClickOutside: handleClickOutside,
187
161
  handleEscapeKeydown: closeLayoutColumnMenu,
188
162
  focusTrap: openedViaKeyboard ? focusTrap : undefined
@@ -24,7 +24,6 @@ var _layoutTwoColumnsSidebarLeft = _interopRequireDefault(require("@atlaskit/ico
24
24
  var _layoutTwoColumnsSidebarRight = _interopRequireDefault(require("@atlaskit/icon/core/layout-two-columns-sidebar-right"));
25
25
  var _tableColumnsDistribute = _interopRequireDefault(require("@atlaskit/icon/core/table-columns-distribute"));
26
26
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
27
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
28
27
  var _actions = require("../pm-plugins/actions");
29
28
  var _layoutColumnDistribution = require("../pm-plugins/utils/layout-column-distribution");
30
29
  var _LayoutColumnsIcon = require("./icons/LayoutColumnsIcon");
@@ -66,47 +65,6 @@ var SIDEBAR_LAYOUT_TYPES = [{
66
65
  title: _messages.layoutMessages.threeColumnsWithSidebars,
67
66
  icon: _layoutThreeColumnsSidebars.default
68
67
  }];
69
-
70
- // These are used for advanced layout options
71
- var LAYOUT_WITH_TWO_COL_DISTRIBUTION_OLD = [{
72
- id: 'editor.layout.twoEquals',
73
- type: 'two_equal',
74
- title: _messages.layoutMessages.twoColumns,
75
- icon: _layoutTwoColumns.default
76
- }, {
77
- id: 'editor.layout.twoRightSidebar',
78
- type: 'two_right_sidebar',
79
- title: _messages.layoutMessages.rightSidebar,
80
- icon: _layoutTwoColumnsSidebarRight.default
81
- }, {
82
- id: 'editor.layout.twoLeftSidebar',
83
- type: 'two_left_sidebar',
84
- title: _messages.layoutMessages.leftSidebar,
85
- icon: _layoutTwoColumnsSidebarLeft.default
86
- }];
87
- var LAYOUT_WITH_THREE_COL_DISTRIBUTION_OLD = [{
88
- id: 'editor.layout.threeEquals',
89
- type: 'three_equal',
90
- title: _messages.layoutMessages.threeColumns,
91
- icon: _layoutThreeColumns.default
92
- }, {
93
- id: 'editor.layout.threeWithSidebars',
94
- type: 'three_with_sidebars',
95
- title: _messages.layoutMessages.threeColumnsWithSidebars,
96
- icon: _layoutThreeColumnsSidebars.default
97
- }, {
98
- id: 'editor.layout.threeRightSidebars',
99
- type: 'three_right_sidebars',
100
- title: _messages.layoutMessages.threeColumnsWithRightSidebars,
101
- icon: _LayoutThreeWithRightSidebars.LayoutThreeWithRightSidebarsIcon,
102
- iconFallback: _LayoutThreeWithRightSidebars.LayoutThreeWithRightSidebarsIcon
103
- }, {
104
- id: 'editor.layout.threeLeftSidebars',
105
- type: 'three_left_sidebars',
106
- title: _messages.layoutMessages.threeColumnsWithLeftSidebars,
107
- icon: _LayoutThreeWithLeftSidebars.LayoutThreeWithLeftSidebarsIcon,
108
- iconFallback: _LayoutThreeWithLeftSidebars.LayoutThreeWithLeftSidebarsIcon
109
- }];
110
68
  var LAYOUT_WITH_TWO_COL_DISTRIBUTION = [{
111
69
  id: 'editor.layout.twoRightSidebar',
112
70
  type: 'two_right_sidebar',
@@ -195,8 +153,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
195
153
  currentLayout = _ref.currentLayout,
196
154
  allowAdvancedSingleColumnLayout = _ref.allowAdvancedSingleColumnLayout;
197
155
  var numberOfColumns = node.content.childCount || 2;
198
- var isLayoutColumnMenuEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true);
199
- var distributionOptions = isLayoutColumnMenuEnabled ? numberOfColumns === 2 ? LAYOUT_WITH_TWO_COL_DISTRIBUTION : numberOfColumns === 3 ? LAYOUT_WITH_THREE_COL_DISTRIBUTION : [] : numberOfColumns === 2 ? LAYOUT_WITH_TWO_COL_DISTRIBUTION_OLD : numberOfColumns === 3 ? LAYOUT_WITH_THREE_COL_DISTRIBUTION_OLD : [];
156
+ var distributionOptions = numberOfColumns === 2 ? LAYOUT_WITH_TWO_COL_DISTRIBUTION : numberOfColumns === 3 ? LAYOUT_WITH_THREE_COL_DISTRIBUTION : [];
200
157
  var columnOptions = [{
201
158
  title: intl.formatMessage(_messages.layoutMessages.columnOption, {
202
159
  count: 2
@@ -239,7 +196,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
239
196
  onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)('single'),
240
197
  selected: numberOfColumns === 1
241
198
  }] : []), columnOptions);
242
- var distributeColumnsButton = isLayoutColumnMenuEnabled && numberOfColumns > 1 ? {
199
+ var distributeColumnsButton = numberOfColumns > 1 ? {
243
200
  disabled: (0, _layoutColumnDistribution.isDistributedUniformly)(getLayoutColumnWidths(node)),
244
201
  icon: _tableColumnsDistribute.default,
245
202
  onClick: function onClick(editorState, dispatch) {
@@ -10,7 +10,6 @@ import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
10
10
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
11
11
  import { fg } from '@atlaskit/platform-feature-flags/fg';
12
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
13
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
13
  import { createDefaultLayoutSection, createMultiColumnLayoutSection, deleteLayoutColumn, distributeLayoutColumns, insertLayoutColumn, insertLayoutColumnsWithAnalytics, setLayoutColumnDangerPreview, setLayoutColumnValign, toggleLayoutColumnMenu } from './pm-plugins/actions';
15
14
  import { default as createLayoutKeymapPlugin } from './pm-plugins/keymap';
16
15
  import { default as createLayoutPlugin } from './pm-plugins/main';
@@ -54,7 +53,7 @@ export const layoutPlugin = ({
54
53
  config: options = {},
55
54
  api
56
55
  }) => {
57
- var _api$blockMenu, _api$analytics2;
56
+ var _api$blockMenu, _api$uiControlRegistr, _api$analytics2;
58
57
  const isAdvancedLayoutEnabled = editorExperiment('advanced_layouts', true);
59
58
  const allowAdvancedSingleColumnLayout = isAdvancedLayoutEnabled && editorExperiment('single_column_layouts', true, {
60
59
  exposure: true
@@ -74,12 +73,9 @@ export const layoutPlugin = ({
74
73
  return Boolean(api === null || api === void 0 ? void 0 : (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(LAYOUT_SECTION_NODE_NAME));
75
74
  }
76
75
  }]);
77
- if (expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
78
- var _api$uiControlRegistr;
79
- api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getLayoutColumnMenuComponents({
80
- api
81
- }));
82
- }
76
+ api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getLayoutColumnMenuComponents({
77
+ api
78
+ }));
83
79
  if (isRegisteredSlashCommandEnabled) {
84
80
  var _api$uiControlRegistr2;
85
81
  api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.register(getLayoutQuickInsertComponents({
@@ -105,14 +101,12 @@ export const layoutPlugin = ({
105
101
  return createLayoutPlugin(options, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
106
102
  }
107
103
  }];
108
- if (expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
109
- plugins.push({
110
- name: 'layoutKeymap',
111
- plugin: () => createLayoutKeymapPlugin({
112
- api
113
- })
114
- });
115
- }
104
+ plugins.push({
105
+ name: 'layoutKeymap',
106
+ plugin: () => createLayoutKeymapPlugin({
107
+ api
108
+ })
109
+ });
116
110
  if ((options.editorAppearance === 'full-page' || options.editorAppearance === 'full-width' || options.editorAppearance === 'max') && api && editorExperiment('advanced_layouts', true)) {
117
111
  plugins.push({
118
112
  name: 'layoutResizing',
@@ -271,7 +265,7 @@ export const layoutPlugin = ({
271
265
  popupsBoundariesElement,
272
266
  popupsScrollableElement
273
267
  }) {
274
- return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('advanced_layouts', true) ? /*#__PURE__*/React.createElement(GlobalStylesWrapper, null) : null, expValEquals('platform_editor_layout_column_menu', 'isEnabled', true) && editorView ? /*#__PURE__*/React.createElement(LayoutColumnMenu, {
268
+ return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('advanced_layouts', true) ? /*#__PURE__*/React.createElement(GlobalStylesWrapper, null) : null, editorView ? /*#__PURE__*/React.createElement(LayoutColumnMenu, {
275
269
  api: api,
276
270
  editorView: editorView,
277
271
  mountTo: popupsMountPoint,
@@ -591,9 +591,6 @@ export function getEffectiveMaxLayoutColumns() {
591
591
  const insertLayoutColumnAt = (side, editorAnalyticsAPI, inputMethod = INPUT_METHOD.LAYOUT_COLUMN_MENU) => ({
592
592
  tr
593
593
  }) => {
594
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
595
- return null;
596
- }
597
594
  const selectedLayoutColumnsResult = getLayoutColumnsFromContentSelection(tr.selection);
598
595
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length === 0) {
599
596
  return null;
@@ -657,12 +654,10 @@ const insertLayoutColumnAt = (side, editorAnalyticsAPI, inputMethod = INPUT_METH
657
654
 
658
655
  // Inserting left shifts positions at/after the new column right by its size; inserting
659
656
  // right leaves them unchanged. Remap the original selection through that mapping.
660
- if (!fg('platform_editor_layout_column_menu_kill_switch_1')) {
661
- const insertMapping = side === 'left' ? new Mapping([new StepMap([insertedColumnPos, 0, newColumn.nodeSize])]) : new Mapping();
662
- const restoredSelection = remapSelectionThroughMapping(originalSelection, insertMapping, tr.doc);
663
- if (restoredSelection) {
664
- tr.setSelection(restoredSelection);
665
- }
657
+ const insertMapping = side === 'left' ? new Mapping([new StepMap([insertedColumnPos, 0, newColumn.nodeSize])]) : new Mapping();
658
+ const restoredSelection = remapSelectionThroughMapping(originalSelection, insertMapping, tr.doc);
659
+ if (restoredSelection) {
660
+ tr.setSelection(restoredSelection);
666
661
  }
667
662
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
668
663
  action: ACTION.INSERTED,
@@ -702,9 +697,6 @@ export const setLayoutColumnValign = ({
702
697
  }, editorAnalyticsAPI, api) => ({
703
698
  tr
704
699
  }) => {
705
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
706
- return null;
707
- }
708
700
  const selectedLayoutColumnsResult = getSelectedLayoutColumnsFromSelection(tr.selection);
709
701
  if (!selectedLayoutColumnsResult) {
710
702
  return null;
@@ -758,9 +750,6 @@ export const distributeLayoutColumns = (editorAnalyticsAPI, api) => ({
758
750
  } = {}) => ({
759
751
  tr
760
752
  }) => {
761
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
762
- return null;
763
- }
764
753
  const selectedLayoutColumnsResult = target === 'allColumns' ? getAllLayoutColumnsFromSelection(tr.selection) : getSelectedLayoutColumnsFromSelection(tr.selection);
765
754
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length < 2) {
766
755
  return null;
@@ -864,10 +853,6 @@ export const deleteLayoutColumn = ({
864
853
  tr
865
854
  }) => {
866
855
  var _api$blockControls4;
867
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
868
- return null;
869
- }
870
-
871
856
  // Only delete columns that are explicitly selected (a column NodeSelection or a selection
872
857
  // fully containing columns). This stops a bare caret inside a column — including inside
873
858
  // nested content such as a table — from deleting the whole column via the delete shortcut.
@@ -941,7 +926,7 @@ export const deleteLayoutColumn = ({
941
926
  // last column when the deleted slot no longer exists. Otherwise the replace above maps
942
927
  // the caret out of the layout to the following paragraph.
943
928
  const remainingColumnCount = remainingColumns.length;
944
- if (hadTextSelection && !fg('platform_editor_layout_column_menu_kill_switch_1') && remainingColumnCount > 0) {
929
+ if (hadTextSelection && remainingColumnCount > 0) {
945
930
  const targetColumnIndex = Math.min(startIndex, remainingColumnCount - 1);
946
931
  const updatedSectionNode = tr.doc.nodeAt(layoutSectionPos);
947
932
  if (updatedSectionNode) {
@@ -4,7 +4,6 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
4
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
6
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
- import { fg } from '@atlaskit/platform-feature-flags/fg';
8
7
  import { MIN_LAYOUT_COLUMN_WIDTH_PERCENT } from './consts';
9
8
 
10
9
  /**
@@ -78,8 +77,7 @@ const dispatchColumnWidths = (view, sectionPos, leftColIndex, leftWidth, rightWi
78
77
 
79
78
  // Capture the selection before the replace below, which otherwise maps the caret out of
80
79
  // the layout to the following paragraph. Restored at the same positions afterwards.
81
- const shouldPreserveSelection = !fg('platform_editor_layout_column_menu_kill_switch_1');
82
- const selectionBeforeResize = shouldPreserveSelection ? state.selection : null;
80
+ const selectionBeforeResize = state.selection;
83
81
  tr.replaceWith(sectionPos + 1, sectionPos + sectionNode.nodeSize - 1, Fragment.from(newColumns));
84
82
  tr.setMeta('layoutColumnResize', true);
85
83
  tr.setMeta('scrollIntoView', false);
@@ -8,7 +8,6 @@ import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosem
8
8
  import { findParentNodeClosestToPos, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
10
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
11
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
11
  import { fixColumnSizes, fixColumnStructure, getSelectedLayout, LAYOUT_COLUMN_INSERT_META } from './actions';
13
12
  import { getColumnDividerDecorations } from './column-resize-divider';
14
13
  import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
@@ -24,7 +23,7 @@ export const DEFAULT_LAYOUT = 'two_equal';
24
23
  * Returns `true` when it placed a selection and consumed the click, else `false`.
25
24
  */
26
25
  const applyBlankSpaceGapCursor = (view, event) => {
27
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true) || !editorExperiment('advanced_layouts', true)) {
26
+ if (!editorExperiment('advanced_layouts', true)) {
28
27
  return false;
29
28
  }
30
29
  const gapTarget = getGapCursorTargetForBlankSpaceClick(view, event);
@@ -3,7 +3,6 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
- import { fg } from '@atlaskit/platform-feature-flags/fg';
7
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
8
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
8
  export const getMaybeLayoutSection = state => {
@@ -66,18 +65,12 @@ const supportsBlankSpaceGapCursorFallback = node => (node === null || node === v
66
65
  /**
67
66
  * For a blank-space click inside a layout column — above the first child (middle/bottom-aligned
68
67
  * columns) or below the last child (any alignment) — return the ProseMirror position and side
69
- * for a gap cursor. Returns `undefined` when the kill switch is ON, the click is outside a
70
- * layoutColumn, or the Y coordinate is not in blank space.
71
- *
72
- * The `advanced_layouts` / `platform_editor_layout_column_menu` gates live in the caller
73
- * (`applyBlankSpaceGapCursor`); only the kill switch is checked here.
68
+ * for a gap cursor. Returns `undefined` when the click is outside a layoutColumn or the Y
69
+ * coordinate is not in blank space. The `advanced_layouts` gate lives in the caller
70
+ * (`applyBlankSpaceGapCursor`).
74
71
  */
75
72
  export const getGapCursorTargetForBlankSpaceClick = (view, event) => {
76
73
  var _columnNode$attrs;
77
- if (fg('platform_editor_layout_column_menu_kill_switch_1')) {
78
- return undefined;
79
- }
80
-
81
74
  // Resolve the column from the DOM target so it works even when posAtCoords returns null
82
75
  // (nothing rendered at the clicked Y).
83
76
  const target = event.target;
@@ -14,10 +14,10 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
14
14
  import { getLayoutColumnMenuAnchorPos } from '../../pm-plugins/utils/layout-column-selection';
15
15
  import { LAYOUT_COLUMN_MENU_FALLBACKS } from './components';
16
16
  import { LAYOUT_COLUMN_MENU } from './keys';
17
- import { calculateFallbackBottomPosition, getLayoutColumnMenuPositioningProps, shouldOpenLayoutColumnMenuBelow } from './utils';
18
17
  const PopupWithListeners = withReactEditorViewOuterListeners(Popup);
19
18
  const TOOLBAR_MENU_SELECTOR = '[data-toolbar-component="menu"]';
20
19
  const NESTED_DROPDOWN_MENU_SELECTOR = '[data-toolbar-nested-dropdown-menu]';
20
+ const LAYOUT_COLUMN_MENU_POPUP_OFFSET_BELOW = [0, 2];
21
21
 
22
22
  /**
23
23
  * Returns the drag handle button for the selected layout column.
@@ -131,33 +131,11 @@ export const LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMen
131
131
  }
132
132
  const target = isExperimentEnabled('platform_editor_block_control_migration') ? surfaceTargetRef.current : legacyTarget;
133
133
  const hasValidTarget = target instanceof HTMLElement;
134
- const positionLayoutColumnMenu = useCallback(position => {
135
- var _menuWrapperRef$curre;
136
- const popup = (_menuWrapperRef$curre = menuWrapperRef.current) === null || _menuWrapperRef$curre === void 0 ? void 0 : _menuWrapperRef$curre.parentElement;
137
- if (!(target instanceof HTMLElement) || !(popup instanceof HTMLElement)) {
138
- return position;
139
- }
140
- if (shouldOpenLayoutColumnMenuBelow({
141
- editorView,
142
- popup,
143
- scrollableElement,
144
- target
145
- })) {
146
- return calculateFallbackBottomPosition(position, target, popup);
147
- }
148
- return position;
149
- }, [editorView, scrollableElement, target]);
150
134
  useEffect(() => {
151
135
  if (isLayoutColumnMenuOpen && (!hasValidMenuSelection || !hasValidTarget || components.length === 0)) {
152
136
  closeLayoutColumnMenu();
153
137
  }
154
138
  }, [closeLayoutColumnMenu, components.length, hasValidMenuSelection, hasValidTarget, isLayoutColumnMenuOpen]);
155
- const {
156
- alignX,
157
- alignY,
158
- offset,
159
- useManualBelowFlip
160
- } = useMemo(() => getLayoutColumnMenuPositioningProps(), []);
161
139
  if (!isLayoutColumnMenuOpen || !hasValidMenuSelection || components.length === 0 || !hasValidTarget) {
162
140
  return null;
163
141
  }
@@ -167,13 +145,10 @@ export const LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMen
167
145
  boundariesElement: boundariesElement,
168
146
  scrollableElement: scrollableElement,
169
147
  zIndex: akEditorFloatingOverlapPanelZIndex,
170
- alignX: alignX,
171
- alignY: alignY,
172
148
  forcePlacement: true,
173
149
  preventOverflow: true,
174
150
  stick: true,
175
- offset: offset,
176
- onPositionCalculated: useManualBelowFlip ? positionLayoutColumnMenu : undefined,
151
+ offset: LAYOUT_COLUMN_MENU_POPUP_OFFSET_BELOW,
177
152
  handleClickOutside: handleClickOutside,
178
153
  handleEscapeKeydown: closeLayoutColumnMenu,
179
154
  focusTrap: openedViaKeyboard ? focusTrap : undefined