@atlaskit/editor-plugin-layout 23.0.3 → 23.0.5

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,27 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 23.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d7f1f4ebb1cd3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d7f1f4ebb1cd3) -
8
+ Keep the shipped layout column delete shortcut behavior for explicitly selected columns. Remove
9
+ the `platform_editor_layout_column_delete_shortcut_fix` and
10
+ `platform_editor_layout_column_valign_rendering` experiment keys. Consumers of these keys must
11
+ remove their experiment reads and use the shipped behavior directly.
12
+ - Updated dependencies
13
+
14
+ ## 23.0.4
15
+
16
+ ### Patch Changes
17
+
18
+ - [`a4fe8636fa0ec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a4fe8636fa0ec) -
19
+ Clean up the fully rolled out `platform_editor_layout_column_menu` experiment and the
20
+ `platform_editor_layout_column_menu_kill_switch_1` feature gate, retaining their shipped behavior.
21
+ Consumers must remove any direct `@atlaskit/tmp-editor-statsig` experiment override for
22
+ `platform_editor_layout_column_menu`.
23
+ - Updated dependencies
24
+
3
25
  ## 23.0.3
4
26
 
5
27
  ### 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,
@@ -18,7 +18,6 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
18
18
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
19
19
  var _fg = require("@atlaskit/platform-feature-flags/fg");
20
20
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
21
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
22
21
  var _consts = require("./consts");
23
22
  var _pluginKey = require("./plugin-key");
24
23
  var _layoutColumnDistribution = require("./utils/layout-column-distribution");
@@ -621,9 +620,6 @@ var insertLayoutColumnAt = function insertLayoutColumnAt(side, editorAnalyticsAP
621
620
  var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _analytics.INPUT_METHOD.LAYOUT_COLUMN_MENU;
622
621
  return function (_ref5) {
623
622
  var tr = _ref5.tr;
624
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
625
- return null;
626
- }
627
623
  var selectedLayoutColumnsResult = (0, _layoutColumnSelection.getLayoutColumnsFromContentSelection)(tr.selection);
628
624
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length === 0) {
629
625
  return null;
@@ -685,12 +681,10 @@ var insertLayoutColumnAt = function insertLayoutColumnAt(side, editorAnalyticsAP
685
681
 
686
682
  // Inserting left shifts positions at/after the new column right by its size; inserting
687
683
  // 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
- }
684
+ var insertMapping = side === 'left' ? new _transform.Mapping([new _transform.StepMap([insertedColumnPos, 0, newColumn.nodeSize])]) : new _transform.Mapping();
685
+ var restoredSelection = remapSelectionThroughMapping(originalSelection, insertMapping, tr.doc);
686
+ if (restoredSelection) {
687
+ tr.setSelection(restoredSelection);
694
688
  }
695
689
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
696
690
  action: _analytics.ACTION.INSERTED,
@@ -732,9 +726,6 @@ var setLayoutColumnValign = exports.setLayoutColumnValign = function setLayoutCo
732
726
  inputMethod = _ref8$inputMethod === void 0 ? _analytics.INPUT_METHOD.LAYOUT_COLUMN_MENU : _ref8$inputMethod;
733
727
  return function (_ref9) {
734
728
  var tr = _ref9.tr;
735
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
736
- return null;
737
- }
738
729
  var selectedLayoutColumnsResult = (0, _layoutColumnSelection.getSelectedLayoutColumnsFromSelection)(tr.selection);
739
730
  if (!selectedLayoutColumnsResult) {
740
731
  return null;
@@ -789,9 +780,6 @@ var distributeLayoutColumns = exports.distributeLayoutColumns = function distrib
789
780
  target = _ref10$target === void 0 ? 'selectedColumns' : _ref10$target;
790
781
  return function (_ref11) {
791
782
  var tr = _ref11.tr;
792
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
793
- return null;
794
- }
795
783
  var selectedLayoutColumnsResult = target === 'allColumns' ? (0, _layoutColumnSelection.getAllLayoutColumnsFromSelection)(tr.selection) : (0, _layoutColumnSelection.getSelectedLayoutColumnsFromSelection)(tr.selection);
796
784
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length < 2) {
797
785
  return null;
@@ -900,14 +888,10 @@ var deleteLayoutColumn = exports.deleteLayoutColumn = function deleteLayoutColum
900
888
  return function (_ref18) {
901
889
  var _api$blockControls4;
902
890
  var tr = _ref18.tr;
903
- if (!(0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
904
- return null;
905
- }
906
-
907
891
  // Only delete columns that are explicitly selected (a column NodeSelection or a selection
908
892
  // fully containing columns). This stops a bare caret inside a column — including inside
909
893
  // nested content such as a table — from deleting the whole column via the delete shortcut.
910
- var selectedLayoutColumnsResult = (0, _expValEquals.expValEquals)('platform_editor_layout_column_delete_shortcut_fix', 'isEnabled', true) ? (0, _layoutColumnSelection.getSelectedLayoutColumnsFromSelection)(tr.selection) : (0, _layoutColumnSelection.getLayoutColumnsFromContentSelection)(tr.selection);
894
+ var selectedLayoutColumnsResult = (0, _layoutColumnSelection.getSelectedLayoutColumnsFromSelection)(tr.selection);
911
895
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length === 0) {
912
896
  return null;
913
897
  }
@@ -972,17 +956,14 @@ var deleteLayoutColumn = exports.deleteLayoutColumn = function deleteLayoutColum
972
956
  }, existingWidths);
973
957
  var updatedLayoutSectionNode = layoutSectionNode.copy(_model.Fragment.fromArray(remainingColumns));
974
958
 
975
- // The cursor-in-column (keyboard) path has a plain text selection; the menu path has a
976
- // column NodeSelection whose post-delete landing is owned by the block-controls
977
- // preserved-selection plugin, so we only restore the caret for the former.
959
+ // A text selection can fully contain columns. Restore its caret in a remaining column;
960
+ // block controls own the landing for a column NodeSelection.
978
961
  var hadTextSelection = tr.selection instanceof _state.TextSelection;
979
962
  tr.replaceWith(layoutSectionPos + 1, layoutSectionPos + layoutSectionNode.nodeSize - 1, columnWidth(updatedLayoutSectionNode, tr.doc.type.schema, redistributed));
980
963
 
981
- // Land the caret in a remaining column — the one now occupying the deleted slot, or the
982
- // last column when the deleted slot no longer exists. Otherwise the replace above maps
983
- // the caret out of the layout to the following paragraph.
964
+ // Keep a text selection within the layout after the selected columns are removed.
984
965
  var remainingColumnCount = remainingColumns.length;
985
- if (hadTextSelection && !(0, _fg.fg)('platform_editor_layout_column_menu_kill_switch_1') && remainingColumnCount > 0) {
966
+ if (hadTextSelection && remainingColumnCount > 0) {
986
967
  var targetColumnIndex = Math.min(startIndex, remainingColumnCount - 1);
987
968
  var updatedSectionNode = tr.doc.nodeAt(layoutSectionPos);
988
969
  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,
@@ -7,7 +7,6 @@ import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
7
7
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { fg } from '@atlaskit/platform-feature-flags/fg';
9
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
10
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
10
  import { DEFAULT_LAYOUT_COLUMN_VALIGN, EVEN_DISTRIBUTED_COL_WIDTHS, MAX_LAYOUT_COLUMNS, MAX_STANDARD_LAYOUT_COLUMNS, MIN_LAYOUT_COLUMN_WIDTH_PERCENT } from './consts';
12
11
  import { pluginKey } from './plugin-key';
13
12
  import { calculateDistribution, isDistributedUniformly, redistributeAfterDeletion, redistributeProportionally } from './utils/layout-column-distribution';
@@ -591,9 +590,6 @@ export function getEffectiveMaxLayoutColumns() {
591
590
  const insertLayoutColumnAt = (side, editorAnalyticsAPI, inputMethod = INPUT_METHOD.LAYOUT_COLUMN_MENU) => ({
592
591
  tr
593
592
  }) => {
594
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
595
- return null;
596
- }
597
593
  const selectedLayoutColumnsResult = getLayoutColumnsFromContentSelection(tr.selection);
598
594
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length === 0) {
599
595
  return null;
@@ -657,12 +653,10 @@ const insertLayoutColumnAt = (side, editorAnalyticsAPI, inputMethod = INPUT_METH
657
653
 
658
654
  // Inserting left shifts positions at/after the new column right by its size; inserting
659
655
  // 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
- }
656
+ const insertMapping = side === 'left' ? new Mapping([new StepMap([insertedColumnPos, 0, newColumn.nodeSize])]) : new Mapping();
657
+ const restoredSelection = remapSelectionThroughMapping(originalSelection, insertMapping, tr.doc);
658
+ if (restoredSelection) {
659
+ tr.setSelection(restoredSelection);
666
660
  }
667
661
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
668
662
  action: ACTION.INSERTED,
@@ -702,9 +696,6 @@ export const setLayoutColumnValign = ({
702
696
  }, editorAnalyticsAPI, api) => ({
703
697
  tr
704
698
  }) => {
705
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
706
- return null;
707
- }
708
699
  const selectedLayoutColumnsResult = getSelectedLayoutColumnsFromSelection(tr.selection);
709
700
  if (!selectedLayoutColumnsResult) {
710
701
  return null;
@@ -758,9 +749,6 @@ export const distributeLayoutColumns = (editorAnalyticsAPI, api) => ({
758
749
  } = {}) => ({
759
750
  tr
760
751
  }) => {
761
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
762
- return null;
763
- }
764
752
  const selectedLayoutColumnsResult = target === 'allColumns' ? getAllLayoutColumnsFromSelection(tr.selection) : getSelectedLayoutColumnsFromSelection(tr.selection);
765
753
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length < 2) {
766
754
  return null;
@@ -864,14 +852,10 @@ export const deleteLayoutColumn = ({
864
852
  tr
865
853
  }) => {
866
854
  var _api$blockControls4;
867
- if (!expValEquals('platform_editor_layout_column_menu', 'isEnabled', true)) {
868
- return null;
869
- }
870
-
871
855
  // Only delete columns that are explicitly selected (a column NodeSelection or a selection
872
856
  // fully containing columns). This stops a bare caret inside a column — including inside
873
857
  // nested content such as a table — from deleting the whole column via the delete shortcut.
874
- const selectedLayoutColumnsResult = expValEquals('platform_editor_layout_column_delete_shortcut_fix', 'isEnabled', true) ? getSelectedLayoutColumnsFromSelection(tr.selection) : getLayoutColumnsFromContentSelection(tr.selection);
858
+ const selectedLayoutColumnsResult = getSelectedLayoutColumnsFromSelection(tr.selection);
875
859
  if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length === 0) {
876
860
  return null;
877
861
  }
@@ -931,17 +915,14 @@ export const deleteLayoutColumn = ({
931
915
  .reverse().reduce((widths, selectedIndex) => redistributeAfterDeletion(widths, selectedIndex, MIN_LAYOUT_COLUMN_WIDTH_PERCENT), existingWidths);
932
916
  const updatedLayoutSectionNode = layoutSectionNode.copy(Fragment.fromArray(remainingColumns));
933
917
 
934
- // The cursor-in-column (keyboard) path has a plain text selection; the menu path has a
935
- // column NodeSelection whose post-delete landing is owned by the block-controls
936
- // preserved-selection plugin, so we only restore the caret for the former.
918
+ // A text selection can fully contain columns. Restore its caret in a remaining column;
919
+ // block controls own the landing for a column NodeSelection.
937
920
  const hadTextSelection = tr.selection instanceof TextSelection;
938
921
  tr.replaceWith(layoutSectionPos + 1, layoutSectionPos + layoutSectionNode.nodeSize - 1, columnWidth(updatedLayoutSectionNode, tr.doc.type.schema, redistributed));
939
922
 
940
- // Land the caret in a remaining column — the one now occupying the deleted slot, or the
941
- // last column when the deleted slot no longer exists. Otherwise the replace above maps
942
- // the caret out of the layout to the following paragraph.
923
+ // Keep a text selection within the layout after the selected columns are removed.
943
924
  const remainingColumnCount = remainingColumns.length;
944
- if (hadTextSelection && !fg('platform_editor_layout_column_menu_kill_switch_1') && remainingColumnCount > 0) {
925
+ if (hadTextSelection && remainingColumnCount > 0) {
945
926
  const targetColumnIndex = Math.min(startIndex, remainingColumnCount - 1);
946
927
  const updatedSectionNode = tr.doc.nodeAt(layoutSectionPos);
947
928
  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;