@atlaskit/editor-plugin-block-controls 2.18.1 → 2.19.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 +21 -0
- package/dist/cjs/pm-plugins/decorations-anchor.js +3 -4
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +1 -1
- package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -6
- package/dist/cjs/ui/global-styles.js +4 -10
- package/dist/es2019/pm-plugins/decorations-anchor.js +3 -4
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +1 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -6
- package/dist/es2019/ui/global-styles.js +4 -10
- package/dist/esm/pm-plugins/decorations-anchor.js +3 -4
- package/dist/esm/pm-plugins/decorations-drag-handle.js +1 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +2 -6
- package/dist/esm/ui/global-styles.js +4 -10
- package/dist/types/blockControlsPluginType.d.ts +15 -13
- package/dist/types/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +15 -13
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -1
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.19.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#102045](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102045)
|
|
8
|
+
[`44f96aff22dd9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/44f96aff22dd9) -
|
|
9
|
+
[ED-26179] clean up platform_editor_elements_dnd_nested_table
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.19.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#101334](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101334)
|
|
17
|
+
[`70742828916ee`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/70742828916ee) -
|
|
18
|
+
Clean up FG platform_editor_element_dnd_nested_fix_patch_3
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 2.18.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.shouldDescendIntoNode = exports.nodeDecorations = exports.findNodeDecs = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
11
|
var _decorationsCommon = require("./decorations-common");
|
|
13
12
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
|
|
@@ -16,7 +15,7 @@ var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSin
|
|
|
16
15
|
var IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT = ['listItem', 'taskList', 'decisionList'];
|
|
17
16
|
var shouldDescendIntoNode = exports.shouldDescendIntoNode = function shouldDescendIntoNode(node) {
|
|
18
17
|
// Optimisation to avoid drawing node decorations for empty table cells
|
|
19
|
-
if (['tableCell', 'tableHeader'].includes(node.type.name)
|
|
18
|
+
if (['tableCell', 'tableHeader'].includes(node.type.name)) {
|
|
20
19
|
var _node$firstChild;
|
|
21
20
|
if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph') {
|
|
22
21
|
return false;
|
|
@@ -31,7 +30,7 @@ var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, pare
|
|
|
31
30
|
// Ignored via go/ees005
|
|
32
31
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
33
32
|
) {
|
|
34
|
-
var isEmbedCard =
|
|
33
|
+
var isEmbedCard = node.type.name === 'embedCard';
|
|
35
34
|
var isMediaSingle = node.type.name === 'mediaSingle';
|
|
36
35
|
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);
|
|
37
36
|
if (isFirstTableRow) {
|
|
@@ -96,7 +95,7 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
|
|
|
96
95
|
var _anchorName2;
|
|
97
96
|
anchorName = (_anchorName2 = anchorName) !== null && _anchorName2 !== void 0 ? _anchorName2 : "--node-anchor-".concat(node.type.name, "-").concat(index);
|
|
98
97
|
}
|
|
99
|
-
var anchorStyles =
|
|
98
|
+
var anchorStyles = "anchor-name: ".concat(anchorName, ";");
|
|
100
99
|
var subType = node.attrs.level ? "-".concat(node.attrs.level) : '';
|
|
101
100
|
decs.push(_view.Decoration.node(pos, pos + node.nodeSize, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
102
101
|
style: anchorStyles
|
|
@@ -52,7 +52,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
if ((0, _experiments.editorExperiment)('nested-dnd', true)) {
|
|
55
|
-
var newPos =
|
|
55
|
+
var newPos = getPos();
|
|
56
56
|
if (typeof newPos === 'number') {
|
|
57
57
|
var $pos = view.state.doc.resolve(newPos);
|
|
58
58
|
isTopLevelNode = ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
|
|
@@ -48,16 +48,12 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
48
48
|
var parentElementType = parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
|
|
49
49
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true) && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
50
50
|
// We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
|
|
51
|
-
if (parentElement && (parentElementType === 'table' || parentElementType === 'tableRow') && (0, _experiments.editorExperiment)('nested-dnd', true)
|
|
52
|
-
exposure: true
|
|
53
|
-
})) {
|
|
51
|
+
if (parentElement && (parentElementType === 'table' || parentElementType === 'tableRow') && (0, _experiments.editorExperiment)('nested-dnd', true)) {
|
|
54
52
|
rootElement = parentElement;
|
|
55
53
|
}
|
|
56
54
|
} else {
|
|
57
55
|
// We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
|
|
58
|
-
if (parentElement && parentElementType === 'table' && (0, _experiments.editorExperiment)('nested-dnd', true)
|
|
59
|
-
exposure: true
|
|
60
|
-
})) {
|
|
56
|
+
if (parentElement && parentElementType === 'table' && (0, _experiments.editorExperiment)('nested-dnd', true)) {
|
|
61
57
|
rootElement = parentElement;
|
|
62
58
|
}
|
|
63
59
|
}
|
|
@@ -73,9 +73,9 @@ var extendedHoverZoneNested = function extendedHoverZoneNested() {
|
|
|
73
73
|
position: 'absolute',
|
|
74
74
|
top: 0,
|
|
75
75
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
76
|
-
left:
|
|
76
|
+
left: 0,
|
|
77
77
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
78
|
-
width:
|
|
78
|
+
width: 0,
|
|
79
79
|
height: '100%',
|
|
80
80
|
cursor: 'default',
|
|
81
81
|
zIndex: 1
|
|
@@ -137,18 +137,12 @@ var globalDnDStyle = (0, _react.css)({
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
var globalStyles = function globalStyles() {
|
|
140
|
-
return (0,
|
|
140
|
+
return (0, _react.css)({
|
|
141
141
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
142
142
|
'.ProseMirror-widget:first-child + *:not([data-panel-type], .code-block, [data-node-type="nestedExpand"], [data-layout-section="true"])': {
|
|
143
143
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
144
144
|
marginTop: '0 !important'
|
|
145
145
|
}
|
|
146
|
-
}) : (0, _react.css)({
|
|
147
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
148
|
-
'.ProseMirror-widget:first-child + *:not([data-panel-type], .code-block, [data-node-type="nestedExpand"])': {
|
|
149
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
150
|
-
marginTop: '0 !important'
|
|
151
|
-
}
|
|
152
146
|
});
|
|
153
147
|
};
|
|
154
148
|
var topLevelNodeMarginStyles = (0, _react.css)({
|
|
@@ -222,6 +216,6 @@ var blockCardWithoutLayout = (0, _react.css)({
|
|
|
222
216
|
});
|
|
223
217
|
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
224
218
|
return (0, _react.jsx)(_react.Global, {
|
|
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, withFormatInLayoutStyleFix,
|
|
219
|
+
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, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle,,]
|
|
226
220
|
});
|
|
227
221
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
3
|
import { getNestedDepth, getNodeAnchor, TYPE_NODE_DEC } from './decorations-common';
|
|
5
4
|
const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
|
|
@@ -8,7 +7,7 @@ const IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaS
|
|
|
8
7
|
const IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT = ['listItem', 'taskList', 'decisionList'];
|
|
9
8
|
export const shouldDescendIntoNode = node => {
|
|
10
9
|
// Optimisation to avoid drawing node decorations for empty table cells
|
|
11
|
-
if (['tableCell', 'tableHeader'].includes(node.type.name)
|
|
10
|
+
if (['tableCell', 'tableHeader'].includes(node.type.name)) {
|
|
12
11
|
var _node$firstChild;
|
|
13
12
|
if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph') {
|
|
14
13
|
return false;
|
|
@@ -23,7 +22,7 @@ const shouldIgnoreNode = (node, ignore_nodes, depth, parent
|
|
|
23
22
|
// Ignored via go/ees005
|
|
24
23
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
24
|
) => {
|
|
26
|
-
const isEmbedCard =
|
|
25
|
+
const isEmbedCard = node.type.name === 'embedCard';
|
|
27
26
|
const isMediaSingle = node.type.name === 'mediaSingle';
|
|
28
27
|
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);
|
|
29
28
|
if (isFirstTableRow) {
|
|
@@ -86,7 +85,7 @@ export const nodeDecorations = (newState, from, to) => {
|
|
|
86
85
|
var _anchorName2;
|
|
87
86
|
anchorName = (_anchorName2 = anchorName) !== null && _anchorName2 !== void 0 ? _anchorName2 : `--node-anchor-${node.type.name}-${index}`;
|
|
88
87
|
}
|
|
89
|
-
const anchorStyles =
|
|
88
|
+
const anchorStyles = `anchor-name: ${anchorName};`;
|
|
90
89
|
const subType = node.attrs.level ? `-${node.attrs.level}` : '';
|
|
91
90
|
decs.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
92
91
|
style: anchorStyles,
|
|
@@ -43,7 +43,7 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
if (editorExperiment('nested-dnd', true)) {
|
|
46
|
-
const newPos =
|
|
46
|
+
const newPos = getPos();
|
|
47
47
|
if (typeof newPos === 'number') {
|
|
48
48
|
const $pos = view.state.doc.resolve(newPos);
|
|
49
49
|
isTopLevelNode = ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
|
|
@@ -43,16 +43,12 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
43
43
|
const parentElementType = parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
|
|
44
44
|
if (editorExperiment('advanced_layouts', true) && fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
45
45
|
// We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
|
|
46
|
-
if (parentElement && (parentElementType === 'table' || parentElementType === 'tableRow') && editorExperiment('nested-dnd', true)
|
|
47
|
-
exposure: true
|
|
48
|
-
})) {
|
|
46
|
+
if (parentElement && (parentElementType === 'table' || parentElementType === 'tableRow') && editorExperiment('nested-dnd', true)) {
|
|
49
47
|
rootElement = parentElement;
|
|
50
48
|
}
|
|
51
49
|
} else {
|
|
52
50
|
// We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
|
|
53
|
-
if (parentElement && parentElementType === 'table' && editorExperiment('nested-dnd', true)
|
|
54
|
-
exposure: true
|
|
55
|
-
})) {
|
|
51
|
+
if (parentElement && parentElementType === 'table' && editorExperiment('nested-dnd', true)) {
|
|
56
52
|
rootElement = parentElement;
|
|
57
53
|
}
|
|
58
54
|
}
|
|
@@ -85,9 +85,9 @@ const extendedHoverZoneNested = () => css({
|
|
|
85
85
|
position: 'absolute',
|
|
86
86
|
top: 0,
|
|
87
87
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
88
|
-
left:
|
|
88
|
+
left: 0,
|
|
89
89
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
90
|
-
width:
|
|
90
|
+
width: 0,
|
|
91
91
|
height: '100%',
|
|
92
92
|
cursor: 'default',
|
|
93
93
|
zIndex: 1
|
|
@@ -161,18 +161,12 @@ const globalDnDStyle = css({
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
const globalStyles = () =>
|
|
164
|
+
const globalStyles = () => css({
|
|
165
165
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
166
166
|
'.ProseMirror-widget:first-child + *:not([data-panel-type], .code-block, [data-node-type="nestedExpand"], [data-layout-section="true"])': {
|
|
167
167
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
168
168
|
marginTop: '0 !important'
|
|
169
169
|
}
|
|
170
|
-
}) : css({
|
|
171
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
172
|
-
'.ProseMirror-widget:first-child + *:not([data-panel-type], .code-block, [data-node-type="nestedExpand"])': {
|
|
173
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
174
|
-
marginTop: '0 !important'
|
|
175
|
-
}
|
|
176
170
|
});
|
|
177
171
|
const topLevelNodeMarginStyles = css({
|
|
178
172
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
@@ -266,6 +260,6 @@ const blockCardWithoutLayout = css({
|
|
|
266
260
|
});
|
|
267
261
|
export const GlobalStylesWrapper = () => {
|
|
268
262
|
return jsx(Global, {
|
|
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, withFormatInLayoutStyleFix,
|
|
263
|
+
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, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle,,]
|
|
270
264
|
});
|
|
271
265
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { getNestedDepth, getNodeAnchor, TYPE_NODE_DEC } from './decorations-common';
|
|
6
5
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
|
|
@@ -9,7 +8,7 @@ var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSin
|
|
|
9
8
|
var IGNORE_NODE_DESCENDANTS_ADVANCED_LAYOUT = ['listItem', 'taskList', 'decisionList'];
|
|
10
9
|
export var shouldDescendIntoNode = function shouldDescendIntoNode(node) {
|
|
11
10
|
// Optimisation to avoid drawing node decorations for empty table cells
|
|
12
|
-
if (['tableCell', 'tableHeader'].includes(node.type.name)
|
|
11
|
+
if (['tableCell', 'tableHeader'].includes(node.type.name)) {
|
|
13
12
|
var _node$firstChild;
|
|
14
13
|
if (node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'paragraph') {
|
|
15
14
|
return false;
|
|
@@ -24,7 +23,7 @@ var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, pare
|
|
|
24
23
|
// Ignored via go/ees005
|
|
25
24
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
25
|
) {
|
|
27
|
-
var isEmbedCard =
|
|
26
|
+
var isEmbedCard = node.type.name === 'embedCard';
|
|
28
27
|
var isMediaSingle = node.type.name === 'mediaSingle';
|
|
29
28
|
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);
|
|
30
29
|
if (isFirstTableRow) {
|
|
@@ -89,7 +88,7 @@ export var nodeDecorations = function nodeDecorations(newState, from, to) {
|
|
|
89
88
|
var _anchorName2;
|
|
90
89
|
anchorName = (_anchorName2 = anchorName) !== null && _anchorName2 !== void 0 ? _anchorName2 : "--node-anchor-".concat(node.type.name, "-").concat(index);
|
|
91
90
|
}
|
|
92
|
-
var anchorStyles =
|
|
91
|
+
var anchorStyles = "anchor-name: ".concat(anchorName, ";");
|
|
93
92
|
var subType = node.attrs.level ? "-".concat(node.attrs.level) : '';
|
|
94
93
|
decs.push(Decoration.node(pos, pos + node.nodeSize, _defineProperty(_defineProperty(_defineProperty({
|
|
95
94
|
style: anchorStyles
|
|
@@ -45,7 +45,7 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
if (editorExperiment('nested-dnd', true)) {
|
|
48
|
-
var newPos =
|
|
48
|
+
var newPos = getPos();
|
|
49
49
|
if (typeof newPos === 'number') {
|
|
50
50
|
var $pos = view.state.doc.resolve(newPos);
|
|
51
51
|
isTopLevelNode = ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
|
|
@@ -42,16 +42,12 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
42
42
|
var parentElementType = parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
|
|
43
43
|
if (editorExperiment('advanced_layouts', true) && fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
44
44
|
// We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
|
|
45
|
-
if (parentElement && (parentElementType === 'table' || parentElementType === 'tableRow') && editorExperiment('nested-dnd', true)
|
|
46
|
-
exposure: true
|
|
47
|
-
})) {
|
|
45
|
+
if (parentElement && (parentElementType === 'table' || parentElementType === 'tableRow') && editorExperiment('nested-dnd', true)) {
|
|
48
46
|
rootElement = parentElement;
|
|
49
47
|
}
|
|
50
48
|
} else {
|
|
51
49
|
// We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
|
|
52
|
-
if (parentElement && parentElementType === 'table' && editorExperiment('nested-dnd', true)
|
|
53
|
-
exposure: true
|
|
54
|
-
})) {
|
|
50
|
+
if (parentElement && parentElementType === 'table' && editorExperiment('nested-dnd', true)) {
|
|
55
51
|
rootElement = parentElement;
|
|
56
52
|
}
|
|
57
53
|
}
|
|
@@ -66,9 +66,9 @@ var extendedHoverZoneNested = function extendedHoverZoneNested() {
|
|
|
66
66
|
position: 'absolute',
|
|
67
67
|
top: 0,
|
|
68
68
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
69
|
-
left:
|
|
69
|
+
left: 0,
|
|
70
70
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
71
|
-
width:
|
|
71
|
+
width: 0,
|
|
72
72
|
height: '100%',
|
|
73
73
|
cursor: 'default',
|
|
74
74
|
zIndex: 1
|
|
@@ -130,18 +130,12 @@ var globalDnDStyle = css({
|
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
var globalStyles = function globalStyles() {
|
|
133
|
-
return
|
|
133
|
+
return css({
|
|
134
134
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
135
135
|
'.ProseMirror-widget:first-child + *:not([data-panel-type], .code-block, [data-node-type="nestedExpand"], [data-layout-section="true"])': {
|
|
136
136
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
137
137
|
marginTop: '0 !important'
|
|
138
138
|
}
|
|
139
|
-
}) : css({
|
|
140
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
141
|
-
'.ProseMirror-widget:first-child + *:not([data-panel-type], .code-block, [data-node-type="nestedExpand"])': {
|
|
142
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
143
|
-
marginTop: '0 !important'
|
|
144
|
-
}
|
|
145
139
|
});
|
|
146
140
|
};
|
|
147
141
|
var topLevelNodeMarginStyles = css({
|
|
@@ -215,6 +209,6 @@ var blockCardWithoutLayout = css({
|
|
|
215
209
|
});
|
|
216
210
|
export var GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
217
211
|
return jsx(Global, {
|
|
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, withFormatInLayoutStyleFix,
|
|
212
|
+
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, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle,,]
|
|
219
213
|
});
|
|
220
214
|
};
|
|
@@ -43,19 +43,21 @@ export type BlockControlsSharedState = {
|
|
|
43
43
|
export type HandleOptions = {
|
|
44
44
|
isFocused: boolean;
|
|
45
45
|
} | undefined;
|
|
46
|
+
export type MoveNode = (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
|
|
47
|
+
export type BlockControlsPluginDependencies = [
|
|
48
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
49
|
+
OptionalPlugin<WidthPlugin>,
|
|
50
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
51
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
52
|
+
OptionalPlugin<AccessibilityUtilsPlugin>,
|
|
53
|
+
/**
|
|
54
|
+
* For Typeahead - Empty line prompt experiment
|
|
55
|
+
* Clean up ticket ED-24824
|
|
56
|
+
*/
|
|
57
|
+
OptionalPlugin<QuickInsertPlugin>
|
|
58
|
+
];
|
|
46
59
|
export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
47
|
-
dependencies:
|
|
48
|
-
OptionalPlugin<EditorDisabledPlugin>,
|
|
49
|
-
OptionalPlugin<WidthPlugin>,
|
|
50
|
-
OptionalPlugin<FeatureFlagsPlugin>,
|
|
51
|
-
OptionalPlugin<AnalyticsPlugin>,
|
|
52
|
-
OptionalPlugin<AccessibilityUtilsPlugin>,
|
|
53
|
-
/**
|
|
54
|
-
* For Typeahead - Empty line prompt experiment
|
|
55
|
-
* Clean up ticket ED-24824
|
|
56
|
-
*/
|
|
57
|
-
OptionalPlugin<QuickInsertPlugin>
|
|
58
|
-
];
|
|
60
|
+
dependencies: BlockControlsPluginDependencies;
|
|
59
61
|
sharedState: BlockControlsSharedState;
|
|
60
62
|
commands: {
|
|
61
63
|
/**
|
|
@@ -67,7 +69,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
67
69
|
moveToLayout: (start: number, to: number, options?: {
|
|
68
70
|
moveToEnd?: boolean;
|
|
69
71
|
}) => EditorCommand;
|
|
70
|
-
moveNode:
|
|
72
|
+
moveNode: MoveNode;
|
|
71
73
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
72
74
|
setNodeDragged: (getPos: () => number | undefined, anchorName: string, nodeType: string) => EditorCommand;
|
|
73
75
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
|
-
export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view:
|
|
5
|
+
export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view: EditorView, event: KeyboardEvent) => boolean;
|
|
@@ -43,19 +43,21 @@ export type BlockControlsSharedState = {
|
|
|
43
43
|
export type HandleOptions = {
|
|
44
44
|
isFocused: boolean;
|
|
45
45
|
} | undefined;
|
|
46
|
+
export type MoveNode = (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
|
|
47
|
+
export type BlockControlsPluginDependencies = [
|
|
48
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
49
|
+
OptionalPlugin<WidthPlugin>,
|
|
50
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
51
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
52
|
+
OptionalPlugin<AccessibilityUtilsPlugin>,
|
|
53
|
+
/**
|
|
54
|
+
* For Typeahead - Empty line prompt experiment
|
|
55
|
+
* Clean up ticket ED-24824
|
|
56
|
+
*/
|
|
57
|
+
OptionalPlugin<QuickInsertPlugin>
|
|
58
|
+
];
|
|
46
59
|
export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
47
|
-
dependencies:
|
|
48
|
-
OptionalPlugin<EditorDisabledPlugin>,
|
|
49
|
-
OptionalPlugin<WidthPlugin>,
|
|
50
|
-
OptionalPlugin<FeatureFlagsPlugin>,
|
|
51
|
-
OptionalPlugin<AnalyticsPlugin>,
|
|
52
|
-
OptionalPlugin<AccessibilityUtilsPlugin>,
|
|
53
|
-
/**
|
|
54
|
-
* For Typeahead - Empty line prompt experiment
|
|
55
|
-
* Clean up ticket ED-24824
|
|
56
|
-
*/
|
|
57
|
-
OptionalPlugin<QuickInsertPlugin>
|
|
58
|
-
];
|
|
60
|
+
dependencies: BlockControlsPluginDependencies;
|
|
59
61
|
sharedState: BlockControlsSharedState;
|
|
60
62
|
commands: {
|
|
61
63
|
/**
|
|
@@ -67,7 +69,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
67
69
|
moveToLayout: (start: number, to: number, options?: {
|
|
68
70
|
moveToEnd?: boolean;
|
|
69
71
|
}) => EditorCommand;
|
|
70
|
-
moveNode:
|
|
72
|
+
moveNode: MoveNode;
|
|
71
73
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
72
74
|
setNodeDragged: (getPos: () => number | undefined, anchorName: string, nodeType: string) => EditorCommand;
|
|
73
75
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
|
-
export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view:
|
|
5
|
+
export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view: EditorView, event: KeyboardEvent) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.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": "^99.
|
|
34
|
+
"@atlaskit/editor-common": "^99.1.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",
|
|
@@ -48,7 +48,7 @@
|
|
|
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.34.0",
|
|
52
52
|
"@atlaskit/tokens": "^3.0.0",
|
|
53
53
|
"@atlaskit/tooltip": "^19.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -121,9 +121,6 @@
|
|
|
121
121
|
"platform_editor_element_drag_and_drop_ed_24885": {
|
|
122
122
|
"type": "boolean"
|
|
123
123
|
},
|
|
124
|
-
"platform_editor_element_dnd_nested_fix_patch_3": {
|
|
125
|
-
"type": "boolean"
|
|
126
|
-
},
|
|
127
124
|
"platform_editor_element_dnd_nested_fix_patch_6": {
|
|
128
125
|
"type": "boolean"
|
|
129
126
|
},
|