@atlaskit/editor-plugin-block-menu 3.0.0 → 3.0.2

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,21 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d6f3f3b09ebff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d6f3f3b09ebff) -
8
+ [ux] ED-29255 Fix layout transformation when column is empty, transform nested lists to match
9
+ container to list transformations and fix task list transforms when task item is empty
10
+
11
+ ## 3.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`73f45bc07b4c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/73f45bc07b4c6) -
16
+ ED-29240: Fixed not able to delete table when it is last element
17
+ - Updated dependencies
18
+
3
19
  ## 3.0.0
4
20
 
5
21
  ### Major Changes
@@ -11,7 +11,7 @@ var getInlineNodeTextContent = exports.getInlineNodeTextContent = function getIn
11
11
  }
12
12
  // Headings are not valid inside headings so convert heading nodes to paragraphs
13
13
  sourceContent.forEach(function (node) {
14
- if (['paragraph', 'heading'].includes(node.type.name)) {
14
+ if (['paragraph', 'heading', 'taskItem'].includes(node.type.name)) {
15
15
  node.content.forEach(function (inlineNode) {
16
16
  if (inlineNode.type.name === 'status') {
17
17
  validTransformedContent += inlineNode.attrs.text;
@@ -80,57 +80,104 @@ var unwrapLayoutNodesToTextNodes = exports.unwrapLayoutNodesToTextNodes = functi
80
80
  }
81
81
  return [sourceNode];
82
82
  };
83
- var transformToBlockNode = function transformToBlockNode(nodes, targetNodeType, schema) {
84
- if (targetNodeType === schema.nodes.codeBlock) {
85
- var newNodes = [];
86
- nodes.forEach(function (node) {
87
- if (node.isTextblock) {
88
- var inlineTextContent = node.type === schema.nodes.codeBlock ? node.textContent : (0, _inlineNodeTransforms.getInlineNodeTextContent)(_model.Fragment.from(node));
89
-
90
- // For first node, add directly
91
- if (newNodes.length === 0) {
92
- newNodes.push({
93
- canBeTransformed: true,
94
- content: [inlineTextContent]
95
- });
96
- } else {
97
- // Check if last node can also be transformed, if yes then append content
98
- var lastItem = newNodes[newNodes.length - 1];
99
- if (lastItem.canBeTransformed) {
100
- newNodes[newNodes.length - 1] = {
101
- content: [].concat((0, _toConsumableArray2.default)(lastItem.content), [inlineTextContent]),
102
- canBeTransformed: true
103
- };
104
- } else {
105
- newNodes.push({
106
- content: [inlineTextContent],
107
- canBeTransformed: true
108
- });
109
- }
110
- }
83
+ var transformToCodeBlock = function transformToCodeBlock(nodes, schema) {
84
+ var newNodes = [];
85
+ var addToNewNodes = function addToNewNodes(content) {
86
+ if (newNodes.length === 0) {
87
+ newNodes.push({
88
+ canBeTransformed: true,
89
+ content: content
90
+ });
91
+ } else {
92
+ // Check if last node can also be transformed, if yes then append content
93
+ var lastItem = newNodes[newNodes.length - 1];
94
+ if (lastItem.canBeTransformed) {
95
+ newNodes[newNodes.length - 1] = {
96
+ content: [].concat((0, _toConsumableArray2.default)(lastItem.content), (0, _toConsumableArray2.default)(content)),
97
+ canBeTransformed: true
98
+ };
111
99
  } else {
112
- // If not text block, then cannot be transformed
113
100
  newNodes.push({
114
- canBeTransformed: false,
115
- content: node
101
+ content: content,
102
+ canBeTransformed: true
116
103
  });
117
104
  }
118
- });
119
- return newNodes.map(function (_ref) {
120
- var canBeTransformed = _ref.canBeTransformed,
121
- content = _ref.content;
122
- if (canBeTransformed) {
123
- var text = content.join('\n');
124
- if (text === '') {
125
- return undefined;
105
+ }
106
+ };
107
+ nodes.forEach(function (node) {
108
+ if (node.isTextblock) {
109
+ var inlineTextContent = node.type === schema.nodes.codeBlock ? node.textContent : (0, _inlineNodeTransforms.getInlineNodeTextContent)(_model.Fragment.from(node));
110
+
111
+ // For first node, add directly
112
+ addToNewNodes([inlineTextContent]);
113
+ } else if ((0, _utils2.isListNode)(node)) {
114
+ var textContent = [];
115
+ var listItemType = node.type === schema.nodes.taskList ? schema.nodes.taskItem : schema.nodes.listItem;
116
+ var listItems = (0, _utils.findChildrenByType)(node, listItemType).map(function (item) {
117
+ return item.node;
118
+ });
119
+ listItems.forEach(function (listItem) {
120
+ if (listItem.type === schema.nodes.taskItem) {
121
+ var _inlineTextContent = (0, _inlineNodeTransforms.getInlineNodeTextContent)(_model.Fragment.from(listItem));
122
+ textContent.push(_inlineTextContent);
123
+ } else {
124
+ var _inlineTextContent2 = (0, _inlineNodeTransforms.getInlineNodeTextContent)(listItem.content);
125
+ textContent.push(_inlineTextContent2);
126
126
  }
127
- return targetNodeType.createChecked(null, schema.text(text));
128
- } else {
129
- return content;
127
+ });
128
+ addToNewNodes(textContent);
129
+ } else {
130
+ // If not text block or list node, then cannot be transformed
131
+ newNodes.push({
132
+ canBeTransformed: false,
133
+ content: node
134
+ });
135
+ }
136
+ });
137
+ return newNodes.map(function (_ref) {
138
+ var canBeTransformed = _ref.canBeTransformed,
139
+ content = _ref.content;
140
+ if (canBeTransformed) {
141
+ var text = content.join('\n');
142
+ if (text === '') {
143
+ return undefined;
130
144
  }
131
- }).filter(Boolean);
145
+ return schema.nodes.codeBlock.createChecked(null, schema.text(text));
146
+ } else {
147
+ return content;
148
+ }
149
+ }).filter(Boolean);
150
+ };
151
+ var transformToBlockNode = function transformToBlockNode(nodes, targetNodeType, schema) {
152
+ if (targetNodeType === schema.nodes.codeBlock) {
153
+ return transformToCodeBlock(nodes, schema);
132
154
  }
133
- return nodes;
155
+ var newNodes = [];
156
+ nodes.forEach(function (node) {
157
+ if ((0, _utils2.isListNode)(node)) {
158
+ var listItemType = node.type === schema.nodes.taskList ? schema.nodes.taskItem : schema.nodes.listItem;
159
+ var listItems = (0, _utils.findChildrenByType)(node, listItemType).map(function (item) {
160
+ return item.node;
161
+ });
162
+ listItems.forEach(function (listItem) {
163
+ if (listItem.type === schema.nodes.taskItem) {
164
+ var inlineContent = (0, _toConsumableArray2.default)(listItem.content.content);
165
+ if (inlineContent.length > 0) {
166
+ newNodes.push(targetNodeType.createChecked(null, inlineContent));
167
+ }
168
+ } else {
169
+ listItem.forEach(function (child) {
170
+ if ((0, _utils2.isHeadingOrParagraphNode)(child)) {
171
+ newNodes.push(targetNodeType.createChecked(null, (0, _toConsumableArray2.default)(child.content.content)));
172
+ }
173
+ });
174
+ }
175
+ });
176
+ } else {
177
+ newNodes.push(node);
178
+ }
179
+ });
180
+ return newNodes;
134
181
  };
135
182
  var transformToContainerNode = function transformToContainerNode(nodes, targetNodeType) {
136
183
  var newNodes = [];
@@ -276,6 +323,9 @@ var transformToListNode = exports.transformToListNode = function transformToList
276
323
  });
277
324
  };
278
325
  var convertUnwrappedLayoutContent = exports.convertUnwrappedLayoutContent = function convertUnwrappedLayoutContent(nodes, targetNodeType, schema) {
326
+ if (nodes.length === 1 && nodes[0].content.size === 0) {
327
+ return nodes;
328
+ }
279
329
  if ((0, _utils2.isBlockNodeType)(targetNodeType)) {
280
330
  return transformToBlockNode(nodes, targetNodeType, schema);
281
331
  }
@@ -54,19 +54,15 @@ var _transformListRecursively = exports.transformListRecursively = function tran
54
54
  inlineContent.push.apply(inlineContent, (0, _toConsumableArray2.default)(convertBlockToInlineContent(grandChild, schema)));
55
55
  }
56
56
  });
57
- if (inlineContent.length > 0) {
58
- transformedItems.push(taskItem.create(null, inlineContent));
59
- }
57
+ transformedItems.push(taskItem.create(null, inlineContent.length > 0 ? inlineContent : null));
60
58
  transformedItems.push.apply(transformedItems, nestedTaskLists);
61
59
  }
62
60
  } else if (isSourceTask && isTargetBulletOrOrdered) {
63
61
  // Convert task => bullet/ordered
64
62
  if (child.type === taskItem) {
65
63
  var _inlineContent = (0, _toConsumableArray2.default)(child.content.content);
66
- if (_inlineContent.length > 0) {
67
- var paragraphNode = paragraph.create(null, _inlineContent);
68
- transformedItems.push(listItem.create(null, [paragraphNode]));
69
- }
64
+ var paragraphNode = paragraph.create(null, _inlineContent.length > 0 ? _inlineContent : null);
65
+ transformedItems.push(listItem.create(null, [paragraphNode]));
70
66
  } else if (child.type === taskList) {
71
67
  var transformedNestedList = _transformListRecursively(_objectSpread(_objectSpread({}, props), {}, {
72
68
  listNode: child
@@ -35,8 +35,8 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
35
35
  } else if ((0, _utils.isTableSelected)(selection)) {
36
36
  var table = (0, _utils.findTable)(selection);
37
37
  if (table) {
38
- from = table.start - 1;
39
- to = table.start + table.node.nodeSize;
38
+ from = table.pos;
39
+ to = table.pos + table.node.nodeSize;
40
40
  }
41
41
  }
42
42
  tr.deleteRange(from, to);
@@ -5,7 +5,7 @@ export const getInlineNodeTextContent = sourceContent => {
5
5
  }
6
6
  // Headings are not valid inside headings so convert heading nodes to paragraphs
7
7
  sourceContent.forEach(node => {
8
- if (['paragraph', 'heading'].includes(node.type.name)) {
8
+ if (['paragraph', 'heading', 'taskItem'].includes(node.type.name)) {
9
9
  node.content.forEach(inlineNode => {
10
10
  if (inlineNode.type.name === 'status') {
11
11
  validTransformedContent += inlineNode.attrs.text;
@@ -62,58 +62,101 @@ export const unwrapLayoutNodesToTextNodes = (context, finalTargetNodeType) => {
62
62
  }
63
63
  return [sourceNode];
64
64
  };
65
- const transformToBlockNode = (nodes, targetNodeType, schema) => {
66
- if (targetNodeType === schema.nodes.codeBlock) {
67
- const newNodes = [];
68
- nodes.forEach(node => {
69
- if (node.isTextblock) {
70
- const inlineTextContent = node.type === schema.nodes.codeBlock ? node.textContent : getInlineNodeTextContent(Fragment.from(node));
71
-
72
- // For first node, add directly
73
- if (newNodes.length === 0) {
74
- newNodes.push({
75
- canBeTransformed: true,
76
- content: [inlineTextContent]
77
- });
78
- } else {
79
- // Check if last node can also be transformed, if yes then append content
80
- const lastItem = newNodes[newNodes.length - 1];
81
- if (lastItem.canBeTransformed) {
82
- newNodes[newNodes.length - 1] = {
83
- content: [...lastItem.content, inlineTextContent],
84
- canBeTransformed: true
85
- };
86
- } else {
87
- newNodes.push({
88
- content: [inlineTextContent],
89
- canBeTransformed: true
90
- });
91
- }
92
- }
65
+ const transformToCodeBlock = (nodes, schema) => {
66
+ const newNodes = [];
67
+ const addToNewNodes = content => {
68
+ if (newNodes.length === 0) {
69
+ newNodes.push({
70
+ canBeTransformed: true,
71
+ content
72
+ });
73
+ } else {
74
+ // Check if last node can also be transformed, if yes then append content
75
+ const lastItem = newNodes[newNodes.length - 1];
76
+ if (lastItem.canBeTransformed) {
77
+ newNodes[newNodes.length - 1] = {
78
+ content: [...lastItem.content, ...content],
79
+ canBeTransformed: true
80
+ };
93
81
  } else {
94
- // If not text block, then cannot be transformed
95
82
  newNodes.push({
96
- canBeTransformed: false,
97
- content: node
83
+ content,
84
+ canBeTransformed: true
98
85
  });
99
86
  }
100
- });
101
- return newNodes.map(({
102
- canBeTransformed,
103
- content
104
- }) => {
105
- if (canBeTransformed) {
106
- const text = content.join('\n');
107
- if (text === '') {
108
- return undefined;
87
+ }
88
+ };
89
+ nodes.forEach(node => {
90
+ if (node.isTextblock) {
91
+ const inlineTextContent = node.type === schema.nodes.codeBlock ? node.textContent : getInlineNodeTextContent(Fragment.from(node));
92
+
93
+ // For first node, add directly
94
+ addToNewNodes([inlineTextContent]);
95
+ } else if (isListNode(node)) {
96
+ const textContent = [];
97
+ const listItemType = node.type === schema.nodes.taskList ? schema.nodes.taskItem : schema.nodes.listItem;
98
+ const listItems = findChildrenByType(node, listItemType).map(item => item.node);
99
+ listItems.forEach(listItem => {
100
+ if (listItem.type === schema.nodes.taskItem) {
101
+ const inlineTextContent = getInlineNodeTextContent(Fragment.from(listItem));
102
+ textContent.push(inlineTextContent);
103
+ } else {
104
+ const inlineTextContent = getInlineNodeTextContent(listItem.content);
105
+ textContent.push(inlineTextContent);
109
106
  }
110
- return targetNodeType.createChecked(null, schema.text(text));
111
- } else {
112
- return content;
107
+ });
108
+ addToNewNodes(textContent);
109
+ } else {
110
+ // If not text block or list node, then cannot be transformed
111
+ newNodes.push({
112
+ canBeTransformed: false,
113
+ content: node
114
+ });
115
+ }
116
+ });
117
+ return newNodes.map(({
118
+ canBeTransformed,
119
+ content
120
+ }) => {
121
+ if (canBeTransformed) {
122
+ const text = content.join('\n');
123
+ if (text === '') {
124
+ return undefined;
113
125
  }
114
- }).filter(Boolean);
126
+ return schema.nodes.codeBlock.createChecked(null, schema.text(text));
127
+ } else {
128
+ return content;
129
+ }
130
+ }).filter(Boolean);
131
+ };
132
+ const transformToBlockNode = (nodes, targetNodeType, schema) => {
133
+ if (targetNodeType === schema.nodes.codeBlock) {
134
+ return transformToCodeBlock(nodes, schema);
115
135
  }
116
- return nodes;
136
+ const newNodes = [];
137
+ nodes.forEach(node => {
138
+ if (isListNode(node)) {
139
+ const listItemType = node.type === schema.nodes.taskList ? schema.nodes.taskItem : schema.nodes.listItem;
140
+ const listItems = findChildrenByType(node, listItemType).map(item => item.node);
141
+ listItems.forEach(listItem => {
142
+ if (listItem.type === schema.nodes.taskItem) {
143
+ const inlineContent = [...listItem.content.content];
144
+ if (inlineContent.length > 0) {
145
+ newNodes.push(targetNodeType.createChecked(null, inlineContent));
146
+ }
147
+ } else {
148
+ listItem.forEach(child => {
149
+ if (isHeadingOrParagraphNode(child)) {
150
+ newNodes.push(targetNodeType.createChecked(null, [...child.content.content]));
151
+ }
152
+ });
153
+ }
154
+ });
155
+ } else {
156
+ newNodes.push(node);
157
+ }
158
+ });
159
+ return newNodes;
117
160
  };
118
161
  const transformToContainerNode = (nodes, targetNodeType) => {
119
162
  const newNodes = [];
@@ -259,6 +302,9 @@ export const transformToListNode = (nodes, targetNodeType, schema) => {
259
302
  });
260
303
  };
261
304
  export const convertUnwrappedLayoutContent = (nodes, targetNodeType, schema) => {
305
+ if (nodes.length === 1 && nodes[0].content.size === 0) {
306
+ return nodes;
307
+ }
262
308
  if (isBlockNodeType(targetNodeType)) {
263
309
  return transformToBlockNode(nodes, targetNodeType, schema);
264
310
  }
@@ -50,19 +50,15 @@ export const transformListRecursively = props => {
50
50
  inlineContent.push(...convertBlockToInlineContent(grandChild, schema));
51
51
  }
52
52
  });
53
- if (inlineContent.length > 0) {
54
- transformedItems.push(taskItem.create(null, inlineContent));
55
- }
53
+ transformedItems.push(taskItem.create(null, inlineContent.length > 0 ? inlineContent : null));
56
54
  transformedItems.push(...nestedTaskLists);
57
55
  }
58
56
  } else if (isSourceTask && isTargetBulletOrOrdered) {
59
57
  // Convert task => bullet/ordered
60
58
  if (child.type === taskItem) {
61
59
  const inlineContent = [...child.content.content];
62
- if (inlineContent.length > 0) {
63
- const paragraphNode = paragraph.create(null, inlineContent);
64
- transformedItems.push(listItem.create(null, [paragraphNode]));
65
- }
60
+ const paragraphNode = paragraph.create(null, inlineContent.length > 0 ? inlineContent : null);
61
+ transformedItems.push(listItem.create(null, [paragraphNode]));
66
62
  } else if (child.type === taskList) {
67
63
  const transformedNestedList = transformListRecursively({
68
64
  ...props,
@@ -29,8 +29,8 @@ const DeleteDropdownItemContent = ({
29
29
  } else if (isTableSelected(selection)) {
30
30
  const table = findTable(selection);
31
31
  if (table) {
32
- from = table.start - 1;
33
- to = table.start + table.node.nodeSize;
32
+ from = table.pos;
33
+ to = table.pos + table.node.nodeSize;
34
34
  }
35
35
  }
36
36
  tr.deleteRange(from, to);
@@ -5,7 +5,7 @@ export var getInlineNodeTextContent = function getInlineNodeTextContent(sourceCo
5
5
  }
6
6
  // Headings are not valid inside headings so convert heading nodes to paragraphs
7
7
  sourceContent.forEach(function (node) {
8
- if (['paragraph', 'heading'].includes(node.type.name)) {
8
+ if (['paragraph', 'heading', 'taskItem'].includes(node.type.name)) {
9
9
  node.content.forEach(function (inlineNode) {
10
10
  if (inlineNode.type.name === 'status') {
11
11
  validTransformedContent += inlineNode.attrs.text;
@@ -73,57 +73,104 @@ export var unwrapLayoutNodesToTextNodes = function unwrapLayoutNodesToTextNodes(
73
73
  }
74
74
  return [sourceNode];
75
75
  };
76
- var transformToBlockNode = function transformToBlockNode(nodes, targetNodeType, schema) {
77
- if (targetNodeType === schema.nodes.codeBlock) {
78
- var newNodes = [];
79
- nodes.forEach(function (node) {
80
- if (node.isTextblock) {
81
- var inlineTextContent = node.type === schema.nodes.codeBlock ? node.textContent : getInlineNodeTextContent(Fragment.from(node));
82
-
83
- // For first node, add directly
84
- if (newNodes.length === 0) {
85
- newNodes.push({
86
- canBeTransformed: true,
87
- content: [inlineTextContent]
88
- });
89
- } else {
90
- // Check if last node can also be transformed, if yes then append content
91
- var lastItem = newNodes[newNodes.length - 1];
92
- if (lastItem.canBeTransformed) {
93
- newNodes[newNodes.length - 1] = {
94
- content: [].concat(_toConsumableArray(lastItem.content), [inlineTextContent]),
95
- canBeTransformed: true
96
- };
97
- } else {
98
- newNodes.push({
99
- content: [inlineTextContent],
100
- canBeTransformed: true
101
- });
102
- }
103
- }
76
+ var transformToCodeBlock = function transformToCodeBlock(nodes, schema) {
77
+ var newNodes = [];
78
+ var addToNewNodes = function addToNewNodes(content) {
79
+ if (newNodes.length === 0) {
80
+ newNodes.push({
81
+ canBeTransformed: true,
82
+ content: content
83
+ });
84
+ } else {
85
+ // Check if last node can also be transformed, if yes then append content
86
+ var lastItem = newNodes[newNodes.length - 1];
87
+ if (lastItem.canBeTransformed) {
88
+ newNodes[newNodes.length - 1] = {
89
+ content: [].concat(_toConsumableArray(lastItem.content), _toConsumableArray(content)),
90
+ canBeTransformed: true
91
+ };
104
92
  } else {
105
- // If not text block, then cannot be transformed
106
93
  newNodes.push({
107
- canBeTransformed: false,
108
- content: node
94
+ content: content,
95
+ canBeTransformed: true
109
96
  });
110
97
  }
111
- });
112
- return newNodes.map(function (_ref) {
113
- var canBeTransformed = _ref.canBeTransformed,
114
- content = _ref.content;
115
- if (canBeTransformed) {
116
- var text = content.join('\n');
117
- if (text === '') {
118
- return undefined;
98
+ }
99
+ };
100
+ nodes.forEach(function (node) {
101
+ if (node.isTextblock) {
102
+ var inlineTextContent = node.type === schema.nodes.codeBlock ? node.textContent : getInlineNodeTextContent(Fragment.from(node));
103
+
104
+ // For first node, add directly
105
+ addToNewNodes([inlineTextContent]);
106
+ } else if (isListNode(node)) {
107
+ var textContent = [];
108
+ var listItemType = node.type === schema.nodes.taskList ? schema.nodes.taskItem : schema.nodes.listItem;
109
+ var listItems = findChildrenByType(node, listItemType).map(function (item) {
110
+ return item.node;
111
+ });
112
+ listItems.forEach(function (listItem) {
113
+ if (listItem.type === schema.nodes.taskItem) {
114
+ var _inlineTextContent = getInlineNodeTextContent(Fragment.from(listItem));
115
+ textContent.push(_inlineTextContent);
116
+ } else {
117
+ var _inlineTextContent2 = getInlineNodeTextContent(listItem.content);
118
+ textContent.push(_inlineTextContent2);
119
119
  }
120
- return targetNodeType.createChecked(null, schema.text(text));
121
- } else {
122
- return content;
120
+ });
121
+ addToNewNodes(textContent);
122
+ } else {
123
+ // If not text block or list node, then cannot be transformed
124
+ newNodes.push({
125
+ canBeTransformed: false,
126
+ content: node
127
+ });
128
+ }
129
+ });
130
+ return newNodes.map(function (_ref) {
131
+ var canBeTransformed = _ref.canBeTransformed,
132
+ content = _ref.content;
133
+ if (canBeTransformed) {
134
+ var text = content.join('\n');
135
+ if (text === '') {
136
+ return undefined;
123
137
  }
124
- }).filter(Boolean);
138
+ return schema.nodes.codeBlock.createChecked(null, schema.text(text));
139
+ } else {
140
+ return content;
141
+ }
142
+ }).filter(Boolean);
143
+ };
144
+ var transformToBlockNode = function transformToBlockNode(nodes, targetNodeType, schema) {
145
+ if (targetNodeType === schema.nodes.codeBlock) {
146
+ return transformToCodeBlock(nodes, schema);
125
147
  }
126
- return nodes;
148
+ var newNodes = [];
149
+ nodes.forEach(function (node) {
150
+ if (isListNode(node)) {
151
+ var listItemType = node.type === schema.nodes.taskList ? schema.nodes.taskItem : schema.nodes.listItem;
152
+ var listItems = findChildrenByType(node, listItemType).map(function (item) {
153
+ return item.node;
154
+ });
155
+ listItems.forEach(function (listItem) {
156
+ if (listItem.type === schema.nodes.taskItem) {
157
+ var inlineContent = _toConsumableArray(listItem.content.content);
158
+ if (inlineContent.length > 0) {
159
+ newNodes.push(targetNodeType.createChecked(null, inlineContent));
160
+ }
161
+ } else {
162
+ listItem.forEach(function (child) {
163
+ if (isHeadingOrParagraphNode(child)) {
164
+ newNodes.push(targetNodeType.createChecked(null, _toConsumableArray(child.content.content)));
165
+ }
166
+ });
167
+ }
168
+ });
169
+ } else {
170
+ newNodes.push(node);
171
+ }
172
+ });
173
+ return newNodes;
127
174
  };
128
175
  var transformToContainerNode = function transformToContainerNode(nodes, targetNodeType) {
129
176
  var newNodes = [];
@@ -269,6 +316,9 @@ export var transformToListNode = function transformToListNode(nodes, targetNodeT
269
316
  });
270
317
  };
271
318
  export var convertUnwrappedLayoutContent = function convertUnwrappedLayoutContent(nodes, targetNodeType, schema) {
319
+ if (nodes.length === 1 && nodes[0].content.size === 0) {
320
+ return nodes;
321
+ }
272
322
  if (isBlockNodeType(targetNodeType)) {
273
323
  return transformToBlockNode(nodes, targetNodeType, schema);
274
324
  }
@@ -48,19 +48,15 @@ var _transformListRecursively = function transformListRecursively(props) {
48
48
  inlineContent.push.apply(inlineContent, _toConsumableArray(convertBlockToInlineContent(grandChild, schema)));
49
49
  }
50
50
  });
51
- if (inlineContent.length > 0) {
52
- transformedItems.push(taskItem.create(null, inlineContent));
53
- }
51
+ transformedItems.push(taskItem.create(null, inlineContent.length > 0 ? inlineContent : null));
54
52
  transformedItems.push.apply(transformedItems, nestedTaskLists);
55
53
  }
56
54
  } else if (isSourceTask && isTargetBulletOrOrdered) {
57
55
  // Convert task => bullet/ordered
58
56
  if (child.type === taskItem) {
59
57
  var _inlineContent = _toConsumableArray(child.content.content);
60
- if (_inlineContent.length > 0) {
61
- var paragraphNode = paragraph.create(null, _inlineContent);
62
- transformedItems.push(listItem.create(null, [paragraphNode]));
63
- }
58
+ var paragraphNode = paragraph.create(null, _inlineContent.length > 0 ? _inlineContent : null);
59
+ transformedItems.push(listItem.create(null, [paragraphNode]));
64
60
  } else if (child.type === taskList) {
65
61
  var transformedNestedList = _transformListRecursively(_objectSpread(_objectSpread({}, props), {}, {
66
62
  listNode: child
@@ -26,8 +26,8 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
26
26
  } else if (isTableSelected(selection)) {
27
27
  var table = findTable(selection);
28
28
  if (table) {
29
- from = table.start - 1;
30
- to = table.start + table.node.nodeSize;
29
+ from = table.pos;
30
+ to = table.pos + table.node.nodeSize;
31
31
  }
32
32
  }
33
33
  tr.deleteRange(from, to);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/css": "^0.14.0",
32
32
  "@atlaskit/dropdown-menu": "^16.3.0",
33
- "@atlaskit/editor-plugin-block-controls": "^6.0.0",
33
+ "@atlaskit/editor-plugin-block-controls": "^6.1.0",
34
34
  "@atlaskit/editor-plugin-decorations": "^5.0.0",
35
35
  "@atlaskit/editor-plugin-selection": "^5.0.0",
36
36
  "@atlaskit/editor-plugin-user-intent": "^3.0.0",
@@ -46,7 +46,7 @@
46
46
  "@babel/runtime": "^7.0.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@atlaskit/editor-common": "^109.1.0",
49
+ "@atlaskit/editor-common": "^109.3.0",
50
50
  "react": "^18.2.0",
51
51
  "react-intl-next": "npm:react-intl@^5.18.1"
52
52
  },