@atlaskit/editor-wikimarkup-transformer 11.20.7 → 11.20.8

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,14 @@
1
1
  # @atlaskit/editor-wikimarkup-transformer
2
2
 
3
+ ## 11.20.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ab828dcb15928`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ab828dcb15928) -
8
+ Add support for flexible list indentation ADF structures: handle wrapper listItem nodes (list as
9
+ first child) and taskList children in listItem encoder
10
+ - Updated dependencies
11
+
3
12
  ## 11.20.7
4
13
 
5
14
  ### Patch Changes
@@ -24,6 +24,7 @@ var listItem = exports.listItem = function listItem(node, prefix, context) {
24
24
  }
25
25
  case 'bulletList':
26
26
  case 'orderedList':
27
+ case 'taskList':
27
28
  {
28
29
  if (contentBuffer.length) {
29
30
  result.push("".concat(prefix, " ").concat(contentBuffer.join('\n')));
@@ -207,10 +207,24 @@ var ListBuilder = exports.ListBuilder = /*#__PURE__*/function () {
207
207
  key: "createListItem",
208
208
  value: function createListItem(content, schema) {
209
209
  if (content.length === 0 || ['paragraph', 'mediaSingle'].indexOf(content[0].type.name) === -1) {
210
- // If the content is empty or the first element is not paragraph or mediaSingle.
211
- // this likely to be a nested list where the toplevel list is empty
210
+ // If the first element is a list node, try to create a wrapper listItem
211
+ // (list as first child, no paragraph) for flexible list indentation.
212
+ // If the schema doesn't support this variant, fall back to prepending
213
+ // an empty paragraph.
214
+ var listTypes = ['bulletList', 'orderedList', 'taskList'];
215
+ if (content.length > 0 && listTypes.indexOf(content[0].type.name) !== -1) {
216
+ try {
217
+ return schema.nodes.listItem.createChecked({}, content);
218
+ } catch (_unused) {
219
+ // Schema doesn't support list as first child of listItem,
220
+ // fall back to prepending an empty paragraph
221
+ }
222
+ }
223
+
224
+ // If the content is empty or the first element is not paragraph or mediaSingle,
225
+ // this is likely a nested list where the top-level list item has no text content.
212
226
  // For example: *# item 1
213
- // In this case we create an empty paragraph for the top level listNode
227
+ // In this case we create an empty paragraph for the top level listNode.
214
228
  content.unshift(this.schema.nodes.paragraph.createChecked());
215
229
  }
216
230
  return schema.nodes.listItem.createChecked({}, content);
@@ -18,6 +18,7 @@ export const listItem = (node, prefix, context) => {
18
18
  }
19
19
  case 'bulletList':
20
20
  case 'orderedList':
21
+ case 'taskList':
21
22
  {
22
23
  if (contentBuffer.length) {
23
24
  result.push(`${prefix} ${contentBuffer.join('\n')}`);
@@ -173,10 +173,24 @@ export class ListBuilder {
173
173
  }
174
174
  createListItem(content, schema) {
175
175
  if (content.length === 0 || ['paragraph', 'mediaSingle'].indexOf(content[0].type.name) === -1) {
176
- // If the content is empty or the first element is not paragraph or mediaSingle.
177
- // this likely to be a nested list where the toplevel list is empty
176
+ // If the first element is a list node, try to create a wrapper listItem
177
+ // (list as first child, no paragraph) for flexible list indentation.
178
+ // If the schema doesn't support this variant, fall back to prepending
179
+ // an empty paragraph.
180
+ const listTypes = ['bulletList', 'orderedList', 'taskList'];
181
+ if (content.length > 0 && listTypes.indexOf(content[0].type.name) !== -1) {
182
+ try {
183
+ return schema.nodes.listItem.createChecked({}, content);
184
+ } catch {
185
+ // Schema doesn't support list as first child of listItem,
186
+ // fall back to prepending an empty paragraph
187
+ }
188
+ }
189
+
190
+ // If the content is empty or the first element is not paragraph or mediaSingle,
191
+ // this is likely a nested list where the top-level list item has no text content.
178
192
  // For example: *# item 1
179
- // In this case we create an empty paragraph for the top level listNode
193
+ // In this case we create an empty paragraph for the top level listNode.
180
194
  content.unshift(this.schema.nodes.paragraph.createChecked());
181
195
  }
182
196
  return schema.nodes.listItem.createChecked({}, content);
@@ -18,6 +18,7 @@ export var listItem = function listItem(node, prefix, context) {
18
18
  }
19
19
  case 'bulletList':
20
20
  case 'orderedList':
21
+ case 'taskList':
21
22
  {
22
23
  if (contentBuffer.length) {
23
24
  result.push("".concat(prefix, " ").concat(contentBuffer.join('\n')));
@@ -199,10 +199,24 @@ export var ListBuilder = /*#__PURE__*/function () {
199
199
  key: "createListItem",
200
200
  value: function createListItem(content, schema) {
201
201
  if (content.length === 0 || ['paragraph', 'mediaSingle'].indexOf(content[0].type.name) === -1) {
202
- // If the content is empty or the first element is not paragraph or mediaSingle.
203
- // this likely to be a nested list where the toplevel list is empty
202
+ // If the first element is a list node, try to create a wrapper listItem
203
+ // (list as first child, no paragraph) for flexible list indentation.
204
+ // If the schema doesn't support this variant, fall back to prepending
205
+ // an empty paragraph.
206
+ var listTypes = ['bulletList', 'orderedList', 'taskList'];
207
+ if (content.length > 0 && listTypes.indexOf(content[0].type.name) !== -1) {
208
+ try {
209
+ return schema.nodes.listItem.createChecked({}, content);
210
+ } catch (_unused) {
211
+ // Schema doesn't support list as first child of listItem,
212
+ // fall back to prepending an empty paragraph
213
+ }
214
+ }
215
+
216
+ // If the content is empty or the first element is not paragraph or mediaSingle,
217
+ // this is likely a nested list where the top-level list item has no text content.
204
218
  // For example: *# item 1
205
- // In this case we create an empty paragraph for the top level listNode
219
+ // In this case we create an empty paragraph for the top level listNode.
206
220
  content.unshift(this.schema.nodes.paragraph.createChecked());
207
221
  }
208
222
  return schema.nodes.listItem.createChecked({}, content);
@@ -1 +1,2 @@
1
- export declare const doubleDashSymbol: import("./").TokenParser;
1
+ import { type TokenParser } from './';
2
+ export declare const doubleDashSymbol: TokenParser;
@@ -1 +1,2 @@
1
- export declare const tripleDashSymbol: import("./").TokenParser;
1
+ import { type TokenParser } from './';
2
+ export declare const tripleDashSymbol: TokenParser;
@@ -1 +1,2 @@
1
- export declare const doubleDashSymbol: import("./").TokenParser;
1
+ import { type TokenParser } from './';
2
+ export declare const doubleDashSymbol: TokenParser;
@@ -1 +1,2 @@
1
- export declare const tripleDashSymbol: import("./").TokenParser;
1
+ import { type TokenParser } from './';
2
+ export declare const tripleDashSymbol: TokenParser;
package/docs/0-intro.tsx CHANGED
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { md, Example, code, AtlassianInternalWarning } from '@atlaskit/docs';
3
3
 
4
- export default md`
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- md template from @atlaskit/docs
5
+ const _default_1: any = md`
5
6
  ${(<AtlassianInternalWarning />)}
6
7
 
7
8
  This package provides a transformer for ProseMirror Node <-> Wikimarkup conversion.
@@ -35,3 +36,4 @@ This package provides a transformer for ProseMirror Node <-> Wikimarkup conversi
35
36
  />
36
37
  )}
37
38
  `;
39
+ export default _default_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-wikimarkup-transformer",
3
- "version": "11.20.7",
3
+ "version": "11.20.8",
4
4
  "description": "Wiki markup transformer for JIRA and Confluence",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@atlaskit/adf-schema": "^52.1.0",
32
+ "@atlaskit/adf-schema": "^52.4.0",
33
33
  "@atlaskit/editor-json-transformer": "^8.31.0",
34
34
  "@atlaskit/editor-prosemirror": "^7.3.0",
35
35
  "@atlaskit/theme": "^22.0.0",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@atlaskit/activity": "^1.0.1",
40
- "@atlaskit/editor-core": "^216.13.0",
40
+ "@atlaskit/editor-core": "^217.5.0",
41
41
  "@atlaskit/editor-test-helpers": "workspace:^",
42
42
  "@atlaskit/mention": "^24.5.0",
43
- "@atlaskit/tokens": "^11.0.0",
43
+ "@atlaskit/tokens": "^11.1.0",
44
44
  "@atlaskit/util-data-test": "^18.5.0",
45
45
  "@emotion/react": "^11.7.1",
46
46
  "@types/debug": "^4.1.10",