@atlaskit/editor-plugin-block-controls 6.3.5 → 6.3.6
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-with-block-menu.js +1 -1
- package/dist/cjs/editor-commands/utils/move-node-utils.js +2 -2
- package/dist/cjs/pm-plugins/utils/getSelection.js +2 -10
- package/dist/es2019/editor-commands/move-node-with-block-menu.js +1 -1
- package/dist/es2019/editor-commands/utils/move-node-utils.js +2 -2
- package/dist/es2019/pm-plugins/utils/getSelection.js +2 -10
- package/dist/esm/editor-commands/move-node-with-block-menu.js +1 -1
- package/dist/esm/editor-commands/utils/move-node-utils.js +2 -2
- package/dist/esm/pm-plugins/utils/getSelection.js +2 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 6.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ef686b3cfdbff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ef686b3cfdbff) -
|
|
8
|
+
ED-29222: Make empty line experiment dependent on block menu
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 6.3.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -38,7 +38,7 @@ var moveNodeWithBlockMenu = exports.moveNodeWithBlockMenu = function moveNodeWit
|
|
|
38
38
|
(0, _moveNode.moveNode)(api)(currentNodePos, moveToPos, _analytics.INPUT_METHOD.BLOCK_MENU)({
|
|
39
39
|
tr: tr
|
|
40
40
|
});
|
|
41
|
-
if (tr.selection.empty && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
41
|
+
if (tr.selection.empty && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
42
42
|
var nodeAtCurrentPos = tr.doc.nodeAt(currentNodePos);
|
|
43
43
|
var nodeAfter = tr.doc.nodeAt(moveToPos);
|
|
44
44
|
var isConsecutiveEmptyLineMove = (nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0;
|
|
@@ -13,7 +13,7 @@ var getCurrentNodePosFromDragHandleSelection = exports.getCurrentNodePosFromDrag
|
|
|
13
13
|
schema = _ref.schema,
|
|
14
14
|
resolve = _ref.resolve;
|
|
15
15
|
var currentNodePos = -1;
|
|
16
|
-
if (selection.empty && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
16
|
+
if (selection.empty && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
17
17
|
currentNodePos = selection.$from.pos;
|
|
18
18
|
}
|
|
19
19
|
if ((0, _utils.isTableSelected)(selection)) {
|
|
@@ -49,7 +49,7 @@ var getPosWhenMoveNodeDown = exports.getPosWhenMoveNodeDown = function getPosWhe
|
|
|
49
49
|
return -1;
|
|
50
50
|
}
|
|
51
51
|
var nodeAfter = tr.doc.nodeAt(nodeAfterPos);
|
|
52
|
-
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
52
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
53
53
|
var nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
|
|
54
54
|
// if move empty line down to another empty line, move to the position of the next empty line
|
|
55
55
|
if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
|
|
@@ -77,11 +77,9 @@ var newGetSelection = function newGetSelection(tr, start) {
|
|
|
77
77
|
var isNodeSelection = node && _state.NodeSelection.isSelectable(node);
|
|
78
78
|
var nodeSize = node ? node.nodeSize : 1;
|
|
79
79
|
var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
|
|
80
|
-
var blockMenuEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true);
|
|
81
|
-
var blockMenuEmptyLineEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
82
80
|
|
|
83
81
|
// this is a fix for empty paragraph selection - put first to avoid any extra work
|
|
84
|
-
if (nodeName === 'paragraph' && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && !
|
|
82
|
+
if (nodeName === 'paragraph' && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
85
83
|
return false;
|
|
86
84
|
}
|
|
87
85
|
var isParagraphHeadingEmpty = ['paragraph', 'heading'].includes(nodeName || '') && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0;
|
|
@@ -90,13 +88,7 @@ var newGetSelection = function newGetSelection(tr, start) {
|
|
|
90
88
|
|
|
91
89
|
// if block menu and empty line format menu are enabled,
|
|
92
90
|
// we want to set the selection to avoid the selection goes to the top of the document
|
|
93
|
-
if ((isParagraphHeadingEmpty || isBlockQuoteEmpty || isListEmpty) &&
|
|
94
|
-
return _state.TextSelection.create(tr.doc, start + 1, start + 1);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// if block menu and empty line format menu are enabled,
|
|
98
|
-
// we want to set the selection to avoid the selection goes to the top of the document
|
|
99
|
-
if (['paragraph', 'heading', 'orderedList', 'bulletList', 'taskList', 'blockquote'].includes(nodeName || '') && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && blockMenuEnabled && blockMenuEmptyLineEnabled) {
|
|
91
|
+
if ((isParagraphHeadingEmpty || isBlockQuoteEmpty || isListEmpty) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
100
92
|
return _state.TextSelection.create(tr.doc, start + 1, start + 1);
|
|
101
93
|
}
|
|
102
94
|
var isBlockQuoteWithMediaOrExtension = nodeName === 'blockquote' && isNodeWithMediaOrExtension(tr, start, nodeSize);
|
|
@@ -33,7 +33,7 @@ export const moveNodeWithBlockMenu = (api, direction) => {
|
|
|
33
33
|
moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.BLOCK_MENU)({
|
|
34
34
|
tr
|
|
35
35
|
});
|
|
36
|
-
if (tr.selection.empty && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
36
|
+
if (tr.selection.empty && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
37
37
|
const nodeAtCurrentPos = tr.doc.nodeAt(currentNodePos);
|
|
38
38
|
const nodeAfter = tr.doc.nodeAt(moveToPos);
|
|
39
39
|
const isConsecutiveEmptyLineMove = (nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0;
|
|
@@ -8,7 +8,7 @@ export const getCurrentNodePosFromDragHandleSelection = ({
|
|
|
8
8
|
resolve
|
|
9
9
|
}) => {
|
|
10
10
|
let currentNodePos = -1;
|
|
11
|
-
if (selection.empty && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
11
|
+
if (selection.empty && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
12
12
|
currentNodePos = selection.$from.pos;
|
|
13
13
|
}
|
|
14
14
|
if (isTableSelected(selection)) {
|
|
@@ -45,7 +45,7 @@ export const getPosWhenMoveNodeDown = ({
|
|
|
45
45
|
return -1;
|
|
46
46
|
}
|
|
47
47
|
const nodeAfter = tr.doc.nodeAt(nodeAfterPos);
|
|
48
|
-
if (expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
48
|
+
if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
49
49
|
const nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
|
|
50
50
|
// if move empty line down to another empty line, move to the position of the next empty line
|
|
51
51
|
if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
|
|
@@ -72,11 +72,9 @@ const newGetSelection = (tr, start) => {
|
|
|
72
72
|
const isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
73
73
|
const nodeSize = node ? node.nodeSize : 1;
|
|
74
74
|
const nodeName = node === null || node === void 0 ? void 0 : node.type.name;
|
|
75
|
-
const blockMenuEnabled = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
|
|
76
|
-
const blockMenuEmptyLineEnabled = expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
77
75
|
|
|
78
76
|
// this is a fix for empty paragraph selection - put first to avoid any extra work
|
|
79
|
-
if (nodeName === 'paragraph' && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && !
|
|
77
|
+
if (nodeName === 'paragraph' && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && !expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
80
78
|
return false;
|
|
81
79
|
}
|
|
82
80
|
const isParagraphHeadingEmpty = ['paragraph', 'heading'].includes(nodeName || '') && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0;
|
|
@@ -85,13 +83,7 @@ const newGetSelection = (tr, start) => {
|
|
|
85
83
|
|
|
86
84
|
// if block menu and empty line format menu are enabled,
|
|
87
85
|
// we want to set the selection to avoid the selection goes to the top of the document
|
|
88
|
-
if ((isParagraphHeadingEmpty || isBlockQuoteEmpty || isListEmpty) &&
|
|
89
|
-
return TextSelection.create(tr.doc, start + 1, start + 1);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// if block menu and empty line format menu are enabled,
|
|
93
|
-
// we want to set the selection to avoid the selection goes to the top of the document
|
|
94
|
-
if (['paragraph', 'heading', 'orderedList', 'bulletList', 'taskList', 'blockquote'].includes(nodeName || '') && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && blockMenuEnabled && blockMenuEmptyLineEnabled) {
|
|
86
|
+
if ((isParagraphHeadingEmpty || isBlockQuoteEmpty || isListEmpty) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
95
87
|
return TextSelection.create(tr.doc, start + 1, start + 1);
|
|
96
88
|
}
|
|
97
89
|
const isBlockQuoteWithMediaOrExtension = nodeName === 'blockquote' && isNodeWithMediaOrExtension(tr, start, nodeSize);
|
|
@@ -32,7 +32,7 @@ export var moveNodeWithBlockMenu = function moveNodeWithBlockMenu(api, direction
|
|
|
32
32
|
moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.BLOCK_MENU)({
|
|
33
33
|
tr: tr
|
|
34
34
|
});
|
|
35
|
-
if (tr.selection.empty && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
35
|
+
if (tr.selection.empty && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
36
36
|
var nodeAtCurrentPos = tr.doc.nodeAt(currentNodePos);
|
|
37
37
|
var nodeAfter = tr.doc.nodeAt(moveToPos);
|
|
38
38
|
var isConsecutiveEmptyLineMove = (nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0;
|
|
@@ -7,7 +7,7 @@ export var getCurrentNodePosFromDragHandleSelection = function getCurrentNodePos
|
|
|
7
7
|
schema = _ref.schema,
|
|
8
8
|
resolve = _ref.resolve;
|
|
9
9
|
var currentNodePos = -1;
|
|
10
|
-
if (selection.empty && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
10
|
+
if (selection.empty && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
11
11
|
currentNodePos = selection.$from.pos;
|
|
12
12
|
}
|
|
13
13
|
if (isTableSelected(selection)) {
|
|
@@ -43,7 +43,7 @@ export var getPosWhenMoveNodeDown = function getPosWhenMoveNodeDown(_ref2) {
|
|
|
43
43
|
return -1;
|
|
44
44
|
}
|
|
45
45
|
var nodeAfter = tr.doc.nodeAt(nodeAfterPos);
|
|
46
|
-
if (expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
46
|
+
if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
47
47
|
var nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
|
|
48
48
|
// if move empty line down to another empty line, move to the position of the next empty line
|
|
49
49
|
if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
|
|
@@ -71,11 +71,9 @@ var newGetSelection = function newGetSelection(tr, start) {
|
|
|
71
71
|
var isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
72
72
|
var nodeSize = node ? node.nodeSize : 1;
|
|
73
73
|
var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
|
|
74
|
-
var blockMenuEnabled = expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
|
|
75
|
-
var blockMenuEmptyLineEnabled = expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
76
74
|
|
|
77
75
|
// this is a fix for empty paragraph selection - put first to avoid any extra work
|
|
78
|
-
if (nodeName === 'paragraph' && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && !
|
|
76
|
+
if (nodeName === 'paragraph' && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && !expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
79
77
|
return false;
|
|
80
78
|
}
|
|
81
79
|
var isParagraphHeadingEmpty = ['paragraph', 'heading'].includes(nodeName || '') && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0;
|
|
@@ -84,13 +82,7 @@ var newGetSelection = function newGetSelection(tr, start) {
|
|
|
84
82
|
|
|
85
83
|
// if block menu and empty line format menu are enabled,
|
|
86
84
|
// we want to set the selection to avoid the selection goes to the top of the document
|
|
87
|
-
if ((isParagraphHeadingEmpty || isBlockQuoteEmpty || isListEmpty) &&
|
|
88
|
-
return TextSelection.create(tr.doc, start + 1, start + 1);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// if block menu and empty line format menu are enabled,
|
|
92
|
-
// we want to set the selection to avoid the selection goes to the top of the document
|
|
93
|
-
if (['paragraph', 'heading', 'orderedList', 'bulletList', 'taskList', 'blockquote'].includes(nodeName || '') && tr.selection.empty && (node === null || node === void 0 ? void 0 : node.childCount) === 0 && blockMenuEnabled && blockMenuEmptyLineEnabled) {
|
|
85
|
+
if ((isParagraphHeadingEmpty || isBlockQuoteEmpty || isListEmpty) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true)) {
|
|
94
86
|
return TextSelection.create(tr.doc, start + 1, start + 1);
|
|
95
87
|
}
|
|
96
88
|
var isBlockQuoteWithMediaOrExtension = nodeName === 'blockquote' && isNodeWithMediaOrExtension(tr, start, nodeSize);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.6",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
53
53
|
"@atlaskit/primitives": "^14.15.0",
|
|
54
54
|
"@atlaskit/theme": "^21.0.0",
|
|
55
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^12.28.0",
|
|
56
56
|
"@atlaskit/tokens": "^6.3.0",
|
|
57
57
|
"@atlaskit/tooltip": "^20.4.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|