@atlaskit/editor-plugin-block-controls 2.16.4 → 2.17.1
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 +26 -0
- package/dist/cjs/editor-commands/move-node.js +1 -1
- package/dist/cjs/editor-commands/move-to-layout.js +2 -2
- package/dist/cjs/pm-plugins/decorations-anchor.js +1 -3
- package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/cjs/pm-plugins/utils/fire-analytics.js +2 -2
- package/dist/cjs/pm-plugins/utils/remove-from-source.js +20 -0
- package/dist/cjs/ui/global-styles.js +3 -11
- package/dist/es2019/editor-commands/move-node.js +2 -2
- package/dist/es2019/editor-commands/move-to-layout.js +3 -3
- package/dist/es2019/pm-plugins/decorations-anchor.js +1 -3
- package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/es2019/pm-plugins/utils/fire-analytics.js +1 -1
- package/dist/es2019/pm-plugins/utils/remove-from-source.js +20 -0
- package/dist/es2019/ui/global-styles.js +4 -15
- package/dist/esm/editor-commands/move-node.js +2 -2
- package/dist/esm/editor-commands/move-to-layout.js +3 -3
- package/dist/esm/pm-plugins/decorations-anchor.js +1 -3
- package/dist/esm/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/esm/pm-plugins/utils/fire-analytics.js +1 -1
- package/dist/esm/pm-plugins/utils/remove-from-source.js +20 -0
- package/dist/esm/ui/global-styles.js +3 -11
- package/dist/types/pm-plugins/utils/fire-analytics.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/fire-analytics.d.ts +1 -1
- package/package.json +7 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.17.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#100897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100897)
|
|
8
|
+
[`afd84cc21d588`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/afd84cc21d588) -
|
|
9
|
+
Remove FG
|
|
10
|
+
- [#100902](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100902)
|
|
11
|
+
[`40de6a66cb5e7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/40de6a66cb5e7) -
|
|
12
|
+
Remove old FG
|
|
13
|
+
|
|
14
|
+
## 2.17.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [#100498](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100498)
|
|
19
|
+
[`b913a28923b5d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b913a28923b5d) -
|
|
20
|
+
ED-25931 Remove a 2 column layout via drag and drop
|
|
21
|
+
- [#100935](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100935)
|
|
22
|
+
[`44dcbb7e1884c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/44dcbb7e1884c) -
|
|
23
|
+
clean up platform_editor_element_dnd_nested_fix_patch_1 feature gate
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 2.16.4
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -222,7 +222,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
222
222
|
api === null || api === void 0 || api.core.actions.focus();
|
|
223
223
|
var $mappedTo = tr.doc.resolve(mappedTo);
|
|
224
224
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
225
|
-
(0, _fireAnalytics.
|
|
225
|
+
(0, _fireAnalytics.attachMoveNodeAnalytics)(tr, inputMethod, resolvedNode.depth, node.type.name, $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth, $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name, $from.sameParent($mappedTo), api);
|
|
226
226
|
} else {
|
|
227
227
|
var _api$analytics;
|
|
228
228
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
@@ -52,7 +52,7 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
52
52
|
if (!(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
53
53
|
tr.setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
54
54
|
}
|
|
55
|
-
(0, _fireAnalytics.
|
|
55
|
+
(0, _fireAnalytics.attachMoveNodeAnalytics)(tr, _analytics.INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
|
|
56
56
|
} else if (toLayout.childCount < (0, _consts.maxLayoutColumnSupported)()) {
|
|
57
57
|
var _$originalFrom$nodeAf2;
|
|
58
58
|
if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
@@ -63,7 +63,7 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
63
63
|
var mappedFrom = tr.mapping.map(from);
|
|
64
64
|
(0, _removeFromSource.removeFromSource)(tr, tr.doc.resolve(mappedFrom));
|
|
65
65
|
}
|
|
66
|
-
(0, _fireAnalytics.
|
|
66
|
+
(0, _fireAnalytics.attachMoveNodeAnalytics)(tr, _analytics.INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf2 = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf2 === void 0 ? void 0 : _$originalFrom$nodeAf2.type.name) || '', 1, 'layoutSection', false, api);
|
|
67
67
|
}
|
|
68
68
|
return tr;
|
|
69
69
|
};
|
|
@@ -32,9 +32,7 @@ var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, pare
|
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
33
33
|
) {
|
|
34
34
|
var isEmbedCard = 'embedCard' === node.type.name && (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3');
|
|
35
|
-
|
|
36
|
-
// TODO use isWrappedMedia when clean up the feature flag
|
|
37
|
-
var isMediaSingle = 'mediaSingle' === node.type.name && (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_1');
|
|
35
|
+
var isMediaSingle = node.type.name === 'mediaSingle';
|
|
38
36
|
var isFirstTableRow = (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'table' && depth === 1 && node === parent.firstChild && 'tableRow' === node.type.name && (0, _experiments.editorExperiment)('advanced_layouts', true);
|
|
39
37
|
if (isFirstTableRow) {
|
|
40
38
|
return false;
|
|
@@ -73,7 +73,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
73
73
|
// We want to exlude handles from showing for wrapped nodes
|
|
74
74
|
// TODO We should be able remove these check if we decided to
|
|
75
75
|
// go we not decoration for wrapped image solution.
|
|
76
|
-
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')
|
|
76
|
+
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')) {
|
|
77
77
|
return false;
|
|
78
78
|
}
|
|
79
79
|
var parentRootElement = rootElement.parentElement;
|
|
@@ -86,7 +86,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
86
86
|
|
|
87
87
|
// We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
|
|
88
88
|
var firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 || (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
|
|
89
|
-
if (parentElement && parentElementType === 'panel' &&
|
|
89
|
+
if (parentElement && parentElementType === 'panel' && !parentElement.classList.contains('ak-editor-panel__no-icon') && (index === 0 || firstChildIsWidget && index === 1)) {
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
92
92
|
} else {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.fireInsertLayoutAnalytics = exports.attachMoveNodeAnalytics = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
|
-
var
|
|
8
|
+
var attachMoveNodeAnalytics = exports.attachMoveNodeAnalytics = function attachMoveNodeAnalytics(tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
9
9
|
// Ignored via go/ees005
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
11
11
|
) {
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.removeFromSource = void 0;
|
|
7
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
7
10
|
var _consts = require("./consts");
|
|
8
11
|
var _updateColumnWidths = require("./update-column-widths");
|
|
9
12
|
var removeFromSource = exports.removeFromSource = function removeFromSource(tr, $from) {
|
|
@@ -16,6 +19,23 @@ var removeFromSource = exports.removeFromSource = function removeFromSource(tr,
|
|
|
16
19
|
if (sourceNode.type.name === 'layoutColumn') {
|
|
17
20
|
if (sourceParent.childCount === _consts.MIN_LAYOUT_COLUMN) {
|
|
18
21
|
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
22
|
+
|
|
23
|
+
// Currently, we assume that the MIN_LAYOUT_COLUMN is set to 2.
|
|
24
|
+
// This value may require an update when we introduce support for a single-column layout.
|
|
25
|
+
if (sourceParent.childCount === 2 && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_DnD_remove_layout')) {
|
|
26
|
+
var _$from$parent$lastChi, _$from$parent$firstCh;
|
|
27
|
+
var layoutContentFragment = $from.parentOffset === 0 ? _model.Fragment.from((_$from$parent$lastChi = $from.parent.lastChild) === null || _$from$parent$lastChi === void 0 ? void 0 : _$from$parent$lastChi.content) : _model.Fragment.from((_$from$parent$firstCh = $from.parent.firstChild) === null || _$from$parent$firstCh === void 0 ? void 0 : _$from$parent$firstCh.content);
|
|
28
|
+
var parent = (0, _utils.findParentNodeClosestToPos)($from, function (node) {
|
|
29
|
+
return node.type.name === 'layoutSection';
|
|
30
|
+
});
|
|
31
|
+
if (parent && layoutContentFragment) {
|
|
32
|
+
var _tr$doc$resolve$nodeA;
|
|
33
|
+
var layoutSectionPos = tr.mapping.map(parent.pos);
|
|
34
|
+
// get the updated layout node size
|
|
35
|
+
var layoutSectionNodeSize = ((_tr$doc$resolve$nodeA = tr.doc.resolve(layoutSectionPos).nodeAfter) === null || _tr$doc$resolve$nodeA === void 0 ? void 0 : _tr$doc$resolve$nodeA.nodeSize) || 0;
|
|
36
|
+
tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
19
39
|
return tr;
|
|
20
40
|
} else {
|
|
21
41
|
(0, _updateColumnWidths.updateColumnWidths)(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
@@ -104,13 +104,8 @@ var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
|
|
|
104
104
|
var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
|
|
105
105
|
var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
|
|
106
106
|
var dropTargetContainer = '.ProseMirror-widget[data-blocks-drop-target-container="true"]';
|
|
107
|
-
var withInlineNodeStyleSelectors = [".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithTrailingBreakAsOnlyChild, ")"), ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ")"), ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithPlaceholder, ")")].join(', ');
|
|
108
107
|
var dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
|
|
109
|
-
var
|
|
110
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
111
|
-
display: 'none !important'
|
|
112
|
-
}));
|
|
113
|
-
var withInlineNodeStyleWithChromeFixSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
|
|
108
|
+
var withInlineNodeStyleSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
|
|
114
109
|
var withFormatInLayoutStyleFixSelectors = ["".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-alignment > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > :is(h1, h2, h3, h4, h5, h6):first-child")].join(', ');
|
|
115
110
|
|
|
116
111
|
/**
|
|
@@ -118,7 +113,7 @@ var withFormatInLayoutStyleFixSelectors = ["".concat(dragHandleContainer, ":firs
|
|
|
118
113
|
* Otherwise it might break composition input for Chrome
|
|
119
114
|
* https://product-fabric.atlassian.net/browse/ED-24136
|
|
120
115
|
*/
|
|
121
|
-
var
|
|
116
|
+
var withInlineNodeStyle = (0, _react.css)((0, _defineProperty2.default)({}, withInlineNodeStyleSelectors, {
|
|
122
117
|
transform: 'scale(0)'
|
|
123
118
|
}));
|
|
124
119
|
var legacyBreakoutWideLayoutStyle = (0, _react.css)({
|
|
@@ -189,9 +184,6 @@ var headingWithIndentationInLayoutStyleFix = (0, _react.css)((0, _defineProperty
|
|
|
189
184
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
190
185
|
marginTop: '0 !important'
|
|
191
186
|
}));
|
|
192
|
-
var getTextNodeStyle = function getTextNodeStyle() {
|
|
193
|
-
return (0, _platformFeatureFlags.fg)('platform_editor_element_controls_chrome_input_fix') ? withInlineNodeStyleWithChromeFix : withInlineNodeStyle;
|
|
194
|
-
};
|
|
195
187
|
var withRelativePosStyle = (0, _react.css)({
|
|
196
188
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
197
189
|
'.ProseMirror': (0, _defineProperty2.default)({}, "&& ".concat(dragHandlerAnchorSelector), {
|
|
@@ -230,6 +222,6 @@ var blockCardWithoutLayout = (0, _react.css)({
|
|
|
230
222
|
});
|
|
231
223
|
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
232
224
|
return (0, _react.jsx)(_react.Global, {
|
|
233
|
-
styles: [globalStyles(), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(),
|
|
225
|
+
styles: [globalStyles(), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
234
226
|
});
|
|
235
227
|
};
|
|
@@ -11,7 +11,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
11
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
12
|
import { key } from '../pm-plugins/main';
|
|
13
13
|
import { DIRECTION } from '../pm-plugins/utils/consts';
|
|
14
|
-
import {
|
|
14
|
+
import { attachMoveNodeAnalytics } from '../pm-plugins/utils/fire-analytics';
|
|
15
15
|
import { getNestedNodePosition } from '../pm-plugins/utils/getNestedNodePosition';
|
|
16
16
|
import { selectNode, setCursorPositionAtMovedNode } from '../pm-plugins/utils/getSelection';
|
|
17
17
|
import { removeFromSource } from '../pm-plugins/utils/remove-from-source';
|
|
@@ -216,7 +216,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
216
216
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
217
217
|
const $mappedTo = tr.doc.resolve(mappedTo);
|
|
218
218
|
if (editorExperiment('advanced_layouts', true)) {
|
|
219
|
-
|
|
219
|
+
attachMoveNodeAnalytics(tr, inputMethod, resolvedNode.depth, node.type.name, $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth, $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name, $from.sameParent($mappedTo), api);
|
|
220
220
|
} else {
|
|
221
221
|
var _api$analytics;
|
|
222
222
|
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
@@ -3,7 +3,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { maxLayoutColumnSupported } from '../pm-plugins/utils/consts';
|
|
6
|
-
import { fireInsertLayoutAnalytics,
|
|
6
|
+
import { fireInsertLayoutAnalytics, attachMoveNodeAnalytics } from '../pm-plugins/utils/fire-analytics';
|
|
7
7
|
import { removeFromSource } from '../pm-plugins/utils/remove-from-source';
|
|
8
8
|
import { updateColumnWidths } from '../pm-plugins/utils/update-column-widths';
|
|
9
9
|
import { isInSameLayout } from '../pm-plugins/utils/validation';
|
|
@@ -47,7 +47,7 @@ const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, $
|
|
|
47
47
|
if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
48
48
|
tr.setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
attachMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
|
|
51
51
|
} else if (toLayout.childCount < maxLayoutColumnSupported()) {
|
|
52
52
|
var _$originalFrom$nodeAf2;
|
|
53
53
|
if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
@@ -58,7 +58,7 @@ const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, $
|
|
|
58
58
|
const mappedFrom = tr.mapping.map(from);
|
|
59
59
|
removeFromSource(tr, tr.doc.resolve(mappedFrom));
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
attachMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf2 = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf2 === void 0 ? void 0 : _$originalFrom$nodeAf2.type.name) || '', 1, 'layoutSection', false, api);
|
|
62
62
|
}
|
|
63
63
|
return tr;
|
|
64
64
|
};
|
|
@@ -24,9 +24,7 @@ const shouldIgnoreNode = (node, ignore_nodes, depth, parent
|
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
25
|
) => {
|
|
26
26
|
const isEmbedCard = 'embedCard' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_3');
|
|
27
|
-
|
|
28
|
-
// TODO use isWrappedMedia when clean up the feature flag
|
|
29
|
-
const isMediaSingle = 'mediaSingle' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_1');
|
|
27
|
+
const isMediaSingle = node.type.name === 'mediaSingle';
|
|
30
28
|
const isFirstTableRow = (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'table' && depth === 1 && node === parent.firstChild && 'tableRow' === node.type.name && editorExperiment('advanced_layouts', true);
|
|
31
29
|
if (isFirstTableRow) {
|
|
32
30
|
return false;
|
|
@@ -68,7 +68,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
68
68
|
// We want to exlude handles from showing for wrapped nodes
|
|
69
69
|
// TODO We should be able remove these check if we decided to
|
|
70
70
|
// go we not decoration for wrapped image solution.
|
|
71
|
-
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')
|
|
71
|
+
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')) {
|
|
72
72
|
return false;
|
|
73
73
|
}
|
|
74
74
|
const parentRootElement = rootElement.parentElement;
|
|
@@ -81,7 +81,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
81
81
|
|
|
82
82
|
// We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
|
|
83
83
|
const firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 ? void 0 : (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
|
|
84
|
-
if (parentElement && parentElementType === 'panel' &&
|
|
84
|
+
if (parentElement && parentElementType === 'panel' && !parentElement.classList.contains('ak-editor-panel__no-icon') && (index === 0 || firstChildIsWidget && index === 1)) {
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
87
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
export const
|
|
2
|
+
export const attachMoveNodeAnalytics = (tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
3
3
|
// Ignored via go/ees005
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
5
5
|
) => {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
4
|
import { MIN_LAYOUT_COLUMN } from './consts';
|
|
2
5
|
import { updateColumnWidths } from './update-column-widths';
|
|
3
6
|
export const removeFromSource = (tr, $from) => {
|
|
@@ -10,6 +13,23 @@ export const removeFromSource = (tr, $from) => {
|
|
|
10
13
|
if (sourceNode.type.name === 'layoutColumn') {
|
|
11
14
|
if (sourceParent.childCount === MIN_LAYOUT_COLUMN) {
|
|
12
15
|
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
16
|
+
|
|
17
|
+
// Currently, we assume that the MIN_LAYOUT_COLUMN is set to 2.
|
|
18
|
+
// This value may require an update when we introduce support for a single-column layout.
|
|
19
|
+
if (sourceParent.childCount === 2 && fg('platform_editor_advanced_layouts_DnD_remove_layout')) {
|
|
20
|
+
var _$from$parent$lastChi, _$from$parent$firstCh;
|
|
21
|
+
const layoutContentFragment = $from.parentOffset === 0 ? Fragment.from((_$from$parent$lastChi = $from.parent.lastChild) === null || _$from$parent$lastChi === void 0 ? void 0 : _$from$parent$lastChi.content) : Fragment.from((_$from$parent$firstCh = $from.parent.firstChild) === null || _$from$parent$firstCh === void 0 ? void 0 : _$from$parent$firstCh.content);
|
|
22
|
+
const parent = findParentNodeClosestToPos($from, node => {
|
|
23
|
+
return node.type.name === 'layoutSection';
|
|
24
|
+
});
|
|
25
|
+
if (parent && layoutContentFragment) {
|
|
26
|
+
var _tr$doc$resolve$nodeA;
|
|
27
|
+
const layoutSectionPos = tr.mapping.map(parent.pos);
|
|
28
|
+
// get the updated layout node size
|
|
29
|
+
const layoutSectionNodeSize = ((_tr$doc$resolve$nodeA = tr.doc.resolve(layoutSectionPos).nodeAfter) === null || _tr$doc$resolve$nodeA === void 0 ? void 0 : _tr$doc$resolve$nodeA.nodeSize) || 0;
|
|
30
|
+
tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
13
33
|
return tr;
|
|
14
34
|
} else {
|
|
15
35
|
updateColumnWidths(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
@@ -126,16 +126,8 @@ const paragraphWithPlaceholder = '+ p > .placeholder-decoration';
|
|
|
126
126
|
const dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
|
|
127
127
|
const dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
|
|
128
128
|
const dropTargetContainer = '.ProseMirror-widget[data-blocks-drop-target-container="true"]';
|
|
129
|
-
const withInlineNodeStyleSelectors = [`.ProseMirror-widget[data-blocks-drag-handle-container="true"]:has(${paragraphWithTrailingBreakAsOnlyChild})`, `.ProseMirror-widget[data-blocks-drag-handle-container="true"]:has(${indentatedParagraphWithTrailingBreakAsOnlyChild})`, `.ProseMirror-widget[data-blocks-drag-handle-container="true"]:has(${paragraphWithPlaceholder})`].join(', ');
|
|
130
129
|
const dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
|
|
131
|
-
const
|
|
132
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
133
|
-
[withInlineNodeStyleSelectors]: {
|
|
134
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
135
|
-
display: 'none !important'
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
const withInlineNodeStyleWithChromeFixSelectors = [`${dragHandleContainer}:has(${paragraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector}`, `${dragHandleContainer}:has(${indentatedParagraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector}`, `${dragHandleContainer}:has(${paragraphWithPlaceholder}) ${dragHandleSelector}`].join(', ');
|
|
130
|
+
const withInlineNodeStyleSelectors = [`${dragHandleContainer}:has(${paragraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector}`, `${dragHandleContainer}:has(${indentatedParagraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector}`, `${dragHandleContainer}:has(${paragraphWithPlaceholder}) ${dragHandleSelector}`].join(', ');
|
|
139
131
|
const withFormatInLayoutStyleFixSelectors = [`${dragHandleContainer}:first-child + .fabric-editor-indentation-mark > p:first-child`, `${dragHandleContainer}:first-child + .fabric-editor-alignment > p:first-child`, `${dragHandleContainer}:first-child + ${dropTargetContainer} + .fabric-editor-indentation-mark > p:first-child`, `${dragHandleContainer}:first-child + ${dropTargetContainer} + .fabric-editor-alignment > p:first-child`, `${dropTargetContainer}:first-child + .fabric-editor-alignment > p:first-child`, `${dropTargetContainer}:first-child + .fabric-editor-indentation-mark > p:first-child`, `${dragHandleContainer}:first-child + .fabric-editor-indentation-mark > :is(h1, h2, h3, h4, h5, h6):first-child`].join(', ');
|
|
140
132
|
|
|
141
133
|
/**
|
|
@@ -143,9 +135,9 @@ const withFormatInLayoutStyleFixSelectors = [`${dragHandleContainer}:first-child
|
|
|
143
135
|
* Otherwise it might break composition input for Chrome
|
|
144
136
|
* https://product-fabric.atlassian.net/browse/ED-24136
|
|
145
137
|
*/
|
|
146
|
-
const
|
|
138
|
+
const withInlineNodeStyle = css({
|
|
147
139
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
148
|
-
[
|
|
140
|
+
[withInlineNodeStyleSelectors]: {
|
|
149
141
|
transform: 'scale(0)'
|
|
150
142
|
}
|
|
151
143
|
});
|
|
@@ -230,9 +222,6 @@ const headingWithIndentationInLayoutStyleFix = css({
|
|
|
230
222
|
marginTop: '0 !important'
|
|
231
223
|
}
|
|
232
224
|
});
|
|
233
|
-
const getTextNodeStyle = () => {
|
|
234
|
-
return fg('platform_editor_element_controls_chrome_input_fix') ? withInlineNodeStyleWithChromeFix : withInlineNodeStyle;
|
|
235
|
-
};
|
|
236
225
|
const withRelativePosStyle = css({
|
|
237
226
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
238
227
|
'.ProseMirror': {
|
|
@@ -277,6 +266,6 @@ const blockCardWithoutLayout = css({
|
|
|
277
266
|
});
|
|
278
267
|
export const GlobalStylesWrapper = () => {
|
|
279
268
|
return jsx(Global, {
|
|
280
|
-
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(),
|
|
269
|
+
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, fg('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
281
270
|
});
|
|
282
271
|
};
|
|
@@ -14,7 +14,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
14
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
15
|
import { key } from '../pm-plugins/main';
|
|
16
16
|
import { DIRECTION } from '../pm-plugins/utils/consts';
|
|
17
|
-
import {
|
|
17
|
+
import { attachMoveNodeAnalytics } from '../pm-plugins/utils/fire-analytics';
|
|
18
18
|
import { getNestedNodePosition } from '../pm-plugins/utils/getNestedNodePosition';
|
|
19
19
|
import { selectNode, setCursorPositionAtMovedNode } from '../pm-plugins/utils/getSelection';
|
|
20
20
|
import { removeFromSource } from '../pm-plugins/utils/remove-from-source';
|
|
@@ -216,7 +216,7 @@ export var moveNode = function moveNode(api) {
|
|
|
216
216
|
api === null || api === void 0 || api.core.actions.focus();
|
|
217
217
|
var $mappedTo = tr.doc.resolve(mappedTo);
|
|
218
218
|
if (editorExperiment('advanced_layouts', true)) {
|
|
219
|
-
|
|
219
|
+
attachMoveNodeAnalytics(tr, inputMethod, resolvedNode.depth, node.type.name, $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth, $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name, $from.sameParent($mappedTo), api);
|
|
220
220
|
} else {
|
|
221
221
|
var _api$analytics;
|
|
222
222
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
@@ -3,7 +3,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { maxLayoutColumnSupported } from '../pm-plugins/utils/consts';
|
|
6
|
-
import { fireInsertLayoutAnalytics,
|
|
6
|
+
import { fireInsertLayoutAnalytics, attachMoveNodeAnalytics } from '../pm-plugins/utils/fire-analytics';
|
|
7
7
|
import { removeFromSource } from '../pm-plugins/utils/remove-from-source';
|
|
8
8
|
import { updateColumnWidths } from '../pm-plugins/utils/update-column-widths';
|
|
9
9
|
import { isInSameLayout } from '../pm-plugins/utils/validation';
|
|
@@ -46,7 +46,7 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
46
46
|
if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
47
47
|
tr.setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
attachMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
|
|
50
50
|
} else if (toLayout.childCount < maxLayoutColumnSupported()) {
|
|
51
51
|
var _$originalFrom$nodeAf2;
|
|
52
52
|
if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
@@ -57,7 +57,7 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
57
57
|
var mappedFrom = tr.mapping.map(from);
|
|
58
58
|
removeFromSource(tr, tr.doc.resolve(mappedFrom));
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
attachMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf2 = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf2 === void 0 ? void 0 : _$originalFrom$nodeAf2.type.name) || '', 1, 'layoutSection', false, api);
|
|
61
61
|
}
|
|
62
62
|
return tr;
|
|
63
63
|
};
|
|
@@ -25,9 +25,7 @@ var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, pare
|
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
26
|
) {
|
|
27
27
|
var isEmbedCard = 'embedCard' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_3');
|
|
28
|
-
|
|
29
|
-
// TODO use isWrappedMedia when clean up the feature flag
|
|
30
|
-
var isMediaSingle = 'mediaSingle' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_1');
|
|
28
|
+
var isMediaSingle = node.type.name === 'mediaSingle';
|
|
31
29
|
var isFirstTableRow = (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'table' && depth === 1 && node === parent.firstChild && 'tableRow' === node.type.name && editorExperiment('advanced_layouts', true);
|
|
32
30
|
if (isFirstTableRow) {
|
|
33
31
|
return false;
|
|
@@ -67,7 +67,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
67
67
|
// We want to exlude handles from showing for wrapped nodes
|
|
68
68
|
// TODO We should be able remove these check if we decided to
|
|
69
69
|
// go we not decoration for wrapped image solution.
|
|
70
|
-
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')
|
|
70
|
+
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')) {
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
var parentRootElement = rootElement.parentElement;
|
|
@@ -80,7 +80,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
80
80
|
|
|
81
81
|
// We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
|
|
82
82
|
var firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 || (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
|
|
83
|
-
if (parentElement && parentElementType === 'panel' &&
|
|
83
|
+
if (parentElement && parentElementType === 'panel' && !parentElement.classList.contains('ak-editor-panel__no-icon') && (index === 0 || firstChildIsWidget && index === 1)) {
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
86
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
export var
|
|
2
|
+
export var attachMoveNodeAnalytics = function attachMoveNodeAnalytics(tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api
|
|
3
3
|
// Ignored via go/ees005
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
5
5
|
) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
4
|
import { MIN_LAYOUT_COLUMN } from './consts';
|
|
2
5
|
import { updateColumnWidths } from './update-column-widths';
|
|
3
6
|
export var removeFromSource = function removeFromSource(tr, $from) {
|
|
@@ -10,6 +13,23 @@ export var removeFromSource = function removeFromSource(tr, $from) {
|
|
|
10
13
|
if (sourceNode.type.name === 'layoutColumn') {
|
|
11
14
|
if (sourceParent.childCount === MIN_LAYOUT_COLUMN) {
|
|
12
15
|
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
16
|
+
|
|
17
|
+
// Currently, we assume that the MIN_LAYOUT_COLUMN is set to 2.
|
|
18
|
+
// This value may require an update when we introduce support for a single-column layout.
|
|
19
|
+
if (sourceParent.childCount === 2 && fg('platform_editor_advanced_layouts_DnD_remove_layout')) {
|
|
20
|
+
var _$from$parent$lastChi, _$from$parent$firstCh;
|
|
21
|
+
var layoutContentFragment = $from.parentOffset === 0 ? Fragment.from((_$from$parent$lastChi = $from.parent.lastChild) === null || _$from$parent$lastChi === void 0 ? void 0 : _$from$parent$lastChi.content) : Fragment.from((_$from$parent$firstCh = $from.parent.firstChild) === null || _$from$parent$firstCh === void 0 ? void 0 : _$from$parent$firstCh.content);
|
|
22
|
+
var parent = findParentNodeClosestToPos($from, function (node) {
|
|
23
|
+
return node.type.name === 'layoutSection';
|
|
24
|
+
});
|
|
25
|
+
if (parent && layoutContentFragment) {
|
|
26
|
+
var _tr$doc$resolve$nodeA;
|
|
27
|
+
var layoutSectionPos = tr.mapping.map(parent.pos);
|
|
28
|
+
// get the updated layout node size
|
|
29
|
+
var layoutSectionNodeSize = ((_tr$doc$resolve$nodeA = tr.doc.resolve(layoutSectionPos).nodeAfter) === null || _tr$doc$resolve$nodeA === void 0 ? void 0 : _tr$doc$resolve$nodeA.nodeSize) || 0;
|
|
30
|
+
tr.replaceWith(layoutSectionPos, layoutSectionPos + layoutSectionNodeSize, layoutContentFragment);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
13
33
|
return tr;
|
|
14
34
|
} else {
|
|
15
35
|
updateColumnWidths(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
@@ -97,13 +97,8 @@ var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
|
|
|
97
97
|
var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
|
|
98
98
|
var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
|
|
99
99
|
var dropTargetContainer = '.ProseMirror-widget[data-blocks-drop-target-container="true"]';
|
|
100
|
-
var withInlineNodeStyleSelectors = [".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithTrailingBreakAsOnlyChild, ")"), ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ")"), ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithPlaceholder, ")")].join(', ');
|
|
101
100
|
var dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
|
|
102
|
-
var
|
|
103
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
104
|
-
display: 'none !important'
|
|
105
|
-
}));
|
|
106
|
-
var withInlineNodeStyleWithChromeFixSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
|
|
101
|
+
var withInlineNodeStyleSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
|
|
107
102
|
var withFormatInLayoutStyleFixSelectors = ["".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-alignment > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > :is(h1, h2, h3, h4, h5, h6):first-child")].join(', ');
|
|
108
103
|
|
|
109
104
|
/**
|
|
@@ -111,7 +106,7 @@ var withFormatInLayoutStyleFixSelectors = ["".concat(dragHandleContainer, ":firs
|
|
|
111
106
|
* Otherwise it might break composition input for Chrome
|
|
112
107
|
* https://product-fabric.atlassian.net/browse/ED-24136
|
|
113
108
|
*/
|
|
114
|
-
var
|
|
109
|
+
var withInlineNodeStyle = css(_defineProperty({}, withInlineNodeStyleSelectors, {
|
|
115
110
|
transform: 'scale(0)'
|
|
116
111
|
}));
|
|
117
112
|
var legacyBreakoutWideLayoutStyle = css({
|
|
@@ -182,9 +177,6 @@ var headingWithIndentationInLayoutStyleFix = css(_defineProperty({}, "".concat(d
|
|
|
182
177
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
183
178
|
marginTop: '0 !important'
|
|
184
179
|
}));
|
|
185
|
-
var getTextNodeStyle = function getTextNodeStyle() {
|
|
186
|
-
return fg('platform_editor_element_controls_chrome_input_fix') ? withInlineNodeStyleWithChromeFix : withInlineNodeStyle;
|
|
187
|
-
};
|
|
188
180
|
var withRelativePosStyle = css({
|
|
189
181
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
190
182
|
'.ProseMirror': _defineProperty({}, "&& ".concat(dragHandlerAnchorSelector), {
|
|
@@ -223,6 +215,6 @@ var blockCardWithoutLayout = css({
|
|
|
223
215
|
});
|
|
224
216
|
export var GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
225
217
|
return jsx(Global, {
|
|
226
|
-
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(),
|
|
218
|
+
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, fg('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
227
219
|
});
|
|
228
220
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { type BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const attachMoveNodeAnalytics: (tr: Transaction, inputMethod: string, fromDepth: number, fromNodeType: string, toDepth?: number, toNodeType?: string, isSameParent?: boolean, api?: ExtractInjectionAPI<BlockControlsPlugin>) => boolean | undefined;
|
|
5
5
|
export declare const fireInsertLayoutAnalytics: (tr: Transaction, api?: ExtractInjectionAPI<BlockControlsPlugin>) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { type BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const attachMoveNodeAnalytics: (tr: Transaction, inputMethod: string, fromDepth: number, fromNodeType: string, toDepth?: number, toNodeType?: string, isSameParent?: boolean, api?: ExtractInjectionAPI<BlockControlsPlugin>) => boolean | undefined;
|
|
5
5
|
export declare const fireInsertLayoutAnalytics: (tr: Transaction, api?: ExtractInjectionAPI<BlockControlsPlugin>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.1",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
34
|
-
"@atlaskit/editor-common": "^98.
|
|
34
|
+
"@atlaskit/editor-common": "^98.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
42
42
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
44
|
-
"@atlaskit/icon": "^23.
|
|
44
|
+
"@atlaskit/icon": "^23.2.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.3.0",
|
|
50
50
|
"@atlaskit/theme": "^14.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^2.32.0",
|
|
52
52
|
"@atlaskit/tokens": "^2.5.0",
|
|
53
53
|
"@atlaskit/tooltip": "^19.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -115,24 +115,15 @@
|
|
|
115
115
|
"platform_editor_element_drag_and_drop_ed_23873": {
|
|
116
116
|
"type": "boolean"
|
|
117
117
|
},
|
|
118
|
-
"platform_editor_element_controls_chrome_input_fix": {
|
|
119
|
-
"type": "boolean"
|
|
120
|
-
},
|
|
121
118
|
"platform_editor_element_drag_and_drop_ed_24321": {
|
|
122
119
|
"type": "boolean"
|
|
123
120
|
},
|
|
124
|
-
"platform_editor_element_drag_and_drop_ed_24227": {
|
|
125
|
-
"type": "boolean"
|
|
126
|
-
},
|
|
127
121
|
"platform_editor_element_drag_and_drop_debug": {
|
|
128
122
|
"type": "boolean"
|
|
129
123
|
},
|
|
130
124
|
"platform_editor_element_drag_and_drop_ed_24885": {
|
|
131
125
|
"type": "boolean"
|
|
132
126
|
},
|
|
133
|
-
"platform_editor_element_dnd_nested_fix_patch_1": {
|
|
134
|
-
"type": "boolean"
|
|
135
|
-
},
|
|
136
127
|
"platform_editor_element_dnd_nested_fix_patch_2": {
|
|
137
128
|
"type": "boolean"
|
|
138
129
|
},
|
|
@@ -171,6 +162,9 @@
|
|
|
171
162
|
},
|
|
172
163
|
"platform_editor_advanced_layouts_post_fix_patch_3": {
|
|
173
164
|
"type": "boolean"
|
|
165
|
+
},
|
|
166
|
+
"platform_editor_advanced_layouts_DnD_remove_layout": {
|
|
167
|
+
"type": "boolean"
|
|
174
168
|
}
|
|
175
169
|
}
|
|
176
170
|
}
|