@atlaskit/editor-plugin-block-controls 7.2.11 → 7.3.0

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,38 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 7.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5167552fe1a93`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5167552fe1a93) -
8
+ [EDITOR-2339] Bump @atlaskit/adf-schema to 51.3.0
9
+
10
+ ### Patch Changes
11
+
12
+ - [`cebe32372285d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cebe32372285d) -
13
+ Tidy up feature gate
14
+ - [`8062900ea5010`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8062900ea5010) -
15
+ [ux] ED-29550 Fix drop targets not showing for layouts as first node
16
+ - [`0b0ef25b2f529`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b0ef25b2f529) -
17
+ Cleanup various feature gates and align them to aifc_create_enabled
18
+ - [`3feef799ad0a5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3feef799ad0a5) -
19
+ [ED-29333] Fix 2 issues when platform_editor_native_anchor_support is enabled
20
+ 1. Drag handle is rendered for media node
21
+ 2. When advanced_layouts experiment is off, quick insert button is rendered based on child node
22
+ inside layout column (as opposed to layout section node )
23
+
24
+ - [`e108f7cc7cedf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e108f7cc7cedf) -
25
+ [ux] Drag handle and quick insert button in dense mode
26
+ - Updated dependencies
27
+
28
+ ## 7.2.12
29
+
30
+ ### Patch Changes
31
+
32
+ - [`5e7e734485a98`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5e7e734485a98) -
33
+ upgrade browser util api
34
+ - Updated dependencies
35
+
3
36
  ## 7.2.11
4
37
 
5
38
  ### Patch Changes
