@atlaskit/editor-plugin-block-controls 6.2.0 → 6.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/pm-plugins/decorations-anchor.js +7 -3
  3. package/dist/cjs/pm-plugins/decorations-drop-target-active.js +2 -1
  4. package/dist/cjs/pm-plugins/handle-mouse-over.js +36 -12
  5. package/dist/cjs/pm-plugins/main.js +3 -2
  6. package/dist/cjs/pm-plugins/quick-insert-calculate-position.js +2 -1
  7. package/dist/cjs/pm-plugins/utils/anchor-utils.js +3 -2
  8. package/dist/cjs/ui/block-menu.js +3 -2
  9. package/dist/cjs/ui/drag-handle.js +12 -10
  10. package/dist/cjs/ui/drop-target-layout.js +4 -2
  11. package/dist/cjs/ui/drop-target.js +20 -6
  12. package/dist/cjs/ui/global-styles.js +96 -1
  13. package/dist/cjs/ui/inline-drop-target.js +39 -5
  14. package/dist/cjs/ui/quick-insert-button.js +3 -2
  15. package/dist/cjs/ui/utils/anchor-name.js +4 -0
  16. package/dist/cjs/ui/utils/dom-attr-name.js +53 -0
  17. package/dist/es2019/pm-plugins/decorations-anchor.js +7 -3
  18. package/dist/es2019/pm-plugins/decorations-drop-target-active.js +2 -1
  19. package/dist/es2019/pm-plugins/handle-mouse-over.js +30 -12
  20. package/dist/es2019/pm-plugins/main.js +3 -2
  21. package/dist/es2019/pm-plugins/quick-insert-calculate-position.js +2 -1
  22. package/dist/es2019/pm-plugins/utils/anchor-utils.js +3 -2
  23. package/dist/es2019/ui/block-menu.js +3 -2
  24. package/dist/es2019/ui/drag-handle.js +12 -10
  25. package/dist/es2019/ui/drop-target-layout.js +4 -2
  26. package/dist/es2019/ui/drop-target.js +20 -6
  27. package/dist/es2019/ui/global-styles.js +131 -1
  28. package/dist/es2019/ui/inline-drop-target.js +39 -5
  29. package/dist/es2019/ui/quick-insert-button.js +4 -3
  30. package/dist/es2019/ui/utils/anchor-name.js +4 -0
  31. package/dist/es2019/ui/utils/dom-attr-name.js +47 -0
  32. package/dist/esm/pm-plugins/decorations-anchor.js +7 -3
  33. package/dist/esm/pm-plugins/decorations-drop-target-active.js +2 -1
  34. package/dist/esm/pm-plugins/handle-mouse-over.js +35 -12
  35. package/dist/esm/pm-plugins/main.js +3 -2
  36. package/dist/esm/pm-plugins/quick-insert-calculate-position.js +2 -1
  37. package/dist/esm/pm-plugins/utils/anchor-utils.js +3 -2
  38. package/dist/esm/ui/block-menu.js +3 -2
  39. package/dist/esm/ui/drag-handle.js +12 -10
  40. package/dist/esm/ui/drop-target-layout.js +4 -2
  41. package/dist/esm/ui/drop-target.js +20 -6
  42. package/dist/esm/ui/global-styles.js +96 -1
  43. package/dist/esm/ui/inline-drop-target.js +39 -5
  44. package/dist/esm/ui/quick-insert-button.js +4 -3
  45. package/dist/esm/ui/utils/anchor-name.js +4 -0
  46. package/dist/esm/ui/utils/dom-attr-name.js +47 -0
  47. package/dist/types/pm-plugins/decorations-anchor.d.ts +2 -0
  48. package/dist/types/ui/utils/dom-attr-name.d.ts +5 -0
  49. package/dist/types-ts4.5/pm-plugins/decorations-anchor.d.ts +2 -0
  50. package/dist/types-ts4.5/ui/utils/dom-attr-name.d.ts +5 -0
  51. package/package.json +4 -4
@@ -15,6 +15,7 @@ var _constants = require("@atlaskit/theme/constants");
15
15
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
16
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
17
  var _consts = require("./consts");
18
+ var _domAttrName = require("./utils/dom-attr-name");
18
19
  /**
19
20
  * @jsxRuntime classic
20
21
  * @jsx jsx
@@ -26,6 +27,7 @@ var _consts = require("./consts");
26
27
  * including those within table rows and media.
27
28
  */
28
29
  var dragHandlerAnchorSelector = '[data-drag-handler-anchor-name]:not([data-drag-handler-node-type="tableRow"], [data-drag-handler-node-type="media"])';
