@atlaskit/editor-plugin-block-controls 3.19.11 → 3.19.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/editor-commands/move-node.js +1 -1
  3. package/dist/cjs/pm-plugins/decorations-anchor.js +1 -2
  4. package/dist/cjs/pm-plugins/decorations-drag-handle.js +14 -5
  5. package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +16 -5
  6. package/dist/cjs/pm-plugins/main.js +23 -2
  7. package/dist/cjs/pm-plugins/utils/marks.js +29 -0
  8. package/dist/cjs/ui/drag-handle.js +46 -29
  9. package/dist/es2019/editor-commands/move-node.js +1 -1
  10. package/dist/es2019/pm-plugins/decorations-anchor.js +1 -2
  11. package/dist/es2019/pm-plugins/decorations-drag-handle.js +15 -5
  12. package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +17 -5
  13. package/dist/es2019/pm-plugins/main.js +23 -2
  14. package/dist/es2019/pm-plugins/utils/marks.js +23 -0
  15. package/dist/es2019/ui/drag-handle.js +19 -2
  16. package/dist/esm/editor-commands/move-node.js +1 -1
  17. package/dist/esm/pm-plugins/decorations-anchor.js +1 -2
  18. package/dist/esm/pm-plugins/decorations-drag-handle.js +14 -5
  19. package/dist/esm/pm-plugins/decorations-quick-insert-button.js +16 -5
  20. package/dist/esm/pm-plugins/main.js +23 -2
  21. package/dist/esm/pm-plugins/utils/marks.js +23 -0
  22. package/dist/esm/ui/drag-handle.js +19 -2
  23. package/dist/types/pm-plugins/decorations-drag-handle.d.ts +14 -1
  24. package/dist/types/pm-plugins/decorations-quick-insert-button.d.ts +15 -1
  25. package/dist/types/pm-plugins/utils/marks.d.ts +16 -0
  26. package/dist/types-ts4.5/pm-plugins/decorations-drag-handle.d.ts +14 -1
  27. package/dist/types-ts4.5/pm-plugins/decorations-quick-insert-button.d.ts +15 -1
  28. package/dist/types-ts4.5/pm-plugins/utils/marks.d.ts +16 -0
  29. package/package.json +8 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 3.19.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [#180394](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/180394)
8
+ [`3d81ac950c9a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d81ac950c9a0) -
9
+ Add alignment mark to widget spec under FG platform_editor_breakout_resizing_widget_fix
10
+
11
+ ## 3.19.12
12
+
13
+ ### Patch Changes
14
+
15
+ - [#175086](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175086)
16
+ [`8e86022627723`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e86022627723) -
17
+ Fix spacing between drag handle and table numbered column
18
+ - Updated dependencies
19
+
3
20
  ## 3.19.11
4
21
 
5
22
  ### Patch Changes
@@ -430,7 +430,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
430
430
  api === null || api === void 0 || api.core.actions.focus();
431
431
  var $mappedTo = tr.doc.resolve(mappedTo);
432
432
  var expandAncestor = (0, _utils2.findParentNodeOfTypeClosestToPos)($to, [expand, nestedExpand]);
433
- if (expandAncestor && (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_6')) {
433
+ if (expandAncestor) {
434
434
  var wasExpandExpanded = _expand.expandedState.get(expandAncestor.node);
435
435
  var updatedExpandAncestor = (0, _utils2.findParentNodeOfTypeClosestToPos)($mappedTo, [expand, nestedExpand]);
436
436
  if (wasExpandExpanded !== undefined && updatedExpandAncestor) {
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.shouldDescendIntoNode = exports.nodeDecorations = exports.findNodeDecs = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _view = require("@atlaskit/editor-prosemirror/view");
10
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
10
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
11
  var _decorationsCommon = require("./decorations-common");
13
12
  var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
@@ -18,7 +17,7 @@ var shouldDescendIntoNode = exports.shouldDescendIntoNode = function shouldDesce
18
17
  // Optimisation to avoid drawing node decorations for empty table cells
19
18
  if (['tableCell', 'tableHeader'].includes(node.type.name)) {
20
19
  var _node$firstChild;
21
- if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph' && ((0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_6') ? node.firstChild.childCount === 0 : true)) {
20
+ if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph' && node.firstChild.childCount === 0) {
22
21
  return false;
23
22
  }
24
23
  }
@@ -15,6 +15,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
16
  var _dragHandle = require("../ui/drag-handle");
17
17
  var _decorationsCommon = require("./decorations-common");
18
+ var _marks = require("./utils/marks");
18
19
  var emptyParagraphNodeDecorations = exports.emptyParagraphNodeDecorations = function emptyParagraphNodeDecorations() {
19
20
  var anchorName = "--node-anchor-paragraph-0";
20
21
  var style = "anchor-name: ".concat(anchorName, "; margin-top: 0px;");
@@ -29,7 +30,16 @@ var findHandleDec = exports.findHandleDec = function findHandleDec(decorations,
29
30
  return spec.type === _decorationsCommon.TYPE_HANDLE_DEC;
30
31
  });
31
32
  };
32
- var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDecoration(api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions, anchorRectCache) {
33
+ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDecoration(_ref) {
34
+ var api = _ref.api,
35
+ formatMessage = _ref.formatMessage,
36
+ pos = _ref.pos,
37
+ anchorName = _ref.anchorName,
38
+ nodeType = _ref.nodeType,
39
+ nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI,
40
+ handleOptions = _ref.handleOptions,
41
+ anchorRectCache = _ref.anchorRectCache,
42
+ editorState = _ref.editorState;
33
43
  if (!(0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true, {
34
44
  exposure: true
35
45
  })) {
@@ -43,11 +53,10 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
43
53
  testid: "".concat(_decorationsCommon.TYPE_HANDLE_DEC, "-").concat((0, _uuid.default)()),
44
54
  /**
45
55
  * sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
46
- * Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
47
- * weird stacking context issues. Providing an empty array causes the widget to correctly render before
48
- * this exact position at the top of the DOM.
56
+ * Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
57
+ * Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
49
58
  */
50
- marks: [],
59
+ marks: (0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_widget_fix') ? (0, _marks.getActiveBlockMarks)(editorState, pos) : [],
51
60
  destroy: function destroy(node) {
52
61
  unbind && unbind();
53
62
  if ((0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
@@ -11,6 +11,7 @@ var _view = require("@atlaskit/editor-prosemirror/view");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
12
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
13
  var _quickInsertButton = require("../ui/quick-insert-button");
14
+ var _marks = require("./utils/marks");
14
15
  var _vanillaQuickInsert = require("./vanilla-quick-insert");
15
16
  var TYPE_QUICK_INSERT = 'INSERT_BUTTON';
16
17
  var findQuickInsertInsertButtonDecoration = exports.findQuickInsertInsertButtonDecoration = function findQuickInsertInsertButtonDecoration(decorations, from, to) {
@@ -18,7 +19,17 @@ var findQuickInsertInsertButtonDecoration = exports.findQuickInsertInsertButtonD
18
19
  return spec.type === TYPE_QUICK_INSERT;
19
20
  });
20
21
  };
21
- var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function quickInsertButtonDecoration(api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache) {
22
+ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function quickInsertButtonDecoration(_ref) {
23
+ var api = _ref.api,
24
+ formatMessage = _ref.formatMessage,
25
+ rootPos = _ref.rootPos,
26
+ anchorName = _ref.anchorName,
27
+ nodeType = _ref.nodeType,
28
+ nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI,
29
+ rootAnchorName = _ref.rootAnchorName,
30
+ rootNodeType = _ref.rootNodeType,
31
+ anchorRectCache = _ref.anchorRectCache,
32
+ editorState = _ref.editorState;
22
33
  var key = (0, _uuid.default)();
23
34
  var cleanupCallbacks = [];
24
35
  var widgetSpec = (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) ? {
@@ -26,11 +37,11 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
26
37
  type: TYPE_QUICK_INSERT,
27
38
  /**
28
39
  * sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
29
- * Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
30
- * weird stacking context issues. Providing an empty array causes the widget to correctly render before
31
- * this exact position at the top of the DOM.
40
+ * Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
41
+ * Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
32
42
  */
33
- marks: [],
43
+
44
+ marks: (0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_widget_fix') ? (0, _marks.getActiveBlockMarks)(editorState, rootPos) : [],
34
45
  destroy: function destroy(_) {
35
46
  if ((0, _platformFeatureFlags.fg)('platform_editor_fix_widget_destroy')) {
36
47
  nodeViewPortalProviderAPI.remove(key);
@@ -419,14 +419,35 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
419
419
  var _activeNode9, _activeNode0, _latestActiveNode, _latestActiveNode2, _latestActiveNode3, _latestActiveNode4;
420
420
  var _oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.pos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.pos);
421
421
  decorations = decorations.remove(_oldHandle);
422
- var handleDec = (0, _decorationsDragHandle.dragHandleDecoration)(api, formatMessage, (_latestActiveNode = latestActiveNode) === null || _latestActiveNode === void 0 ? void 0 : _latestActiveNode.pos, (_latestActiveNode2 = latestActiveNode) === null || _latestActiveNode2 === void 0 ? void 0 : _latestActiveNode2.anchorName, (_latestActiveNode3 = latestActiveNode) === null || _latestActiveNode3 === void 0 ? void 0 : _latestActiveNode3.nodeType, nodeViewPortalProviderAPI, (_latestActiveNode4 = latestActiveNode) === null || _latestActiveNode4 === void 0 ? void 0 : _latestActiveNode4.handleOptions, anchorRectCache);
422
+ var handleDec = (0, _decorationsDragHandle.dragHandleDecoration)({
423
+ api: api,
424
+ formatMessage: formatMessage,
425
+ pos: (_latestActiveNode = latestActiveNode) === null || _latestActiveNode === void 0 ? void 0 : _latestActiveNode.pos,
426
+ anchorName: (_latestActiveNode2 = latestActiveNode) === null || _latestActiveNode2 === void 0 ? void 0 : _latestActiveNode2.anchorName,
427
+ nodeType: (_latestActiveNode3 = latestActiveNode) === null || _latestActiveNode3 === void 0 ? void 0 : _latestActiveNode3.nodeType,
428
+ handleOptions: (_latestActiveNode4 = latestActiveNode) === null || _latestActiveNode4 === void 0 ? void 0 : _latestActiveNode4.handleOptions,
429
+ nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
430
+ anchorRectCache: anchorRectCache,
431
+ editorState: newState
432
+ });
423
433
  decorations = decorations.add(newState.doc, [handleDec]);
424
434
  }
425
435
  if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
426
436
  var _activeNode1, _activeNode10, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
427
437
  var _oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos);
428
438
  decorations = decorations.remove(_oldQuickInsertButton);
429
- var quickInsertButton = (0, _decorationsQuickInsertButton.quickInsertButtonDecoration)(api, formatMessage, (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.rootPos, (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.anchorName, (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.nodeType, nodeViewPortalProviderAPI, (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName, (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType, anchorRectCache);
439
+ var quickInsertButton = (0, _decorationsQuickInsertButton.quickInsertButtonDecoration)({
440
+ api: api,
441
+ formatMessage: formatMessage,
442
+ anchorName: (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.anchorName,
443
+ nodeType: (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.nodeType,
444
+ nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
445
+ rootPos: (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.rootPos,
446
+ rootAnchorName: (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName,
447
+ rootNodeType: (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType,
448
+ anchorRectCache: anchorRectCache,
449
+ editorState: newState
450
+ });
430
451
  decorations = decorations.add(newState.doc, [quickInsertButton]);
431
452
  }
432
453
  }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getActiveBlockMarks = void 0;
7
+ /**
8
+ * Returns list of block marks on schema that widgets are allowed to render inside
9
+ * Currently
10
+ * - indent
11
+ * - alignment
12
+ * @param state - The editor state
13
+ * @returns The block marks
14
+ * @example
15
+ * ```ts
16
+ * const marks = getBlockMarks(state);
17
+ * console.log(marks);
18
+ * // [indent, alignment]
19
+ * ```
20
+ */
21
+ var getActiveBlockMarks = exports.getActiveBlockMarks = function getActiveBlockMarks(state, pos) {
22
+ var alignment = state.schema.marks.alignment;
23
+ var resolvedPos = state.doc.resolve(pos);
24
+ // find all active marks at the position
25
+ var marks = resolvedPos.marks();
26
+ return marks.filter(function (mark) {
27
+ return mark.type === alignment;
28
+ });
29
+ };
@@ -20,6 +20,7 @@ var _styles = require("@atlaskit/editor-common/styles");
20
20
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
21
21
  var _state = require("@atlaskit/editor-prosemirror/state");
22
22
  var _utils = require("@atlaskit/editor-prosemirror/utils");
23
+ var _consts = require("@atlaskit/editor-shared-styles/consts");
23
24
  var _dragHandleVertical = _interopRequireDefault(require("@atlaskit/icon/core/drag-handle-vertical"));
24
25
  var _dragHandler = _interopRequireDefault(require("@atlaskit/icon/glyph/drag-handler"));
25
26
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -33,7 +34,7 @@ var _analytics2 = require("../pm-plugins/utils/analytics");
33
34
  var _dragHandlePositions = require("../pm-plugins/utils/drag-handle-positions");
34
35
  var _getSelection = require("../pm-plugins/utils/getSelection");
35
36
  var _selection = require("../pm-plugins/utils/selection");
36
- var _consts = require("./consts");
37
+ var _consts2 = require("./consts");
37
38
  var _dragPreview = require("./drag-preview");
38
39
  var _anchorName = require("./utils/anchor-name");
39
40
  var _visibilityContainer = require("./visibility-container");
@@ -74,6 +75,22 @@ var buttonWrapperStyles = (0, _react2.css)({
74
75
  boxSizing: 'border-box'
75
76
  }
76
77
  });
78
+ var buttonWrapperStylesPatch = (0, _react2.css)({
79
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
80
+ '[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
81
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
82
+ marginRight: -_consts.akEditorTableToolbarSize,
83
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
84
+ paddingRight: _consts.akEditorTableToolbarSize
85
+ },
86
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
87
+ '[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
88
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
89
+ marginRight: -_consts.akEditorTableToolbarSize,
90
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
91
+ paddingRight: _consts.akEditorTableToolbarSize
92
+ }
93
+ });
77
94
 
78
95
  // update color to match quick insert button for new editor controls
79
96
  var dragHandleColor = (0, _react2.css)({
@@ -86,18 +103,18 @@ var dragHandleButtonStyles = (0, _react2.css)({
86
103
  justifyContent: 'center',
87
104
  alignItems: 'center',
88
105
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
89
- height: _consts.DRAG_HANDLE_HEIGHT,
106
+ height: _consts2.DRAG_HANDLE_HEIGHT,
90
107
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
91
- width: _consts.DRAG_HANDLE_WIDTH,
108
+ width: _consts2.DRAG_HANDLE_WIDTH,
92
109
  border: 'none',
93
110
  background: 'transparent',
94
111
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
95
- borderRadius: _consts.DRAG_HANDLE_BORDER_RADIUS,
112
+ borderRadius: _consts2.DRAG_HANDLE_BORDER_RADIUS,
96
113
  // when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
97
114
  color: "var(--ds-icon, #44546F)",
98
115
  cursor: 'grab',
99
116
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
100
- zIndex: _consts.DRAG_HANDLE_ZINDEX,
117
+ zIndex: _consts2.DRAG_HANDLE_ZINDEX,
101
118
  outline: 'none',
102
119
  '&:hover': {
103
120
  backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
@@ -128,18 +145,18 @@ var dragHandleButtonStylesOld = (0, _react2.css)({
128
145
  justifyContent: 'center',
129
146
  alignItems: 'center',
130
147
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
131
- height: _consts.DRAG_HANDLE_HEIGHT,
148
+ height: _consts2.DRAG_HANDLE_HEIGHT,
132
149
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
133
- width: _consts.DRAG_HANDLE_WIDTH,
150
+ width: _consts2.DRAG_HANDLE_WIDTH,
134
151
  border: 'none',
135
152
  background: 'transparent',
136
153
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
137
- borderRadius: _consts.DRAG_HANDLE_BORDER_RADIUS,
154
+ borderRadius: _consts2.DRAG_HANDLE_BORDER_RADIUS,
138
155
  // when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
139
156
  color: "var(--ds-icon, #44546F)",
140
157
  cursor: 'grab',
141
158
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
142
- zIndex: _consts.DRAG_HANDLE_ZINDEX,
159
+ zIndex: _consts2.DRAG_HANDLE_ZINDEX,
143
160
  outline: 'none',
144
161
  '&:hover': {
145
162
  backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
@@ -164,14 +181,14 @@ var dragHandleContainerStyles = (0, _primitives.xcss)({
164
181
  });
165
182
  var tooltipContainerStyles = (0, _react2.css)({
166
183
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
167
- bottom: "-".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
184
+ bottom: "-".concat(_consts2.STICKY_CONTROLS_TOP_MARGIN, "px"),
168
185
  position: 'sticky',
169
186
  display: 'block',
170
187
  zIndex: 100 // card = 100
171
188
  });
172
189
  var tooltipContainerStylesStickyHeaderWithMask = (0, _react2.css)({
173
190
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
174
- top: "".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
191
+ top: "".concat(_consts2.STICKY_CONTROLS_TOP_MARGIN, "px"),
175
192
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
176
193
  '[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
177
194
  top: '0'
@@ -183,7 +200,7 @@ var tooltipContainerStylesStickyHeaderWithMask = (0, _react2.css)({
183
200
  });
184
201
  var tooltipContainerStylesStickyHeaderWithoutMask = (0, _react2.css)({
185
202
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
186
- top: "".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
203
+ top: "".concat(_consts2.STICKY_CONTROLS_TOP_MARGIN, "px"),
187
204
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
188
205
  '[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
189
206
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
@@ -230,23 +247,23 @@ var handleIconDragStart = function handleIconDragStart(e) {
230
247
  };
231
248
  var getNodeSpacingForPreview = function getNodeSpacingForPreview(node) {
232
249
  if (!node) {
233
- return _consts.spacingBetweenNodesForPreview['default'];
250
+ return _consts2.spacingBetweenNodesForPreview['default'];
234
251
  }
235
252
  var nodeTypeName = node.type.name;
236
253
  if (nodeTypeName === 'heading') {
237
- return _consts.spacingBetweenNodesForPreview["heading".concat(node.attrs.level)] || _consts.spacingBetweenNodesForPreview['default'];
254
+ return _consts2.spacingBetweenNodesForPreview["heading".concat(node.attrs.level)] || _consts2.spacingBetweenNodesForPreview['default'];
238
255
  }
239
- return _consts.spacingBetweenNodesForPreview[nodeTypeName] || _consts.spacingBetweenNodesForPreview['default'];
256
+ return _consts2.spacingBetweenNodesForPreview[nodeTypeName] || _consts2.spacingBetweenNodesForPreview['default'];
240
257
  };
241
258
  var getNodeMargins = function getNodeMargins(node) {
242
259
  if (!node) {
243
- return _consts.nodeMargins['default'];
260
+ return _consts2.nodeMargins['default'];
244
261
  }
245
262
  var nodeTypeName = node.type.name;
246
263
  if (nodeTypeName === 'heading') {
247
- return _consts.nodeMargins["heading".concat(node.attrs.level)] || _consts.nodeMargins['default'];
264
+ return _consts2.nodeMargins["heading".concat(node.attrs.level)] || _consts2.nodeMargins['default'];
248
265
  }
249
- return _consts.nodeMargins[nodeTypeName] || _consts.nodeMargins['default'];
266
+ return _consts2.nodeMargins[nodeTypeName] || _consts2.nodeMargins['default'];
250
267
  };
251
268
  var useDragHandlePluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
252
269
  var macroInteractionUpdates = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'featureFlags.macroInteractionUpdates');
@@ -339,7 +356,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
339
356
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
340
357
  if (!isMultiSelect || tr.selection.empty || !e.shiftKey) {
341
358
  tr = (0, _getSelection.selectNode)(tr, startPos, nodeType);
342
- if (_consts.BLOCK_MENU_ENABLED && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
359
+ if (_consts2.BLOCK_MENU_ENABLED && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
343
360
  var _api$blockControls;
344
361
  api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
345
362
  anchorName: anchorName
@@ -348,7 +365,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
348
365
  });
349
366
  e.stopPropagation();
350
367
  }
351
- } else if (isTopLevelNode && $anchor.depth <= _consts.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH && e.shiftKey && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_shift_click_select')) {
368
+ } else if (isTopLevelNode && $anchor.depth <= _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH && e.shiftKey && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_shift_click_select')) {
352
369
  var _api$blockControls2;
353
370
  var alignAnchorHeadToSel = (0, _selection.alignAnchorHeadInDirectionOfPos)(tr.selection, startPos);
354
371
  var selectionWithExpandedHead = (0, _selection.expandSelectionHeadToNodeAtPos)(alignAnchorHeadToSel, startPos);
@@ -637,11 +654,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
637
654
  if (supportsAnchor) {
638
655
  var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
639
656
  return _objectSpread({
640
- 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(_consts.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
641
- top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)")
657
+ 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(_consts2.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
658
+ top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_consts2.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)(nodeType), "px)")
642
659
  }, bottom);
643
660
  }
644
- var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
661
+ 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) : {};
645
662
  return _objectSpread({
646
663
  left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
647
664
  top: (0, _dragHandlePositions.getTopPosition)(dom, nodeType)
@@ -683,11 +700,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
683
700
  if (supportsAnchor) {
684
701
  var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
685
702
  return _objectSpread({
686
- 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(_consts.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
687
- top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)")
703
+ 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(_consts2.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
704
+ top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_consts2.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)(nodeType), "px)")
688
705
  }, bottom);
689
706
  }
690
- var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
707
+ 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) : {};
691
708
  return _objectSpread({
692
709
  left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
693
710
  top: (0, _dragHandlePositions.getTopPosition)(dom, nodeType)
@@ -768,7 +785,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
768
785
  }
769
786
  var mSelect = api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.multiSelectDnD;
770
787
  var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
771
- if (isShiftDown && (!isTopLevelNode || isTopLevelNode && $anchor.depth > _consts.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
788
+ if (isShiftDown && (!isTopLevelNode || isTopLevelNode && $anchor.depth > _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
772
789
  setDragHandleDisabled(true);
773
790
  } else {
774
791
  setDragHandleDisabled(false);
@@ -905,7 +922,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
905
922
  });
906
923
  }
907
924
  }, (0, _react2.jsx)("span", {
908
- css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) && buttonWrapperStyles]
925
+ css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) && buttonWrapperStyles, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_15') && buttonWrapperStylesPatch]
909
926
  }, renderButton()))));
910
927
  };
911
928
  var stickyWithoutTooltip = function stickyWithoutTooltip() {
@@ -919,7 +936,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
919
936
  }, (0, _react2.jsx)("span", {
920
937
  css: [tooltipContainerStyles, (0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) && tooltipContainerStylesStickyHeaderWithMask, !(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) && tooltipContainerStylesStickyHeaderWithoutMask]
921
938
  }, (0, _react2.jsx)("span", {
922
- css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) && buttonWrapperStyles]
939
+ css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) && buttonWrapperStyles, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_15') && buttonWrapperStylesPatch]
923
940
  }, renderButton())));
924
941
  };
925
942
  var buttonWithTooltip = function buttonWithTooltip() {
@@ -434,7 +434,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
434
434
  api === null || api === void 0 ? void 0 : api.core.actions.focus();
435
435
  const $mappedTo = tr.doc.resolve(mappedTo);
436
436
  const expandAncestor = findParentNodeOfTypeClosestToPos($to, [expand, nestedExpand]);
437
- if (expandAncestor && fg('platform_editor_element_dnd_nested_fix_patch_6')) {
437
+ if (expandAncestor) {
438
438
  const wasExpandExpanded = expandedState.get(expandAncestor.node);
439
439
  const updatedExpandAncestor = findParentNodeOfTypeClosestToPos($mappedTo, [expand, nestedExpand]);
440
440
  if (wasExpandExpanded !== undefined && updatedExpandAncestor) {
@@ -1,5 +1,4 @@
1
1
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
3
  import { NESTED_DEPTH, getNodeAnchor, getNodeTypeWithLevel, TYPE_NODE_DEC } from './decorations-common';
5
4
  const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
@@ -10,7 +9,7 @@ export const shouldDescendIntoNode = node => {
10
9
  // Optimisation to avoid drawing node decorations for empty table cells
11
10
  if (['tableCell', 'tableHeader'].includes(node.type.name)) {
12
11
  var _node$firstChild;
13
- if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph' && (fg('platform_editor_element_dnd_nested_fix_patch_6') ? node.firstChild.childCount === 0 : true)) {
12
+ if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph' && node.firstChild.childCount === 0) {
14
13
  return false;
15
14
  }
16
15
  }
@@ -7,6 +7,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
7
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
8
  import { DragHandle, DragHandleWithVisibility } from '../ui/drag-handle';
9
9
  import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
10
+ import { getActiveBlockMarks } from './utils/marks';
10
11
  export const emptyParagraphNodeDecorations = () => {
11
12
  const anchorName = `--node-anchor-paragraph-0`;
12
13
  const style = `anchor-name: ${anchorName}; margin-top: 0px;`;
@@ -20,7 +21,17 @@ export const emptyParagraphNodeDecorations = () => {
20
21
  export const findHandleDec = (decorations, from, to) => {
21
22
  return decorations.find(from, to, spec => spec.type === TYPE_HANDLE_DEC);
22
23
  };
23
- export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions, anchorRectCache) => {
24
+ export const dragHandleDecoration = ({
25
+ api,
26
+ formatMessage,
27
+ pos,
28
+ anchorName,
29
+ nodeType,
30
+ nodeViewPortalProviderAPI,
31
+ handleOptions,
32
+ anchorRectCache,
33
+ editorState
34
+ }) => {
24
35
  if (!editorExperiment('platform_editor_block_control_optimise_render', true, {
25
36
  exposure: true
26
37
  })) {
@@ -34,11 +45,10 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
34
45
  testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
35
46
  /**
36
47
  * sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
37
- * Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
38
- * weird stacking context issues. Providing an empty array causes the widget to correctly render before
39
- * this exact position at the top of the DOM.
48
+ * Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
49
+ * Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
40
50
  */
41
- marks: [],
51
+ marks: fg('platform_editor_breakout_resizing_widget_fix') ? getActiveBlockMarks(editorState, pos) : [],
42
52
  destroy: node => {
43
53
  unbind && unbind();
44
54
  if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
@@ -4,12 +4,24 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
6
  import { QuickInsertWithVisibility, TypeAheadControl } from '../ui/quick-insert-button';
7
+ import { getActiveBlockMarks } from './utils/marks';
7
8
  import { createVanillaButton } from './vanilla-quick-insert';
8
9
  const TYPE_QUICK_INSERT = 'INSERT_BUTTON';
9
10
  export const findQuickInsertInsertButtonDecoration = (decorations, from, to) => {
10
11
  return decorations.find(from, to, spec => spec.type === TYPE_QUICK_INSERT);
11
12
  };
12
- export const quickInsertButtonDecoration = (api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache) => {
13
+ export const quickInsertButtonDecoration = ({
14
+ api,
15
+ formatMessage,
16
+ rootPos,
17
+ anchorName,
18
+ nodeType,
19
+ nodeViewPortalProviderAPI,
20
+ rootAnchorName,
21
+ rootNodeType,
22
+ anchorRectCache,
23
+ editorState
24
+ }) => {
13
25
  const key = uuid();
14
26
  const cleanupCallbacks = [];
15
27
  const widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
@@ -17,11 +29,11 @@ export const quickInsertButtonDecoration = (api, formatMessage, rootPos, anchorN
17
29
  type: TYPE_QUICK_INSERT,
18
30
  /**
19
31
  * sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
20
- * Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
21
- * weird stacking context issues. Providing an empty array causes the widget to correctly render before
22
- * this exact position at the top of the DOM.
32
+ * Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
33
+ * Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
23
34
  */
24
- marks: [],
35
+
36
+ marks: fg('platform_editor_breakout_resizing_widget_fix') ? getActiveBlockMarks(editorState, rootPos) : [],
25
37
  destroy: _ => {
26
38
  if (fg('platform_editor_fix_widget_destroy')) {
27
39
  nodeViewPortalProviderAPI.remove(key);
@@ -418,14 +418,35 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
418
418
  var _activeNode9, _activeNode0, _latestActiveNode, _latestActiveNode2, _latestActiveNode3, _latestActiveNode4;
419
419
  const oldHandle = findHandleDec(decorations, (_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.pos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.pos);
420
420
  decorations = decorations.remove(oldHandle);
421
- const handleDec = dragHandleDecoration(api, formatMessage, (_latestActiveNode = latestActiveNode) === null || _latestActiveNode === void 0 ? void 0 : _latestActiveNode.pos, (_latestActiveNode2 = latestActiveNode) === null || _latestActiveNode2 === void 0 ? void 0 : _latestActiveNode2.anchorName, (_latestActiveNode3 = latestActiveNode) === null || _latestActiveNode3 === void 0 ? void 0 : _latestActiveNode3.nodeType, nodeViewPortalProviderAPI, (_latestActiveNode4 = latestActiveNode) === null || _latestActiveNode4 === void 0 ? void 0 : _latestActiveNode4.handleOptions, anchorRectCache);
421
+ const handleDec = dragHandleDecoration({
422
+ api,
423
+ formatMessage,
424
+ pos: (_latestActiveNode = latestActiveNode) === null || _latestActiveNode === void 0 ? void 0 : _latestActiveNode.pos,
425
+ anchorName: (_latestActiveNode2 = latestActiveNode) === null || _latestActiveNode2 === void 0 ? void 0 : _latestActiveNode2.anchorName,
426
+ nodeType: (_latestActiveNode3 = latestActiveNode) === null || _latestActiveNode3 === void 0 ? void 0 : _latestActiveNode3.nodeType,
427
+ handleOptions: (_latestActiveNode4 = latestActiveNode) === null || _latestActiveNode4 === void 0 ? void 0 : _latestActiveNode4.handleOptions,
428
+ nodeViewPortalProviderAPI,
429
+ anchorRectCache,
430
+ editorState: newState
431
+ });
422
432
  decorations = decorations.add(newState.doc, [handleDec]);
423
433
  }
424
434
  if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && editorExperiment('platform_editor_controls', 'variant1')) {
425
435
  var _activeNode1, _activeNode10, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
426
436
  const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos);
427
437
  decorations = decorations.remove(oldQuickInsertButton);
428
- const quickInsertButton = quickInsertButtonDecoration(api, formatMessage, (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.rootPos, (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.anchorName, (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.nodeType, nodeViewPortalProviderAPI, (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName, (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType, anchorRectCache);
438
+ const quickInsertButton = quickInsertButtonDecoration({
439
+ api,
440
+ formatMessage,
441
+ anchorName: (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.anchorName,
442
+ nodeType: (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.nodeType,
443
+ nodeViewPortalProviderAPI,
444
+ rootPos: (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.rootPos,
445
+ rootAnchorName: (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName,
446
+ rootNodeType: (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType,
447
+ anchorRectCache,
448
+ editorState: newState
449
+ });
429
450
  decorations = decorations.add(newState.doc, [quickInsertButton]);
430
451
  }
431
452
  }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Returns list of block marks on schema that widgets are allowed to render inside
3
+ * Currently
4
+ * - indent
5
+ * - alignment
6
+ * @param state - The editor state
7
+ * @returns The block marks
8
+ * @example
9
+ * ```ts
10
+ * const marks = getBlockMarks(state);
11
+ * console.log(marks);
12
+ * // [indent, alignment]
13
+ * ```
14
+ */
15
+ export const getActiveBlockMarks = (state, pos) => {
16
+ const {
17
+ alignment
18
+ } = state.schema.marks;
19
+ const resolvedPos = state.doc.resolve(pos);
20
+ // find all active marks at the position
21
+ const marks = resolvedPos.marks();
22
+ return marks.filter(mark => mark.type === alignment);
23
+ };
@@ -17,6 +17,7 @@ import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
17
17
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
18
18
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
19
19
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
20
+ import { akEditorTableToolbarSize } from '@atlaskit/editor-shared-styles/consts';
20
21
  import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
21
22
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
22
23
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -66,6 +67,22 @@ const buttonWrapperStyles = css({
66
67
  boxSizing: 'border-box'
67
68
  }
68
69
  });
70
+ const buttonWrapperStylesPatch = css({
71
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
72
+ '[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
73
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
74
+ marginRight: -akEditorTableToolbarSize,
75
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
76
+ paddingRight: akEditorTableToolbarSize
77
+ },
78
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
79
+ '[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
81
+ marginRight: -akEditorTableToolbarSize,
82
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
83
+ paddingRight: akEditorTableToolbarSize
84
+ }
85
+ });
69
86
 
70
87
  // update color to match quick insert button for new editor controls
71
88
  const dragHandleColor = css({
@@ -889,7 +906,7 @@ export const DragHandle = ({
889
906
  });
890
907
  }
891
908
  }, jsx("span", {
892
- css: [shouldMaskNodeControls(nodeType, isTopLevelNode) && buttonWrapperStyles]
909
+ css: [shouldMaskNodeControls(nodeType, isTopLevelNode) && buttonWrapperStyles, fg('platform_editor_controls_patch_15') && buttonWrapperStylesPatch]
893
910
  }, renderButton()))));
894
911
  const stickyWithoutTooltip = () => jsx(Box
895
912
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
@@ -901,7 +918,7 @@ export const DragHandle = ({
901
918
  }, jsx("span", {
902
919
  css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNode) && tooltipContainerStylesStickyHeaderWithMask, !shouldMaskNodeControls(nodeType, isTopLevelNode) && tooltipContainerStylesStickyHeaderWithoutMask]
903
920
  }, jsx("span", {
904
- css: [shouldMaskNodeControls(nodeType, isTopLevelNode) && buttonWrapperStyles]
921
+ css: [shouldMaskNodeControls(nodeType, isTopLevelNode) && buttonWrapperStyles, fg('platform_editor_controls_patch_15') && buttonWrapperStylesPatch]
905
922
  }, renderButton())));
906
923
  const buttonWithTooltip = () => jsx(Tooltip, {
907
924
  content: jsx(TooltipContentWithMultipleShortcuts, {
@@ -424,7 +424,7 @@ export var moveNode = function moveNode(api) {
424
424
  api === null || api === void 0 || api.core.actions.focus();
425
425
  var $mappedTo = tr.doc.resolve(mappedTo);
426
426
  var expandAncestor = findParentNodeOfTypeClosestToPos($to, [expand, nestedExpand]);
427
- if (expandAncestor && fg('platform_editor_element_dnd_nested_fix_patch_6')) {
427
+ if (expandAncestor) {
428
428
  var wasExpandExpanded = expandedState.get(expandAncestor.node);
429
429
  var updatedExpandAncestor = findParentNodeOfTypeClosestToPos($mappedTo, [expand, nestedExpand]);
430
430
  if (wasExpandExpanded !== undefined && updatedExpandAncestor) {
@@ -1,6 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
4
  import { NESTED_DEPTH, getNodeAnchor, getNodeTypeWithLevel, TYPE_NODE_DEC } from './decorations-common';
6
5
  var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
@@ -11,7 +10,7 @@ export var shouldDescendIntoNode = function shouldDescendIntoNode(node) {
11
10
  // Optimisation to avoid drawing node decorations for empty table cells
12
11
  if (['tableCell', 'tableHeader'].includes(node.type.name)) {
13
12
  var _node$firstChild;
14
- if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph' && (fg('platform_editor_element_dnd_nested_fix_patch_6') ? node.firstChild.childCount === 0 : true)) {
13
+ if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph' && node.firstChild.childCount === 0) {
15
14
  return false;
16
15
  }
17
16
  }
@@ -8,6 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
9
  import { DragHandle, DragHandleWithVisibility } from '../ui/drag-handle';
10
10
  import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
11
+ import { getActiveBlockMarks } from './utils/marks';
11
12
  export var emptyParagraphNodeDecorations = function emptyParagraphNodeDecorations() {
12
13
  var anchorName = "--node-anchor-paragraph-0";
13
14
  var style = "anchor-name: ".concat(anchorName, "; margin-top: 0px;");
@@ -22,7 +23,16 @@ export var findHandleDec = function findHandleDec(decorations, from, to) {
22
23
  return spec.type === TYPE_HANDLE_DEC;
23
24
  });
24
25
  };
25
- export var dragHandleDecoration = function dragHandleDecoration(api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions, anchorRectCache) {
26
+ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
27
+ var api = _ref.api,
28
+ formatMessage = _ref.formatMessage,
29
+ pos = _ref.pos,
30
+ anchorName = _ref.anchorName,
31
+ nodeType = _ref.nodeType,
32
+ nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI,
33
+ handleOptions = _ref.handleOptions,
34
+ anchorRectCache = _ref.anchorRectCache,
35
+ editorState = _ref.editorState;
26
36
  if (!editorExperiment('platform_editor_block_control_optimise_render', true, {
27
37
  exposure: true
28
38
  })) {
@@ -36,11 +46,10 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
36
46
  testid: "".concat(TYPE_HANDLE_DEC, "-").concat(uuid()),
37
47
  /**
38
48
  * sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
39
- * Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
40
- * weird stacking context issues. Providing an empty array causes the widget to correctly render before
41
- * this exact position at the top of the DOM.
49
+ * Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
50
+ * Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
42
51
  */
43
- marks: [],
52
+ marks: fg('platform_editor_breakout_resizing_widget_fix') ? getActiveBlockMarks(editorState, pos) : [],
44
53
  destroy: function destroy(node) {
45
54
  unbind && unbind();
46
55
  if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
@@ -4,6 +4,7 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
6
  import { QuickInsertWithVisibility, TypeAheadControl } from '../ui/quick-insert-button';
7
+ import { getActiveBlockMarks } from './utils/marks';
7
8
  import { createVanillaButton } from './vanilla-quick-insert';
8
9
  var TYPE_QUICK_INSERT = 'INSERT_BUTTON';
9
10
  export var findQuickInsertInsertButtonDecoration = function findQuickInsertInsertButtonDecoration(decorations, from, to) {
@@ -11,7 +12,17 @@ export var findQuickInsertInsertButtonDecoration = function findQuickInsertInser
11
12
  return spec.type === TYPE_QUICK_INSERT;
12
13
  });
13
14
  };
14
- export var quickInsertButtonDecoration = function quickInsertButtonDecoration(api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache) {
15
+ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(_ref) {
16
+ var api = _ref.api,
17
+ formatMessage = _ref.formatMessage,
18
+ rootPos = _ref.rootPos,
19
+ anchorName = _ref.anchorName,
20
+ nodeType = _ref.nodeType,
21
+ nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI,
22
+ rootAnchorName = _ref.rootAnchorName,
23
+ rootNodeType = _ref.rootNodeType,
24
+ anchorRectCache = _ref.anchorRectCache,
25
+ editorState = _ref.editorState;
15
26
  var key = uuid();
16
27
  var cleanupCallbacks = [];
17
28
  var widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
@@ -19,11 +30,11 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(ap
19
30
  type: TYPE_QUICK_INSERT,
20
31
  /**
21
32
  * sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
22
- * Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
23
- * weird stacking context issues. Providing an empty array causes the widget to correctly render before
24
- * this exact position at the top of the DOM.
33
+ * Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
34
+ * Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
25
35
  */
26
- marks: [],
36
+
37
+ marks: fg('platform_editor_breakout_resizing_widget_fix') ? getActiveBlockMarks(editorState, rootPos) : [],
27
38
  destroy: function destroy(_) {
28
39
  if (fg('platform_editor_fix_widget_destroy')) {
29
40
  nodeViewPortalProviderAPI.remove(key);
@@ -412,14 +412,35 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
412
412
  var _activeNode9, _activeNode0, _latestActiveNode, _latestActiveNode2, _latestActiveNode3, _latestActiveNode4;
413
413
  var _oldHandle = findHandleDec(decorations, (_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.pos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.pos);
414
414
  decorations = decorations.remove(_oldHandle);
415
- var handleDec = dragHandleDecoration(api, formatMessage, (_latestActiveNode = latestActiveNode) === null || _latestActiveNode === void 0 ? void 0 : _latestActiveNode.pos, (_latestActiveNode2 = latestActiveNode) === null || _latestActiveNode2 === void 0 ? void 0 : _latestActiveNode2.anchorName, (_latestActiveNode3 = latestActiveNode) === null || _latestActiveNode3 === void 0 ? void 0 : _latestActiveNode3.nodeType, nodeViewPortalProviderAPI, (_latestActiveNode4 = latestActiveNode) === null || _latestActiveNode4 === void 0 ? void 0 : _latestActiveNode4.handleOptions, anchorRectCache);
415
+ var handleDec = dragHandleDecoration({
416
+ api: api,
417
+ formatMessage: formatMessage,
418
+ pos: (_latestActiveNode = latestActiveNode) === null || _latestActiveNode === void 0 ? void 0 : _latestActiveNode.pos,
419
+ anchorName: (_latestActiveNode2 = latestActiveNode) === null || _latestActiveNode2 === void 0 ? void 0 : _latestActiveNode2.anchorName,
420
+ nodeType: (_latestActiveNode3 = latestActiveNode) === null || _latestActiveNode3 === void 0 ? void 0 : _latestActiveNode3.nodeType,
421
+ handleOptions: (_latestActiveNode4 = latestActiveNode) === null || _latestActiveNode4 === void 0 ? void 0 : _latestActiveNode4.handleOptions,
422
+ nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
423
+ anchorRectCache: anchorRectCache,
424
+ editorState: newState
425
+ });
416
426
  decorations = decorations.add(newState.doc, [handleDec]);
417
427
  }
418
428
  if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && editorExperiment('platform_editor_controls', 'variant1')) {
419
429
  var _activeNode1, _activeNode10, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
420
430
  var _oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos);
421
431
  decorations = decorations.remove(_oldQuickInsertButton);
422
- var quickInsertButton = quickInsertButtonDecoration(api, formatMessage, (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.rootPos, (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.anchorName, (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.nodeType, nodeViewPortalProviderAPI, (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName, (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType, anchorRectCache);
432
+ var quickInsertButton = quickInsertButtonDecoration({
433
+ api: api,
434
+ formatMessage: formatMessage,
435
+ anchorName: (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.anchorName,
436
+ nodeType: (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.nodeType,
437
+ nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
438
+ rootPos: (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.rootPos,
439
+ rootAnchorName: (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName,
440
+ rootNodeType: (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType,
441
+ anchorRectCache: anchorRectCache,
442
+ editorState: newState
443
+ });
423
444
  decorations = decorations.add(newState.doc, [quickInsertButton]);
424
445
  }
425
446
  }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Returns list of block marks on schema that widgets are allowed to render inside
3
+ * Currently
4
+ * - indent
5
+ * - alignment
6
+ * @param state - The editor state
7
+ * @returns The block marks
8
+ * @example
9
+ * ```ts
10
+ * const marks = getBlockMarks(state);
11
+ * console.log(marks);
12
+ * // [indent, alignment]
13
+ * ```
14
+ */
15
+ export var getActiveBlockMarks = function getActiveBlockMarks(state, pos) {
16
+ var alignment = state.schema.marks.alignment;
17
+ var resolvedPos = state.doc.resolve(pos);
18
+ // find all active marks at the position
19
+ var marks = resolvedPos.marks();
20
+ return marks.filter(function (mark) {
21
+ return mark.type === alignment;
22
+ });
23
+ };
@@ -22,6 +22,7 @@ import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
22
22
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
23
23
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
24
24
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
25
+ import { akEditorTableToolbarSize } from '@atlaskit/editor-shared-styles/consts';
25
26
  import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
26
27
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
27
28
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -71,6 +72,22 @@ var buttonWrapperStyles = css({
71
72
  boxSizing: 'border-box'
72
73
  }
73
74
  });
75
+ var buttonWrapperStylesPatch = css({
76
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
77
+ '[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
78
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
79
+ marginRight: -akEditorTableToolbarSize,
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
81
+ paddingRight: akEditorTableToolbarSize
82
+ },
83
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
84
+ '[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
85
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
86
+ marginRight: -akEditorTableToolbarSize,
87
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
88
+ paddingRight: akEditorTableToolbarSize
89
+ }
90
+ });
74
91
 
75
92
  // update color to match quick insert button for new editor controls
76
93
  var dragHandleColor = css({
@@ -902,7 +919,7 @@ export var DragHandle = function DragHandle(_ref) {
902
919
  });
903
920
  }
904
921
  }, jsx("span", {
905
- css: [shouldMaskNodeControls(nodeType, isTopLevelNode) && buttonWrapperStyles]
922
+ css: [shouldMaskNodeControls(nodeType, isTopLevelNode) && buttonWrapperStyles, fg('platform_editor_controls_patch_15') && buttonWrapperStylesPatch]
906
923
  }, renderButton()))));
907
924
  };
908
925
  var stickyWithoutTooltip = function stickyWithoutTooltip() {
@@ -916,7 +933,7 @@ export var DragHandle = function DragHandle(_ref) {
916
933
  }, jsx("span", {
917
934
  css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNode) && tooltipContainerStylesStickyHeaderWithMask, !shouldMaskNodeControls(nodeType, isTopLevelNode) && tooltipContainerStylesStickyHeaderWithoutMask]
918
935
  }, jsx("span", {
919
- css: [shouldMaskNodeControls(nodeType, isTopLevelNode) && buttonWrapperStyles]
936
+ css: [shouldMaskNodeControls(nodeType, isTopLevelNode) && buttonWrapperStyles, fg('platform_editor_controls_patch_15') && buttonWrapperStylesPatch]
920
937
  }, renderButton())));
921
938
  };
922
939
  var buttonWithTooltip = function buttonWithTooltip() {
@@ -1,9 +1,22 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
4
5
  import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
6
  import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
6
7
  import { AnchorRectCache } from './utils/anchor-utils';
7
8
  export declare const emptyParagraphNodeDecorations: () => Decoration;
8
9
  export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
9
- export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, handleOptions?: HandleOptions, anchorRectCache?: AnchorRectCache) => Decoration;
10
+ type DragHandleDecorationParams = {
11
+ api: ExtractInjectionAPI<BlockControlsPlugin>;
12
+ formatMessage: IntlShape['formatMessage'];
13
+ pos: number;
14
+ anchorName: string;
15
+ nodeType: string;
16
+ nodeViewPortalProviderAPI: PortalProviderAPI;
17
+ handleOptions?: HandleOptions;
18
+ anchorRectCache?: AnchorRectCache;
19
+ editorState: EditorState;
20
+ };
21
+ export declare const dragHandleDecoration: ({ api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions, anchorRectCache, editorState, }: DragHandleDecorationParams) => Decoration;
22
+ export {};
@@ -1,8 +1,22 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import { EditorState } from '@atlaskit/editor-prosemirror/state';
4
5
  import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
6
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
6
7
  import { AnchorRectCache } from './utils/anchor-utils';
7
8
  export declare const findQuickInsertInsertButtonDecoration: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
8
- export declare const quickInsertButtonDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], rootPos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, rootAnchorName?: string, rootNodeType?: string, anchorRectCache?: AnchorRectCache) => Decoration;
9
+ type QuickInsertButtonDecorationParams = {
10
+ api: ExtractInjectionAPI<BlockControlsPlugin>;
11
+ formatMessage: IntlShape['formatMessage'];
12
+ rootPos: number;
13
+ anchorName: string;
14
+ nodeType: string;
15
+ nodeViewPortalProviderAPI: PortalProviderAPI;
16
+ rootAnchorName?: string;
17
+ rootNodeType?: string;
18
+ anchorRectCache?: AnchorRectCache;
19
+ editorState: EditorState;
20
+ };
21
+ export declare const quickInsertButtonDecoration: ({ api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache, editorState, }: QuickInsertButtonDecorationParams) => Decoration;
22
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
2
+ /**
3
+ * Returns list of block marks on schema that widgets are allowed to render inside
4
+ * Currently
5
+ * - indent
6
+ * - alignment
7
+ * @param state - The editor state
8
+ * @returns The block marks
9
+ * @example
10
+ * ```ts
11
+ * const marks = getBlockMarks(state);
12
+ * console.log(marks);
13
+ * // [indent, alignment]
14
+ * ```
15
+ */
16
+ export declare const getActiveBlockMarks: (state: EditorState, pos: number) => import("prosemirror-model").Mark[];
@@ -1,9 +1,22 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
4
5
  import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
6
  import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
6
7
  import { AnchorRectCache } from './utils/anchor-utils';
7
8
  export declare const emptyParagraphNodeDecorations: () => Decoration;
8
9
  export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
9
- export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, handleOptions?: HandleOptions, anchorRectCache?: AnchorRectCache) => Decoration;
10
+ type DragHandleDecorationParams = {
11
+ api: ExtractInjectionAPI<BlockControlsPlugin>;
12
+ formatMessage: IntlShape['formatMessage'];
13
+ pos: number;
14
+ anchorName: string;
15
+ nodeType: string;
16
+ nodeViewPortalProviderAPI: PortalProviderAPI;
17
+ handleOptions?: HandleOptions;
18
+ anchorRectCache?: AnchorRectCache;
19
+ editorState: EditorState;
20
+ };
21
+ export declare const dragHandleDecoration: ({ api, formatMessage, pos, anchorName, nodeType, nodeViewPortalProviderAPI, handleOptions, anchorRectCache, editorState, }: DragHandleDecorationParams) => Decoration;
22
+ export {};
@@ -1,8 +1,22 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import { EditorState } from '@atlaskit/editor-prosemirror/state';
4
5
  import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
6
  import type { BlockControlsPlugin } from '../blockControlsPluginType';
6
7
  import { AnchorRectCache } from './utils/anchor-utils';
7
8
  export declare const findQuickInsertInsertButtonDecoration: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
8
- export declare const quickInsertButtonDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], rootPos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, rootAnchorName?: string, rootNodeType?: string, anchorRectCache?: AnchorRectCache) => Decoration;
9
+ type QuickInsertButtonDecorationParams = {
10
+ api: ExtractInjectionAPI<BlockControlsPlugin>;
11
+ formatMessage: IntlShape['formatMessage'];
12
+ rootPos: number;
13
+ anchorName: string;
14
+ nodeType: string;
15
+ nodeViewPortalProviderAPI: PortalProviderAPI;
16
+ rootAnchorName?: string;
17
+ rootNodeType?: string;
18
+ anchorRectCache?: AnchorRectCache;
19
+ editorState: EditorState;
20
+ };
21
+ export declare const quickInsertButtonDecoration: ({ api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache, editorState, }: QuickInsertButtonDecorationParams) => Decoration;
22
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
2
+ /**
3
+ * Returns list of block marks on schema that widgets are allowed to render inside
4
+ * Currently
5
+ * - indent
6
+ * - alignment
7
+ * @param state - The editor state
8
+ * @returns The block marks
9
+ * @example
10
+ * ```ts
11
+ * const marks = getBlockMarks(state);
12
+ * console.log(marks);
13
+ * // [indent, alignment]
14
+ * ```
15
+ */
16
+ export declare const getActiveBlockMarks: (state: EditorState, pos: number) => import("prosemirror-model").Mark[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.19.11",
3
+ "version": "3.19.13",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -8,8 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
- "team": "Editor: Jenga",
12
- "runReact18": true
11
+ "team": "Editor: Jenga"
13
12
  },
14
13
  "repository": "https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo",
15
14
  "main": "dist/cjs/index.js",
@@ -33,13 +32,13 @@
33
32
  },
34
33
  "dependencies": {
35
34
  "@atlaskit/adf-schema": "^47.6.0",
36
- "@atlaskit/editor-common": "^107.3.0",
35
+ "@atlaskit/editor-common": "^107.4.0",
37
36
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
38
37
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
39
38
  "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
40
39
  "@atlaskit/editor-plugin-feature-flags": "^1.4.0",
41
40
  "@atlaskit/editor-plugin-interaction": "^3.0.0",
42
- "@atlaskit/editor-plugin-metrics": "^3.5.0",
41
+ "@atlaskit/editor-plugin-metrics": "^3.6.0",
43
42
  "@atlaskit/editor-plugin-quick-insert": "^2.6.0",
44
43
  "@atlaskit/editor-plugin-selection": "^2.2.0",
45
44
  "@atlaskit/editor-plugin-type-ahead": "^2.7.0",
@@ -56,7 +55,7 @@
56
55
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
57
56
  "@atlaskit/primitives": "^14.10.0",
58
57
  "@atlaskit/theme": "^18.0.0",
59
- "@atlaskit/tmp-editor-statsig": "^8.4.0",
58
+ "@atlaskit/tmp-editor-statsig": "^8.6.0",
60
59
  "@atlaskit/tokens": "^5.4.0",
61
60
  "@atlaskit/tooltip": "^20.3.0",
62
61
  "@babel/runtime": "^7.0.0",
@@ -114,9 +113,6 @@
114
113
  "platform_editor_element_drag_and_drop_ed_23873": {
115
114
  "type": "boolean"
116
115
  },
117
- "platform_editor_element_dnd_nested_fix_patch_6": {
118
- "type": "boolean"
119
- },
120
116
  "platform_editor_use_nested_table_pm_nodes": {
121
117
  "type": "boolean"
122
118
  },
@@ -191,6 +187,9 @@
191
187
  },
192
188
  "platform_editor_controls_patch_15": {
193
189
  "type": "boolean"
190
+ },
191
+ "platform_editor_breakout_resizing_widget_fix": {
192
+ "type": "boolean"
194
193
  }
195
194
  }
196
195
  }