@atlaskit/adf-schema 28.1.12 → 28.2.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.
Files changed (210) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/types/index.d.ts +1 -1
  3. package/package.json +1 -1
  4. package/src/__tests__/unit/json-schema/v1.ts +0 -55
  5. package/src/__tests__/unit/schema/create-schema.ts +0 -214
  6. package/src/__tests__/unit/schema/default-schema.ts +0 -192
  7. package/src/__tests__/unit/schema/marks/annotation.ts +0 -46
  8. package/src/__tests__/unit/schema/marks/border.ts +0 -76
  9. package/src/__tests__/unit/schema/marks/breakout.ts +0 -24
  10. package/src/__tests__/unit/schema/marks/code.ts +0 -44
  11. package/src/__tests__/unit/schema/marks/confluence-inline-comment.ts +0 -25
  12. package/src/__tests__/unit/schema/marks/data-consumer.ts +0 -52
  13. package/src/__tests__/unit/schema/marks/em.ts +0 -37
  14. package/src/__tests__/unit/schema/marks/link.ts +0 -188
  15. package/src/__tests__/unit/schema/marks/strike.ts +0 -37
  16. package/src/__tests__/unit/schema/marks/strong.ts +0 -43
  17. package/src/__tests__/unit/schema/marks/subsup.ts +0 -50
  18. package/src/__tests__/unit/schema/marks/text-color.ts +0 -61
  19. package/src/__tests__/unit/schema/marks/underline.ts +0 -36
  20. package/src/__tests__/unit/schema/nodes/_consts.ts +0 -964
  21. package/src/__tests__/unit/schema/nodes/block-card.ts +0 -184
  22. package/src/__tests__/unit/schema/nodes/blockquote.ts +0 -44
  23. package/src/__tests__/unit/schema/nodes/bodied-extension.ts +0 -101
  24. package/src/__tests__/unit/schema/nodes/code-block.ts +0 -221
  25. package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +0 -32
  26. package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +0 -35
  27. package/src/__tests__/unit/schema/nodes/date.ts +0 -51
  28. package/src/__tests__/unit/schema/nodes/decision-item.ts +0 -46
  29. package/src/__tests__/unit/schema/nodes/decision-list.ts +0 -52
  30. package/src/__tests__/unit/schema/nodes/embed-card.ts +0 -60
  31. package/src/__tests__/unit/schema/nodes/emoji.ts +0 -71
  32. package/src/__tests__/unit/schema/nodes/expand.ts +0 -51
  33. package/src/__tests__/unit/schema/nodes/extension.ts +0 -101
  34. package/src/__tests__/unit/schema/nodes/hard-break.ts +0 -24
  35. package/src/__tests__/unit/schema/nodes/heading.ts +0 -56
  36. package/src/__tests__/unit/schema/nodes/image.ts +0 -32
  37. package/src/__tests__/unit/schema/nodes/inline-card.ts +0 -106
  38. package/src/__tests__/unit/schema/nodes/inline-extension.ts +0 -79
  39. package/src/__tests__/unit/schema/nodes/layout-column.ts +0 -54
  40. package/src/__tests__/unit/schema/nodes/layout-section.ts +0 -95
  41. package/src/__tests__/unit/schema/nodes/list-item.ts +0 -49
  42. package/src/__tests__/unit/schema/nodes/media-group.ts +0 -67
  43. package/src/__tests__/unit/schema/nodes/media-single.ts +0 -171
  44. package/src/__tests__/unit/schema/nodes/media.ts +0 -384
  45. package/src/__tests__/unit/schema/nodes/mention.ts +0 -115
  46. package/src/__tests__/unit/schema/nodes/nestedExpand.ts +0 -72
  47. package/src/__tests__/unit/schema/nodes/ordered-list.ts +0 -49
  48. package/src/__tests__/unit/schema/nodes/panel.ts +0 -180
  49. package/src/__tests__/unit/schema/nodes/paragraph.ts +0 -25
  50. package/src/__tests__/unit/schema/nodes/placeholder.ts +0 -46
  51. package/src/__tests__/unit/schema/nodes/rule.ts +0 -24
  52. package/src/__tests__/unit/schema/nodes/status.ts +0 -120
  53. package/src/__tests__/unit/schema/nodes/tableNodes.ts +0 -555
  54. package/src/__tests__/unit/schema/nodes/task-item.ts +0 -39
  55. package/src/__tests__/unit/schema/nodes/task-list.ts +0 -45
  56. package/src/__tests__/unit/schema/nodes/unknown-block.ts +0 -42
  57. package/src/__tests__/unit/schema/nodes/unsupported-block.ts +0 -42
  58. package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +0 -38
  59. package/src/__tests__/unit/utils/colors.ts +0 -42
  60. package/src/__tests__/unit/utils/url.ts +0 -209
  61. package/src/schema/bitbucket-schema.ts +0 -43
  62. package/src/schema/confluence-schema.ts +0 -76
  63. package/src/schema/create-schema.ts +0 -337
  64. package/src/schema/default-schema.ts +0 -180
  65. package/src/schema/groups.ts +0 -30
  66. package/src/schema/inline-nodes.ts +0 -9
  67. package/src/schema/jira-schema.ts +0 -158
  68. package/src/schema/marks/__tests__/unit/annotation.ts +0 -18
  69. package/src/schema/marks/alignment.ts +0 -48
  70. package/src/schema/marks/annotation.ts +0 -107
  71. package/src/schema/marks/border.ts +0 -74
  72. package/src/schema/marks/breakout.ts +0 -42
  73. package/src/schema/marks/code.ts +0 -45
  74. package/src/schema/marks/confluence-inline-comment.ts +0 -32
  75. package/src/schema/marks/data-consumer.ts +0 -100
  76. package/src/schema/marks/em.ts +0 -19
  77. package/src/schema/marks/fragment.ts +0 -77
  78. package/src/schema/marks/indentation.ts +0 -47
  79. package/src/schema/marks/link.ts +0 -139
  80. package/src/schema/marks/strike.ts +0 -26
  81. package/src/schema/marks/strong.ts +0 -45
  82. package/src/schema/marks/subsup.ts +0 -53
  83. package/src/schema/marks/text-color.ts +0 -172
  84. package/src/schema/marks/type-ahead-query.ts +0 -22
  85. package/src/schema/marks/underline.ts +0 -24
  86. package/src/schema/marks/unsupported-mark.ts +0 -9
  87. package/src/schema/marks/unsupported-node-attributes.ts +0 -8
  88. package/src/schema/nodes/block-card.ts +0 -121
  89. package/src/schema/nodes/blockquote.ts +0 -25
  90. package/src/schema/nodes/bodied-extension.ts +0 -75
  91. package/src/schema/nodes/bullet-list.ts +0 -17
  92. package/src/schema/nodes/caption.ts +0 -51
  93. package/src/schema/nodes/code-block.ts +0 -176
  94. package/src/schema/nodes/confluence-jira-issue.ts +0 -43
  95. package/src/schema/nodes/confluence-unsupported-block.ts +0 -29
  96. package/src/schema/nodes/confluence-unsupported-inline.ts +0 -30
  97. package/src/schema/nodes/date.ts +0 -38
  98. package/src/schema/nodes/decision-item.ts +0 -50
  99. package/src/schema/nodes/decision-list.ts +0 -56
  100. package/src/schema/nodes/doc.ts +0 -30
  101. package/src/schema/nodes/embed-card.ts +0 -62
  102. package/src/schema/nodes/emoji.ts +0 -89
  103. package/src/schema/nodes/expand.ts +0 -101
  104. package/src/schema/nodes/extension.ts +0 -60
  105. package/src/schema/nodes/hard-break.ts +0 -21
  106. package/src/schema/nodes/heading.ts +0 -64
  107. package/src/schema/nodes/image.ts +0 -32
  108. package/src/schema/nodes/inline-card.ts +0 -70
  109. package/src/schema/nodes/inline-extension.ts +0 -57
  110. package/src/schema/nodes/layout-column.ts +0 -68
  111. package/src/schema/nodes/layout-section.ts +0 -93
  112. package/src/schema/nodes/list-item.ts +0 -13
  113. package/src/schema/nodes/media-group.ts +0 -44
  114. package/src/schema/nodes/media-inline.ts +0 -19
  115. package/src/schema/nodes/media-single.ts +0 -179
  116. package/src/schema/nodes/media.ts +0 -253
  117. package/src/schema/nodes/mention.ts +0 -86
  118. package/src/schema/nodes/nested-expand.ts +0 -77
  119. package/src/schema/nodes/ordered-list.ts +0 -62
  120. package/src/schema/nodes/panel.ts +0 -133
  121. package/src/schema/nodes/paragraph.ts +0 -79
  122. package/src/schema/nodes/placeholder.ts +0 -40
  123. package/src/schema/nodes/rule.ts +0 -17
  124. package/src/schema/nodes/status.ts +0 -58
  125. package/src/schema/nodes/tableNodes.ts +0 -478
  126. package/src/schema/nodes/task-item.ts +0 -51
  127. package/src/schema/nodes/task-list.ts +0 -61
  128. package/src/schema/nodes/text.ts +0 -19
  129. package/src/schema/nodes/types/block-content.ts +0 -51
  130. package/src/schema/nodes/types/extensions.ts +0 -36
  131. package/src/schema/nodes/types/inline-content.ts +0 -56
  132. package/src/schema/nodes/types/list.ts +0 -54
  133. package/src/schema/nodes/types/mark.ts +0 -16
  134. package/src/schema/nodes/types/non-nestable-block-content.ts +0 -39
  135. package/src/schema/nodes/types/rich-media-common.ts +0 -51
  136. package/src/schema/nodes/unknown-block.ts +0 -13
  137. package/src/schema/nodes/unsupported-block.ts +0 -28
  138. package/src/schema/nodes/unsupported-inline.ts +0 -27
  139. package/src/schema/unsupported.ts +0 -4
  140. package/src/steps/__tests__/unit/analytics.ts +0 -72
  141. package/src/steps/__tests__/unit/link-meta-step.ts +0 -64
  142. package/src/steps/__tests__/unit/override-document-step.ts +0 -174
  143. package/src/steps/__tests__/unit/set-attrs.ts +0 -71
  144. package/src/steps/analytics.ts +0 -189
  145. package/src/steps/link-meta-step.ts +0 -105
  146. package/src/steps/override-document-step.ts +0 -97
  147. package/src/steps/set-attrs.tsx +0 -74
  148. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-0.json +0 -15
  149. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-1.json +0 -15
  150. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-2.json +0 -15
  151. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-3.json +0 -15
  152. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-0.json +0 -9
  153. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-1.json +0 -9
  154. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-2.json +0 -9
  155. package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row-inverted.json +0 -98
  156. package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row.json +0 -71
  157. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0-inverted.json +0 -19
  158. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0.json +0 -19
  159. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1-inverted.json +0 -21
  160. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1.json +0 -21
  161. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2-inverted.json +0 -21
  162. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2.json +0 -21
  163. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3-inverted.json +0 -19
  164. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3.json +0 -19
  165. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0-inverted.json +0 -63
  166. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0.json +0 -21
  167. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1-inverted.json +0 -64
  168. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1.json +0 -22
  169. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2-inverted.json +0 -63
  170. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2.json +0 -21
  171. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0-inverted.json +0 -19
  172. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0.json +0 -19
  173. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1-inverted.json +0 -19
  174. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1.json +0 -19
  175. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2-inverted.json +0 -19
  176. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2.json +0 -19
  177. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3-inverted.json +0 -19
  178. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3.json +0 -19
  179. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0-inverted.json +0 -52
  180. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0.json +0 -38
  181. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1-inverted.json +0 -52
  182. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1.json +0 -38
  183. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2-inverted.json +0 -25
  184. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2.json +0 -11
  185. package/src/steps/table/__tests__/_utils.ts +0 -102
  186. package/src/steps/table/__tests__/add-column-merge-columns.ts +0 -509
  187. package/src/steps/table/__tests__/add-column-merge-rows.ts +0 -466
  188. package/src/steps/table/__tests__/add-column.ts +0 -638
  189. package/src/steps/table/add-column.ts +0 -443
  190. package/src/steps/table/constants.ts +0 -4
  191. package/src/steps/table/sort-column.ts +0 -57
  192. package/src/steps/table/types.ts +0 -48
  193. package/src/steps/table/utils/cell-step.ts +0 -239
  194. package/src/steps/table/utils/cells-at-column.ts +0 -75
  195. package/src/steps/table/utils/find-column.ts +0 -90
  196. package/src/steps/table/utils/get-table-rect-from-doc.ts +0 -37
  197. package/src/steps/table/utils/side-effects/rows.ts +0 -327
  198. package/src/steps/table/utils/side-effects/side-effects.ts +0 -90
  199. package/src/steps/table/utils/side-effects/table.ts +0 -112
  200. package/src/steps/table/utils/side-effects/types.ts +0 -34
  201. package/src/steps/table/utils/table-map.ts +0 -28
  202. package/src/steps/type-ahead.ts +0 -100
  203. package/src/steps.ts +0 -16
  204. package/src/utils/colors.ts +0 -171
  205. package/src/utils/confluence/emoji.ts +0 -99
  206. package/src/utils/extensions.ts +0 -32
  207. package/src/utils/parseDOM.ts +0 -2
  208. package/src/utils/url.ts +0 -173
  209. package/src/utils/uuid.ts +0 -19
  210. package/src/version.json +0 -6
