@atlaskit/editor-plugin-block-menu 20.0.4 → 21.0.0

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,20 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 21.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 20.0.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`2fbdbadc1a47c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2fbdbadc1a47c) -
14
+ Convert direct container headings and nested list paragraphs to Normal or Small text while
15
+ preserving other nested content under platform_editor_block_menu_small_text.
16
+ - Updated dependencies
17
+
3
18
  ## 20.0.4
4
19
 
5
20
  ### Patch Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.TRANSFORMATION_MATRIX_PANEL_C1 = exports.TRANSFORMATION_MATRIX = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
9
10
  var _applyTargetTextTypeStep = require("./steps/applyTargetTextTypeStep");
10
11
  var _convertEachNodeStep = require("./steps/convertEachNodeStep");
11
12
  var _decisionListToListStep = require("./steps/decisionListToListStep");
@@ -24,6 +25,19 @@ var _wrapMixedContentStep = require("./steps/wrapMixedContentStep");
24
25
  var _wrapStep = require("./steps/wrapStep");
25
26
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
26
27
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
28
+ var applyTargetHeadingToParagraphStep = function applyTargetHeadingToParagraphStep(nodes, context) {
29
+ if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_menu_small_text')) {
30
+ return nodes;
31
+ }
32
+ return nodes.map(function (node) {
33
+ var _applyTargetTextTypeS;
34
+ if (node.type.name !== 'heading') {
35
+ return node;
36
+ }
37
+ return (_applyTargetTextTypeS = (0, _applyTargetTextTypeStep.applyTargetTextTypeStep)([node], context).at(0)) !== null && _applyTargetTextTypeS !== void 0 ? _applyTargetTextTypeS : node;
38
+ });
39
+ };
40
+
27
41
  /**
28
42
  * Creates the transformation matrix for all node type pairs.
29
43
  * When includePanelC1 is true (platform_editor_nest_table_in_panel experiment on),
@@ -71,7 +85,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
71
85
  expand: [_unwrapStep.unwrapStep, _wrapStep.wrapStep],
72
86
  nestedExpand: [_unwrapStep.unwrapStep, _wrapStep.wrapStep],
73
87
  layoutSection: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
74
- paragraph: [_unwrapStep.unwrapStep]
88
+ paragraph: [_unwrapStep.unwrapStep, applyTargetHeadingToParagraphStep]
75
89
  },
76
90
  panel_c1: includePanelC1 ? {
77
91
  blockquote: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
@@ -79,7 +93,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
79
93
  expand: [_unwrapStep.unwrapStep, _wrapStep.wrapStep],
80
94
  nestedExpand: [_unwrapStep.unwrapStep, _wrapStep.wrapStep],
81
95
  layoutSection: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep],
82
- paragraph: [_unwrapStep.unwrapStep]
96
+ paragraph: [_unwrapStep.unwrapStep, applyTargetHeadingToParagraphStep]
83
97
  } : {},
84
98
  expand: _objectSpread(_objectSpread({
85
99
  panel: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep]
@@ -89,7 +103,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
89
103
  blockquote: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
90
104
  layoutSection: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
91
105
  nestedExpand: [_unwrapExpandStep.unwrapExpandStep, _wrapStep.wrapStep],
92
- paragraph: [_unwrapExpandStep.unwrapExpandStep]
106
+ paragraph: [_unwrapExpandStep.unwrapExpandStep, applyTargetHeadingToParagraphStep]
93
107
  }),
94
108
  nestedExpand: _objectSpread(_objectSpread({
95
109
  panel: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep]
@@ -98,7 +112,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
98
112
  } : {}), {}, {
99
113
  blockquote: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
100
114
  layoutSection: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
101
- paragraph: [_unwrapExpandStep.unwrapExpandStep]
115
+ paragraph: [_unwrapExpandStep.unwrapExpandStep, applyTargetHeadingToParagraphStep]
102
116
  }),
103
117
  blockquote: _objectSpread(_objectSpread({
104
118
  expand: [_wrapStep.wrapStep],
@@ -108,7 +122,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
108
122
  }, includePanelC1 ? {
109
123
  panel_c1: [_unwrapStep.unwrapStep, _wrapStep.wrapStep]
110
124
  } : {}), {}, {
111
- paragraph: [_unwrapStep.unwrapStep],
125
+ paragraph: [_unwrapStep.unwrapStep, applyTargetHeadingToParagraphStep],
112
126
  decisionList: [_unwrapStep.unwrapStep, _wrapBlockquoteToDecisionListStep.wrapBlockquoteToDecisionListStep]
113
127
  }),
114
128
  layoutSection: _objectSpread(_objectSpread({
@@ -119,7 +133,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
119
133
  }, includePanelC1 ? {
120
134
  panel_c1: [_unwrapLayoutStep.unwrapLayoutStep, _wrapMixedContentStep.wrapMixedContentStep]
121
135
  } : {}), {}, {
122
- paragraph: [_unwrapLayoutStep.unwrapLayoutStep]
136
+ paragraph: [_unwrapLayoutStep.unwrapLayoutStep, applyTargetHeadingToParagraphStep]
123
137
  }),
124
138
  codeBlock: _objectSpread(_objectSpread({
125
139
  blockquote: [_wrapStep.wrapStep],
@@ -13,7 +13,14 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
13
  var _utils = require("../transform-node-utils/utils");
14
14
  var _TRANSFORMATION_MATRIX = require("./TRANSFORMATION_MATRIX");
15
15
  var _types = require("./types");
16
+ var LIST_NODE_TYPE_NAMES = new Set(['bulletList', 'orderedList', 'taskList', 'decisionList', 'listItem', 'taskItem', 'blockTaskItem', 'decisionItem']);
17
+ var shouldRecurseThroughListNode = function shouldRecurseThroughListNode(node) {
18
+ return LIST_NODE_TYPE_NAMES.has(node.type.name);
19
+ };
16
20
  var _applyTargetNodeMarks = function applyTargetNodeMarks(node, targetNodeType, marksToAdd, marksToRemove, schema) {
21
+ var shouldRecurseIntoChildren = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : function () {
22
+ return true;
23
+ };
17
24
  var nextNode = node;
18
25
  if (node.type === targetNodeType) {
19
26
  var marksAfterRemovals = (marksToRemove !== null && marksToRemove !== void 0 ? marksToRemove : []).reduce(function (currentMarks, name) {
@@ -29,12 +36,12 @@ var _applyTargetNodeMarks = function applyTargetNodeMarks(node, targetNodeType,
29
36
  }, marksAfterRemovals);
30
37
  nextNode = node.mark(marks);
31
38
  }
32
- if (nextNode.childCount === 0) {
39
+ if (!shouldRecurseIntoChildren(nextNode) || nextNode.childCount === 0) {
33
40
  return nextNode;
34
41
  }
35
42
  var children = [];
36
43
  nextNode.forEach(function (child) {
37
- return children.push(_applyTargetNodeMarks(child, targetNodeType, marksToAdd, marksToRemove, schema));
44
+ return children.push(_applyTargetNodeMarks(child, targetNodeType, marksToAdd, marksToRemove, schema, shouldRecurseIntoChildren));
38
45
  });
39
46
  return nextNode.copy(_model.Fragment.fromArray(children));
40
47
  };
@@ -112,12 +119,13 @@ var convertNodesToTargetType = exports.convertNodesToTargetType = function conve
112
119
  }, sourceNodes);
113
120
  return upgradePanelNodesToPanelC1(_resultNodes, parentNode, schema);
114
121
  }
122
+ var shouldLimitTargetNodeMarkRecursion = targetNodeTypeName === 'paragraph' && ['multi', 'panel', 'panel_c1', 'expand', 'nestedExpand', 'blockquote', 'layoutSection'].includes(selectedNodeTypeName);
115
123
  var resultNodes = (_steps$reduce = steps === null || steps === void 0 ? void 0 : steps.reduce(function (nodes, step) {
116
124
  return step(nodes, context);
117
125
  }, sourceNodes)) !== null && _steps$reduce !== void 0 ? _steps$reduce : sourceNodes;
118
126
  var upgradedNodes = steps !== null && steps !== void 0 && steps.length ? upgradePanelNodesToPanelC1(resultNodes, parentNode, schema) : resultNodes;
119
127
  return upgradedNodes.map(function (node) {
120
- return _applyTargetNodeMarks(node, targetNodeType, marksToAdd, marksToRemove, schema);
128
+ return _applyTargetNodeMarks(node, targetNodeType, marksToAdd, marksToRemove, schema, shouldLimitTargetNodeMarkRecursion ? shouldRecurseThroughListNode : undefined);
121
129
  });
122
130
  };
123
131
  var isTransformDisabledBasedOnStepsConfig = exports.isTransformDisabledBasedOnStepsConfig = function isTransformDisabledBasedOnStepsConfig(selectedNodeType, targetNodeType) {
@@ -1,3 +1,4 @@
1
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
1
2
  import { applyTargetTextTypeStep } from './steps/applyTargetTextTypeStep';
2
3
  import { convertEachNodeStep } from './steps/convertEachNodeStep';
3
4
  import { decisionListToListStep } from './steps/decisionListToListStep';
@@ -14,6 +15,19 @@ import { wrapBlockquoteToDecisionListStep } from './steps/wrapBlockquoteToDecisi
14
15
  import { wrapIntoListStep } from './steps/wrapIntoListStep';
15
16
  import { wrapMixedContentStep } from './steps/wrapMixedContentStep';
16
17
  import { wrapStep } from './steps/wrapStep';
18
+ const applyTargetHeadingToParagraphStep = (nodes, context) => {
19
+ if (!isExperimentEnabled('platform_editor_block_menu_small_text')) {
20
+ return nodes;
21
+ }
22
+ return nodes.map(node => {
23
+ var _applyTargetTextTypeS;
24
+ if (node.type.name !== 'heading') {
25
+ return node;
26
+ }
27
+ return (_applyTargetTextTypeS = applyTargetTextTypeStep([node], context).at(0)) !== null && _applyTargetTextTypeS !== void 0 ? _applyTargetTextTypeS : node;
28
+ });
29
+ };
30
+
17
31
  /**
18
32
  * Creates the transformation matrix for all node type pairs.
19
33
  * When includePanelC1 is true (platform_editor_nest_table_in_panel experiment on),
@@ -60,7 +74,7 @@ const createTransformationMatrix = includePanelC1 => ({
60
74
  expand: [unwrapStep, wrapStep],
61
75
  nestedExpand: [unwrapStep, wrapStep],
62
76
  layoutSection: [unwrapStep, wrapMixedContentStep],
63
- paragraph: [unwrapStep]
77
+ paragraph: [unwrapStep, applyTargetHeadingToParagraphStep]
64
78
  },
65
79
  panel_c1: includePanelC1 ? {
66
80
  blockquote: [unwrapStep, wrapMixedContentStep],
@@ -68,7 +82,7 @@ const createTransformationMatrix = includePanelC1 => ({
68
82
  expand: [unwrapStep, wrapStep],
69
83
  nestedExpand: [unwrapStep, wrapStep],
70
84
  layoutSection: [unwrapStep, wrapMixedContentStep],
71
- paragraph: [unwrapStep]
85
+ paragraph: [unwrapStep, applyTargetHeadingToParagraphStep]
72
86
  } : {},
73
87
  expand: {
74
88
  panel: [unwrapExpandStep, wrapMixedContentStep],
@@ -78,7 +92,7 @@ const createTransformationMatrix = includePanelC1 => ({
78
92
  blockquote: [unwrapExpandStep, wrapMixedContentStep],
79
93
  layoutSection: [unwrapExpandStep, wrapMixedContentStep],
80
94
  nestedExpand: [unwrapExpandStep, wrapStep],
81
- paragraph: [unwrapExpandStep]
95
+ paragraph: [unwrapExpandStep, applyTargetHeadingToParagraphStep]
82
96
  },
83
97
  nestedExpand: {
84
98
  panel: [unwrapExpandStep, wrapMixedContentStep],
@@ -87,7 +101,7 @@ const createTransformationMatrix = includePanelC1 => ({
87
101
  } : {}),
88
102
  blockquote: [unwrapExpandStep, wrapMixedContentStep],
89
103
  layoutSection: [unwrapExpandStep, wrapMixedContentStep],
90
- paragraph: [unwrapExpandStep]
104
+ paragraph: [unwrapExpandStep, applyTargetHeadingToParagraphStep]
91
105
  },
92
106
  blockquote: {
93
107
  expand: [wrapStep],
@@ -97,7 +111,7 @@ const createTransformationMatrix = includePanelC1 => ({
97
111
  ...(includePanelC1 ? {
98
112
  panel_c1: [unwrapStep, wrapStep]
99
113
  } : {}),
100
- paragraph: [unwrapStep],
114
+ paragraph: [unwrapStep, applyTargetHeadingToParagraphStep],
101
115
  decisionList: [unwrapStep, wrapBlockquoteToDecisionListStep]
102
116
  },
103
117
  layoutSection: {
@@ -108,7 +122,7 @@ const createTransformationMatrix = includePanelC1 => ({
108
122
  ...(includePanelC1 ? {
109
123
  panel_c1: [unwrapLayoutStep, wrapMixedContentStep]
110
124
  } : {}),
111
- paragraph: [unwrapLayoutStep]
125
+ paragraph: [unwrapLayoutStep, applyTargetHeadingToParagraphStep]
112
126
  },
113
127
  codeBlock: {
114
128
  blockquote: [wrapStep],
@@ -5,7 +5,9 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
5
  import { getTargetNodeTypeNameInContext } from '../transform-node-utils/utils';
6
6
  import { TRANSFORMATION_MATRIX, TRANSFORMATION_MATRIX_PANEL_C1 } from './TRANSFORMATION_MATRIX';
7
7
  import { getNodeName, toNodeTypeValue } from './types';
8
- const applyTargetNodeMarks = (node, targetNodeType, marksToAdd, marksToRemove, schema) => {
8
+ const LIST_NODE_TYPE_NAMES = new Set(['bulletList', 'orderedList', 'taskList', 'decisionList', 'listItem', 'taskItem', 'blockTaskItem', 'decisionItem']);
9
+ const shouldRecurseThroughListNode = node => LIST_NODE_TYPE_NAMES.has(node.type.name);
10
+ const applyTargetNodeMarks = (node, targetNodeType, marksToAdd, marksToRemove, schema, shouldRecurseIntoChildren = () => true) => {
9
11
  let nextNode = node;
10
12
  if (node.type === targetNodeType) {
11
13
  const marksAfterRemovals = (marksToRemove !== null && marksToRemove !== void 0 ? marksToRemove : []).reduce((currentMarks, name) => {
@@ -18,11 +20,11 @@ const applyTargetNodeMarks = (node, targetNodeType, marksToAdd, marksToRemove, s
18
20
  }, marksAfterRemovals);
19
21
  nextNode = node.mark(marks);
20
22
  }
21
- if (nextNode.childCount === 0) {
23
+ if (!shouldRecurseIntoChildren(nextNode) || nextNode.childCount === 0) {
22
24
  return nextNode;
23
25
  }
24
26
  const children = [];
25
- nextNode.forEach(child => children.push(applyTargetNodeMarks(child, targetNodeType, marksToAdd, marksToRemove, schema)));
27
+ nextNode.forEach(child => children.push(applyTargetNodeMarks(child, targetNodeType, marksToAdd, marksToRemove, schema, shouldRecurseIntoChildren)));
26
28
  return nextNode.copy(Fragment.fromArray(children));
27
29
  };
28
30
 
@@ -98,9 +100,10 @@ export const convertNodesToTargetType = ({
98
100
  const resultNodes = steps.reduce((nodes, step) => step(nodes, context), sourceNodes);
99
101
  return upgradePanelNodesToPanelC1(resultNodes, parentNode, schema);
100
102
  }
103
+ const shouldLimitTargetNodeMarkRecursion = targetNodeTypeName === 'paragraph' && ['multi', 'panel', 'panel_c1', 'expand', 'nestedExpand', 'blockquote', 'layoutSection'].includes(selectedNodeTypeName);
101
104
  const resultNodes = (_steps$reduce = steps === null || steps === void 0 ? void 0 : steps.reduce((nodes, step) => step(nodes, context), sourceNodes)) !== null && _steps$reduce !== void 0 ? _steps$reduce : sourceNodes;
102
105
  const upgradedNodes = steps !== null && steps !== void 0 && steps.length ? upgradePanelNodesToPanelC1(resultNodes, parentNode, schema) : resultNodes;
103
- return upgradedNodes.map(node => applyTargetNodeMarks(node, targetNodeType, marksToAdd, marksToRemove, schema));
106
+ return upgradedNodes.map(node => applyTargetNodeMarks(node, targetNodeType, marksToAdd, marksToRemove, schema, shouldLimitTargetNodeMarkRecursion ? shouldRecurseThroughListNode : undefined));
104
107
  };
105
108
  export const isTransformDisabledBasedOnStepsConfig = (selectedNodeType, targetNodeType) => {
106
109
  const steps = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? TRANSFORMATION_MATRIX_PANEL_C1[selectedNodeType][targetNodeType] : TRANSFORMATION_MATRIX[selectedNodeType][targetNodeType];
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
5
  import { applyTargetTextTypeStep } from './steps/applyTargetTextTypeStep';
5
6
  import { convertEachNodeStep } from './steps/convertEachNodeStep';
6
7
  import { decisionListToListStep } from './steps/decisionListToListStep';
@@ -17,6 +18,19 @@ import { wrapBlockquoteToDecisionListStep } from './steps/wrapBlockquoteToDecisi
17
18
  import { wrapIntoListStep } from './steps/wrapIntoListStep';
18
19
  import { wrapMixedContentStep } from './steps/wrapMixedContentStep';
19
20
  import { wrapStep } from './steps/wrapStep';
21
+ var applyTargetHeadingToParagraphStep = function applyTargetHeadingToParagraphStep(nodes, context) {
22
+ if (!isExperimentEnabled('platform_editor_block_menu_small_text')) {
23
+ return nodes;
24
+ }
25
+ return nodes.map(function (node) {
26
+ var _applyTargetTextTypeS;
27
+ if (node.type.name !== 'heading') {
28
+ return node;
29
+ }
30
+ return (_applyTargetTextTypeS = applyTargetTextTypeStep([node], context).at(0)) !== null && _applyTargetTextTypeS !== void 0 ? _applyTargetTextTypeS : node;
31
+ });
32
+ };
33
+
20
34
  /**
21
35
  * Creates the transformation matrix for all node type pairs.
22
36
  * When includePanelC1 is true (platform_editor_nest_table_in_panel experiment on),
@@ -64,7 +78,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
64
78
  expand: [unwrapStep, wrapStep],
65
79
  nestedExpand: [unwrapStep, wrapStep],
66
80
  layoutSection: [unwrapStep, wrapMixedContentStep],
67
- paragraph: [unwrapStep]
81
+ paragraph: [unwrapStep, applyTargetHeadingToParagraphStep]
68
82
  },
69
83
  panel_c1: includePanelC1 ? {
70
84
  blockquote: [unwrapStep, wrapMixedContentStep],
@@ -72,7 +86,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
72
86
  expand: [unwrapStep, wrapStep],
73
87
  nestedExpand: [unwrapStep, wrapStep],
74
88
  layoutSection: [unwrapStep, wrapMixedContentStep],
75
- paragraph: [unwrapStep]
89
+ paragraph: [unwrapStep, applyTargetHeadingToParagraphStep]
76
90
  } : {},
77
91
  expand: _objectSpread(_objectSpread({
78
92
  panel: [unwrapExpandStep, wrapMixedContentStep]
@@ -82,7 +96,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
82
96
  blockquote: [unwrapExpandStep, wrapMixedContentStep],
83
97
  layoutSection: [unwrapExpandStep, wrapMixedContentStep],
84
98
  nestedExpand: [unwrapExpandStep, wrapStep],
85
- paragraph: [unwrapExpandStep]
99
+ paragraph: [unwrapExpandStep, applyTargetHeadingToParagraphStep]
86
100
  }),
87
101
  nestedExpand: _objectSpread(_objectSpread({
88
102
  panel: [unwrapExpandStep, wrapMixedContentStep]
@@ -91,7 +105,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
91
105
  } : {}), {}, {
92
106
  blockquote: [unwrapExpandStep, wrapMixedContentStep],
93
107
  layoutSection: [unwrapExpandStep, wrapMixedContentStep],
94
- paragraph: [unwrapExpandStep]
108
+ paragraph: [unwrapExpandStep, applyTargetHeadingToParagraphStep]
95
109
  }),
96
110
  blockquote: _objectSpread(_objectSpread({
97
111
  expand: [wrapStep],
@@ -101,7 +115,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
101
115
  }, includePanelC1 ? {
102
116
  panel_c1: [unwrapStep, wrapStep]
103
117
  } : {}), {}, {
104
- paragraph: [unwrapStep],
118
+ paragraph: [unwrapStep, applyTargetHeadingToParagraphStep],
105
119
  decisionList: [unwrapStep, wrapBlockquoteToDecisionListStep]
106
120
  }),
107
121
  layoutSection: _objectSpread(_objectSpread({
@@ -112,7 +126,7 @@ var createTransformationMatrix = function createTransformationMatrix(includePane
112
126
  }, includePanelC1 ? {
113
127
  panel_c1: [unwrapLayoutStep, wrapMixedContentStep]
114
128
  } : {}), {}, {
115
- paragraph: [unwrapLayoutStep]
129
+ paragraph: [unwrapLayoutStep, applyTargetHeadingToParagraphStep]
116
130
  }),
117
131
  codeBlock: _objectSpread(_objectSpread({
118
132
  blockquote: [wrapStep],
@@ -6,7 +6,14 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
6
  import { getTargetNodeTypeNameInContext } from '../transform-node-utils/utils';
7
7
  import { TRANSFORMATION_MATRIX, TRANSFORMATION_MATRIX_PANEL_C1 } from './TRANSFORMATION_MATRIX';
8
8
  import { getNodeName, toNodeTypeValue } from './types';
9
+ var LIST_NODE_TYPE_NAMES = new Set(['bulletList', 'orderedList', 'taskList', 'decisionList', 'listItem', 'taskItem', 'blockTaskItem', 'decisionItem']);
10
+ var shouldRecurseThroughListNode = function shouldRecurseThroughListNode(node) {
11
+ return LIST_NODE_TYPE_NAMES.has(node.type.name);
12
+ };
9
13
  var _applyTargetNodeMarks = function applyTargetNodeMarks(node, targetNodeType, marksToAdd, marksToRemove, schema) {
14
+ var shouldRecurseIntoChildren = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : function () {
15
+ return true;
16
+ };
10
17
  var nextNode = node;
11
18
  if (node.type === targetNodeType) {
12
19
  var marksAfterRemovals = (marksToRemove !== null && marksToRemove !== void 0 ? marksToRemove : []).reduce(function (currentMarks, name) {
@@ -22,12 +29,12 @@ var _applyTargetNodeMarks = function applyTargetNodeMarks(node, targetNodeType,
22
29
  }, marksAfterRemovals);
23
30
  nextNode = node.mark(marks);
24
31
  }
25
- if (nextNode.childCount === 0) {
32
+ if (!shouldRecurseIntoChildren(nextNode) || nextNode.childCount === 0) {
26
33
  return nextNode;
27
34
  }
28
35
  var children = [];
29
36
  nextNode.forEach(function (child) {
30
- return children.push(_applyTargetNodeMarks(child, targetNodeType, marksToAdd, marksToRemove, schema));
37
+ return children.push(_applyTargetNodeMarks(child, targetNodeType, marksToAdd, marksToRemove, schema, shouldRecurseIntoChildren));
31
38
  });
32
39
  return nextNode.copy(Fragment.fromArray(children));
33
40
  };
@@ -105,12 +112,13 @@ export var convertNodesToTargetType = function convertNodesToTargetType(_ref3) {
105
112
  }, sourceNodes);
106
113
  return upgradePanelNodesToPanelC1(_resultNodes, parentNode, schema);
107
114
  }
115
+ var shouldLimitTargetNodeMarkRecursion = targetNodeTypeName === 'paragraph' && ['multi', 'panel', 'panel_c1', 'expand', 'nestedExpand', 'blockquote', 'layoutSection'].includes(selectedNodeTypeName);
108
116
  var resultNodes = (_steps$reduce = steps === null || steps === void 0 ? void 0 : steps.reduce(function (nodes, step) {
109
117
  return step(nodes, context);
110
118
  }, sourceNodes)) !== null && _steps$reduce !== void 0 ? _steps$reduce : sourceNodes;
111
119
  var upgradedNodes = steps !== null && steps !== void 0 && steps.length ? upgradePanelNodesToPanelC1(resultNodes, parentNode, schema) : resultNodes;
112
120
  return upgradedNodes.map(function (node) {
113
- return _applyTargetNodeMarks(node, targetNodeType, marksToAdd, marksToRemove, schema);
121
+ return _applyTargetNodeMarks(node, targetNodeType, marksToAdd, marksToRemove, schema, shouldLimitTargetNodeMarkRecursion ? shouldRecurseThroughListNode : undefined);
114
122
  });
115
123
  };
116
124
  export var isTransformDisabledBasedOnStepsConfig = function isTransformDisabledBasedOnStepsConfig(selectedNodeType, targetNodeType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "20.0.4",
3
+ "version": "21.0.0",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,11 +27,11 @@
27
27
  "dependencies": {
28
28
  "@atlaskit/browser-apis": "^1.2.0",
29
29
  "@atlaskit/css": "^1.1.0",
30
- "@atlaskit/editor-plugin-analytics": "^21.0.0",
31
- "@atlaskit/editor-plugin-block-controls": "^22.0.0",
32
- "@atlaskit/editor-plugin-decorations": "^21.0.0",
33
- "@atlaskit/editor-plugin-selection": "^21.0.0",
34
- "@atlaskit/editor-plugin-user-intent": "^19.0.0",
30
+ "@atlaskit/editor-plugin-analytics": "^22.0.0",
31
+ "@atlaskit/editor-plugin-block-controls": "^23.0.0",
32
+ "@atlaskit/editor-plugin-decorations": "^22.0.0",
33
+ "@atlaskit/editor-plugin-selection": "^22.0.0",
34
+ "@atlaskit/editor-plugin-user-intent": "^20.0.0",
35
35
  "@atlaskit/editor-prosemirror": "^9.0.0",
36
36
  "@atlaskit/editor-shared-styles": "^4.3.0",
37
37
  "@atlaskit/editor-tables": "^3.2.0",
@@ -42,14 +42,14 @@
42
42
  "@atlaskit/platform-feature-flags": "^2.2.0",
43
43
  "@atlaskit/primitives": "^22.5.0",
44
44
  "@atlaskit/prosemirror-history": "^1.2.0",
45
- "@atlaskit/tmp-editor-statsig": "^208.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^209.0.0",
46
46
  "@atlaskit/tokens": "^20.0.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "bind-event-listener": "^3.0.0",
49
49
  "memoize-one": "^6.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@atlaskit/editor-common": "^125.3.0",
52
+ "@atlaskit/editor-common": "^126.0.0",
53
53
  "react": "^18.2.0 || ^19.2.0",
54
54
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
55
55
  },