@atlaskit/editor-plugin-block-controls 2.26.3 → 2.26.4
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/pm-plugins/decorations-anchor.js +8 -1
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +33 -12
- package/dist/es2019/pm-plugins/decorations-anchor.js +8 -1
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +25 -2
- package/dist/esm/pm-plugins/decorations-anchor.js +8 -1
- package/dist/esm/pm-plugins/decorations-drag-handle.js +33 -12
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.26.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#112698](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112698)
|
|
8
|
+
[`121f8e8854a3a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/121f8e8854a3a) -
|
|
9
|
+
[ux] [ED-26476] Bugfix for drag handle appearing on nested tables when it shouldn't.
|
|
10
|
+
|
|
3
11
|
## 2.26.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -28,9 +28,16 @@ var shouldDescendIntoNode = exports.shouldDescendIntoNode = function shouldDesce
|
|
|
28
28
|
return !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
|
|
29
29
|
};
|
|
30
30
|
var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, parent) {
|
|
31
|
-
var _node$attrs, _node$attrs2;
|
|
31
|
+
var _nodeTypes$table, _node$attrs, _node$attrs2;
|
|
32
32
|
var isEmbedCard = node.type.name === 'embedCard';
|
|
33
33
|
var isMediaSingle = node.type.name === 'mediaSingle';
|
|
34
|
+
var nodeTypes = node.type.schema.nodes;
|
|
35
|
+
var isTable = node.type.name === (nodeTypes === null || nodeTypes === void 0 || (_nodeTypes$table = nodeTypes.table) === null || _nodeTypes$table === void 0 ? void 0 : _nodeTypes$table.name);
|
|
36
|
+
var parentIsTable = parent && [nodeTypes.tableHeader, nodeTypes.tableCell].includes(parent.type);
|
|
37
|
+
var isNestedTable = isTable && parentIsTable;
|
|
38
|
+
if (isNestedTable && (0, _platformFeatureFlags.fg)('platform_editor_disable_drag_handle_nested_tables')) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
34
41
|
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);
|
|
35
42
|
if (isFirstTableRow) {
|
|
36
43
|
return false;
|
|
@@ -8,6 +8,7 @@ exports.findHandleDec = exports.emptyParagraphNodeDecorations = exports.dragHand
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _bindEventListener = require("bind-event-listener");
|
|
11
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
12
13
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
13
14
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -70,18 +71,38 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
70
71
|
// There are times when global clear: "both" styles are applied to this decoration causing jumpiness
|
|
71
72
|
// due to margins applied to other nodes eg. Headings
|
|
72
73
|
element.style.clear = 'unset';
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
|
|
75
|
+
// temporarily re-instating ReactDOM.render to fix drag handle focus issue, fix to
|
|
76
|
+
// follow via ED-26546
|
|
77
|
+
|
|
78
|
+
// if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
79
|
+
// nodeViewPortalProviderAPI.render(
|
|
80
|
+
// () =>
|
|
81
|
+
// createElement(DragHandle, {
|
|
82
|
+
// view,
|
|
83
|
+
// api,
|
|
84
|
+
// formatMessage,
|
|
85
|
+
// getPos,
|
|
86
|
+
// anchorName,
|
|
87
|
+
// nodeType,
|
|
88
|
+
// handleOptions,
|
|
89
|
+
// isTopLevelNode,
|
|
90
|
+
// }),
|
|
91
|
+
// element,
|
|
92
|
+
// key,
|
|
93
|
+
// );
|
|
94
|
+
// } else {
|
|
95
|
+
_reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dragHandle.DragHandle, {
|
|
96
|
+
view: view,
|
|
97
|
+
api: api,
|
|
98
|
+
formatMessage: formatMessage,
|
|
99
|
+
getPos: getPos,
|
|
100
|
+
anchorName: anchorName,
|
|
101
|
+
nodeType: nodeType,
|
|
102
|
+
handleOptions: handleOptions,
|
|
103
|
+
isTopLevelNode: isTopLevelNode
|
|
104
|
+
}), element);
|
|
105
|
+
//}
|
|
85
106
|
return element;
|
|
86
107
|
}, {
|
|
87
108
|
side: -1,
|
|
@@ -20,9 +20,16 @@ export const shouldDescendIntoNode = node => {
|
|
|
20
20
|
return !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
|
|
21
21
|
};
|
|
22
22
|
const shouldIgnoreNode = (node, ignore_nodes, depth, parent) => {
|
|
23
|
-
var _node$attrs, _node$attrs2;
|
|
23
|
+
var _nodeTypes$table, _node$attrs, _node$attrs2;
|
|
24
24
|
const isEmbedCard = node.type.name === 'embedCard';
|
|
25
25
|
const isMediaSingle = node.type.name === 'mediaSingle';
|
|
26
|
+
const nodeTypes = node.type.schema.nodes;
|
|
27
|
+
const isTable = node.type.name === (nodeTypes === null || nodeTypes === void 0 ? void 0 : (_nodeTypes$table = nodeTypes.table) === null || _nodeTypes$table === void 0 ? void 0 : _nodeTypes$table.name);
|
|
28
|
+
const parentIsTable = parent && [nodeTypes.tableHeader, nodeTypes.tableCell].includes(parent.type);
|
|
29
|
+
const isNestedTable = isTable && parentIsTable;
|
|
30
|
+
if (isNestedTable && fg('platform_editor_disable_drag_handle_nested_tables')) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
26
33
|
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);
|
|
27
34
|
if (isFirstTableRow) {
|
|
28
35
|
return false;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
3
4
|
import uuid from 'uuid';
|
|
4
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -61,7 +62,28 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
|
|
|
61
62
|
// There are times when global clear: "both" styles are applied to this decoration causing jumpiness
|
|
62
63
|
// due to margins applied to other nodes eg. Headings
|
|
63
64
|
element.style.clear = 'unset';
|
|
64
|
-
|
|
65
|
+
|
|
66
|
+
// temporarily re-instating ReactDOM.render to fix drag handle focus issue, fix to
|
|
67
|
+
// follow via ED-26546
|
|
68
|
+
|
|
69
|
+
// if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
70
|
+
// nodeViewPortalProviderAPI.render(
|
|
71
|
+
// () =>
|
|
72
|
+
// createElement(DragHandle, {
|
|
73
|
+
// view,
|
|
74
|
+
// api,
|
|
75
|
+
// formatMessage,
|
|
76
|
+
// getPos,
|
|
77
|
+
// anchorName,
|
|
78
|
+
// nodeType,
|
|
79
|
+
// handleOptions,
|
|
80
|
+
// isTopLevelNode,
|
|
81
|
+
// }),
|
|
82
|
+
// element,
|
|
83
|
+
// key,
|
|
84
|
+
// );
|
|
85
|
+
// } else {
|
|
86
|
+
ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
|
|
65
87
|
view,
|
|
66
88
|
api,
|
|
67
89
|
formatMessage,
|
|
@@ -70,7 +92,8 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
|
|
|
70
92
|
nodeType,
|
|
71
93
|
handleOptions,
|
|
72
94
|
isTopLevelNode
|
|
73
|
-
}), element
|
|
95
|
+
}), element);
|
|
96
|
+
//}
|
|
74
97
|
return element;
|
|
75
98
|
}, {
|
|
76
99
|
side: -1,
|
|
@@ -21,9 +21,16 @@ export var shouldDescendIntoNode = function shouldDescendIntoNode(node) {
|
|
|
21
21
|
return !IGNORE_NODE_DESCENDANTS.includes(node.type.name);
|
|
22
22
|
};
|
|
23
23
|
var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, parent) {
|
|
24
|
-
var _node$attrs, _node$attrs2;
|
|
24
|
+
var _nodeTypes$table, _node$attrs, _node$attrs2;
|
|
25
25
|
var isEmbedCard = node.type.name === 'embedCard';
|
|
26
26
|
var isMediaSingle = node.type.name === 'mediaSingle';
|
|
27
|
+
var nodeTypes = node.type.schema.nodes;
|
|
28
|
+
var isTable = node.type.name === (nodeTypes === null || nodeTypes === void 0 || (_nodeTypes$table = nodeTypes.table) === null || _nodeTypes$table === void 0 ? void 0 : _nodeTypes$table.name);
|
|
29
|
+
var parentIsTable = parent && [nodeTypes.tableHeader, nodeTypes.tableCell].includes(parent.type);
|
|
30
|
+
var isNestedTable = isTable && parentIsTable;
|
|
31
|
+
if (isNestedTable && fg('platform_editor_disable_drag_handle_nested_tables')) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
27
34
|
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);
|
|
28
35
|
if (isFirstTableRow) {
|
|
29
36
|
return false;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { bind } from 'bind-event-listener';
|
|
4
|
+
import ReactDOM from 'react-dom';
|
|
4
5
|
import uuid from 'uuid';
|
|
5
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -63,18 +64,38 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
63
64
|
// There are times when global clear: "both" styles are applied to this decoration causing jumpiness
|
|
64
65
|
// due to margins applied to other nodes eg. Headings
|
|
65
66
|
element.style.clear = 'unset';
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
|
|
68
|
+
// temporarily re-instating ReactDOM.render to fix drag handle focus issue, fix to
|
|
69
|
+
// follow via ED-26546
|
|
70
|
+
|
|
71
|
+
// if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
72
|
+
// nodeViewPortalProviderAPI.render(
|
|
73
|
+
// () =>
|
|
74
|
+
// createElement(DragHandle, {
|
|
75
|
+
// view,
|
|
76
|
+
// api,
|
|
77
|
+
// formatMessage,
|
|
78
|
+
// getPos,
|
|
79
|
+
// anchorName,
|
|
80
|
+
// nodeType,
|
|
81
|
+
// handleOptions,
|
|
82
|
+
// isTopLevelNode,
|
|
83
|
+
// }),
|
|
84
|
+
// element,
|
|
85
|
+
// key,
|
|
86
|
+
// );
|
|
87
|
+
// } else {
|
|
88
|
+
ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
|
|
89
|
+
view: view,
|
|
90
|
+
api: api,
|
|
91
|
+
formatMessage: formatMessage,
|
|
92
|
+
getPos: getPos,
|
|
93
|
+
anchorName: anchorName,
|
|
94
|
+
nodeType: nodeType,
|
|
95
|
+
handleOptions: handleOptions,
|
|
96
|
+
isTopLevelNode: isTopLevelNode
|
|
97
|
+
}), element);
|
|
98
|
+
//}
|
|
78
99
|
return element;
|
|
79
100
|
}, {
|
|
80
101
|
side: -1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.26.
|
|
3
|
+
"version": "2.26.4",
|
|
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": "^47.2.1",
|
|
34
|
-
"@atlaskit/editor-common": "^99.
|
|
34
|
+
"@atlaskit/editor-common": "^99.15.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.12.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.5.0",
|
|
@@ -148,6 +148,9 @@
|
|
|
148
148
|
},
|
|
149
149
|
"platform_editor_track_node_types": {
|
|
150
150
|
"type": "boolean"
|
|
151
|
+
},
|
|
152
|
+
"platform_editor_disable_drag_handle_nested_tables": {
|
|
153
|
+
"type": "boolean"
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
156
|
}
|