@atlaskit/editor-plugin-block-controls 12.0.1 → 12.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/pm-plugins/decorations-drop-target-active.js +8 -5
- package/dist/cjs/pm-plugins/decorations-drop-target.js +7 -2
- package/dist/cjs/pm-plugins/quick-insert-calculate-position.js +2 -1
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +8 -1
- package/dist/cjs/ui/consts.js +14 -0
- package/dist/cjs/ui/drag-handle.js +1 -1
- package/dist/cjs/ui/inline-drop-target.js +2 -1
- package/dist/cjs/ui/quick-insert-button.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drop-target-active.js +4 -5
- package/dist/es2019/pm-plugins/decorations-drop-target.js +4 -2
- package/dist/es2019/pm-plugins/quick-insert-calculate-position.js +2 -1
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +4 -1
- package/dist/es2019/ui/consts.js +14 -0
- package/dist/es2019/ui/drag-handle.js +1 -1
- package/dist/es2019/ui/inline-drop-target.js +2 -1
- package/dist/es2019/ui/quick-insert-button.js +1 -1
- package/dist/esm/pm-plugins/decorations-drop-target-active.js +7 -5
- package/dist/esm/pm-plugins/decorations-drop-target.js +7 -2
- package/dist/esm/pm-plugins/quick-insert-calculate-position.js +2 -1
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +7 -1
- package/dist/esm/ui/consts.js +14 -0
- package/dist/esm/ui/drag-handle.js +1 -1
- package/dist/esm/ui/inline-drop-target.js +2 -1
- package/dist/esm/ui/quick-insert-button.js +1 -1
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 12.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4c8035c5703fd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4c8035c5703fd) -
|
|
8
|
+
Add multiBodiedExtension support to block controls
|
|
9
|
+
|
|
3
10
|
## 12.0.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.getActiveDropTargetDecorations = exports.canMoveNodeOrSliceToPos = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
7
10
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
12
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
16
|
var _decorationsCommon = require("./decorations-common");
|
|
@@ -19,18 +23,17 @@ var _validation = require("./utils/validation");
|
|
|
19
23
|
* List of parent node types that can have child nodes
|
|
20
24
|
*/
|
|
21
25
|
var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
|
|
22
|
-
var PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK = [].concat(PARENT_WITH_END_DROP_TARGET, ['bodiedSyncBlock']);
|
|
23
26
|
|
|
24
27
|
/**
|
|
25
28
|
* List of node types that does not allow drop targets at before or after the node.
|
|
26
29
|
*/
|
|
27
30
|
var NODE_WITH_NO_PARENT_POS = ['tableCell', 'tableHeader', 'layoutColumn'];
|
|
28
31
|
var UNSUPPORTED_LAYOUT_CONTENT = ['syncBlock', 'bodiedSyncBlock'];
|
|
32
|
+
var getContainerNodeTypes = (0, _memoizeOne.default)(function () {
|
|
33
|
+
return [].concat(PARENT_WITH_END_DROP_TARGET, (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : []), (0, _toConsumableArray2.default)((0, _experiments.editorExperiment)('platform_synced_block', true) ? ['bodiedSyncBlock'] : []));
|
|
34
|
+
});
|
|
29
35
|
var isContainerNode = function isContainerNode(node) {
|
|
30
|
-
|
|
31
|
-
return PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK.includes(node.type.name);
|
|
32
|
-
}
|
|
33
|
-
return PARENT_WITH_END_DROP_TARGET.includes(node.type.name);
|
|
36
|
+
return getContainerNodeTypes().includes(node.type.name);
|
|
34
37
|
};
|
|
35
38
|
var canMoveNodeOrSliceToPos = exports.canMoveNodeOrSliceToPos = function canMoveNodeOrSliceToPos(state, node, parent, index, $toPos, activeNode) {
|
|
36
39
|
// For deciding to show drop targets or not when multiple nodes are selected
|
|
@@ -6,11 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.findDropTargetDecs = exports.dropTargetDecorations = exports.createLayoutDropTargetDecoration = exports.createDropTargetDecoration = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _react = require("react");
|
|
11
|
+
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
10
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
11
13
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
15
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
18
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
19
|
var _consts = require("../ui/consts");
|
|
@@ -23,8 +26,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
23
26
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
24
27
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
|
|
25
28
|
var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
|
|
26
|
-
var PARENT_WITH_END_DROP_TARGET_NEXT = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension', 'bodiedSyncBlock'];
|
|
27
29
|
var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
30
|
+
var getParentTypesWithEndDropTarget = (0, _memoizeOne.default)(function () {
|
|
31
|
+
return [].concat(PARENT_WITH_END_DROP_TARGET, (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : []), (0, _toConsumableArray2.default)((0, _experiments.editorExperiment)('platform_synced_block', true) ? ['bodiedSyncBlock'] : []));
|
|
32
|
+
});
|
|
28
33
|
var shouldDescend = function shouldDescend(node) {
|
|
29
34
|
return !['mediaSingle', 'paragraph', 'heading'].includes(node.type.name);
|
|
30
35
|
};
|
|
@@ -197,6 +202,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
|
|
|
197
202
|
var selectionFrom = Math.min(expandedAnchor.pos, expandedHead.pos);
|
|
198
203
|
var selectionTo = Math.max(expandedAnchor.pos, expandedHead.pos);
|
|
199
204
|
var handleInsideSelection = activeNodePos !== undefined && activeNodePos >= selectionFrom && activeNodePos <= selectionTo;
|
|
205
|
+
var parentTypesWithEndDropTarget = getParentTypesWithEndDropTarget();
|
|
200
206
|
newState.doc.nodesBetween(docFrom, docTo, function (node, pos, parent, index) {
|
|
201
207
|
var depth = 0;
|
|
202
208
|
// drop target deco at the end position
|
|
@@ -244,7 +250,6 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
|
|
|
244
250
|
pushNodeStack(node, depth);
|
|
245
251
|
return false; //not valid pos, so nested not valid either
|
|
246
252
|
}
|
|
247
|
-
var parentTypesWithEndDropTarget = (0, _experiments.editorExperiment)('platform_synced_block', true) ? PARENT_WITH_END_DROP_TARGET_NEXT : PARENT_WITH_END_DROP_TARGET;
|
|
248
253
|
var parentTypeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _utils.getBaseNodeTypeName)(parent.type) : parent.type.name;
|
|
249
254
|
if (parent.lastChild === node && !(0, _utils.isEmptyParagraph)(node) && parentTypesWithEndDropTarget.includes(parentTypeName)) {
|
|
250
255
|
endPos = pos + node.nodeSize;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.calculatePosition = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _consts = require("../ui/consts");
|
|
10
11
|
var _anchorName = require("../ui/utils/anchor-name");
|
|
11
12
|
var _domAttrName = require("../ui/utils/dom-attr-name");
|
|
@@ -34,7 +35,7 @@ var calculatePosition = exports.calculatePosition = function calculatePosition(_
|
|
|
34
35
|
});
|
|
35
36
|
var dom = view.dom.querySelector("[".concat((0, _domAttrName.getAnchorAttrName)(), "=\"").concat(safeAnchorName, "\"]"));
|
|
36
37
|
var hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
37
|
-
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
38
|
+
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension' || rootNodeType === 'multiBodiedExtension' && (0, _platformFeatureFlags.fg)('confluence_frontend_native_tabs_extension');
|
|
38
39
|
var isBlockCard = rootNodeType === 'blockCard';
|
|
39
40
|
var isEmbedCard = rootNodeType === 'embedCard';
|
|
40
41
|
var isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.shouldMaskNodeControls = exports.shouldBeSticky = exports.getTopPosition = exports.getNodeHeight = exports.getLeftPosition = exports.getControlHeightCSSValue = exports.getControlBottomCSSValue = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
7
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
12
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
9
13
|
var _consts = require("../../ui/consts");
|
|
10
14
|
var STICKY_NODES = ['panel', 'table', 'expand', 'layoutSection', 'bodiedExtension'];
|
|
@@ -59,8 +63,11 @@ var getLeftPosition = exports.getLeftPosition = function getLeftPosition(dom, ty
|
|
|
59
63
|
var getNodeHeight = exports.getNodeHeight = function getNodeHeight(dom, anchor, anchorRectCache) {
|
|
60
64
|
return (anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchor)) || (dom === null || dom === void 0 ? void 0 : dom.offsetHeight);
|
|
61
65
|
};
|
|
66
|
+
var getStickyNodes = (0, _memoizeOne.default)(function () {
|
|
67
|
+
return [].concat(STICKY_NODES, (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : []));
|
|
68
|
+
});
|
|
62
69
|
var shouldBeSticky = exports.shouldBeSticky = function shouldBeSticky(nodeType) {
|
|
63
|
-
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') &&
|
|
70
|
+
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && getStickyNodes().includes(nodeType);
|
|
64
71
|
};
|
|
65
72
|
var getControlBottomCSSValue = exports.getControlBottomCSSValue = function getControlBottomCSSValue(anchor, isSticky, isTopLevelNode, isLayoutColumn) {
|
|
66
73
|
return (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn || !isSticky || !isTopLevelNode ? {
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
14
|
var _dropTargetMarginMap;
|
|
14
15
|
var DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_HEIGHT = 24;
|
|
@@ -92,6 +93,11 @@ var getNestedNodeLeftPaddingMargin = exports.getNestedNodeLeftPaddingMargin = fu
|
|
|
92
93
|
switch (nodeType) {
|
|
93
94
|
case 'bodiedExtension':
|
|
94
95
|
return '28px';
|
|
96
|
+
case 'multiBodiedExtension':
|
|
97
|
+
if ((0, _platformFeatureFlags.fg)('confluence_frontend_native_tabs_extension')) {
|
|
98
|
+
return '28px';
|
|
99
|
+
}
|
|
100
|
+
return "".concat(_styles.DRAG_HANDLE_WIDTH + DRAG_HANDLE_NARROW_GAP, "px");
|
|
95
101
|
case 'expand':
|
|
96
102
|
case 'nestedExpand':
|
|
97
103
|
return '24px';
|
|
@@ -234,6 +240,10 @@ var spacingBetweenNodesForPreview = exports.spacingBetweenNodesForPreview = {
|
|
|
234
240
|
top: '0',
|
|
235
241
|
bottom: '0'
|
|
236
242
|
},
|
|
243
|
+
multiBodiedExtension: {
|
|
244
|
+
top: '0',
|
|
245
|
+
bottom: '0'
|
|
246
|
+
},
|
|
237
247
|
extension: {
|
|
238
248
|
top: '0',
|
|
239
249
|
bottom: '0'
|
|
@@ -313,6 +323,10 @@ var nodeMargins = exports.nodeMargins = {
|
|
|
313
323
|
top: 0,
|
|
314
324
|
bottom: 0
|
|
315
325
|
},
|
|
326
|
+
multiBodiedExtension: {
|
|
327
|
+
top: 0,
|
|
328
|
+
bottom: 0
|
|
329
|
+
},
|
|
316
330
|
extension: {
|
|
317
331
|
top: 12,
|
|
318
332
|
bottom: 12
|
|
@@ -819,7 +819,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
819
819
|
}) : anchorName;
|
|
820
820
|
var dom = view.dom.querySelector("[".concat((0, _domAttrName.getAnchorAttrName)(), "=\"").concat(safeAnchorName, "\"]"));
|
|
821
821
|
var hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
|
|
822
|
-
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension';
|
|
822
|
+
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension' && (0, _platformFeatureFlags.fg)('confluence_frontend_native_tabs_extension');
|
|
823
823
|
var isBlockCard = nodeType === 'blockCard' && !!blockCardWidth;
|
|
824
824
|
var isEmbedCard = nodeType === 'embedCard';
|
|
825
825
|
var isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
14
15
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
15
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
@@ -83,7 +84,7 @@ var getWidthOffset = function getWidthOffset(node, width, position) {
|
|
|
83
84
|
return isLeftPosition ? "0.5*(var(--ak-editor--line-length) - ".concat(width, ")") : "-0.5*(var(--ak-editor--line-length) - ".concat(width, ")");
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
if (node.type.name === 'bodiedExtension' || node.type.name === 'extension') {
|
|
87
|
+
if (node.type.name === 'bodiedExtension' || node.type.name === 'extension' || node.type.name === 'multiBodiedExtension' && (0, _platformFeatureFlags.fg)('confluence_frontend_native_tabs_extension')) {
|
|
87
88
|
return '-12px';
|
|
88
89
|
}
|
|
89
90
|
};
|
|
@@ -191,7 +191,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
191
191
|
});
|
|
192
192
|
var dom = view.dom.querySelector("[".concat((0, _domAttrName.getAnchorAttrName)(), "=\"").concat(safeAnchorName, "\"]"));
|
|
193
193
|
var hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
194
|
-
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
194
|
+
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension' || rootNodeType === 'multiBodiedExtension' && (0, _platformFeatureFlags.fg)('confluence_frontend_native_tabs_extension');
|
|
195
195
|
var isBlockCard = rootNodeType === 'blockCard';
|
|
196
196
|
var isEmbedCard = rootNodeType === 'embedCard';
|
|
197
197
|
var isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import memoizeOne from 'memoize-one';
|
|
1
2
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
2
3
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
3
4
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
8
|
import { getNodeAnchor } from './decorations-common';
|
|
@@ -14,18 +16,15 @@ import { canMoveNodeToIndex, canMoveSliceToIndex, isInSameLayout } from './utils
|
|
|
14
16
|
* List of parent node types that can have child nodes
|
|
15
17
|
*/
|
|
16
18
|
const PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
|
|
17
|
-
const PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK = [...PARENT_WITH_END_DROP_TARGET, 'bodiedSyncBlock'];
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* List of node types that does not allow drop targets at before or after the node.
|
|
21
22
|
*/
|
|
22
23
|
const NODE_WITH_NO_PARENT_POS = ['tableCell', 'tableHeader', 'layoutColumn'];
|
|
23
24
|
const UNSUPPORTED_LAYOUT_CONTENT = ['syncBlock', 'bodiedSyncBlock'];
|
|
25
|
+
const getContainerNodeTypes = memoizeOne(() => [...PARENT_WITH_END_DROP_TARGET, ...(fg('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : []), ...(editorExperiment('platform_synced_block', true) ? ['bodiedSyncBlock'] : [])]);
|
|
24
26
|
const isContainerNode = node => {
|
|
25
|
-
|
|
26
|
-
return PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK.includes(node.type.name);
|
|
27
|
-
}
|
|
28
|
-
return PARENT_WITH_END_DROP_TARGET.includes(node.type.name);
|
|
27
|
+
return getContainerNodeTypes().includes(node.type.name);
|
|
29
28
|
};
|
|
30
29
|
export const canMoveNodeOrSliceToPos = (state, node, parent, index, $toPos, activeNode) => {
|
|
31
30
|
// For deciding to show drop targets or not when multiple nodes are selected
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
+
import memoizeOne from 'memoize-one';
|
|
2
3
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
4
|
import uuid from 'uuid';
|
|
4
5
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
5
6
|
import { getBaseNodeTypeName, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
6
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
11
|
import { nodeMargins } from '../ui/consts';
|
|
@@ -14,8 +16,8 @@ import { maxLayoutColumnSupported } from './utils/consts';
|
|
|
14
16
|
import { canMoveNodeToIndex, canMoveSliceToIndex, isInSameLayout } from './utils/validation';
|
|
15
17
|
const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
|
|
16
18
|
const PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
|
|
17
|
-
const PARENT_WITH_END_DROP_TARGET_NEXT = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension', 'bodiedSyncBlock'];
|
|
18
19
|
const DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
20
|
+
const getParentTypesWithEndDropTarget = memoizeOne(() => [...PARENT_WITH_END_DROP_TARGET, ...(fg('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : []), ...(editorExperiment('platform_synced_block', true) ? ['bodiedSyncBlock'] : [])]);
|
|
19
21
|
const shouldDescend = node => {
|
|
20
22
|
return !['mediaSingle', 'paragraph', 'heading'].includes(node.type.name);
|
|
21
23
|
};
|
|
@@ -186,6 +188,7 @@ export const dropTargetDecorations = (newState, api, formatMessage, nodeViewPort
|
|
|
186
188
|
const selectionFrom = Math.min(expandedAnchor.pos, expandedHead.pos);
|
|
187
189
|
const selectionTo = Math.max(expandedAnchor.pos, expandedHead.pos);
|
|
188
190
|
const handleInsideSelection = activeNodePos !== undefined && activeNodePos >= selectionFrom && activeNodePos <= selectionTo;
|
|
191
|
+
const parentTypesWithEndDropTarget = getParentTypesWithEndDropTarget();
|
|
189
192
|
newState.doc.nodesBetween(docFrom, docTo, (node, pos, parent, index) => {
|
|
190
193
|
let depth = 0;
|
|
191
194
|
// drop target deco at the end position
|
|
@@ -233,7 +236,6 @@ export const dropTargetDecorations = (newState, api, formatMessage, nodeViewPort
|
|
|
233
236
|
pushNodeStack(node, depth);
|
|
234
237
|
return false; //not valid pos, so nested not valid either
|
|
235
238
|
}
|
|
236
|
-
const parentTypesWithEndDropTarget = editorExperiment('platform_synced_block', true) ? PARENT_WITH_END_DROP_TARGET_NEXT : PARENT_WITH_END_DROP_TARGET;
|
|
237
239
|
const parentTypeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(parent.type) : parent.type.name;
|
|
238
240
|
if (parent.lastChild === node && !isEmptyParagraph(node) && parentTypesWithEndDropTarget.includes(parentTypeName)) {
|
|
239
241
|
endPos = pos + node.nodeSize;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_LEFT_OFFSET } from '../ui/consts';
|
|
2
3
|
import { refreshAnchorName } from '../ui/utils/anchor-name';
|
|
3
4
|
import { getAnchorAttrName } from '../ui/utils/dom-attr-name';
|
|
@@ -26,7 +27,7 @@ export const calculatePosition = ({
|
|
|
26
27
|
});
|
|
27
28
|
const dom = view.dom.querySelector(`[${getAnchorAttrName()}="${safeAnchorName}"]`);
|
|
28
29
|
const hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
29
|
-
const isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
30
|
+
const isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension' || rootNodeType === 'multiBodiedExtension' && fg('confluence_frontend_native_tabs_extension');
|
|
30
31
|
const isBlockCard = rootNodeType === 'blockCard';
|
|
31
32
|
const isEmbedCard = rootNodeType === 'embedCard';
|
|
32
33
|
const isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import memoizeOne from 'memoize-one';
|
|
1
2
|
import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
5
|
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT, DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, dragHandleGap } from '../../ui/consts';
|
|
4
6
|
const STICKY_NODES = ['panel', 'table', 'expand', 'layoutSection', 'bodiedExtension'];
|
|
@@ -51,8 +53,9 @@ export const getLeftPosition = (dom, type, innerContainer, macroInteractionUpdat
|
|
|
51
53
|
|
|
52
54
|
// anchorRectCache seems to have a 100% cache miss rate
|
|
53
55
|
export const getNodeHeight = (dom, anchor, anchorRectCache) => (anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchor)) || (dom === null || dom === void 0 ? void 0 : dom.offsetHeight);
|
|
56
|
+
const getStickyNodes = memoizeOne(() => [...STICKY_NODES, ...(fg('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : [])]);
|
|
54
57
|
export const shouldBeSticky = nodeType => {
|
|
55
|
-
return editorExperiment('platform_editor_controls', 'variant1') &&
|
|
58
|
+
return editorExperiment('platform_editor_controls', 'variant1') && getStickyNodes().includes(nodeType);
|
|
56
59
|
};
|
|
57
60
|
export const getControlBottomCSSValue = (anchor, isSticky, isTopLevelNode, isLayoutColumn) => {
|
|
58
61
|
return editorExperiment('advanced_layouts', true) && isLayoutColumn || !isSticky || !isTopLevelNode ? {
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { breakoutResizableNodes as breakoutResizableNodesNew } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
export const DRAG_HANDLE_HEIGHT = 24;
|
|
6
7
|
export const DRAG_HANDLE_BORDER_RADIUS = 4;
|
|
@@ -83,6 +84,11 @@ export const getNestedNodeLeftPaddingMargin = nodeType => {
|
|
|
83
84
|
switch (nodeType) {
|
|
84
85
|
case 'bodiedExtension':
|
|
85
86
|
return '28px';
|
|
87
|
+
case 'multiBodiedExtension':
|
|
88
|
+
if (fg('confluence_frontend_native_tabs_extension')) {
|
|
89
|
+
return '28px';
|
|
90
|
+
}
|
|
91
|
+
return `${DRAG_HANDLE_WIDTH + DRAG_HANDLE_NARROW_GAP}px`;
|
|
86
92
|
case 'expand':
|
|
87
93
|
case 'nestedExpand':
|
|
88
94
|
return '24px';
|
|
@@ -243,6 +249,10 @@ export const spacingBetweenNodesForPreview = {
|
|
|
243
249
|
top: '0',
|
|
244
250
|
bottom: '0'
|
|
245
251
|
},
|
|
252
|
+
multiBodiedExtension: {
|
|
253
|
+
top: '0',
|
|
254
|
+
bottom: '0'
|
|
255
|
+
},
|
|
246
256
|
extension: {
|
|
247
257
|
top: '0',
|
|
248
258
|
bottom: '0'
|
|
@@ -322,6 +332,10 @@ export const nodeMargins = {
|
|
|
322
332
|
top: 0,
|
|
323
333
|
bottom: 0
|
|
324
334
|
},
|
|
335
|
+
multiBodiedExtension: {
|
|
336
|
+
top: 0,
|
|
337
|
+
bottom: 0
|
|
338
|
+
},
|
|
325
339
|
extension: {
|
|
326
340
|
top: 12,
|
|
327
341
|
bottom: 12
|
|
@@ -799,7 +799,7 @@ export const DragHandle = ({
|
|
|
799
799
|
}) : anchorName;
|
|
800
800
|
const dom = view.dom.querySelector(`[${getAnchorAttrName()}="${safeAnchorName}"]`);
|
|
801
801
|
const hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
|
|
802
|
-
const isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension';
|
|
802
|
+
const isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension' && fg('confluence_frontend_native_tabs_extension');
|
|
803
803
|
const isBlockCard = nodeType === 'blockCard' && !!blockCardWidth;
|
|
804
804
|
const isEmbedCard = nodeType === 'embedCard';
|
|
805
805
|
const isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -8,6 +8,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
12
13
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
13
14
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -72,7 +73,7 @@ const getWidthOffset = (node, width, position) => {
|
|
|
72
73
|
return isLeftPosition ? `0.5*(var(--ak-editor--line-length) - ${width})` : `-0.5*(var(--ak-editor--line-length) - ${width})`;
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
if (node.type.name === 'bodiedExtension' || node.type.name === 'extension') {
|
|
76
|
+
if (node.type.name === 'bodiedExtension' || node.type.name === 'extension' || node.type.name === 'multiBodiedExtension' && fg('confluence_frontend_native_tabs_extension')) {
|
|
76
77
|
return '-12px';
|
|
77
78
|
}
|
|
78
79
|
};
|
|
@@ -180,7 +180,7 @@ export const TypeAheadControl = ({
|
|
|
180
180
|
});
|
|
181
181
|
const dom = view.dom.querySelector(`[${getAnchorAttrName()}="${safeAnchorName}"]`);
|
|
182
182
|
const hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
183
|
-
const isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
183
|
+
const isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension' || rootNodeType === 'multiBodiedExtension' && fg('confluence_frontend_native_tabs_extension');
|
|
184
184
|
const isBlockCard = rootNodeType === 'blockCard';
|
|
185
185
|
const isEmbedCard = rootNodeType === 'embedCard';
|
|
186
186
|
const isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import memoizeOne from 'memoize-one';
|
|
1
3
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
2
4
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
3
5
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
9
|
import { getNodeAnchor } from './decorations-common';
|
|
@@ -14,18 +17,17 @@ import { canMoveNodeToIndex, canMoveSliceToIndex, isInSameLayout } from './utils
|
|
|
14
17
|
* List of parent node types that can have child nodes
|
|
15
18
|
*/
|
|
16
19
|
var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
|
|
17
|
-
var PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK = [].concat(PARENT_WITH_END_DROP_TARGET, ['bodiedSyncBlock']);
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* List of node types that does not allow drop targets at before or after the node.
|
|
21
23
|
*/
|
|
22
24
|
var NODE_WITH_NO_PARENT_POS = ['tableCell', 'tableHeader', 'layoutColumn'];
|
|
23
25
|
var UNSUPPORTED_LAYOUT_CONTENT = ['syncBlock', 'bodiedSyncBlock'];
|
|
26
|
+
var getContainerNodeTypes = memoizeOne(function () {
|
|
27
|
+
return [].concat(PARENT_WITH_END_DROP_TARGET, _toConsumableArray(fg('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : []), _toConsumableArray(editorExperiment('platform_synced_block', true) ? ['bodiedSyncBlock'] : []));
|
|
28
|
+
});
|
|
24
29
|
var isContainerNode = function isContainerNode(node) {
|
|
25
|
-
|
|
26
|
-
return PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK.includes(node.type.name);
|
|
27
|
-
}
|
|
28
|
-
return PARENT_WITH_END_DROP_TARGET.includes(node.type.name);
|
|
30
|
+
return getContainerNodeTypes().includes(node.type.name);
|
|
29
31
|
};
|
|
30
32
|
export var canMoveNodeOrSliceToPos = function canMoveNodeOrSliceToPos(state, node, parent, index, $toPos, activeNode) {
|
|
31
33
|
// For deciding to show drop targets or not when multiple nodes are selected
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
import { createElement } from 'react';
|
|
6
|
+
import memoizeOne from 'memoize-one';
|
|
5
7
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
6
8
|
import uuid from 'uuid';
|
|
7
9
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
8
10
|
import { getBaseNodeTypeName, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
9
11
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
15
|
import { nodeMargins } from '../ui/consts';
|
|
@@ -17,8 +20,10 @@ import { maxLayoutColumnSupported } from './utils/consts';
|
|
|
17
20
|
import { canMoveNodeToIndex, canMoveSliceToIndex, isInSameLayout } from './utils/validation';
|
|
18
21
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
|
|
19
22
|
var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
|
|
20
|
-
var PARENT_WITH_END_DROP_TARGET_NEXT = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension', 'bodiedSyncBlock'];
|
|
21
23
|
var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
24
|
+
var getParentTypesWithEndDropTarget = memoizeOne(function () {
|
|
25
|
+
return [].concat(PARENT_WITH_END_DROP_TARGET, _toConsumableArray(fg('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : []), _toConsumableArray(editorExperiment('platform_synced_block', true) ? ['bodiedSyncBlock'] : []));
|
|
26
|
+
});
|
|
22
27
|
var shouldDescend = function shouldDescend(node) {
|
|
23
28
|
return !['mediaSingle', 'paragraph', 'heading'].includes(node.type.name);
|
|
24
29
|
};
|
|
@@ -191,6 +196,7 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
|
|
|
191
196
|
var selectionFrom = Math.min(expandedAnchor.pos, expandedHead.pos);
|
|
192
197
|
var selectionTo = Math.max(expandedAnchor.pos, expandedHead.pos);
|
|
193
198
|
var handleInsideSelection = activeNodePos !== undefined && activeNodePos >= selectionFrom && activeNodePos <= selectionTo;
|
|
199
|
+
var parentTypesWithEndDropTarget = getParentTypesWithEndDropTarget();
|
|
194
200
|
newState.doc.nodesBetween(docFrom, docTo, function (node, pos, parent, index) {
|
|
195
201
|
var depth = 0;
|
|
196
202
|
// drop target deco at the end position
|
|
@@ -238,7 +244,6 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
|
|
|
238
244
|
pushNodeStack(node, depth);
|
|
239
245
|
return false; //not valid pos, so nested not valid either
|
|
240
246
|
}
|
|
241
|
-
var parentTypesWithEndDropTarget = editorExperiment('platform_synced_block', true) ? PARENT_WITH_END_DROP_TARGET_NEXT : PARENT_WITH_END_DROP_TARGET;
|
|
242
247
|
var parentTypeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(parent.type) : parent.type.name;
|
|
243
248
|
if (parent.lastChild === node && !isEmptyParagraph(node) && parentTypesWithEndDropTarget.includes(parentTypeName)) {
|
|
244
249
|
endPos = pos + node.nodeSize;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_LEFT_OFFSET } from '../ui/consts';
|
|
5
6
|
import { refreshAnchorName } from '../ui/utils/anchor-name';
|
|
6
7
|
import { getAnchorAttrName } from '../ui/utils/dom-attr-name';
|
|
@@ -28,7 +29,7 @@ export var calculatePosition = function calculatePosition(_ref) {
|
|
|
28
29
|
});
|
|
29
30
|
var dom = view.dom.querySelector("[".concat(getAnchorAttrName(), "=\"").concat(safeAnchorName, "\"]"));
|
|
30
31
|
var hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
31
|
-
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
32
|
+
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension' || rootNodeType === 'multiBodiedExtension' && fg('confluence_frontend_native_tabs_extension');
|
|
32
33
|
var isBlockCard = rootNodeType === 'blockCard';
|
|
33
34
|
var isEmbedCard = rootNodeType === 'embedCard';
|
|
34
35
|
var isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import memoizeOne from 'memoize-one';
|
|
1
3
|
import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
6
|
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT, DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, dragHandleGap } from '../../ui/consts';
|
|
4
7
|
var STICKY_NODES = ['panel', 'table', 'expand', 'layoutSection', 'bodiedExtension'];
|
|
@@ -53,8 +56,11 @@ export var getLeftPosition = function getLeftPosition(dom, type, innerContainer,
|
|
|
53
56
|
export var getNodeHeight = function getNodeHeight(dom, anchor, anchorRectCache) {
|
|
54
57
|
return (anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchor)) || (dom === null || dom === void 0 ? void 0 : dom.offsetHeight);
|
|
55
58
|
};
|
|
59
|
+
var getStickyNodes = memoizeOne(function () {
|
|
60
|
+
return [].concat(STICKY_NODES, _toConsumableArray(fg('confluence_frontend_native_tabs_extension') ? ['multiBodiedExtension'] : []));
|
|
61
|
+
});
|
|
56
62
|
export var shouldBeSticky = function shouldBeSticky(nodeType) {
|
|
57
|
-
return editorExperiment('platform_editor_controls', 'variant1') &&
|
|
63
|
+
return editorExperiment('platform_editor_controls', 'variant1') && getStickyNodes().includes(nodeType);
|
|
58
64
|
};
|
|
59
65
|
export var getControlBottomCSSValue = function getControlBottomCSSValue(anchor, isSticky, isTopLevelNode, isLayoutColumn) {
|
|
60
66
|
return editorExperiment('advanced_layouts', true) && isLayoutColumn || !isSticky || !isTopLevelNode ? {
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -3,6 +3,7 @@ var _dropTargetMarginMap;
|
|
|
3
3
|
import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import { breakoutResizableNodes as breakoutResizableNodesNew } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
export var DRAG_HANDLE_HEIGHT = 24;
|
|
8
9
|
export var DRAG_HANDLE_BORDER_RADIUS = 4;
|
|
@@ -85,6 +86,11 @@ export var getNestedNodeLeftPaddingMargin = function getNestedNodeLeftPaddingMar
|
|
|
85
86
|
switch (nodeType) {
|
|
86
87
|
case 'bodiedExtension':
|
|
87
88
|
return '28px';
|
|
89
|
+
case 'multiBodiedExtension':
|
|
90
|
+
if (fg('confluence_frontend_native_tabs_extension')) {
|
|
91
|
+
return '28px';
|
|
92
|
+
}
|
|
93
|
+
return "".concat(DRAG_HANDLE_WIDTH + DRAG_HANDLE_NARROW_GAP, "px");
|
|
88
94
|
case 'expand':
|
|
89
95
|
case 'nestedExpand':
|
|
90
96
|
return '24px';
|
|
@@ -227,6 +233,10 @@ export var spacingBetweenNodesForPreview = {
|
|
|
227
233
|
top: '0',
|
|
228
234
|
bottom: '0'
|
|
229
235
|
},
|
|
236
|
+
multiBodiedExtension: {
|
|
237
|
+
top: '0',
|
|
238
|
+
bottom: '0'
|
|
239
|
+
},
|
|
230
240
|
extension: {
|
|
231
241
|
top: '0',
|
|
232
242
|
bottom: '0'
|
|
@@ -306,6 +316,10 @@ export var nodeMargins = {
|
|
|
306
316
|
top: 0,
|
|
307
317
|
bottom: 0
|
|
308
318
|
},
|
|
319
|
+
multiBodiedExtension: {
|
|
320
|
+
top: 0,
|
|
321
|
+
bottom: 0
|
|
322
|
+
},
|
|
309
323
|
extension: {
|
|
310
324
|
top: 12,
|
|
311
325
|
bottom: 12
|
|
@@ -815,7 +815,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
815
815
|
}) : anchorName;
|
|
816
816
|
var dom = view.dom.querySelector("[".concat(getAnchorAttrName(), "=\"").concat(safeAnchorName, "\"]"));
|
|
817
817
|
var hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
|
|
818
|
-
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension';
|
|
818
|
+
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension' && fg('confluence_frontend_native_tabs_extension');
|
|
819
819
|
var isBlockCard = nodeType === 'blockCard' && !!blockCardWidth;
|
|
820
820
|
var isEmbedCard = nodeType === 'embedCard';
|
|
821
821
|
var isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -10,6 +10,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
12
|
import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
14
15
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
16
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -74,7 +75,7 @@ var getWidthOffset = function getWidthOffset(node, width, position) {
|
|
|
74
75
|
return isLeftPosition ? "0.5*(var(--ak-editor--line-length) - ".concat(width, ")") : "-0.5*(var(--ak-editor--line-length) - ".concat(width, ")");
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
if (node.type.name === 'bodiedExtension' || node.type.name === 'extension') {
|
|
78
|
+
if (node.type.name === 'bodiedExtension' || node.type.name === 'extension' || node.type.name === 'multiBodiedExtension' && fg('confluence_frontend_native_tabs_extension')) {
|
|
78
79
|
return '-12px';
|
|
79
80
|
}
|
|
80
81
|
};
|
|
@@ -185,7 +185,7 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
185
185
|
});
|
|
186
186
|
var dom = view.dom.querySelector("[".concat(getAnchorAttrName(), "=\"").concat(safeAnchorName, "\"]"));
|
|
187
187
|
var hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
188
|
-
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
188
|
+
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension' || rootNodeType === 'multiBodiedExtension' && fg('confluence_frontend_native_tabs_extension');
|
|
189
189
|
var isBlockCard = rootNodeType === 'blockCard';
|
|
190
190
|
var isEmbedCard = rootNodeType === 'embedCard';
|
|
191
191
|
var isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.2",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/editor-plugin-quick-insert": "^11.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-selection": "^11.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-toolbar": "^8.0.0",
|
|
44
|
-
"@atlaskit/editor-plugin-type-ahead": "^11.
|
|
44
|
+
"@atlaskit/editor-plugin-type-ahead": "^11.1.0",
|
|
45
45
|
"@atlaskit/editor-plugin-user-intent": "^9.0.0",
|
|
46
46
|
"@atlaskit/editor-plugin-width": "^12.0.0",
|
|
47
47
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^19.0.0",
|
|
58
58
|
"@atlaskit/theme": "^25.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^89.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^89.1.0",
|
|
60
60
|
"@atlaskit/tokens": "^13.1.0",
|
|
61
61
|
"@atlaskit/tooltip": "^22.6.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"uuid": "^3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^115.
|
|
70
|
+
"@atlaskit/editor-common": "^115.5.0",
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"react-dom": "^18.2.0",
|
|
73
73
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -146,6 +146,9 @@
|
|
|
146
146
|
},
|
|
147
147
|
"confluence_remix_button_right_side_block_fg": {
|
|
148
148
|
"type": "boolean"
|
|
149
|
+
},
|
|
150
|
+
"confluence_frontend_native_tabs_extension": {
|
|
151
|
+
"type": "boolean"
|
|
149
152
|
}
|
|
150
153
|
},
|
|
151
154
|
"devDependencies": {
|