30
+ var dragHandlerAnchorSelectorNext = "[".concat(_domAttrName.NODE_ANCHOR_ATTR_NAME, "]:not([data-prosemirror-node-name=\"tableRow\"], [data-prosemirror-node-name=\"tableCell\"], [data-prosemirror-node-name=\"media\"])");
29
31
  var gutterPaddingWidth = function gutterPaddingWidth() {
30
32
  return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? "".concat((0, _editorSharedStyles.akEditorGutterPaddingDynamic)(), "px") : '100%';
31
33
  };
@@ -89,6 +91,63 @@ var extendedHoverZone = function extendedHoverZone() {
89
91
  display: 'none'
90
92
  }));
91
93
  };
94
+ var extendedHoverZoneNext = function extendedHoverZoneNext() {
95
+ return (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, ".block-ctrl-drag-preview ".concat(dragHandlerAnchorSelectorNext, "::after"), {
96
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
97
+ display: 'none !important'
98
+ }), '.ProseMirror', (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "&& ".concat(dragHandlerAnchorSelectorNext, "::after"), {
99
+ content: '""',
100
+ position: 'absolute',
101
+ top: 0,
102
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
103
+ left: "-".concat(_consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, "px"),
104
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
105
+ width: "".concat(_consts.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, "px"),
106
+ height: '100%',
107
+ cursor: 'default',
108
+ zIndex: 1
109
+ }), "&& ".concat(dragHandlerAnchorSelectorNext, ":not([").concat(_domAttrName.NODE_ANCHOR_ATTR_NAME, "] [").concat(_domAttrName.NODE_ANCHOR_ATTR_NAME, "])::after"), {
110
+ content: '""',
111
+ position: 'absolute',
112
+ top: 0,
113
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
114
+ left: gutterPaddingLeft(),
115
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
116
+ width: gutterPaddingWidth(),
117
+ height: '100%',
118
+ cursor: 'default',
119
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
120
+ zIndex: -1
121
+ }), "&& :is(.pm-table-cell-content-wrap, .pm-table-header-content-wrap) > ".concat(dragHandlerAnchorSelectorNext, "::after"), {
122
+ content: '""',
123
+ position: 'absolute',
124
+ top: 0,
125
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
126
+ left: 0,
127
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
128
+ width: 0,
129
+ height: '100%',
130
+ cursor: 'default',
131
+ zIndex: 1
132
+ }), '&& [data-drag-handler-anchor-name][data-layout-column]::after', {
133
+ content: '""',
134
+ position: 'absolute',
135
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
136
+ top: "".concat(-_styles.DRAG_HANDLE_WIDTH / 2, "px"),
137
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
138
+ left: 0,
139
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
140
+ width: '100%',
141
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
142
+ height: "".concat(_styles.DRAG_HANDLE_WIDTH, "px"),
143
+ cursor: 'default',
144
+ zIndex: 1
145
+ })), 'hr[data-drag-handler-anchor-name]', {
146
+ overflow: 'visible'
147
+ }), '[data-blocks-drag-handle-container="true"] + [data-drag-handler-anchor-depth="0"]::after', {
148
+ display: 'none'
149
+ }));
150
+ };
92
151
  var extendHoverZoneReduced = (0, _react.css)({
93
152
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
94
153
  '.ProseMirror': (0, _defineProperty2.default)({}, "&& [data-drag-handler-anchor-depth=\"0\"]".concat(dragHandlerAnchorSelector, "::after"), (0, _defineProperty2.default)({}, "@container editor-area (max-width: ".concat(_editorSharedStyles.akEditorFullPageNarrowBreakout, "px)"), {
@@ -98,6 +157,15 @@ var extendHoverZoneReduced = (0, _react.css)({
98
157
  width: "".concat(_editorSharedStyles.akEditorGutterPaddingReduced, "px")
99
158
  }))
100
159
  });
160
+ var extendHoverZoneReducedNext = (0, _react.css)({
161
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
162
+ '.ProseMirror': (0, _defineProperty2.default)({}, "> ".concat(dragHandlerAnchorSelectorNext, "::after"), (0, _defineProperty2.default)({}, "@container editor-area (max-width: ".concat(_editorSharedStyles.akEditorFullPageNarrowBreakout, "px)"), {
163
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
164
+ left: "-".concat(_editorSharedStyles.akEditorGutterPaddingReduced, "px"),
165
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
166
+ width: "".concat(_editorSharedStyles.akEditorGutterPaddingReduced, "px")
167
+ }))
168
+ });
101
169
  var extendedDragZone = (0, _react.css)({
102
170
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
103
171
  '.ProseMirror': (0, _defineProperty2.default)({}, "&& [data-drag-handler-anchor-depth=\"0\"]".concat(dragHandlerAnchorSelector, "::after"), {
@@ -105,6 +173,13 @@ var extendedDragZone = (0, _react.css)({
105
173
  left: "calc((100% - var(--ak-editor-max-container-width))/2)"
106
174
  })
107
175
  });
176
+ var extendedDragZoneNext = (0, _react.css)({
177
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
178
+ '.ProseMirror': (0, _defineProperty2.default)({}, "&& > ".concat(dragHandlerAnchorSelectorNext, "::after"), {
179
+ width: 'var(--ak-editor-max-container-width)',
180
+ left: "calc((100% - var(--ak-editor-max-container-width))/2)"
181
+ })
182
+ });
108
183
  var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
109
184
  var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
110
185
  var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
@@ -279,6 +354,17 @@ var withRelativePosStyle = (0, _react.css)({
279
354
  content: "\"".concat(_whitespace.ZERO_WIDTH_SPACE, "\"")
280
355
  })
281
356
  });
357
+ var withRelativePosStyleNext = (0, _react.css)({
358
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
359
+ '.ProseMirror': (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "&& ".concat(dragHandlerAnchorSelectorNext), {
360
+ position: 'relative'
361
+ }), "&& ".concat(dragHandlerAnchorSelectorNext, ":has(> .ProseMirror-trailingBreak:only-child)::before"), {
362
+ // Workaround to force safari to show the cursor on blank lines even when there is no content
363
+ // See: CONFCLOUD-80210
364
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
365
+ content: "\"".concat(_whitespace.ZERO_WIDTH_SPACE, "\"")
366
+ })
367
+ });
282
368
  var withAnchorNameZindexStyle = (0, _react.css)({
283
369
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
284
370
  '.ProseMirror': {
@@ -288,6 +374,15 @@ var withAnchorNameZindexStyle = (0, _react.css)({
288
374
  }
289
375
  }
290
376
  });
377
+ var withAnchorNameZindexStyleNext = (0, _react.css)({
378
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
379
+ '.ProseMirror': {
380
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
381
+ '> [data-drag-handler-anchor-name]': {
382
+ zIndex: 1
383
+ }
384
+ }
385
+ });
291
386
 
292
387
  // This style is used to define width for block card (with datasource) that does not have layout
293
388
  // In full-width editor, block card has width of full-width layout
@@ -309,6 +404,6 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
309
404
  disabled: !(0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
310
405
  });
311
406
  return (0, _react.jsx)(_react.Global, {
312
- styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
407
+ styles: [globalStyles(), globalDnDStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? withRelativePosStyleNext : withRelativePosStyle, topLevelNodeMarginStyles, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle]
313
408
  });
314
409
  };
