@atlaskit/editor-plugin-block-menu 5.2.3 → 5.2.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/editor-commands/transform-node-utils/{wrapMixedContentStep.js → steps/wrapMixedContentStep.js} +25 -25
  3. package/dist/cjs/editor-commands/transform-node-utils/transform.js +10 -14
  4. package/dist/es2019/editor-commands/transform-node-utils/{wrapMixedContentStep.js → steps/wrapMixedContentStep.js} +25 -22
  5. package/dist/es2019/editor-commands/transform-node-utils/transform.js +10 -14
  6. package/dist/esm/editor-commands/transform-node-utils/{wrapMixedContentStep.js → steps/wrapMixedContentStep.js} +25 -24
  7. package/dist/esm/editor-commands/transform-node-utils/transform.js +10 -14
  8. package/dist/types/editor-commands/transform-node-utils/{wrapMixedContentStep.d.ts → steps/wrapMixedContentStep.d.ts} +1 -1
  9. package/dist/types-ts4.5/editor-commands/transform-node-utils/{wrapMixedContentStep.d.ts → steps/wrapMixedContentStep.d.ts} +1 -1
  10. package/package.json +1 -1
  11. package/dist/cjs/editor-commands/transform-node-utils/steps/convertBulletListToTextStep.js +0 -34
  12. package/dist/cjs/editor-commands/transform-node-utils/steps/convertOrderedListToTextStep.js +0 -62
  13. package/dist/cjs/editor-commands/transform-node-utils/steps/convertTaskListToTextStep.js +0 -39
  14. package/dist/cjs/editor-commands/transform-node-utils/steps/createListToTextStep.js +0 -90
  15. package/dist/es2019/editor-commands/transform-node-utils/steps/convertBulletListToTextStep.js +0 -27
  16. package/dist/es2019/editor-commands/transform-node-utils/steps/convertOrderedListToTextStep.js +0 -55
  17. package/dist/es2019/editor-commands/transform-node-utils/steps/convertTaskListToTextStep.js +0 -34
  18. package/dist/es2019/editor-commands/transform-node-utils/steps/createListToTextStep.js +0 -86
  19. package/dist/esm/editor-commands/transform-node-utils/steps/convertBulletListToTextStep.js +0 -29
  20. package/dist/esm/editor-commands/transform-node-utils/steps/convertOrderedListToTextStep.js +0 -57
  21. package/dist/esm/editor-commands/transform-node-utils/steps/convertTaskListToTextStep.js +0 -34
  22. package/dist/esm/editor-commands/transform-node-utils/steps/createListToTextStep.js +0 -85
  23. package/dist/types/editor-commands/transform-node-utils/steps/convertBulletListToTextStep.d.ts +0 -18
  24. package/dist/types/editor-commands/transform-node-utils/steps/convertOrderedListToTextStep.d.ts +0 -19
  25. package/dist/types/editor-commands/transform-node-utils/steps/convertTaskListToTextStep.d.ts +0 -22
  26. package/dist/types/editor-commands/transform-node-utils/steps/createListToTextStep.d.ts +0 -38
  27. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/convertBulletListToTextStep.d.ts +0 -18
  28. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/convertOrderedListToTextStep.d.ts +0 -19
  29. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/convertTaskListToTextStep.d.ts +0 -22
  30. package/dist/types-ts4.5/editor-commands/transform-node-utils/steps/createListToTextStep.d.ts +0 -38
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 5.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`dbbf4fabef4fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dbbf4fabef4fe) -
8
+ [ux] Scope change | Remove text transformations for incompatible nodes
9
+ - [`bb7cbcb12ae4f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bb7cbcb12ae4f) -
10
+ [ux] Implement transformation steps for panel to other nodes
11
+
3
12
  ## 5.2.3
4
13
 
5
14
  ### Patch Changes
@@ -1,36 +1,33 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.wrapMixedContentStep = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
7
  var _model = require("@atlaskit/editor-prosemirror/model");
10
- var _types = require("./types");
11
- var _unwrapStep = require("./unwrapStep");
8
+ var _types = require("../types");
12
9
  /**
13
- * Determines if a node can be flattened (unwrapped and its contents merged).
14
- *
15
- * According to the text transformations list, flattenable nodes are:
16
- * - Bulleted list, Numbered list, Task list
17
- * - Text nodes (heading, paragraph)
18
- *
19
- * Containers (panels, expands, layouts, blockquotes) and atomic nodes (tables, media, macros) break out.
10
+ * Determines if a node is a text node (heading or paragraph).
11
+ * Text nodes can have their content converted to paragraphs when they can't be wrapped directly.
20
12
  */
