@atlaskit/editor-plugin-block-controls 11.5.2 → 11.5.3
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 +8 -0
- package/dist/cjs/editor-commands/move-node.js +3 -1
- package/dist/cjs/pm-plugins/decorations-drop-target.js +2 -1
- package/dist/cjs/pm-plugins/utils/validation.js +3 -1
- package/dist/es2019/editor-commands/move-node.js +4 -2
- package/dist/es2019/pm-plugins/decorations-drop-target.js +3 -2
- package/dist/es2019/pm-plugins/utils/validation.js +3 -1
- package/dist/esm/editor-commands/move-node.js +4 -2
- package/dist/esm/pm-plugins/decorations-drop-target.js +3 -2
- package/dist/esm/pm-plugins/utils/validation.js +3 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 11.5.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cd85cdec5ae7e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cd85cdec5ae7e) -
|
|
8
|
+
EDITOR-7170 add transform for panel -> panel_c1
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 11.5.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -19,6 +19,7 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
|
19
19
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
20
20
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
21
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
23
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
24
|
var _main = require("../pm-plugins/main");
|
|
24
25
|
var _analytics2 = require("../pm-plugins/utils/analytics");
|
|
@@ -77,7 +78,8 @@ var nodesSupportDragLayoutColumnInto = ['tableCell', 'tableHeader', 'panel', 'ex
|
|
|
77
78
|
var isDragLayoutColumnIntoSupportedNodes = function isDragLayoutColumnIntoSupportedNodes($from, $to) {
|
|
78
79
|
var _$from$nodeAfter;
|
|
79
80
|
var isTopLevel = $to.depth === 0;
|
|
80
|
-
var
|
|
81
|
+
var toParentTypeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _utils.getBaseNodeTypeName)($to.parent.type) : $to.parent.type.name;
|
|
82
|
+
var isDragIntoNodes = nodesSupportDragLayoutColumnInto.includes(toParentTypeName);
|
|
81
83
|
var supportedCondition = isDragIntoNodes || isTopLevel;
|
|
82
84
|
return ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && supportedCondition;
|
|
83
85
|
};
|
|
@@ -245,7 +245,8 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
|
|
|
245
245
|
return false; //not valid pos, so nested not valid either
|
|
246
246
|
}
|
|
247
247
|
var parentTypesWithEndDropTarget = (0, _experiments.editorExperiment)('platform_synced_block', true) ? PARENT_WITH_END_DROP_TARGET_NEXT : PARENT_WITH_END_DROP_TARGET;
|
|
248
|
-
|
|
248
|
+
var parentTypeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _utils.getBaseNodeTypeName)(parent.type) : parent.type.name;
|
|
249
|
+
if (parent.lastChild === node && !(0, _utils.isEmptyParagraph)(node) && parentTypesWithEndDropTarget.includes(parentTypeName)) {
|
|
249
250
|
endPos = pos + node.nodeSize;
|
|
250
251
|
}
|
|
251
252
|
var previousNode = popNodeStack(depth); // created scoped variable
|
|
@@ -12,6 +12,7 @@ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
|
12
12
|
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
13
13
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
14
14
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
17
|
var isInsideTable = exports.isInsideTable = function isInsideTable(nodeType) {
|
|
17
18
|
var _nodeType$schema$node = nodeType.schema.nodes,
|
|
@@ -112,6 +113,7 @@ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos,
|
|
|
112
113
|
nestedExpand = _schema$nodes.nestedExpand,
|
|
113
114
|
doc = _schema$nodes.doc,
|
|
114
115
|
panel = _schema$nodes.panel,
|
|
116
|
+
panel_c1 = _schema$nodes.panel_c1,
|
|
115
117
|
layoutColumn = _schema$nodes.layoutColumn,
|
|
116
118
|
layoutSection = _schema$nodes.layoutSection;
|
|
117
119
|
var destParentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type;
|
|
@@ -133,7 +135,7 @@ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos,
|
|
|
133
135
|
}
|
|
134
136
|
return canCreateNodeWithContentInsideAnotherNode([tableCell, tableHeader], convertedFragment);
|
|
135
137
|
}
|
|
136
|
-
if (destParentNodeType === panel) {
|
|
138
|
+
if (destParentNodeType === panel || (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) && destParentNodeType === panel_c1) {
|
|
137
139
|
return canCreateNodeWithContentInsideAnotherNode([panel], layoutColumnContent);
|
|
138
140
|
}
|
|
139
141
|
if (destParentNodeType === expand) {
|
|
@@ -4,13 +4,14 @@ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
|
4
4
|
import { expandSelectionBounds, GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
5
5
|
import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
6
6
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
7
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
7
|
+
import { getBaseNodeTypeName, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
11
11
|
import { findChildrenByType, findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
12
12
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
16
|
import { key } from '../pm-plugins/main';
|
|
16
17
|
import { attachMoveNodeAnalytics, getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
|
|
@@ -69,7 +70,8 @@ const nodesSupportDragLayoutColumnInto = ['tableCell', 'tableHeader', 'panel', '
|
|
|
69
70
|
const isDragLayoutColumnIntoSupportedNodes = ($from, $to) => {
|
|
70
71
|
var _$from$nodeAfter;
|
|
71
72
|
const isTopLevel = $to.depth === 0;
|
|
72
|
-
const
|
|
73
|
+
const toParentTypeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName($to.parent.type) : $to.parent.type.name;
|
|
74
|
+
const isDragIntoNodes = nodesSupportDragLayoutColumnInto.includes(toParentTypeName);
|
|
73
75
|
const supportedCondition = isDragIntoNodes || isTopLevel;
|
|
74
76
|
return ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && supportedCondition;
|
|
75
77
|
};
|
|
@@ -2,7 +2,7 @@ import { createElement } from 'react';
|
|
|
2
2
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
3
|
import uuid from 'uuid';
|
|
4
4
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
5
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { getBaseNodeTypeName, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -234,7 +234,8 @@ export const dropTargetDecorations = (newState, api, formatMessage, nodeViewPort
|
|
|
234
234
|
return false; //not valid pos, so nested not valid either
|
|
235
235
|
}
|
|
236
236
|
const parentTypesWithEndDropTarget = editorExperiment('platform_synced_block', true) ? PARENT_WITH_END_DROP_TARGET_NEXT : PARENT_WITH_END_DROP_TARGET;
|
|
237
|
-
|
|
237
|
+
const parentTypeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(parent.type) : parent.type.name;
|
|
238
|
+
if (parent.lastChild === node && !isEmptyParagraph(node) && parentTypesWithEndDropTarget.includes(parentTypeName)) {
|
|
238
239
|
endPos = pos + node.nodeSize;
|
|
239
240
|
}
|
|
240
241
|
const previousNode = popNodeStack(depth); // created scoped variable
|
|
@@ -2,6 +2,7 @@ import memoizeOne from 'memoize-one';
|
|
|
2
2
|
import { getParentOfTypeCount, isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
|
|
3
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
7
|
export const isInsideTable = nodeType => {
|
|
7
8
|
const {
|
|
@@ -100,6 +101,7 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNo
|
|
|
100
101
|
nestedExpand,
|
|
101
102
|
doc,
|
|
102
103
|
panel,
|
|
104
|
+
panel_c1,
|
|
103
105
|
layoutColumn,
|
|
104
106
|
layoutSection
|
|
105
107
|
} = schema.nodes;
|
|
@@ -122,7 +124,7 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNo
|
|
|
122
124
|
}
|
|
123
125
|
return canCreateNodeWithContentInsideAnotherNode([tableCell, tableHeader], convertedFragment);
|
|
124
126
|
}
|
|
125
|
-
if (destParentNodeType === panel) {
|
|
127
|
+
if (destParentNodeType === panel || expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) && destParentNodeType === panel_c1) {
|
|
126
128
|
return canCreateNodeWithContentInsideAnotherNode([panel], layoutColumnContent);
|
|
127
129
|
}
|
|
128
130
|
if (destParentNodeType === expand) {
|
|
@@ -7,13 +7,14 @@ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
|
7
7
|
import { expandSelectionBounds, GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
8
8
|
import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
9
9
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
10
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
10
|
+
import { getBaseNodeTypeName, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
11
11
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
12
12
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
14
14
|
import { findChildrenByType, findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
15
15
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
18
19
|
import { key } from '../pm-plugins/main';
|
|
19
20
|
import { attachMoveNodeAnalytics, getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
|
|
@@ -71,7 +72,8 @@ var nodesSupportDragLayoutColumnInto = ['tableCell', 'tableHeader', 'panel', 'ex
|
|
|
71
72
|
var isDragLayoutColumnIntoSupportedNodes = function isDragLayoutColumnIntoSupportedNodes($from, $to) {
|
|
72
73
|
var _$from$nodeAfter;
|
|
73
74
|
var isTopLevel = $to.depth === 0;
|
|
74
|
-
var
|
|
75
|
+
var toParentTypeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName($to.parent.type) : $to.parent.type.name;
|
|
76
|
+
var isDragIntoNodes = nodesSupportDragLayoutColumnInto.includes(toParentTypeName);
|
|
75
77
|
var supportedCondition = isDragIntoNodes || isTopLevel;
|
|
76
78
|
return ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && supportedCondition;
|
|
77
79
|
};
|
|
@@ -5,7 +5,7 @@ import { createElement } from 'react';
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
6
6
|
import uuid from 'uuid';
|
|
7
7
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
8
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
8
|
+
import { getBaseNodeTypeName, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -239,7 +239,8 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
|
|
|
239
239
|
return false; //not valid pos, so nested not valid either
|
|
240
240
|
}
|
|
241
241
|
var parentTypesWithEndDropTarget = editorExperiment('platform_synced_block', true) ? PARENT_WITH_END_DROP_TARGET_NEXT : PARENT_WITH_END_DROP_TARGET;
|
|
242
|
-
|
|
242
|
+
var parentTypeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(parent.type) : parent.type.name;
|
|
243
|
+
if (parent.lastChild === node && !isEmptyParagraph(node) && parentTypesWithEndDropTarget.includes(parentTypeName)) {
|
|
243
244
|
endPos = pos + node.nodeSize;
|
|
244
245
|
}
|
|
245
246
|
var previousNode = popNodeStack(depth); // created scoped variable
|
|
@@ -2,6 +2,7 @@ import memoizeOne from 'memoize-one';
|
|
|
2
2
|
import { getParentOfTypeCount, isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
|
|
3
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
7
|
export var isInsideTable = function isInsideTable(nodeType) {
|
|
7
8
|
var _nodeType$schema$node = nodeType.schema.nodes,
|
|
@@ -102,6 +103,7 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNo
|
|
|
102
103
|
nestedExpand = _schema$nodes.nestedExpand,
|
|
103
104
|
doc = _schema$nodes.doc,
|
|
104
105
|
panel = _schema$nodes.panel,
|
|
106
|
+
panel_c1 = _schema$nodes.panel_c1,
|
|
105
107
|
layoutColumn = _schema$nodes.layoutColumn,
|
|
106
108
|
layoutSection = _schema$nodes.layoutSection;
|
|
107
109
|
var destParentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type;
|
|
@@ -123,7 +125,7 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNo
|
|
|
123
125
|
}
|
|
124
126
|
return canCreateNodeWithContentInsideAnotherNode([tableCell, tableHeader], convertedFragment);
|
|
125
127
|
}
|
|
126
|
-
if (destParentNodeType === panel) {
|
|
128
|
+
if (destParentNodeType === panel || expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) && destParentNodeType === panel_c1) {
|
|
127
129
|
return canCreateNodeWithContentInsideAnotherNode([panel], layoutColumnContent);
|
|
128
130
|
}
|
|
129
131
|
if (destParentNodeType === expand) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.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": "^84.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^84.3.0",
|
|
60
60
|
"@atlaskit/tokens": "^13.0.0",
|
|
61
61
|
"@atlaskit/tooltip": "^22.3.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": "^114.
|
|
70
|
+
"@atlaskit/editor-common": "^114.49.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"
|