@@ -13,6 +13,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
13
  var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
14
14
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
15
15
  var _colors = require("@atlaskit/theme/colors");
16
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
17
  var _decorationsCommon = require("../pm-plugins/decorations-common");
17
18
  var _activeAnchorTracker = require("../pm-plugins/utils/active-anchor-tracker");
18
19
  var _anchorUtils = require("../pm-plugins/utils/anchor-utils");
@@ -100,8 +101,11 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
100
101
  isDraggedOver = _useState2[0],
101
102
  setIsDraggedOver = _useState2[1];
102
103
  var anchorName = (0, _react.useMemo)(function () {
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)) || '' : '';
106
+ }
103
107
  return nextNode ? (0, _decorationsCommon.getNodeAnchor)(nextNode) : '';
104
- }, [nextNode]);
108
+ }, [api, getPos, nextNode]);
105
109
  var _useActiveAnchorTrack = (0, _activeAnchorTracker.useActiveAnchorTracker)(anchorName),
106
110
  _useActiveAnchorTrack2 = (0, _slicedToArray2.default)(_useActiveAnchorTrack, 1),
107
111
  isActiveAnchor = _useActiveAnchorTrack2[0];
@@ -110,6 +114,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
110
114
  if (!nextNode) {
111
115
  return defaultNodeDimension;
112
116
  }
117
+ var nextNodePos = getPos();
113
118
  var innerContainerWidth = null;
114
119
  var targetAnchorName = anchorName;
115
120
  if (['blockCard', 'embedCard', 'extension'].includes(nextNode.type.name)) {
@@ -128,7 +133,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
128
133
  innerContainerWidth = "calc(var(--ak-editor--line-length) * ".concat(percentageWidth, ")");
129
134
  }