@@ -1,42 +0,0 @@
1
- import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
-
3
- import { schema } from 'adf-test-helpers/src/adf-schema';
4
-
5
- const packageName = process.env._PACKAGE_NAME_ as string;
6
-
7
- describe(`${packageName}/schema unsupportedBlock node`, () => {
8
- const originalValue = {
9
- type: 'invalidNode',
10
- content: [
11
- {
12
- type: 'text',
13
- text: 'foo',
14
- },
15
- ],
16
- };
17
-
18
- it('should parse unsupported block nodes', () => {
19
- const doc = fromHTML(
20
- `<div
21
- data-node-type="unsupportedBlock"
22
- data-original-value='${JSON.stringify(originalValue)}'
23
- />`,
24
- schema,
25
- );
26
- const unsupportedBlockNode = doc.firstChild!;
27
- expect(unsupportedBlockNode.type).toEqual(schema.nodes.unsupportedBlock);
28
- expect(unsupportedBlockNode.attrs.originalValue).toEqual(originalValue);
29
- });
30
-
31
- it('should encode unsupported block nodes to html', () => {
32
- const unsupportedBlockNode = schema.nodes.unsupportedBlock.create({
33
- originalValue,
34
- });
35
- const domNode = toDOM(unsupportedBlockNode, schema)
36
- .firstChild as HTMLElement;
37
-
38
- expect(domNode.getAttribute('data-original-value')).toEqual(
39
- JSON.stringify(originalValue),
40
- );
41
- });
42
- });
@@ -1,38 +0,0 @@
1
- import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
-
3
- import { schema } from 'adf-test-helpers/src/adf-schema';
4
-
5
- const packageName = process.env._PACKAGE_NAME_ as string;
6
-
7
- describe(`${packageName}/schema unsupportedInline node`, () => {
8
- const originalValue = {
9
- type: 'invalidInlineNode',
10
- };
11
-
12
- it('should parse unsupported inline nodes', () => {
13
- const doc = fromHTML(
14
- `<span
15
- data-node-type="unsupportedInline"
16
- data-original-value='${JSON.stringify(originalValue)}'
17
- />`,
18
- schema,
19
- );
20
- const paragraph = doc.firstChild!;
21
- const unsupportedInlineNode = paragraph.firstChild!;
22
-
23
- expect(unsupportedInlineNode.type).toEqual(schema.nodes.unsupportedInline);
24
- expect(unsupportedInlineNode.attrs.originalValue).toEqual(originalValue);
25
- });
26
-
27
- it('should encode unsupported inline nodes to html', () => {
28
- const unsupportedInlineNode = schema.nodes.unsupportedInline.create({
29
- originalValue,
30
- });
31
- const domNode = toDOM(unsupportedInlineNode, schema)
32
- .firstChild as HTMLElement;
33
-
34
- expect(domNode.getAttribute('data-original-value')).toEqual(
35
- JSON.stringify(originalValue),
36
- );
37
- });
38
- });
@@ -1,42 +0,0 @@
1
- import { hexToRgba, isRgb, normalizeHexColor } from '../../../utils/colors';
2
- const packageName = process.env._PACKAGE_NAME_ as string;
3
-
4
- describe(`${packageName}/colors color utils`, () => {
5
- describe('hex2rgba', () => {
6
- it('converts short hex to rgba', () => {
7
- expect(hexToRgba('#fab', 0.5)).toEqual('rgba(255,170,187,0.5)');
8
- });
9
-
10
- it('converts long hex to rgba', () => {
11
- expect(hexToRgba('#ffaabb', 0.5)).toEqual('rgba(255,170,187,0.5)');
12
- });
13
- });
14
-
15
- describe('isRgb', () => {
16
- it('returns truthy for rgb', () => {
17
- expect(isRgb('rgb(0, 0, 0)')).toBeTruthy();
18
- });
19
-
20
- it('returns truthy for rgba', () => {
21
- expect(isRgb('rgba(0, 0, 0, 0)')).toBeTruthy();
22
- });
23
-
24
- it('returns falsy for hex', () => {
25
- expect(isRgb('#FFFFFF')).toBeFalsy();
26
- });
27
-
28
- it('returns falsy for random string', () => {
29
- expect(isRgb('rgab(00')).toBeFalsy();
30
- });
31
- });
32
-
33
- describe('normalizeHexColor', () => {
34
- it('return hex color of a color name', () => {
35
- expect(normalizeHexColor('red')).toEqual('#ff0000');
36
- });
37
-
38
- it('should return null when passed `default`', () => {
39
- expect(normalizeHexColor('default')).toBe(null);
40
- });
41
- });
42
- });
@@ -1,209 +0,0 @@
1
- import { getLinkMatch, isRootRelative, normalizeUrl } from '../../../utils/url';
2
- const packageName = process.env._PACKAGE_NAME_ as string;
3
-
4
- describe(`${packageName}/url url utils`, () => {
5
- describe('normalizeUrl', () => {
6
- const examples = [
7
- ['prettyandsimple@example.com', 'mailto:prettyandsimple@example.com'],
8
- ['gopher://go.com', 'gopher://go.com'],
9
- ['dynamicsnav://go.com', 'dynamicsnav://go.com'],
10
- ['integrity://go.com', 'integrity://go.com'],
11
- ['file://go.pdf', 'file://go.pdf'],
12
- ['smb://go.com', 'smb://go.com'],
13
- [
14
- 'mailto:prettyandsimple@example.com',
15
- 'mailto:prettyandsimple@example.com',
16
- ],
17
- ['tel:1234', 'tel:1234'],
18
- ['tel:1234', 'tel:1234'],
19
-
20
- // Examples from https://datatracker.ietf.org/doc/html/rfc3966#section-6
21
- ['tel:+1-201-555-0123', 'tel:+1-201-555-0123'],
22
- ['tel:+1-201-555-0123', 'tel:+1-201-555-0123'],
23
- ['tel:+1(800)555-0123', 'tel:+1(800)555-0123'],
24
-
25
- // adf-schema didn't previously support notes:, even though linking-common does.
26
- // This isn't a valid scheme, so we're not adding support
27
- ['notes:somenoteurl', ''],
28
- ['notes://somenoteurl', 'notes://somenoteurl'],
29
-
30
- ['example.com', 'http://example.com'],
31
- ['http://example.com', 'http://example.com'],
32
- ['', ''],
33
- [undefined, ''],
34
- ['javascript:alert(1)', ''],
35
- [
36
- `https://test.blah.com/something#/search?_filter=(filters:!(),var:(x:!t,value:0),time:(from:now-1h,to:now))&_query=(fields:!(field.name,field.message),filters:!(('$state':(store:appState)),sort:!())`,
37
- `https://test.blah.com/something#/search?_filter=(filters:!(),var:(x:!t,value:0),time:(from:now-1h,to:now))&_query=(fields:!(field.name,field.message),filters:!(('$state':(store:appState)),sort:!())`,
38
- 'handles links with nested parentheses',
39
- ],
40
- [
41
- 'jamfselfservice://content?entity=policy&id=551&action=view',
42
- 'jamfselfservice://content?entity=policy&id=551&action=view',
43
- ],
44
- ];
45
- examples.forEach(([actual, expected, message]) => {
46
- const testCase =
47
- message || `should convert from "${actual}" -> "${expected}"`;
48
- it(testCase, () => {
49
- expect(normalizeUrl(actual)).toEqual(expected);
50
- });
51
- });
52
- });
53
-
54
- describe('getLinkMatch', () => {
55
- const noise = (url: string) =>
56
- `some text before ${url} and some more text after`;
57
- it('should match web URLs', () => {
58
- expect(getLinkMatch('http://localhost:1988')).not.toBe(undefined);
59
- expect(getLinkMatch('http://www.atlassian.com')).not.toBe(undefined);
60
- expect(getLinkMatch('http://www.atlassian.com/')).not.toBe(undefined);
61
- expect(getLinkMatch('https://atlassian.com')).not.toBe(undefined);
62
- expect(getLinkMatch('https://atlassian.com/')).not.toBe(undefined);
63
- expect(getLinkMatch('www.atlassian.com')).not.toBe(undefined);
64
- expect(getLinkMatch('www.atlassian.com/')).not.toBe(undefined);
65
- expect(getLinkMatch('www.atlassian.com/foo/bar')).not.toBe(undefined);
66
- expect(getLinkMatch('www.atlassian.com:12313/foo/bar')).not.toBe(
67
- undefined,
68
- );
69
- expect(getLinkMatch('www.atlassian.com/foo/bar#foo')).not.toBe(undefined);
70
- expect(getLinkMatch('www.atlassian.com/foo/bar?foo#bar')).not.toBe(
71
- undefined,
72
- );
73
- });
74
-
75
- it('should match only the link when surrounded with text', () => {
76
- expect(getLinkMatch(noise('http://localhost:1988'))!.raw).toEqual(
77
- 'http://localhost:1988',
78
- );
79
- expect(getLinkMatch(noise('http://www.atlassian.com'))!.raw).toEqual(
80
- 'http://www.atlassian.com',
81
- );
82
- expect(getLinkMatch(noise('http://www.atlassian.com/'))!.raw).toEqual(
83
- 'http://www.atlassian.com/',
84
- );
85
- expect(getLinkMatch(noise('https://atlassian.com'))!.raw).toEqual(
86
- 'https://atlassian.com',
87
- );
88
- expect(getLinkMatch(noise('https://atlassian.com/'))!.raw).toEqual(
89
- 'https://atlassian.com/',
90
- );
91
- expect(getLinkMatch(noise('www.atlassian.com'))!.raw).toEqual(
92
- 'www.atlassian.com',
93
- );
94
- expect(getLinkMatch(noise('www.atlassian.com/'))!.raw).toEqual(
95
- 'www.atlassian.com/',
96
- );
97
- expect(getLinkMatch(noise('www.atlassian.com/foo/bar'))!.raw).toEqual(
98
- 'www.atlassian.com/foo/bar',
99
- );
100
- expect(
101
- getLinkMatch(noise('www.atlassian.com:12313/foo/bar'))!.raw,
102
- ).toEqual('www.atlassian.com:12313/foo/bar');
103
- expect(getLinkMatch(noise('www.atlassian.com/foo/bar#foo'))!.raw).toEqual(
104
- 'www.atlassian.com/foo/bar#foo',
105
- );
106
- expect(
107
- getLinkMatch(noise('www.atlassian.com/foo/bar?foo#bar'))!.raw,
108
- ).toEqual('www.atlassian.com/foo/bar?foo#bar');
109
- });
110
-
111
- it('should not match filepaths', () => {
112
- expect(getLinkMatch('./index.php')).toEqual(null);
113
- expect(getLinkMatch('/index.php')).toEqual(null);
114
- });
115
- it('should not match markdown headings', () => {
116
- expect(getLinkMatch('#hello')).toEqual(null);
117
- expect(getLinkMatch('# hello')).toEqual(null);
118
- });
119
- it('should not match javascript', () => {
120
- expect(getLinkMatch('javascript:alert(1);')).toEqual(null);
121
- });
122
- it('should not match app: or tcp: schemes', () => {
123
- expect(getLinkMatch('app://atlassian.com')).toEqual(null);
124
- expect(getLinkMatch('tcp://173.123.21.12')).toEqual(null);
125
- });
126
-
127
- it('should not match special characters', () => {
128
- expect(getLinkMatch('[www.atlassian.com?hello=there]')!.raw).toEqual(
129
- 'www.atlassian.com?hello=there',
130
- );
131
- expect(getLinkMatch('(www.atlassian.com#hello>')!.raw).toEqual(
132
- 'www.atlassian.com#hello',
133
- );
134
- expect(getLinkMatch('(www.atlassian.com/hello<')!.raw).toEqual(
135
- 'www.atlassian.com/hello',
136
- );
137
- expect(getLinkMatch('(www.atlassian.com/hello?foo=bar^)')!.raw).toEqual(
138
- 'www.atlassian.com/hello?foo=bar^',
139
- );
140
- });
141
- it('should match EMAILs', () => {
142
- expect(getLinkMatch('prettyandsimple@example.com')).not.toBe(undefined);
143
- expect(getLinkMatch('very.common@example.com')).not.toBe(undefined);
144
- expect(
145
- getLinkMatch('disposable.style.email.with+symbol@example.com'),
146
- ).not.toBe(undefined);
147
- expect(getLinkMatch('other.email-with-dash@example.com')).not.toBe(
148
- undefined,
149
- );
150
- expect(getLinkMatch('x@example.com')).not.toBe(undefined);
151
- expect(getLinkMatch('example-indeed@strange-example.com')).not.toBe(
152
- undefined,
153
- );
154
- expect(getLinkMatch('example@s.solutions')).not.toBe(undefined);
155
- });
156
-
157
- it('should not match invalid EMAILs', () => {
158
- expect(getLinkMatch('john.doe@example..com')).toEqual(null);
159
- });
160
-
161
- it('should match only the EMAIL when surrounded with text', () => {
162
- expect(getLinkMatch(noise('http://localhost:1988'))!.raw).toEqual(
163
- 'http://localhost:1988',
164
- );
165
- expect(getLinkMatch(noise('prettyandsimple@example.com'))!.raw).toEqual(
166
- 'prettyandsimple@example.com',
167
- );
168
- expect(getLinkMatch(noise('very.common@example.com'))!.raw).toEqual(
169
- 'very.common@example.com',
170
- );
171
- expect(
172
- getLinkMatch(noise('disposable.style.email.with+symbol@example.com'))!
173
- .raw,
174
- ).toEqual('disposable.style.email.with+symbol@example.com');
175
- expect(
176
- getLinkMatch(noise('other.email-with-dash@example.com'))!.raw,
177
- ).toEqual('other.email-with-dash@example.com');
178
- expect(getLinkMatch(noise('x@example.com'))!.raw).toEqual(
179
- 'x@example.com',
180
- );
181
- expect(
182
- getLinkMatch(noise('example-indeed@strange-example.com'))!.raw,
183
- ).toEqual('example-indeed@strange-example.com');
184
- });
185
-
186
- it('should not match filename extensions', () => {
187
- expect(getLinkMatch('test.sh')).toEqual(null);
188
- expect(getLinkMatch('test.as')).toEqual(null);
189
- expect(getLinkMatch('test.ms')).toEqual(null);
190
- expect(getLinkMatch('test.py')).toEqual(null);
191
- expect(getLinkMatch('test.ps')).toEqual(null);
192
- expect(getLinkMatch('test.so')).toEqual(null);
193
- expect(getLinkMatch('test.pl')).toEqual(null);
194
- });
195
- });
196
-
197
- describe('isRootRelative', () => {
198
- it('should return true', () => {
199
- expect(isRootRelative('/test')).toEqual(true);
200
- expect(isRootRelative('/home/test')).toEqual(true);
201
- });
202
- it('should return false', () => {
203
- expect(isRootRelative('www.atlassian.com')).toEqual(false);
204
- expect(isRootRelative('https://www.atlassian.com')).toEqual(false);
205
- expect(isRootRelative('test/')).toEqual(false);
206
- expect(isRootRelative(' /test')).toEqual(false);
207
- });
208
- });
209
- });
@@ -1,43 +0,0 @@
1
- import { Schema } from '@atlaskit/editor-prosemirror/model';
2
- import { createSchema } from './create-schema';
3
-
4
- /**
5
- * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
6
- **/
7
- export const bitbucketSchema: Schema = createSchema({
8
- nodes: [
9
- 'doc',
10
- 'caption',
11
- 'paragraph',
12
- 'text',
13
- 'bulletList',
14
- 'orderedList',
15
- 'listItem',
16
- 'heading',
17
- 'blockquote',
18
- 'codeBlock',
19
- 'hardBreak',
20
- 'rule',
21
- 'image',
22
- 'media',
23
- 'mediaSingle',
24
- 'mention',
25
- 'emoji',
26
- 'table',
27
- 'tableCell',
28
- 'tableHeader',
29
- 'tableRow',
30
- 'inlineCard',
31
- 'unsupportedBlock',
32
- 'unsupportedInline',
33
- ],
34
- marks: [
35
- 'em',
36
- 'strong',
37
- 'strike',
38
- 'link',
39
- 'code',
40
- 'unsupportedMark',
41
- 'unsupportedNodeAttribute',
42
- ],
43
- });
@@ -1,76 +0,0 @@
1
- import { createSchema } from './create-schema';
2
- import { Schema } from '@atlaskit/editor-prosemirror/model';
3
-
4
- const nodes = [
5
- 'doc',
6
- 'paragraph',
7
- 'blockquote',
8
- 'codeBlock',
9
- 'panel',
10
- 'hardBreak',
11
- 'orderedList',
12
- 'bulletList',
13
- 'heading',
14
- 'mediaInline',
15
- 'mediaGroup',
16
- 'mediaSingle',
17
- 'media',
18
- 'caption',
19
- 'confluenceUnsupportedBlock',
20
- 'confluenceJiraIssue',
21
- 'expand',
22
- 'nestedExpand',
23
- 'extension',
24
- 'inlineExtension',
25
- 'bodiedExtension',
26
- 'listItem',
27
- 'mention',
28
- 'text',
29
- 'confluenceUnsupportedInline',
30
- 'media',
31
- 'rule',
32
- 'table',
33
- 'tableCell',
34
- 'tableHeader',
35
- 'tableRow',
36
- 'emoji',
37
- 'taskList',
38
- 'taskItem',
39
- 'date',
40
- 'placeholder',
41
- 'decisionList',
42
- 'decisionItem',
43
- 'layoutSection',
44
- 'layoutColumn',
45
- 'inlineCard',
46
- 'unsupportedBlock',
47
- 'unsupportedInline',
48
- ];
49
-
50
- const marks = [
51
- 'link',
52
- 'em',
53
- 'strong',
54
- 'strike',
55
- 'subsup',
56
- 'underline',
57
- 'mentionQuery',
58
- 'code',
59
- 'textColor',
60
- 'confluenceInlineComment',
61
- 'annotation',
62
- 'unsupportedMark',
63
- 'unsupportedNodeAttribute',
64
- ];
65
-
66
- /**
67
- * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
68
- **/
69
- export const confluenceSchema: Schema = createSchema({ nodes, marks });
70
- /**
71
- * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
72
- **/
73
- export const confluenceSchemaWithMediaSingle: Schema = createSchema({
74
- nodes: nodes.concat('mediaSingle'),
75
- marks,
76
- });