21
- var canFlatten = function canFlatten(node) {
13
+ var isTextNode = function isTextNode(node) {
22
14
  var category = _types.NODE_CATEGORY_BY_TYPE[node.type.name];
23
- // Text and list nodes can be flattened (converted to simpler forms)
24
- return category === 'text' || category === 'list';
15
+ return category === 'text';
25
16
  };
26
17
 
27
18
  /**
28
- * Flattens a node by extracting its contents using the appropriate unwrap step.
29
- * This is only called for text and list nodes that can be converted to simpler forms.
30
- * Uses unwrapStep to extract children from list containers.
19
+ * Converts a text node (heading, paragraph) to a paragraph preserving its inline content.
20
+ * This is used when a text node can't be wrapped directly in the target container
21
+ * (e.g., heading can't go in blockquote, so it becomes a paragraph).
31
22
  */
32
- var flattenNode = function flattenNode(node, context) {
33
- return (0, _unwrapStep.unwrapStep)([node], context);
23
+ var convertTextNodeToParagraph = function convertTextNodeToParagraph(node, schema) {
24
+ var _schema$nodes$paragra;
25
+ // If it's already a paragraph, return as-is
26
+ if (node.type.name === 'paragraph') {
27
+ return node;
28
+ }
29
+ // Convert heading (or other text node) to paragraph with same inline content
30
+ return (_schema$nodes$paragra = schema.nodes.paragraph.createAndFill({}, node.content)) !== null && _schema$nodes$paragra !== void 0 ? _schema$nodes$paragra : null;
34
31
  };
35
32
 
36
33
  /**
@@ -123,13 +120,16 @@ var wrapMixedContentStep = exports.wrapMixedContentStep = function wrapMixedCont
123
120
  if (expandNode) {
124
121
  result.push(expandNode);
125
122
  }
126
- } else if (canFlatten(node)) {
127
- var _currentContainerCont;
128
- // Node cannot be wrapped but CAN be flattened - flatten and add to container
129
- var flattenedNodes = flattenNode(node, context);
130
- (_currentContainerCont = currentContainerContent).push.apply(_currentContainerCont, (0, _toConsumableArray2.default)(flattenedNodes));
123
+ } else if (isTextNode(node)) {
124
+ // Text node (heading, paragraph) that can't be wrapped - convert to paragraph
125
+ // Example: heading can't go in blockquote, so convert to paragraph with same content
126
+ var paragraph = convertTextNodeToParagraph(node, schema);
127
+ if (paragraph) {
128
+ currentContainerContent.push(paragraph);
129
+ }
131
130
  } else {
132
- // Node cannot be wrapped AND cannot be flattened (containers, tables, media, macros) - break out
131
+ // All other nodes that cannot be wrapped (lists, containers, tables, media, macros) - break out
132
+ // This includes list nodes like taskList that can't be placed in certain containers
133
133
  flushCurrentContainer();
134
134
  result.push(node);
135
135
  }
@@ -6,19 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getOutputNodes = void 0;
7
7
  var _utils = require("../transform-node-utils/utils");
8
8
  var _flattenStep = require("./flattenStep");
9
- var _convertBulletListToTextStep = require("./steps/convertBulletListToTextStep");
10
- var _convertOrderedListToTextStep = require("./steps/convertOrderedListToTextStep");
11
- var _convertTaskListToTextStep = require("./steps/convertTaskListToTextStep");
12
9
  var _flattenListStep = require("./steps/flattenListStep");
13
10
  var _listToListStep = require("./steps/listToListStep");
14
11
  var _unwrapLayoutStep = require("./steps/unwrapLayoutStep");
15
12
  var _unwrapListStep = require("./steps/unwrapListStep");
13
+ var _wrapMixedContentStep = require("./steps/wrapMixedContentStep");
16
14
  var _stubStep = require("./stubStep");
17
15
  var _types = require("./types");
18
16
  var _unwrapExpandStep = require("./unwrapExpandStep");
19
17
  var _unwrapStep = require("./unwrapStep");
20
18
  var _wrapIntoLayoutStep = require("./wrapIntoLayoutStep");
21
- var _wrapMixedContentStep = require("./wrapMixedContentStep");
22
19
  var _wrapStep = require("./wrapStep");
23
20
  // Exampled step for overrides:
24
21
  // - open Block menu on a paragraph, click 'Panel' in the Turn into'
@@ -64,7 +61,8 @@ var TRANSFORM_STEPS_OVERRIDE = {
64
61
  },
65
62
  panel: {
66
63
  layoutSection: [_unwrapStep.unwrapStep, _wrapIntoLayoutStep.wrapIntoLayoutStep],
67
- codeBlock: [_unwrapStep.unwrapStep, _flattenStep.flattenStep, _wrapStep.wrapStep]
64
+ codeBlock: [_unwrapStep.unwrapStep, _flattenStep.flattenStep, _wrapStep.wrapStep],
65
+ blockquote: [_unwrapStep.unwrapStep, _wrapMixedContentStep.wrapMixedContentStep]
68
66
  },
69
67
  expand: {
70
68
  panel: [_unwrapExpandStep.unwrapExpandStep, _wrapMixedContentStep.wrapMixedContentStep],
@@ -100,21 +98,19 @@ var TRANSFORM_STEPS_OVERRIDE = {
100
98
  panel: [_wrapStep.wrapStep]
101
99
  },
102
100
  bulletList: {
103
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
104
- codeBlock: [_convertBulletListToTextStep.convertBulletListToTextStep, _flattenStep.flattenStep, _wrapStep.wrapStep],
101
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
102
+ codeBlock: [_stubStep.stubStep],
105
103
  layoutSection: [_wrapIntoLayoutStep.wrapIntoLayoutStep]
106
104
  },
107
105
  orderedList: {
108
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
109
- codeBlock: [_convertOrderedListToTextStep.convertOrderedListToTextStep, _flattenStep.flattenStep, _wrapStep.wrapStep],
110
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
106
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
107
+ codeBlock: [_stubStep.stubStep],
111
108
  layoutSection: [_wrapIntoLayoutStep.wrapIntoLayoutStep]
112
109
  },
113
110
  taskList: {
114
- // Warning: Actuall transformation logic not complete (Skeptical that prosemirror-markdown can be used)
115
- blockquote: [_convertTaskListToTextStep.convertTaskListToTextStep, _wrapStep.wrapStep],
116
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
117
- codeBlock: [_convertTaskListToTextStep.convertTaskListToTextStep, _flattenStep.flattenStep, _wrapStep.wrapStep],
111
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
112
+ blockquote: [_stubStep.stubStep],
113
+ codeBlock: [_stubStep.stubStep],
118
114
  layoutSection: [_wrapIntoLayoutStep.wrapIntoLayoutStep]
119
115
  },
120
116
  table: {
@@ -1,29 +1,28 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
- import { NODE_CATEGORY_BY_TYPE } from './types';
3
- import { unwrapStep } from './unwrapStep';
2
+ import { NODE_CATEGORY_BY_TYPE } from '../types';
4
3
 
5
4
  /**
6
- * Determines if a node can be flattened (unwrapped and its contents merged).
7
- *
8
- * According to the text transformations list, flattenable nodes are:
9
- * - Bulleted list, Numbered list, Task list
10
- * - Text nodes (heading, paragraph)
11
- *
12
- * Containers (panels, expands, layouts, blockquotes) and atomic nodes (tables, media, macros) break out.
5
+ * Determines if a node is a text node (heading or paragraph).
6
+ * Text nodes can have their content converted to paragraphs when they can't be wrapped directly.
13
7
  */
14
- const canFlatten = node => {
8
+ const isTextNode = node => {
15
9
  const category = NODE_CATEGORY_BY_TYPE[node.type.name];
16
- // Text and list nodes can be flattened (converted to simpler forms)
17
- return category === 'text' || category === 'list';
10
+ return category === 'text';
18
11
  };
19
12
 
20
13
  /**
21
- * Flattens a node by extracting its contents using the appropriate unwrap step.
22
- * This is only called for text and list nodes that can be converted to simpler forms.
23
- * Uses unwrapStep to extract children from list containers.
14
+ * Converts a text node (heading, paragraph) to a paragraph preserving its inline content.
15
+ * This is used when a text node can't be wrapped directly in the target container
16
+ * (e.g., heading can't go in blockquote, so it becomes a paragraph).
24
17
  */
25
- const flattenNode = (node, context) => {
26
- return unwrapStep([node], context);
18
+ const convertTextNodeToParagraph = (node, schema) => {
19
+ var _schema$nodes$paragra;
20
+ // If it's already a paragraph, return as-is
21
+ if (node.type.name === 'paragraph') {
22
+ return node;
23
+ }
24
+ // Convert heading (or other text node) to paragraph with same inline content
25
+ return (_schema$nodes$paragra = schema.nodes.paragraph.createAndFill({}, node.content)) !== null && _schema$nodes$paragra !== void 0 ? _schema$nodes$paragra : null;
27
26
  };
28
27
 
29
28
  /**
@@ -118,12 +117,16 @@ export const wrapMixedContentStep = (nodes, context) => {
118
117
  if (expandNode) {
119
118
  result.push(expandNode);
120
119
  }
121
- } else if (canFlatten(node)) {
122
- // Node cannot be wrapped but CAN be flattened - flatten and add to container
123
- const flattenedNodes = flattenNode(node, context);
124
- currentContainerContent.push(...flattenedNodes);
120
+ } else if (isTextNode(node)) {
121
+ // Text node (heading, paragraph) that can't be wrapped - convert to paragraph
122
+ // Example: heading can't go in blockquote, so convert to paragraph with same content
123
+ const paragraph = convertTextNodeToParagraph(node, schema);
124
+ if (paragraph) {
125
+ currentContainerContent.push(paragraph);
126
+ }
125
127
  } else {
126
- // Node cannot be wrapped AND cannot be flattened (containers, tables, media, macros) - break out
128
+ // All other nodes that cannot be wrapped (lists, containers, tables, media, macros) - break out
129
+ // This includes list nodes like taskList that can't be placed in certain containers
127
130
  flushCurrentContainer();
128
131
  result.push(node);
129
132
  }
@@ -1,18 +1,15 @@
1
1
  import { getTargetNodeTypeNameInContext } from '../transform-node-utils/utils';
2
2
  import { flattenStep } from './flattenStep';
3
- import { convertBulletListToTextStep } from './steps/convertBulletListToTextStep';
4
- import { convertOrderedListToTextStep } from './steps/convertOrderedListToTextStep';
5
- import { convertTaskListToTextStep } from './steps/convertTaskListToTextStep';
6
3
  import { flattenListStep } from './steps/flattenListStep';
7
4
  import { listToListStep } from './steps/listToListStep';
8
5
  import { unwrapLayoutStep } from './steps/unwrapLayoutStep';
9
6
  import { unwrapListStep } from './steps/unwrapListStep';
7
+ import { wrapMixedContentStep } from './steps/wrapMixedContentStep';
10
8
  import { stubStep } from './stubStep';
11
9
  import { NODE_CATEGORY_BY_TYPE, toNodeTypeValue } from './types';
12
10
  import { unwrapExpandStep } from './unwrapExpandStep';
13
11
  import { unwrapStep } from './unwrapStep';
14
12
  import { wrapIntoLayoutStep } from './wrapIntoLayoutStep';
15
- import { wrapMixedContentStep } from './wrapMixedContentStep';
16
13
  import { wrapStep } from './wrapStep';
17
14
 
18
15
  // Exampled step for overrides:
@@ -59,7 +56,8 @@ const TRANSFORM_STEPS_OVERRIDE = {
59
56
  },
60
57
  panel: {
61
58
  layoutSection: [unwrapStep, wrapIntoLayoutStep],
62
- codeBlock: [unwrapStep, flattenStep, wrapStep]
59
+ codeBlock: [unwrapStep, flattenStep, wrapStep],
60
+ blockquote: [unwrapStep, wrapMixedContentStep]
63
61
  },
64
62
  expand: {
65
63
  panel: [unwrapExpandStep, wrapMixedContentStep],
@@ -95,21 +93,19 @@ const TRANSFORM_STEPS_OVERRIDE = {
95
93
  panel: [wrapStep]
96
94
  },
97
95
  bulletList: {
98
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
99
- codeBlock: [convertBulletListToTextStep, flattenStep, wrapStep],
96
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
97
+ codeBlock: [stubStep],
100
98
  layoutSection: [wrapIntoLayoutStep]
101
99
  },
102
100
  orderedList: {
103
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
104
- codeBlock: [convertOrderedListToTextStep, flattenStep, wrapStep],
105
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
101
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
102
+ codeBlock: [stubStep],
106
103
  layoutSection: [wrapIntoLayoutStep]
107
104
  },
108
105
  taskList: {
109
- // Warning: Actuall transformation logic not complete (Skeptical that prosemirror-markdown can be used)
110
- blockquote: [convertTaskListToTextStep, wrapStep],
111
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
112
- codeBlock: [convertTaskListToTextStep, flattenStep, wrapStep],
106
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
107
+ blockquote: [stubStep],
108
+ codeBlock: [stubStep],
113
109
  layoutSection: [wrapIntoLayoutStep]
114
110
  },
115
111
  table: {
@@ -1,30 +1,28 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
- import { NODE_CATEGORY_BY_TYPE } from './types';
4
- import { unwrapStep } from './unwrapStep';
2
+ import { NODE_CATEGORY_BY_TYPE } from '../types';
5
3
 
6
4
  /**
7
- * Determines if a node can be flattened (unwrapped and its contents merged).
8
- *
9
- * According to the text transformations list, flattenable nodes are:
10
- * - Bulleted list, Numbered list, Task list
11
- * - Text nodes (heading, paragraph)
12
- *
13
- * Containers (panels, expands, layouts, blockquotes) and atomic nodes (tables, media, macros) break out.
5
+ * Determines if a node is a text node (heading or paragraph).
6
+ * Text nodes can have their content converted to paragraphs when they can't be wrapped directly.
14
7
  */
15
- var canFlatten = function canFlatten(node) {
8
+ var isTextNode = function isTextNode(node) {
16
9
  var category = NODE_CATEGORY_BY_TYPE[node.type.name];
17
- // Text and list nodes can be flattened (converted to simpler forms)
18
- return category === 'text' || category === 'list';
10
+ return category === 'text';
19
11
  };
20
12
 
21
13
  /**
22
- * Flattens a node by extracting its contents using the appropriate unwrap step.
23
- * This is only called for text and list nodes that can be converted to simpler forms.
24
- * Uses unwrapStep to extract children from list containers.
14
+ * Converts a text node (heading, paragraph) to a paragraph preserving its inline content.
15
+ * This is used when a text node can't be wrapped directly in the target container
16
+ * (e.g., heading can't go in blockquote, so it becomes a paragraph).
25
17
  */
26
- var flattenNode = function flattenNode(node, context) {
27
- return unwrapStep([node], context);
18
+ var convertTextNodeToParagraph = function convertTextNodeToParagraph(node, schema) {
19
+ var _schema$nodes$paragra;
20
+ // If it's already a paragraph, return as-is
21
+ if (node.type.name === 'paragraph') {
22
+ return node;
23
+ }
24
+ // Convert heading (or other text node) to paragraph with same inline content
25
+ return (_schema$nodes$paragra = schema.nodes.paragraph.createAndFill({}, node.content)) !== null && _schema$nodes$paragra !== void 0 ? _schema$nodes$paragra : null;
28
26
  };
29
27
 
30
28
  /**
@@ -117,13 +115,16 @@ export var wrapMixedContentStep = function wrapMixedContentStep(nodes, context)
117
115
  if (expandNode) {
118
116
  result.push(expandNode);
119
117
  }
120
- } else if (canFlatten(node)) {
121
- var _currentContainerCont;
122
- // Node cannot be wrapped but CAN be flattened - flatten and add to container
123
- var flattenedNodes = flattenNode(node, context);
124
- (_currentContainerCont = currentContainerContent).push.apply(_currentContainerCont, _toConsumableArray(flattenedNodes));
118
+ } else if (isTextNode(node)) {
119
+ // Text node (heading, paragraph) that can't be wrapped - convert to paragraph
120
+ // Example: heading can't go in blockquote, so convert to paragraph with same content
121
+ var paragraph = convertTextNodeToParagraph(node, schema);
122
+ if (paragraph) {
123
+ currentContainerContent.push(paragraph);
124
+ }
125
125
  } else {
126
- // Node cannot be wrapped AND cannot be flattened (containers, tables, media, macros) - break out
126
+ // All other nodes that cannot be wrapped (lists, containers, tables, media, macros) - break out
127
+ // This includes list nodes like taskList that can't be placed in certain containers
127
128
  flushCurrentContainer();
128
129
  result.push(node);
129
130
  }
@@ -1,18 +1,15 @@
1
1
  import { getTargetNodeTypeNameInContext } from '../transform-node-utils/utils';
2
2
  import { flattenStep } from './flattenStep';
3
- import { convertBulletListToTextStep } from './steps/convertBulletListToTextStep';
4
- import { convertOrderedListToTextStep } from './steps/convertOrderedListToTextStep';
5
- import { convertTaskListToTextStep } from './steps/convertTaskListToTextStep';
6
3
  import { flattenListStep } from './steps/flattenListStep';
7
4
  import { listToListStep } from './steps/listToListStep';
8
5
  import { unwrapLayoutStep } from './steps/unwrapLayoutStep';
9
6
  import { unwrapListStep } from './steps/unwrapListStep';
7
+ import { wrapMixedContentStep } from './steps/wrapMixedContentStep';
10
8
  import { stubStep } from './stubStep';
11
9
  import { NODE_CATEGORY_BY_TYPE, toNodeTypeValue } from './types';
12
10
  import { unwrapExpandStep } from './unwrapExpandStep';
13
11
  import { unwrapStep } from './unwrapStep';
14
12
  import { wrapIntoLayoutStep } from './wrapIntoLayoutStep';
15
- import { wrapMixedContentStep } from './wrapMixedContentStep';
16
13
  import { wrapStep } from './wrapStep';
17
14
 
18
15
  // Exampled step for overrides:
@@ -59,7 +56,8 @@ var TRANSFORM_STEPS_OVERRIDE = {
59
56
  },
60
57
  panel: {
61
58
  layoutSection: [unwrapStep, wrapIntoLayoutStep],
62
- codeBlock: [unwrapStep, flattenStep, wrapStep]
59
+ codeBlock: [unwrapStep, flattenStep, wrapStep],
60
+ blockquote: [unwrapStep, wrapMixedContentStep]
63
61
  },
64
62
  expand: {
65
63
  panel: [unwrapExpandStep, wrapMixedContentStep],
@@ -95,21 +93,19 @@ var TRANSFORM_STEPS_OVERRIDE = {
95
93
  panel: [wrapStep]
96
94
  },
97
95
  bulletList: {
98
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
99
- codeBlock: [convertBulletListToTextStep, flattenStep, wrapStep],
96
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
97
+ codeBlock: [stubStep],
100
98
  layoutSection: [wrapIntoLayoutStep]
101
99
  },
102
100
  orderedList: {
103
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
104
- codeBlock: [convertOrderedListToTextStep, flattenStep, wrapStep],
105
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
101
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
102
+ codeBlock: [stubStep],
106
103
  layoutSection: [wrapIntoLayoutStep]
107
104
  },
108
105
  taskList: {
109
- // Warning: Actuall transformation logic not complete (Skeptical that prosemirror-markdown can be used)
110
- blockquote: [convertTaskListToTextStep, wrapStep],
111
- // Warning: Actuall transformation logic not complete (Likelly prosemirror-markdown to be used)
112
- codeBlock: [convertTaskListToTextStep, flattenStep, wrapStep],
106
+ // Text transformations currently not in scope > options will be disabled > stubbing in case
107
+ blockquote: [stubStep],
108
+ codeBlock: [stubStep],
113
109
  layoutSection: [wrapIntoLayoutStep]
114
110
  },
115
111
  table: {
@@ -1,4 +1,4 @@
1
- import type { TransformStep } from './types';
1
+ import type { TransformStep } from '../types';
2
2
  /**
3
3
  * A wrap step that handles mixed content according to the Compatibility Matrix:
4
4
  * - Wraps consecutive compatible nodes into the target container
@@ -1,4 +1,4 @@
1
- import type { TransformStep } from './types';
1
+ import type { TransformStep } from '../types';
2
2
  /**
3
3
  * A wrap step that handles mixed content according to the Compatibility Matrix:
4
4
  * - Wraps consecutive compatible nodes into the target container
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "5.2.3",
3
+ "version": "5.2.4",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.convertBulletListToTextStep = void 0;
7
- var _createListToTextStep = require("./createListToTextStep");
8
- /**
9
- * Given an array of nodes, processes each bullet list by converting its items
10
- * to paragraphs with "- " prefix.
11
- *
12
- * Handles nested bullet lists recursively with 3-space indentation per level.
13
- *
14
- * @example
15
- * Input:
16
- * - bulletList()(
17
- * listItem()(p()('Item 1')),
18
- * bulletList()(listItem()(p()('Sub item 1')))
19
- * )
20
- *
21
- * Output:
22
- * - p()('- Item 1')
23
- * - p()(' - Sub item 1')
24
- */
25
- var convertBulletListToTextStep = exports.convertBulletListToTextStep = (0, _createListToTextStep.createListToTextStep)({
26
- listTypeName: 'bulletList',
27
- itemTypeName: 'listItem',
28
- indent: ' ',
29
- // 3 spaces per nesting level
30
- getPrefix: function getPrefix() {
31
- return '- ';
32
- },
33
- unwrapParagraphContent: true
34
- });
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.convertOrderedListToTextStep = void 0;
7
- var _createListToTextStep = require("./createListToTextStep");
8
- /**
9
- * Converts a number to a letter (1=a, 2=b, etc.)
10
- * For numbers > 26, continues with aa, ab, etc.
11
- */
12
- var numberToLetter = function numberToLetter(num) {
13
- var result = '';
14
- var n = num;
15
- while (n > 0) {
16
- n--;
17
- result = String.fromCharCode(97 + n % 26) + result;
18
- n = Math.floor(n / 26);
19
- }
20
- return result;
21
- };
22
-
23
- /**
24
- * Gets the appropriate prefix for an ordered list item based on depth and index.
25
- * - Level 0: "1. ", "2. ", "3. ", etc.
26
- * - Level 1+: "a. ", "b. ", "c. ", etc.
27
- */
28
- var getOrderedListPrefix = function getOrderedListPrefix(depth, index) {
29
- if (depth === 0) {
30
- return "".concat(index, ". ");
31
- }
32
- return "".concat(numberToLetter(index), ". ");
33
- };
34
-
35
- /**
36
- * Given an array of nodes, processes each ordered list by converting its items
37
- * to paragraphs with numbered prefixes (1., 2., 3.) at the top level and
38
- * lettered prefixes (a., b., c.) for nested levels.
39
- *
40
- * Handles nested ordered lists recursively with 3-space indentation per level.
41
- *
42
- * @example
43
- * Input:
44
- * - orderedList({ order: 1 })(
45
- * listItem()(p()('Item 1')),
46
- * orderedList({ order: 1 })(listItem()(p()('Sub item 1')))
47
- * )
48
- *
49
- * Output:
50
- * - p()('1. Item 1')
51
- * - p()(' a. Sub item 1')
52
- */
53
- var convertOrderedListToTextStep = exports.convertOrderedListToTextStep = (0, _createListToTextStep.createListToTextStep)({
54
- listTypeName: 'orderedList',
55
- itemTypeName: 'listItem',
56
- indent: ' ',
57
- // 3 spaces per nesting level
58
- getPrefix: function getPrefix(depth, index) {
59
- return getOrderedListPrefix(depth, index);
60
- },
61
- unwrapParagraphContent: true
62
- });
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.convertTaskListToTextStep = void 0;
7
- var _createListToTextStep = require("./createListToTextStep");
8
- /**
9
- * Given an array of nodes, processes each task list by converting its items
10
- * to paragraphs with a checkbox prefix. Uses "[] " for unchecked (TODO) tasks
11
- * and "[x] " for checked (DONE) tasks.
12
- *
13
- * Handles nested task lists recursively with 4-space indentation per level.
14
- *
15
- * This is used when converting a task list to a container that doesn't support
16
- * task items (like blockquote).
17
- *
18
- * @example
19
- * Input:
20
- * - taskList()(
21
- * taskItem({ state: 'TODO' })('Task list item'),
22
- * taskList()(taskItem({ state: 'DONE' })('Nested done task'))
23
- * )
24
- *
25
- * Output:
26
- * - p()('[] Task list item')
27
- * - p()(' [x] Nested done task')
28
- */
29
- var convertTaskListToTextStep = exports.convertTaskListToTextStep = (0, _createListToTextStep.createListToTextStep)({
30
- listTypeName: 'taskList',
31
- itemTypeName: 'taskItem',
32
- indent: ' ',
33
- // 4 spaces per nesting level
34
- getPrefix: function getPrefix(_, __, itemNode) {
35
- var _itemNode$attrs;
36
- return ((_itemNode$attrs = itemNode.attrs) === null || _itemNode$attrs === void 0 ? void 0 : _itemNode$attrs.state) === 'DONE' ? '[x] ' : '[] ';
37
- },
38
- unwrapParagraphContent: false
39
- });