130
135
  } else if (nextNode.type.name === 'table' && nextNode.firstChild) {
131
- var tableWidthAnchor = (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
136
+ var tableWidthAnchor = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? typeof nextNodePos === 'number' ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.firstChild, nextNodePos + 1)) || '' : '' : (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
132
137
  var isNumberColumnEnabled = Boolean(nextNode.attrs.isNumberColumnEnabled);
133
138
  if ((0, _anchorUtils.isAnchorSupported)()) {
134
139
  innerContainerWidth = isNumberColumnEnabled ? "calc(anchor-size(".concat(tableWidthAnchor, " width) + ").concat(TABLE_NUMBERED_COLUMN_WIDTH, "px)") : "anchor-size(".concat(tableWidthAnchor, " width)");
@@ -141,13 +146,42 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
141
146
  innerContainerWidth = "min(".concat(nextNode.attrs.width, "px, ").concat(innerContainerWidth, ")");
142
147
  }
143
148
  } else if (nextNode.type.name === 'mediaSingle' && nextNode.firstChild) {
144
- targetAnchorName = (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
149
+ if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true)) {
150
+ var _nextNode$firstChild;
151
+ // check pos is a number
152
+ if (typeof nextNodePos === 'number' && ((_nextNode$firstChild = nextNode.firstChild) === null || _nextNode$firstChild === void 0 ? void 0 : _nextNode$firstChild.type.name) === 'media') {
153
+ targetAnchorName = (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.firstChild, nextNodePos + 1)) || '';
154
+ }
155
+ } else {
156
+ targetAnchorName = (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
157
+ }
145
158
  }
146
159
 
147
160
  // Set the height target anchor name to the first or last column of the layout section so that it also works for stacked layout
148
161
  var heightTargetAnchorName = targetAnchorName;
149
162
  if (nextNode.type.name === 'layoutSection' && nextNode.firstChild && nextNode.lastChild) {
150
- heightTargetAnchorName = isLeftPosition ? (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild) : (0, _decorationsCommon.getNodeAnchor)(nextNode.lastChild);
163
+ if (isLeftPosition) {
164
+ if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true)) {
165
+ if (typeof nextNodePos === 'number') {
166
+ heightTargetAnchorName = (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.firstChild, nextNodePos + 1)) || '';
167
+ } else {
168
+ heightTargetAnchorName = '';
169
+ }
170
+ } else {
171
+ heightTargetAnchorName = (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
172
+ }
173
+ } else {
174
+ if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true)) {
175
+ if (typeof nextNodePos === 'number') {
176
+ var lastNodeStartPos = nextNode.content.size - nextNode.lastChild.nodeSize;
177
+ heightTargetAnchorName = (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.lastChild, lastNodeStartPos + 1)) || '';
178
+ } else {
179
+ heightTargetAnchorName = '';
180
+ }
181
+ } else {
182
+ heightTargetAnchorName = (0, _decorationsCommon.getNodeAnchor)(nextNode.lastChild);
183
+ }
184
+ }
151
185
  }
152
186
  if ((0, _anchorUtils.isAnchorSupported)()) {
153
187
  var width = innerContainerWidth || "anchor-size(".concat(targetAnchorName, " width)");
@@ -179,7 +213,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
179
213
  };
180
214
  }
181
215
  return defaultNodeDimension;
182
- }, [anchorName, anchorRectCache, nextNode, position, isLeftPosition]);
216
+ }, [nextNode, anchorName, anchorRectCache, getPos, api, isLeftPosition, position]);
183
217
  var onDrop = (0, _react.useCallback)(function () {
184
218
  var _api$blockControls;
185
219
  var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
@@ -26,6 +26,7 @@ var _widgetPositions = require("../pm-plugins/utils/widget-positions");
26
26
  var _consts = require("./consts");
27
27
  var _anchorName = require("./utils/anchor-name");
28
28
  var _documentChecks = require("./utils/document-checks");
29
+ var _domAttrName = require("./utils/dom-attr-name");
29
30
  var _editorCommands = require("./utils/editor-commands");
30
31
  var _visibilityContainer = require("./visibility-container");
31
32
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -121,7 +122,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
121
122
  view: view,
122
123
  anchorName: rootAnchorName
123
124
  });
124
- var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(safeAnchorName, "\"]"));
125
+ var dom = view.dom.querySelector("[".concat((0, _domAttrName.getAnchorAttrName)(), "=\"").concat(safeAnchorName, "\"]"));
125
126
  var hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
126
127
  var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
127
128
  var isBlockCard = rootNodeType === 'blockCard';