@@ -40,50 +40,37 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
40
40
  function transformSourceSlice(nodeCopy, destType) {
41
41
  var srcNode = nodeCopy.content.firstChild;
42
42
  var schema = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.schema;
43
- if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
44
- if (!schema) {
45
- return nodeCopy;
46
- }
47
- var _schema$nodes = schema.nodes,
48
- doc = _schema$nodes.doc,
49
- layoutColumn = _schema$nodes.layoutColumn;
50
- var destTypeInTable = (0, _validation.isInsideTable)(destType);
51
- var destTypeInDocOrLayoutCol = [doc, layoutColumn].includes(destType);
43
+ if (!schema) {
44
+ return nodeCopy;
45
+ }
46
+ var _schema$nodes = schema.nodes,
47
+ doc = _schema$nodes.doc,
48
+ layoutColumn = _schema$nodes.layoutColumn;
49
+ var destTypeInTable = (0, _validation.isInsideTable)(destType);
50
+ var destTypeInDocOrLayoutCol = [doc, layoutColumn].includes(destType);
52
51
 
53
- // No need to loop over slice content if destination requires no transformations
54
- if (!destTypeInTable && !destTypeInDocOrLayoutCol) {
55
- return nodeCopy;
56
- }
57
- var containsExpand = false;
58
- var containsNestedExpand = false;
59
- for (var i = 0; i < nodeCopy.content.childCount; i++) {
60
- var node = nodeCopy.content.child(i);
61
- if (node.type === schema.nodes.expand) {
62
- containsExpand = true;
63
- } else if (node.type === schema.nodes.nestedExpand) {
64
- containsNestedExpand = true;
65
- }
66
- if (containsExpand && containsNestedExpand) {
67
- break;
68
- }
69
- }
70
- if (containsExpand && destTypeInTable) {
71
- return (0, _validation.transformSliceExpandToNestedExpand)(nodeCopy);
72
- } else if (containsNestedExpand && destTypeInDocOrLayoutCol) {
73
- return (0, _transforms.transformSliceNestedExpandToExpand)(nodeCopy, schema);
52
+ // No need to loop over slice content if destination requires no transformations
53
+ if (!destTypeInTable && !destTypeInDocOrLayoutCol) {
54
+ return nodeCopy;
55
+ }
56
+ var containsExpand = false;
57
+ var containsNestedExpand = false;
58
+ for (var i = 0; i < nodeCopy.content.childCount; i++) {
59
+ var node = nodeCopy.content.child(i);
60
+ if (node.type === schema.nodes.expand) {
61
+ containsExpand = true;
62
+ } else if (node.type === schema.nodes.nestedExpand) {
63
+ containsNestedExpand = true;
74
64
  }
75
- } else {
76
- if (srcNode && schema) {
77
- var _schema$nodes2 = schema.nodes,
78
- _doc = _schema$nodes2.doc,
79
- _layoutColumn = _schema$nodes2.layoutColumn;
80
- if (srcNode.type === schema.nodes.nestedExpand && [_doc, _layoutColumn].includes(destType)) {
81
- return (0, _transforms.transformSliceNestedExpandToExpand)(nodeCopy, schema);
82
- } else if (srcNode.type === schema.nodes.expand && (0, _validation.isInsideTable)(destType)) {
83
- return (0, _validation.transformSliceExpandToNestedExpand)(nodeCopy);
84
- }
65
+ if (containsExpand && containsNestedExpand) {
66
+ break;
85
67
  }
86
68
  }
69
+ if (containsExpand && destTypeInTable) {
70
+ return (0, _validation.transformSliceExpandToNestedExpand)(nodeCopy);
71
+ } else if (containsNestedExpand && destTypeInDocOrLayoutCol) {
72
+ return (0, _transforms.transformSliceNestedExpandToExpand)(nodeCopy, schema);
73
+ }
87
74
  return nodeCopy;
88
75
  }
89
76
  var nodesSupportDragLayoutColumnInto = ['tableCell', 'tableHeader', 'panel', 'expand', 'nestedExpand'];
@@ -146,7 +133,7 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
146
133
  var hoistedPos;
147
134
  var from = Math.min(expandedAnchor, expandedHead);
148
135
  // Nodes like lists nest within themselves, we need to find the top most position
149
- if (isParentNodeOfTypeLayout && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
136
+ if (isParentNodeOfTypeLayout) {
150
137
  var LAYOUT_COL_DEPTH = 3;
151
138
  hoistedPos = state.doc.resolve(from).before(LAYOUT_COL_DEPTH);
152
139
  }
@@ -288,15 +275,9 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
288
275
  var _api$core7;
289
276
  api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref4) {
290
277
  var tr = _ref4.tr;
291
- if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
292
- api === null || api === void 0 || api.blockControls.commands.setMultiSelectPositions($newAnchor.pos, $newHead.pos)({
293
- tr: tr
294
- });
295
- } else {
296
- api === null || api === void 0 || api.blockControls.commands.setMultiSelectPositions(expandedAnchor, expandedHead)({
297
- tr: tr
298
- });
299
- }
278
+ api === null || api === void 0 || api.blockControls.commands.setMultiSelectPositions($newAnchor.pos, $newHead.pos)({
279
+ tr: tr
280
+ });
300
281
  moveNode(api)(currentNodePos, moveToPos, _analytics.INPUT_METHOD.SHORTCUT, formatMessage)({
301
282
  tr: tr
302
283
  });
@@ -318,15 +299,9 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
318
299
  var _api$core9;
319
300
  api === null || api === void 0 || (_api$core9 = api.core) === null || _api$core9 === void 0 || _api$core9.actions.execute(function (_ref6) {
320
301
  var tr = _ref6.tr;
321
- if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
322
- api === null || api === void 0 || api.blockControls.commands.setMultiSelectPositions($newAnchor.pos, $newHead.pos)({
323
- tr: tr
324
- });
325
- } else {
326
- api === null || api === void 0 || api.blockControls.commands.setMultiSelectPositions(expandedAnchor, expandedHead)({
327
- tr: tr
328
- });
329
- }
302
+ api === null || api === void 0 || api.blockControls.commands.setMultiSelectPositions($newAnchor.pos, $newHead.pos)({
303
+ tr: tr
304
+ });
330
305
  tr.scrollIntoView();
331
306
  return tr;
332
307
  });
@@ -36,7 +36,7 @@ var getNodeSelector = function getNodeSelector(ignoreNodes, ignoreNodeDescendant
36
36
  };
37
37
  var getDefaultNodeSelector = (0, _memoizeOne.default)(function () {
38
38
  // we don't show handler for node nested in table
39
- return getNodeSelector((0, _toConsumableArray2.default)(_decorationsAnchor.IGNORE_NODES_NEXT), [].concat((0, _toConsumableArray2.default)(_decorationsAnchor.IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT), ['table']));
39
+ return getNodeSelector([].concat((0, _toConsumableArray2.default)(_decorationsAnchor.IGNORE_NODES_NEXT), ['media']), [].concat((0, _toConsumableArray2.default)(_decorationsAnchor.IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT), ['table']));
40
40
  });
41
41
  var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, event, api) {
42
42
  var _api$blockControls, _api$editorDisabled, _target$classList;
@@ -51,7 +51,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
51
51
  editorDisabled = _ref2.editorDisabled;
52
52
 
53
53
  // We shouldn't be firing mouse over transactions when the editor is disabled
54
- if (editorDisabled && (0, _platformFeatureFlags.fg)('platform_editor_ai_rovo_free_gen')) {
54
+ if (editorDisabled && (0, _platformFeatureFlags.fg)('aifc_create_enabled')) {
55
55
  return false;
56
56
  }
57
57
 
@@ -64,24 +64,25 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
64
64
  // Ignored via go/ees005
65
65
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
66
66
  var target = event.target;
67
+ var isNativeAnchorSupported = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true);
67
68
  if (target !== null && target !== void 0 && (_target$classList = target.classList) !== null && _target$classList !== void 0 && _target$classList.contains('ProseMirror')) {
68
69
  return false;
69
70
  }
70
- var rootElement = target === null || target === void 0 ? void 0 : target.closest((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? getDefaultNodeSelector() : "[data-drag-handler-anchor-name]");
71
+ var rootElement = target === null || target === void 0 ? void 0 : target.closest(isNativeAnchorSupported ? getDefaultNodeSelector() : "[data-drag-handler-anchor-name]");
71
72
  if (rootElement) {
72
73
  var _rootElement$parentEl;
73
74
  // We want to exlude handles from showing for empty paragraph and heading nodes
74
75
  if (isEmptyNestedParagraphOrHeading(rootElement)) {
75
76
  return false;
76
77
  }
77
- if (rootElement.getAttribute((0, _domAttrName.getTypeNameAttrName)()) === 'media' && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
78
+ if (rootElement.getAttribute((0, _domAttrName.getTypeNameAttrName)()) === 'media' && (0, _experiments.editorExperiment)('advanced_layouts', true) && !isNativeAnchorSupported) {
78
79
  rootElement = rootElement.closest("[".concat((0, _domAttrName.getAnchorAttrName)(), "][").concat((0, _domAttrName.getTypeNameAttrName)(), "=\"mediaSingle\"]"));
79
80
  if (!rootElement) {
80
81
  return false;
81
82
  }
82
83
  }
83
84
  var parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest("[".concat((0, _domAttrName.getAnchorAttrName)(), "]"));
84
- var parentElementType = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? (0, _domAttrName.getTypeNameFromDom)(parentElement) : parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
85
+ var parentElementType = isNativeAnchorSupported ? (0, _domAttrName.getTypeNameFromDom)(parentElement) : parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
85
86
  if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
86
87
  // We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
87
88
  if (parentElement && parentElementType === 'table') {
@@ -89,7 +90,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
89
90
  } else if (parentElement && parentElementType === 'tableRow') {
90
91
  var _parentElement$parent;
91
92
  var grandparentElement = parentElement === null || parentElement === void 0 || (_parentElement$parent = parentElement.parentElement) === null || _parentElement$parent === void 0 ? void 0 : _parentElement$parent.closest("[".concat((0, _domAttrName.getAnchorAttrName)(), "]"));
92
- var grandparentElementType = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? (0, _domAttrName.getTypeNameFromDom)(grandparentElement) : grandparentElement === null || grandparentElement === void 0 ? void 0 : grandparentElement.getAttribute('data-drag-handler-node-type');
93
+ var grandparentElementType = isNativeAnchorSupported ? (0, _domAttrName.getTypeNameFromDom)(grandparentElement) : grandparentElement === null || grandparentElement === void 0 ? void 0 : grandparentElement.getAttribute('data-drag-handler-node-type');
93
94
  if (grandparentElement && grandparentElementType === 'table') {
94
95
  rootElement = grandparentElement;
95
96
  }
@@ -156,11 +157,11 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
156
157
  if (rootDOM instanceof HTMLElement) {
157
158
  var _rootDOM$getAttribute;
158
159
  rootAnchorName = (_rootDOM$getAttribute = rootDOM.getAttribute((0, _domAttrName.getAnchorAttrName)())) !== null && _rootDOM$getAttribute !== void 0 ? _rootDOM$getAttribute : undefined;
159
- rootNodeType = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? (0, _domAttrName.getTypeNameFromDom)(rootDOM) : rootDOM.getAttribute('data-drag-handler-node-type');
160
+ rootNodeType = isNativeAnchorSupported ? (0, _domAttrName.getTypeNameFromDom)(rootDOM) : rootDOM.getAttribute('data-drag-handler-node-type');
160
161
  }
161
162
  }
162
163
  }
163
- var nodeType = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? (0, _domAttrName.getTypeNameFromDom)(rootElement) : rootElement.getAttribute('data-drag-handler-node-type');
164
+ var nodeType = isNativeAnchorSupported ? (0, _domAttrName.getTypeNameFromDom)(rootElement) : rootElement.getAttribute('data-drag-handler-node-type');
164
165
  if (nodeType) {
165
166
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
166
167
  var _api$core, _api$blockControls2;
@@ -296,12 +296,13 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
296
296
  if (activeNode && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== true) {
297
297
  var _mappedRootPos$pos, _mappedRootPos;
298
298
  var _mappedPos;
299
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
299
300
  // In safari, when platform_editor_controls is on,
300
301
  // sometimes the drag handle for the layout disppears after you click on the handle for a few times
301
302
  // Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
302
303
  // This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
303
304
  // This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
304
- if (_browser.browser.webkit && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
305
+ if (browser.webkit && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
305
306
  _mappedPos = tr.mapping.mapResult(activeNode.pos);
306
307
  isActiveNodeDeleted = _mappedPos.deleted;
307
308
  } else {
@@ -8,7 +8,6 @@ var _selection2 = 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 _utils2 = require("@atlaskit/editor-tables/utils");
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
13
12
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
14
13
  var getInlineNodePos = exports.getInlineNodePos = function getInlineNodePos(tr, start, nodeSize) {
@@ -73,7 +72,7 @@ var oldGetSelection = function oldGetSelection(tr, start) {
73
72
  // we need a quick way to make all child media nodes appear as selected without the need for a custom selection
74
73
  nodeName === 'mediaGroup') {
75
74
  return new _state.NodeSelection($startPos);
76
- } else if (nodeName === 'taskList' && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
75
+ } else if (nodeName === 'taskList') {
77
76
  return _state.TextSelection.create(tr.doc, start, start + nodeSize);
78
77
  } else {
79
78
  var _getInlineNodePos = getInlineNodePos(tr, start, nodeSize),
@@ -114,7 +113,7 @@ var newGetSelection = function newGetSelection(tr, start) {
114
113
  var $mediaStartPos = tr.doc.resolve(start + 1);
115
114
  return new _state.NodeSelection($mediaStartPos);
116
115
  }
117
- if (nodeName === 'taskList' && !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
116
+ if (nodeName === 'taskList' && !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
118
117
  return _state.TextSelection.create(tr.doc, start, start + nodeSize);
119
118
  }
120
119
  var _getInlineNodePos2 = getInlineNodePos(tr, start, nodeSize),
@@ -179,40 +178,22 @@ var isHandleCorrelatedToSelection = exports.isHandleCorrelatedToSelection = func
179
178
  }
180
179
  var nodeStart;
181
180
  var $selectionFrom = selection.$from;
182
- if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
183
- nodeStart = $selectionFrom.before($selectionFrom.sharedDepth(selection.to) + 1);
184
- if (nodeStart === $selectionFrom.pos) {
185
- nodeStart = $selectionFrom.depth ? $selectionFrom.before() : $selectionFrom.pos;
186
- }
187
- var $resolvedNodePos = state.doc.resolve(nodeStart);
188
- if (['tableRow', 'tableCell', 'tableHeader'].includes($resolvedNodePos.node().type.name)) {
189
- var parentNodeFindRes = (0, _utils.findParentNodeOfType)(state.schema.nodes['table'])(selection);
190
- var tablePos = parentNodeFindRes === null || parentNodeFindRes === void 0 ? void 0 : parentNodeFindRes.pos;
191
- nodeStart = typeof tablePos === 'undefined' ? nodeStart : tablePos;
192
- } else if (['listItem'].includes($resolvedNodePos.node().type.name)) {
193
- nodeStart = $resolvedNodePos.before(rootListDepth($resolvedNodePos));
194
- } else if (['taskList'].includes($resolvedNodePos.node().type.name)) {
195
- var listdepth = rootTaskListDepth($resolvedNodePos);
196
- nodeStart = $resolvedNodePos.before(listdepth);
197
- } else if (['blockquote'].includes($resolvedNodePos.node().type.name)) {
198
- nodeStart = $resolvedNodePos.before();
199
- }
200
- } else {
201
- var selectionFrom = $selectionFrom.pos;
202
- nodeStart = $selectionFrom.depth ? $selectionFrom.before() : selectionFrom;
203
- var _$resolvedNodePos = state.doc.resolve(nodeStart);
204
- if (['tableRow', 'tableCell', 'tableHeader'].includes(_$resolvedNodePos.node().type.name)) {
205
- var _parentNodeFindRes = (0, _utils.findParentNodeOfType)(state.schema.nodes['table'])(selection);
206
- var _tablePos = _parentNodeFindRes === null || _parentNodeFindRes === void 0 ? void 0 : _parentNodeFindRes.pos;
207
- nodeStart = typeof _tablePos === 'undefined' ? nodeStart : _tablePos;
208
- } else if (['listItem'].includes(_$resolvedNodePos.node().type.name)) {
209
- nodeStart = _$resolvedNodePos.before(rootListDepth(_$resolvedNodePos));
210
- } else if (['taskList'].includes(_$resolvedNodePos.node().type.name)) {
211
- var _listdepth = rootTaskListDepth(_$resolvedNodePos);
212
- nodeStart = _$resolvedNodePos.before(_listdepth);
213
- } else if (['blockquote'].includes(_$resolvedNodePos.node().type.name)) {
214
- nodeStart = _$resolvedNodePos.before();
215
- }
181
+ nodeStart = $selectionFrom.before($selectionFrom.sharedDepth(selection.to) + 1);
182
+ if (nodeStart === $selectionFrom.pos) {
183
+ nodeStart = $selectionFrom.depth ? $selectionFrom.before() : $selectionFrom.pos;
184
+ }
185
+ var $resolvedNodePos = state.doc.resolve(nodeStart);
186
+ if (['tableRow', 'tableCell', 'tableHeader'].includes($resolvedNodePos.node().type.name)) {
187
+ var parentNodeFindRes = (0, _utils.findParentNodeOfType)(state.schema.nodes['table'])(selection);
188
+ var tablePos = parentNodeFindRes === null || parentNodeFindRes === void 0 ? void 0 : parentNodeFindRes.pos;
189
+ nodeStart = typeof tablePos === 'undefined' ? nodeStart : tablePos;
190
+ } else if (['listItem'].includes($resolvedNodePos.node().type.name)) {
191
+ nodeStart = $resolvedNodePos.before(rootListDepth($resolvedNodePos));
192
+ } else if (['taskList'].includes($resolvedNodePos.node().type.name)) {
193
+ var listdepth = rootTaskListDepth($resolvedNodePos);
194
+ nodeStart = $resolvedNodePos.before(listdepth);
195
+ } else if (['blockquote'].includes($resolvedNodePos.node().type.name)) {
196
+ nodeStart = $resolvedNodePos.before();
216
197
  }
217
198
  return Boolean(handlePos < selection.$to.pos && handlePos >= nodeStart);
218
199
  };
@@ -173,7 +173,7 @@ function canMoveSliceToIndex(slice, sliceFromPos, sliceToPos, destParent, indexI
173
173
  }
174
174
 
175
175
  // Multiple layout columns do not drop correctly.
176
- if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type.name) === 'layoutColumn' && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
176
+ if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type.name) === 'layoutColumn') {
177
177
  return false;
178
178
  }
179
179
  for (var i = 0; i < slice.content.childCount; i++) {
@@ -135,6 +135,16 @@ var dragHandleButtonStyles = (0, _react2.css)({
135
135
  backgroundColor: "var(--ds-background-disabled, transparent)"
136
136
  }
137
137
  });
138
+
139
+ // Calculate scaled dimensions based on the base font size using CSS calc()
140
+ // Default font size is 16px, scale proportionally
141
+ // Standard: 16px -> 24h x 12w, Dense: 13px -> 18h x 9w
142
+ var dragHandleButtonDenseModeStyles = (0, _react2.css)({
143
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
144
+ height: "calc(".concat(_consts2.DRAG_HANDLE_HEIGHT, "px * var(--ak-editor-base-font-size) / ").concat(_consts.akEditorFullPageDefaultFontSize, "px)"),
145
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
146
+ width: "calc(".concat(_styles.DRAG_HANDLE_WIDTH, "px * var(--ak-editor-base-font-size) / ").concat(_consts.akEditorFullPageDefaultFontSize, "px)")
147
+ });
138
148
  var dragHandleButtonSmallScreenStyles = (0, _react2.css)((0, _defineProperty2.default)({}, "@container editor-area (max-width: ".concat(_consts.akEditorFullPageNarrowBreakout, "px)"), {
139
149
  opacity: 0,
140
150
  visibility: 'hidden'
@@ -248,7 +258,8 @@ var selectedStyles = (0, _react2.css)({
248
258
  // icon span receives dragStart event, instead of button, and since it is not registered as a draggable element
249
259
  // with pragmatic DnD and pragmatic DnD is not triggered
250
260
  var handleIconDragStart = function handleIconDragStart(e) {
251
- if (!_browser.browser.chrome) {
261
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
262
+ if (!browser.chrome) {
252
263
  return;
253
264
  }
254
265
  // prevent dragStart handler triggered by icon
@@ -537,9 +548,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
537
548
  if (typeof handlePos !== 'number') {
538
549
  return tr;
539
550
  }
540
- var oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
541
551
  var newHandlePosCheck = (0, _getSelection.isHandleCorrelatedToSelection)(view.state, tr.selection, handlePos);
542
- if (!tr.selection.empty && ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
552
+ if (!tr.selection.empty && newHandlePosCheck) {
543
553
  var _api$blockControls7;
544
554
  api === null || api === void 0 || (_api$blockControls7 = api.blockControls) === null || _api$blockControls7 === void 0 || _api$blockControls7.commands.setMultiSelectPositions()({
545
555
  tr: tr
@@ -731,7 +741,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
731
741
  var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
732
742
  return _objectSpread({
733
743
  left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
734
- top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? $pos && $pos.nodeAfter && (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) || nodeType : nodeType, "px)")
744
+ top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start)+ ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? $pos && $pos.nodeAfter && (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) || nodeType : nodeType), "px)")
735
745
  }, bottom);
736
746
  }
737
747
  var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts2.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
@@ -947,6 +957,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
947
957
  (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true) && event.stopPropagation();
948
958
  };
949
959
  var hasHadInteraction = interactionState !== 'hasNotHadInteraction';
960
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
950
961
  var renderButton = function renderButton() {
951
962
  return (
952
963
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
@@ -955,7 +966,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
955
966
  css: [(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
956
967
  // ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
957
968
  // See https://product-fabric.atlassian.net/browse/ED-26266
958
- _browser.browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? focusedStyles : focusedStylesOld],
969
+ browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? focusedStyles : focusedStylesOld, (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') && dragHandleButtonDenseModeStyles],
959
970
  ref: buttonRef
960
971
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
961
972
  ,
@@ -8,6 +8,7 @@ exports.dragPreview = void 0;
8
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _browser = require("@atlaskit/editor-common/browser");
10
10
  var _colors = require("@atlaskit/theme/colors");
11
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
12
  var previewStyle = {
12
13
  borderColor: "var(--ds-border, ".concat(_colors.N30, ")"),
13
14
  borderStyle: 'solid',
@@ -69,12 +70,13 @@ var createContentPreviewElement = function createContentPreviewElement(dom, node
69
70
  // Ignored via go/ees005
70
71
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
71
72
  dom.cloneNode(true);
73
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
72
74
  clonedDom.style.marginLeft = '0';
73
75
  clonedDom.style.marginTop = nodeSpacing ? "".concat(nodeSpacing.top) : '0';
74
76
  clonedDom.style.marginRight = '0';
75
77
  clonedDom.style.marginBottom = nodeSpacing ? "".concat(nodeSpacing.bottom) : '0';
76
78
  clonedDom.style.boxShadow = 'none';
77
- clonedDom.style.opacity = _browser.browser.windows ? '1' : '0.31';
79
+ clonedDom.style.opacity = browser.windows ? '1' : '0.31';
78
80
  contentPreviewOneElement.appendChild(clonedDom);
79
81
  return contentPreviewOneElement;
80
82
  };
@@ -102,7 +102,8 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
102
102
  setIsDraggedOver = _useState2[1];
103
103
  var anchorName = (0, _react.useMemo)(function () {
104
104
  if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true)) {
105
- return nextNode ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode, getPos() || -1)) || '' : '';
105
+ var _getPos;
106
+ return nextNode ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode, (_getPos = getPos()) !== null && _getPos !== void 0 ? _getPos : -1)) || '' : '';
106
107
  }
107
108
  return nextNode ? (0, _decorationsCommon.getNodeAnchor)(nextNode) : '';
108
109
  }, [api, getPos, nextNode]);
@@ -17,9 +17,12 @@ var _styles = require("@atlaskit/editor-common/styles");
17
17
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
18
18
  var _state = require("@atlaskit/editor-prosemirror/state");
19
19
  var _utils = require("@atlaskit/editor-prosemirror/utils");
20
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
20
21
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
21
22
  var _add = _interopRequireDefault(require("@atlaskit/icon/core/add"));
23
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
24
  var _primitives = require("@atlaskit/primitives");
25
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
23
26
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
24
27
  var _dragHandlePositions = require("../pm-plugins/utils/drag-handle-positions");
25
28
  var _widgetPositions = require("../pm-plugins/utils/widget-positions");
@@ -62,6 +65,16 @@ var stickyButtonStyles = (0, _primitives.xcss)({
62
65
  outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
63
66
  }
64
67
  });
68
+
69
+ // Calculate scaled dimensions based on the base font size using CSS calc()
70
+ // Default font size is 16px, scale proportionally
71
+ // Standard: 16px -> 24px x 24px, Dense: 13px -> ~18.5px x ~18.5px
72
+ var stickyButtonDenseModeStyles = (0, _primitives.xcss)({
73
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
74
+ height: "calc(".concat(_consts.QUICK_INSERT_HEIGHT, "px * var(--ak-editor-base-font-size) / ").concat(_editorSharedStyles.akEditorFullPageDefaultFontSize, "px)"),
75
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
76
+ width: "calc(".concat(_consts.QUICK_INSERT_WIDTH, "px * var(--ak-editor-base-font-size) / ").concat(_editorSharedStyles.akEditorFullPageDefaultFontSize, "px)")
77
+ });
65
78
  var containerStaticStyles = (0, _primitives.xcss)({
66
79
  position: 'absolute',
67
80
  zIndex: 'card'
@@ -278,7 +291,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
278
291
  testId: "editor-quick-insert-button",
279
292
  type: "button",
280
293
  "aria-label": formatMessage(_messages.blockControlsMessages.insert),
281
- xcss: [stickyButtonStyles],
294
+ xcss: [stickyButtonStyles, (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') && stickyButtonDenseModeStyles],
282
295
  onClick: handleQuickInsert,
283
296
  onMouseDown: handleMouseDown
284
297
  }, (0, _react2.jsx)(_add.default, {
@@ -31,52 +31,38 @@ import { getPosWhenMoveNodeDown, getPosWhenMoveNodeUp } from './utils/move-node-
31
31
  function transformSourceSlice(nodeCopy, destType) {
32
32
  const srcNode = nodeCopy.content.firstChild;
33
33
  const schema = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.schema;
34
- if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
35
- if (!schema) {
36
- return nodeCopy;
37
- }
38
- const {
39
- doc,
40
- layoutColumn
41
- } = schema.nodes;
42
- const destTypeInTable = isInsideTable(destType);
43
- const destTypeInDocOrLayoutCol = [doc, layoutColumn].includes(destType);
34
+ if (!schema) {
35
+ return nodeCopy;
36
+ }
37
+ const {
38
+ doc,
39
+ layoutColumn
40
+ } = schema.nodes;
41
+ const destTypeInTable = isInsideTable(destType);
42
+ const destTypeInDocOrLayoutCol = [doc, layoutColumn].includes(destType);
44
43
 
45
- // No need to loop over slice content if destination requires no transformations
46
- if (!destTypeInTable && !destTypeInDocOrLayoutCol) {
47
- return nodeCopy;
48
- }
49
- let containsExpand = false;
50
- let containsNestedExpand = false;
51
- for (let i = 0; i < nodeCopy.content.childCount; i++) {
52
- const node = nodeCopy.content.child(i);
53
- if (node.type === schema.nodes.expand) {
54
- containsExpand = true;
55
- } else if (node.type === schema.nodes.nestedExpand) {
56
- containsNestedExpand = true;
57
- }
58
- if (containsExpand && containsNestedExpand) {
59
- break;
60
- }
44
+ // No need to loop over slice content if destination requires no transformations
45
+ if (!destTypeInTable && !destTypeInDocOrLayoutCol) {
46
+ return nodeCopy;
47
+ }
48
+ let containsExpand = false;
49
+ let containsNestedExpand = false;
50
+ for (let i = 0; i < nodeCopy.content.childCount; i++) {
51
+ const node = nodeCopy.content.child(i);
52
+ if (node.type === schema.nodes.expand) {
53
+ containsExpand = true;
54
+ } else if (node.type === schema.nodes.nestedExpand) {
55
+ containsNestedExpand = true;
61
56
  }
62
- if (containsExpand && destTypeInTable) {
63
- return transformSliceExpandToNestedExpand(nodeCopy);
64
- } else if (containsNestedExpand && destTypeInDocOrLayoutCol) {
65
- return transformSliceNestedExpandToExpand(nodeCopy, schema);
66
- }
67
- } else {
68
- if (srcNode && schema) {
69
- const {
70
- doc,
71
- layoutColumn
72
- } = schema.nodes;
73
- if (srcNode.type === schema.nodes.nestedExpand && [doc, layoutColumn].includes(destType)) {
74
- return transformSliceNestedExpandToExpand(nodeCopy, schema);
75
- } else if (srcNode.type === schema.nodes.expand && isInsideTable(destType)) {
76
- return transformSliceExpandToNestedExpand(nodeCopy);
77
- }
57
+ if (containsExpand && containsNestedExpand) {
58
+ break;
78
59
  }
79
60
  }
61
+ if (containsExpand && destTypeInTable) {
62
+ return transformSliceExpandToNestedExpand(nodeCopy);
63
+ } else if (containsNestedExpand && destTypeInDocOrLayoutCol) {
64
+ return transformSliceNestedExpandToExpand(nodeCopy, schema);
65
+ }
80
66
  return nodeCopy;
81
67
  }
82
68
  const nodesSupportDragLayoutColumnInto = ['tableCell', 'tableHeader', 'panel', 'expand', 'nestedExpand'];
@@ -145,7 +131,7 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
145
131
  let hoistedPos;
146
132
  const from = Math.min(expandedAnchor, expandedHead);
147
133
  // Nodes like lists nest within themselves, we need to find the top most position
148
- if (isParentNodeOfTypeLayout && fg('platform_editor_elements_dnd_multi_select_patch_1')) {
134
+ if (isParentNodeOfTypeLayout) {
149
135
  const LAYOUT_COL_DEPTH = 3;
150
136
  hoistedPos = state.doc.resolve(from).before(LAYOUT_COL_DEPTH);
151
137
  }
@@ -291,15 +277,9 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
291
277
  api === null || api === void 0 ? void 0 : (_api$core7 = api.core) === null || _api$core7 === void 0 ? void 0 : _api$core7.actions.execute(({
292
278
  tr
293
279
  }) => {
294
- if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
295
- api === null || api === void 0 ? void 0 : api.blockControls.commands.setMultiSelectPositions($newAnchor.pos, $newHead.pos)({
296
- tr
297
- });
298
- } else {
299
- api === null || api === void 0 ? void 0 : api.blockControls.commands.setMultiSelectPositions(expandedAnchor, expandedHead)({
300
- tr
301
- });
302
- }
280
+ api === null || api === void 0 ? void 0 : api.blockControls.commands.setMultiSelectPositions($newAnchor.pos, $newHead.pos)({
281
+ tr
282
+ });
303
283
  moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.SHORTCUT, formatMessage)({
304
284
  tr
305
285
  });
@@ -323,15 +303,9 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
323
303
  api === null || api === void 0 ? void 0 : (_api$core9 = api.core) === null || _api$core9 === void 0 ? void 0 : _api$core9.actions.execute(({
324
304
  tr
325
305
  }) => {
326
- if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
327
- api === null || api === void 0 ? void 0 : api.blockControls.commands.setMultiSelectPositions($newAnchor.pos, $newHead.pos)({
328
- tr
329
- });
330
- } else {
331
- api === null || api === void 0 ? void 0 : api.blockControls.commands.setMultiSelectPositions(expandedAnchor, expandedHead)({
332
- tr
333
- });
334
- }
306
+ api === null || api === void 0 ? void 0 : api.blockControls.commands.setMultiSelectPositions($newAnchor.pos, $newHead.pos)({
307
+ tr
308
+ });
335
309
  tr.scrollIntoView();
336
310
  return tr;
337
311
  });