@atlaskit/editor-plugin-block-controls 2.15.6 → 2.15.7
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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.15.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#178258](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/178258)
|
|
8
|
+
[`89f4f17d79f0e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/89f4f17d79f0e) -
|
|
9
|
+
ED-26037 fix insert nested node to layout
|
|
10
|
+
|
|
3
11
|
## 2.15.6
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -54,7 +54,7 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
54
54
|
var _$originalFrom$nodeAf2;
|
|
55
55
|
if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
56
56
|
(0, _removeFromSource.removeFromSource)(tr, tr.doc.resolve(from));
|
|
57
|
-
|
|
57
|
+
insertToDestinationNoWidthUpdate(tr, tr.mapping.map(to), sourceNode);
|
|
58
58
|
} else {
|
|
59
59
|
insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
|
|
60
60
|
var mappedFrom = tr.mapping.map(from);
|
|
@@ -64,11 +64,29 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
64
64
|
}
|
|
65
65
|
return tr;
|
|
66
66
|
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* This function is similar to insertToDestination
|
|
70
|
+
* But without update width step, mainly rely on the append transaction from layout.
|
|
71
|
+
* @param tr
|
|
72
|
+
* @param to
|
|
73
|
+
* @param sourceNode
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
var insertToDestinationNoWidthUpdate = function insertToDestinationNoWidthUpdate(tr, to, sourceNode) {
|
|
77
|
+
var _ref2 = tr.doc.type.schema.nodes || {},
|
|
78
|
+
layoutColumn = _ref2.layoutColumn;
|
|
79
|
+
var content = layoutColumn.createChecked({
|
|
80
|
+
width: 0
|
|
81
|
+
}, sourceNode.type.name === 'layoutColumn' ? sourceNode.content : sourceNode);
|
|
82
|
+
tr.insert(to, content);
|
|
83
|
+
return tr;
|
|
84
|
+
};
|
|
67
85
|
var insertToDestination = function insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos) {
|
|
68
|
-
var
|
|
69
|
-
newColumnWidth =
|
|
70
|
-
var
|
|
71
|
-
layoutColumn =
|
|
86
|
+
var _ref3 = (0, _updateColumnWidths.updateColumnWidths)(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {},
|
|
87
|
+
newColumnWidth = _ref3.newColumnWidth;
|
|
88
|
+
var _ref4 = tr.doc.type.schema.nodes || {},
|
|
89
|
+
layoutColumn = _ref4.layoutColumn;
|
|
72
90
|
var content = layoutColumn.createChecked({
|
|
73
91
|
width: newColumnWidth
|
|
74
92
|
}, sourceNode.type.name === 'layoutColumn' ? sourceNode.content : sourceNode);
|
|
@@ -87,10 +105,10 @@ var canMoveToLayout = function canMoveToLayout(from, to, tr) {
|
|
|
87
105
|
if (from === to) {
|
|
88
106
|
return;
|
|
89
107
|
}
|
|
90
|
-
var
|
|
91
|
-
layoutSection =
|
|
92
|
-
layoutColumn =
|
|
93
|
-
doc =
|
|
108
|
+
var _ref5 = tr.doc.type.schema.nodes || {},
|
|
109
|
+
layoutSection = _ref5.layoutSection,
|
|
110
|
+
layoutColumn = _ref5.layoutColumn,
|
|
111
|
+
doc = _ref5.doc;
|
|
94
112
|
|
|
95
113
|
// layout plugin does not exist
|
|
96
114
|
if (!layoutSection || !layoutColumn) {
|
|
@@ -119,8 +137,8 @@ var canMoveToLayout = function canMoveToLayout(from, to, tr) {
|
|
|
119
137
|
};
|
|
120
138
|
var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
121
139
|
return function (from, to, options) {
|
|
122
|
-
return function (
|
|
123
|
-
var tr =
|
|
140
|
+
return function (_ref6) {
|
|
141
|
+
var tr = _ref6.tr;
|
|
124
142
|
var canMove = canMoveToLayout(from, to, tr);
|
|
125
143
|
if (!canMove) {
|
|
126
144
|
return tr;
|
|
@@ -129,11 +147,11 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
|
129
147
|
fromNode = canMove.fromNode,
|
|
130
148
|
$from = canMove.$from,
|
|
131
149
|
$to = canMove.$to;
|
|
132
|
-
var
|
|
133
|
-
layoutSection =
|
|
134
|
-
layoutColumn =
|
|
135
|
-
var
|
|
136
|
-
breakout =
|
|
150
|
+
var _ref7 = tr.doc.type.schema.nodes || {},
|
|
151
|
+
layoutSection = _ref7.layoutSection,
|
|
152
|
+
layoutColumn = _ref7.layoutColumn;
|
|
153
|
+
var _ref8 = tr.doc.type.schema.marks || {},
|
|
154
|
+
breakout = _ref8.breakout;
|
|
137
155
|
var fromNodeWithoutBreakout = fromNode;
|
|
138
156
|
var getBreakoutMode = function getBreakoutMode(node) {
|
|
139
157
|
var _node$marks$find;
|
|
@@ -49,7 +49,7 @@ const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, $
|
|
|
49
49
|
var _$originalFrom$nodeAf2;
|
|
50
50
|
if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
51
51
|
removeFromSource(tr, tr.doc.resolve(from));
|
|
52
|
-
|
|
52
|
+
insertToDestinationNoWidthUpdate(tr, tr.mapping.map(to), sourceNode);
|
|
53
53
|
} else {
|
|
54
54
|
insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
|
|
55
55
|
const mappedFrom = tr.mapping.map(from);
|
|
@@ -59,6 +59,25 @@ const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, $
|
|
|
59
59
|
}
|
|
60
60
|
return tr;
|
|
61
61
|
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* This function is similar to insertToDestination
|
|
65
|
+
* But without update width step, mainly rely on the append transaction from layout.
|
|
66
|
+
* @param tr
|
|
67
|
+
* @param to
|
|
68
|
+
* @param sourceNode
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
const insertToDestinationNoWidthUpdate = (tr, to, sourceNode) => {
|
|
72
|
+
const {
|
|
73
|
+
layoutColumn
|
|
74
|
+
} = tr.doc.type.schema.nodes || {};
|
|
75
|
+
const content = layoutColumn.createChecked({
|
|
76
|
+
width: 0
|
|
77
|
+
}, sourceNode.type.name === 'layoutColumn' ? sourceNode.content : sourceNode);
|
|
78
|
+
tr.insert(to, content);
|
|
79
|
+
return tr;
|
|
80
|
+
};
|
|
62
81
|
const insertToDestination = (tr, to, sourceNode, toLayout, toLayoutPos) => {
|
|
63
82
|
const {
|
|
64
83
|
newColumnWidth
|
|
@@ -48,7 +48,7 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
48
48
|
var _$originalFrom$nodeAf2;
|
|
49
49
|
if (fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
50
50
|
removeFromSource(tr, tr.doc.resolve(from));
|
|
51
|
-
|
|
51
|
+
insertToDestinationNoWidthUpdate(tr, tr.mapping.map(to), sourceNode);
|
|
52
52
|
} else {
|
|
53
53
|
insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
|
|
54
54
|
var mappedFrom = tr.mapping.map(from);
|
|
@@ -58,11 +58,29 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
58
58
|
}
|
|
59
59
|
return tr;
|
|
60
60
|
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* This function is similar to insertToDestination
|
|
64
|
+
* But without update width step, mainly rely on the append transaction from layout.
|
|
65
|
+
* @param tr
|
|
66
|
+
* @param to
|
|
67
|
+
* @param sourceNode
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
var insertToDestinationNoWidthUpdate = function insertToDestinationNoWidthUpdate(tr, to, sourceNode) {
|
|
71
|
+
var _ref2 = tr.doc.type.schema.nodes || {},
|
|
72
|
+
layoutColumn = _ref2.layoutColumn;
|
|
73
|
+
var content = layoutColumn.createChecked({
|
|
74
|
+
width: 0
|
|
75
|
+
}, sourceNode.type.name === 'layoutColumn' ? sourceNode.content : sourceNode);
|
|
76
|
+
tr.insert(to, content);
|
|
77
|
+
return tr;
|
|
78
|
+
};
|
|
61
79
|
var insertToDestination = function insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos) {
|
|
62
|
-
var
|
|
63
|
-
newColumnWidth =
|
|
64
|
-
var
|
|
65
|
-
layoutColumn =
|
|
80
|
+
var _ref3 = updateColumnWidths(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {},
|
|
81
|
+
newColumnWidth = _ref3.newColumnWidth;
|
|
82
|
+
var _ref4 = tr.doc.type.schema.nodes || {},
|
|
83
|
+
layoutColumn = _ref4.layoutColumn;
|
|
66
84
|
var content = layoutColumn.createChecked({
|
|
67
85
|
width: newColumnWidth
|
|
68
86
|
}, sourceNode.type.name === 'layoutColumn' ? sourceNode.content : sourceNode);
|
|
@@ -81,10 +99,10 @@ var canMoveToLayout = function canMoveToLayout(from, to, tr) {
|
|
|
81
99
|
if (from === to) {
|
|
82
100
|
return;
|
|
83
101
|
}
|
|
84
|
-
var
|
|
85
|
-
layoutSection =
|
|
86
|
-
layoutColumn =
|
|
87
|
-
doc =
|
|
102
|
+
var _ref5 = tr.doc.type.schema.nodes || {},
|
|
103
|
+
layoutSection = _ref5.layoutSection,
|
|
104
|
+
layoutColumn = _ref5.layoutColumn,
|
|
105
|
+
doc = _ref5.doc;
|
|
88
106
|
|
|
89
107
|
// layout plugin does not exist
|
|
90
108
|
if (!layoutSection || !layoutColumn) {
|
|
@@ -113,8 +131,8 @@ var canMoveToLayout = function canMoveToLayout(from, to, tr) {
|
|
|
113
131
|
};
|
|
114
132
|
export var moveToLayout = function moveToLayout(api) {
|
|
115
133
|
return function (from, to, options) {
|
|
116
|
-
return function (
|
|
117
|
-
var tr =
|
|
134
|
+
return function (_ref6) {
|
|
135
|
+
var tr = _ref6.tr;
|
|
118
136
|
var canMove = canMoveToLayout(from, to, tr);
|
|
119
137
|
if (!canMove) {
|
|
120
138
|
return tr;
|
|
@@ -123,11 +141,11 @@ export var moveToLayout = function moveToLayout(api) {
|
|
|
123
141
|
fromNode = canMove.fromNode,
|
|
124
142
|
$from = canMove.$from,
|
|
125
143
|
$to = canMove.$to;
|
|
126
|
-
var
|
|
127
|
-
layoutSection =
|
|
128
|
-
layoutColumn =
|
|
129
|
-
var
|
|
130
|
-
breakout =
|
|
144
|
+
var _ref7 = tr.doc.type.schema.nodes || {},
|
|
145
|
+
layoutSection = _ref7.layoutSection,
|
|
146
|
+
layoutColumn = _ref7.layoutColumn;
|
|
147
|
+
var _ref8 = tr.doc.type.schema.marks || {},
|
|
148
|
+
breakout = _ref8.breakout;
|
|
131
149
|
var fromNodeWithoutBreakout = fromNode;
|
|
132
150
|
var getBreakoutMode = function getBreakoutMode(node) {
|
|
133
151
|
var _node$marks$find;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.7",
|
|
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": "^96.
|
|
34
|
+
"@atlaskit/editor-common": "^96.5.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",
|