@@ -161,7 +162,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
161
162
  (0, _react.useEffect)(function () {
162
163
  var cleanUpTransitionListener;
163
164
  if (rootNodeType === 'extension' || rootNodeType === 'embedCard') {
164
- var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(rootAnchorName, "\"]"));
165
+ var dom = view.dom.querySelector("[".concat((0, _domAttrName.getAnchorAttrName)(), "=\"").concat(rootAnchorName, "\"]"));
165
166
  if (!dom) {
166
167
  return;
167
168
  }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.refreshAnchorName = void 0;
7
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
7
8
  var _decorationsAnchor = require("../../pm-plugins/decorations-anchor");
8
9
  var _main = require("../../pm-plugins/main");
9
10
  /**
@@ -15,6 +16,9 @@ var refreshAnchorName = exports.refreshAnchorName = function refreshAnchorName(_
15
16
  view = _ref.view,
16
17
  anchorName = _ref.anchorName;
17
18
  var newAnchorName = anchorName || '';
19
+ if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true)) {
20
+ return newAnchorName;
21
+ }
18
22
  var pos = getPos();
19
23
  if (anchorName || pos === undefined) {
20
24
  return newAnchorName;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTypeNameFromDom = exports.getTypeNameAttrName = exports.getAnchorAttrName = exports.NODE_NODE_TYPE_ATTR_NAME = exports.NODE_ANCHOR_ATTR_NAME = void 0;
7
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
+ var NODE_ANCHOR_ATTR_NAME = exports.NODE_ANCHOR_ATTR_NAME = 'data-node-anchor';
9
+ var NODE_NODE_TYPE_ATTR_NAME = exports.NODE_NODE_TYPE_ATTR_NAME = 'data-prosemirror-node-name';
10
+ var getAnchorAttrName = exports.getAnchorAttrName = function getAnchorAttrName() {
11
+ if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true)) {
12
+ return NODE_ANCHOR_ATTR_NAME;
13
+ }
14
+ return 'data-drag-handler-anchor-name';
15
+ };
16
+ var getTypeNameAttrName = exports.getTypeNameAttrName = function getTypeNameAttrName() {
17
+ if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true)) {
18
+ return NODE_NODE_TYPE_ATTR_NAME;
19
+ }
20
+ return 'data-drag-handler-node-type';
21
+ };
22
+ var isHeadingElement = function isHeadingElement(element) {
23
+ var headingTags = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
24
+ return headingTags.includes(element.tagName);
25
+ };
26
+
27
+ // This function replicates the behavior of getNodeTypeWithLevel by returning the same value.
28
+ var getTypeNameFromDom = exports.getTypeNameFromDom = function getTypeNameFromDom(element) {
29
+ if (!element) {
30
+ return '';
31
+ }
32
+ var nodeType = element === null || element === void 0 ? void 0 : element.getAttribute(NODE_NODE_TYPE_ATTR_NAME);
33
+ if (!nodeType) {
34
+ return '';
35
+ }
36
+ if (isHeadingElement(element)) {
37
+ switch (element.tagName) {
38
+ case 'H1':
39
+ return 'heading-1';
40
+ case 'H2':
41
+ return 'heading-2';
42
+ case 'H3':
43
+ return 'heading-3';
44
+ case 'H4':
45
+ return 'heading-4';
46
+ case 'H5':
47
+ return 'heading-5';
48
+ case 'H6':
49
+ return 'heading-6';
50
+ }
51
+ }
52
+ return nodeType;
53
+ };
@@ -1,10 +1,11 @@
1
1
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
- import { NESTED_DEPTH, getNodeAnchor, getNodeTypeWithLevel, TYPE_NODE_DEC } from './decorations-common';
4
+ import { getNodeAnchor, getNodeTypeWithLevel, NESTED_DEPTH, TYPE_NODE_DEC } from './decorations-common';
4
5
  const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
5
- const IGNORE_NODES_NEXT = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption'];
6
+ export const IGNORE_NODES_NEXT = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption'];
6
7
  const IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
7
- const IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT = ['listItem', 'taskList', 'decisionList'];
8
+ export const IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT = ['listItem', 'taskList', 'decisionList'];
8
9
  export const shouldDescendIntoNode = node => {
9
10
  // Optimisation to avoid drawing node decorations for empty table cells
10
11
  if (['tableCell', 'tableHeader'].includes(node.type.name)) {
@@ -94,6 +95,9 @@ export const findNodeDecs = (state, decorations, from, to) => {
94
95
  };
95
96
  export const nodeDecorations = (newState, from, to) => {
96
97
  const decs = [];
98
+ if (expValEquals('platform_editor_native_anchor_support', 'isEnabled', true)) {
99
+ return [];
100
+ }
97
101
  const docFrom = from === undefined || from < 0 ? 0 : from;
98
102
  const docTo = to === undefined || to > newState.doc.nodeSize - 2 ? newState.doc.nodeSize - 2 : to;
99
103
  const ignore_nodes = editorExperiment('advanced_layouts', true) ? IGNORE_NODES_NEXT : IGNORE_NODES;
@@ -1,5 +1,6 @@
1
1
  import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
2
2
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
5
  import { getNodeAnchor } from './decorations-common';
5
6
  import { createDropTargetDecoration, createLayoutDropTargetDecoration } from './decorations-drop-target';
@@ -213,7 +214,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
213
214
  }
214
215
  }
215
216
  }
216
- defaultActiveAnchorTracker.emit(getNodeAnchor(rootNodeWithPos.node));
217
+ defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(rootNodeWithPos.node, rootNodeWithPos.pos) || '' : getNodeAnchor(rootNodeWithPos.node));
217
218
  return {
218
219
  decsToAdd,
219
220
  decsToRemove
@@ -1,6 +1,10 @@
1
+ import memoizeOne from 'memoize-one';
1
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
4
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
3
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
+ import { getAnchorAttrName, getTypeNameAttrName, getTypeNameFromDom, NODE_ANCHOR_ATTR_NAME } from '../ui/utils/dom-attr-name';
7
+ import { IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, IGNORE_NODES_NEXT } from './decorations-anchor';
4
8
  const isEmptyNestedParagraphOrHeading = target => {
5
9
  if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
6
10
  var _target$parentElement;
@@ -8,6 +12,20 @@ const isEmptyNestedParagraphOrHeading = target => {
8
12
  }
9
13
  return false;
10
14
  };
15
+ const getNodeSelector = (ignoreNodes, ignoreNodeDescendants) => {
16
+ const baseSelector = `[${NODE_ANCHOR_ATTR_NAME}]`;
17
+ if (ignoreNodes.length === 0 && ignoreNodeDescendants.length === 0) {
18
+ return baseSelector;
19
+ }
20
+ const ignoreNodeSelectorList = ignoreNodes.map(node => `[data-prosemirror-node-name="${node}"]`);
21
+ const ignoreNodeDescendantsSelectorList = ignoreNodeDescendants.map(node => `[data-prosemirror-node-name="${node}"] [data-node-anchor]`);
22
+ const ignoreSelector = [...ignoreNodeSelectorList, ...ignoreNodeDescendantsSelectorList, '[data-prosemirror-node-inline="true"]'].join(', ');
23
+ return `${baseSelector}:not(${ignoreSelector})`;
24
+ };
25
+ const getDefaultNodeSelector = memoizeOne(() => {
26
+ // we don't show handler for node nested in table
27
+ return getNodeSelector([...IGNORE_NODES_NEXT], [...IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT, 'table']);
28
+ });
11
29
  export const handleMouseOver = (view, event, api) => {
12
30
  var _api$blockControls, _api$editorDisabled, _target$classList;
13
31
  const {
@@ -39,21 +57,21 @@ export const handleMouseOver = (view, event, api) => {
39
57
  if (target !== null && target !== void 0 && (_target$classList = target.classList) !== null && _target$classList !== void 0 && _target$classList.contains('ProseMirror')) {
40
58
  return false;
41
59
  }
42
- let rootElement = target === null || target === void 0 ? void 0 : target.closest('[data-drag-handler-anchor-name]');
60
+ let rootElement = target === null || target === void 0 ? void 0 : target.closest(expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? getDefaultNodeSelector() : `[data-drag-handler-anchor-name]`);
43
61
  if (rootElement) {
44
62
  var _rootElement$parentEl;
45
63
  // We want to exlude handles from showing for empty paragraph and heading nodes
46
64
  if (isEmptyNestedParagraphOrHeading(rootElement)) {
47
65
  return false;
48
66
  }
49
- if (rootElement.getAttribute('data-drag-handler-node-type') === 'media' && editorExperiment('advanced_layouts', true)) {
50
- rootElement = rootElement.closest('[data-drag-handler-anchor-name][data-drag-handler-node-type="mediaSingle"]');
67
+ if (rootElement.getAttribute(getTypeNameAttrName()) === 'media' && editorExperiment('advanced_layouts', true)) {
68
+ rootElement = rootElement.closest(`[${getAnchorAttrName()}][${getTypeNameAttrName()}="mediaSingle"]`);
51
69
  if (!rootElement) {
52
70
  return false;
53
71
  }
54
72
  }
55
- const parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest('[data-drag-handler-anchor-name]');
56
- const parentElementType = parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
73
+ const parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest(`[${getAnchorAttrName()}]`);
74
+ const parentElementType = expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? getTypeNameFromDom(parentElement) : parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
57
75
  if (editorExperiment('advanced_layouts', true)) {
58
76
  // We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
59
77
  if (fg('platform_editor_table_drag_handle_shift_fix')) {
@@ -61,8 +79,8 @@ export const handleMouseOver = (view, event, api) => {
61
79
  rootElement = parentElement;
62
80
  } else if (parentElement && parentElementType === 'tableRow') {
63
81
  var _parentElement$parent;
64
- const grandparentElement = parentElement === null || parentElement === void 0 ? void 0 : (_parentElement$parent = parentElement.parentElement) === null || _parentElement$parent === void 0 ? void 0 : _parentElement$parent.closest('[data-drag-handler-anchor-name]');
65
- const grandparentElementType = grandparentElement === null || grandparentElement === void 0 ? void 0 : grandparentElement.getAttribute('data-drag-handler-node-type');
82
+ const grandparentElement = parentElement === null || parentElement === void 0 ? void 0 : (_parentElement$parent = parentElement.parentElement) === null || _parentElement$parent === void 0 ? void 0 : _parentElement$parent.closest(`[${getAnchorAttrName()}]`);
83
+ const grandparentElementType = expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? getTypeNameFromDom(grandparentElement) : grandparentElement === null || grandparentElement === void 0 ? void 0 : grandparentElement.getAttribute('data-drag-handler-node-type');
66
84
  if (grandparentElement && grandparentElementType === 'table') {
67
85
  rootElement = grandparentElement;
68
86
  }
@@ -79,7 +97,7 @@ export const handleMouseOver = (view, event, api) => {
79
97
 
80
98
  // Ignored via go/ees005
81
99
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
82
- const anchorName = rootElement.getAttribute('data-drag-handler-anchor-name');
100
+ const anchorName = rootElement.getAttribute(getAnchorAttrName());
83
101
  // No need to update handle position if its already there
84
102
  if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName) === anchorName) {
85
103
  return false;
@@ -120,13 +138,13 @@ export const handleMouseOver = (view, event, api) => {
120
138
  if (targetPos !== rootPos) {
121
139
  const rootDOM = view.nodeDOM(rootPos);
122
140
  if (rootDOM instanceof HTMLElement) {
123
- var _rootDOM$getAttribute, _rootDOM$getAttribute2;
124
- rootAnchorName = (_rootDOM$getAttribute = rootDOM.getAttribute('data-drag-handler-anchor-name')) !== null && _rootDOM$getAttribute !== void 0 ? _rootDOM$getAttribute : undefined;
125
- rootNodeType = (_rootDOM$getAttribute2 = rootDOM.getAttribute('data-drag-handler-node-type')) !== null && _rootDOM$getAttribute2 !== void 0 ? _rootDOM$getAttribute2 : undefined;
141
+ var _rootDOM$getAttribute;
142
+ rootAnchorName = (_rootDOM$getAttribute = rootDOM.getAttribute(getAnchorAttrName())) !== null && _rootDOM$getAttribute !== void 0 ? _rootDOM$getAttribute : undefined;
143
+ rootNodeType = expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? getTypeNameFromDom(rootDOM) : rootDOM.getAttribute('data-drag-handler-node-type');
126
144
  }
127
145
  }
128
146
  }
129
- const nodeType = rootElement.getAttribute('data-drag-handler-node-type');
147
+ const nodeType = expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? getTypeNameFromDom(rootElement) : rootElement.getAttribute('data-drag-handler-node-type');
130
148
  if (nodeType) {
131
149
  if (editorExperiment('platform_editor_controls', 'variant1')) {
132
150
  var _api$core, _api$blockControls2, _rootPos, _rootAnchorName, _rootNodeType;
@@ -16,6 +16,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
16
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
17
17
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
18
18
  import { BLOCK_MENU_ENABLED } from '../ui/consts';
19
+ import { getAnchorAttrName } from '../ui/utils/dom-attr-name';
19
20
  import { findNodeDecs, nodeDecorations } from './decorations-anchor';
20
21
  import { dragHandleDecoration, emptyParagraphNodeDecorations, findHandleDec } from './decorations-drag-handle';
21
22
  import { dropTargetDecorations, findDropTargetDecs } from './decorations-drop-target';
@@ -642,7 +643,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
642
643
  event.preventDefault();
643
644
  return false;
644
645
  }
645
- const nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : (_event$target$closest = _event$target.closest) === null || _event$target$closest === void 0 ? void 0 : _event$target$closest.call(_event$target, '[data-drag-handler-anchor-name]');
646
+ const nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : (_event$target$closest = _event$target.closest) === null || _event$target$closest === void 0 ? void 0 : _event$target$closest.call(_event$target, `[${getAnchorAttrName()}]`);
646
647
  if (!nodeElement) {
647
648
  return false;
648
649
  }
@@ -683,7 +684,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
683
684
  if (isHTMLElement(event.target)) {
684
685
  const closestParentElement = event.target.closest('[data-drag-handler-anchor-depth="0"]');
685
686
  if (closestParentElement) {
686
- const currentAnchor = closestParentElement.getAttribute('data-drag-handler-anchor-name');
687
+ const currentAnchor = closestParentElement.getAttribute(getAnchorAttrName());
687
688
  if (currentAnchor) {
688
689
  defaultActiveAnchorTracker.emit(currentAnchor);
689
690
  }
@@ -1,5 +1,6 @@
1
1
  import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_LEFT_OFFSET } from '../ui/consts';
2
2
  import { refreshAnchorName } from '../ui/utils/anchor-name';
3
+ import { getAnchorAttrName } from '../ui/utils/dom-attr-name';
3
4
  import { getControlBottomCSSValue, getControlHeightCSSValue, getNodeHeight, getTopPosition, shouldBeSticky } from './utils/drag-handle-positions';
4
5
  import { getLeftPositionForRootElement } from './utils/widget-positions';
5
6
 
@@ -23,7 +24,7 @@ export const calculatePosition = ({
23
24
  view,
24
25
  anchorName: rootAnchorName
25
26
  });
26
- const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${safeAnchorName}"]`);
27
+ const dom = view.dom.querySelector(`[${getAnchorAttrName()}="${safeAnchorName}"]`);
27
28
  const hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
28
29
  const isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
29
30
  const isBlockCard = rootNodeType === 'blockCard';
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import memoizeOne from 'memoize-one';
3
+ import { getAnchorAttrName } from '../../ui/utils/dom-attr-name';
3
4
  export const isAnchorSupported = memoizeOne(() => {
4
5
  // directly use CSS would cause failed SSR tests.
5
6
  if (window.CSS && window.CSS.supports) {
@@ -21,9 +22,9 @@ export class AnchorRectCache {
21
22
  getRects() {
22
23
  if (this.isDirty) {
23
24
  var _this$view;
24
- const anchorElements = ((_this$view = this.view) === null || _this$view === void 0 ? void 0 : _this$view.dom.querySelectorAll('[data-drag-handler-anchor-name]')) || [];
25
+ const anchorElements = ((_this$view = this.view) === null || _this$view === void 0 ? void 0 : _this$view.dom.querySelectorAll(`[${getAnchorAttrName()}]`)) || [];
25
26
  this.anchorRectMap = Array.from(anchorElements).reduce((prev, curr) => {
26
- const anchorName = curr.getAttribute('data-drag-handler-anchor-name');
27
+ const anchorName = curr.getAttribute(getAnchorAttrName());
27
28
  if (anchorName) {
28
29
  return {
29
30
  ...prev,
@@ -7,6 +7,7 @@ import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styl
7
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
8
  import { getBlockMenuItems, menuItemsCallback } from './block-menu-items';
9
9
  import { BLOCK_MENU_WIDTH } from './consts';
10
+ import { getAnchorAttrName } from './utils/dom-attr-name';
10
11
  const BlockMenuContent = ({
11
12
  editorView,
12
13
  mountPoint,
@@ -16,7 +17,7 @@ const BlockMenuContent = ({
16
17
  menuTriggerBy,
17
18
  formatMessage
18
19
  }) => {
19
- const activeNodeSelector = `[data-drag-handler-anchor-name=${menuTriggerBy}]`;
20
+ const activeNodeSelector = `[${getAnchorAttrName()}=${menuTriggerBy}]`;
20
21
  const targetHandleRef = document.querySelector(activeNodeSelector);
21
22
  const items = getBlockMenuItems(formatMessage);
22
23
  const handleOpenChange = useCallback(payload => {
@@ -106,7 +107,7 @@ const BlockMenu = ({
106
107
  formatMessage: formatMessage
107
108
  });
108
109
  }
109
- const activeNodeSelector = `[data-drag-handler-anchor-name=${menuTriggerBy}]`;
110
+ const activeNodeSelector = `[${getAnchorAttrName()}=${menuTriggerBy}]`;
110
111
  const targetHandleRef = document.querySelector(activeNodeSelector);
111
112
  const items = getBlockMenuItems(formatMessage);
112
113
  const handleOpenChange = payload => {