@atlaskit/adf-schema 28.1.11 → 28.1.13

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 (218) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/build/tsconfig.json +0 -18
  4. package/index.ts +0 -275
  5. package/src/__tests__/unit/json-schema/v1.ts +0 -55
  6. package/src/__tests__/unit/schema/create-schema.ts +0 -214
  7. package/src/__tests__/unit/schema/default-schema.ts +0 -192
  8. package/src/__tests__/unit/schema/marks/annotation.ts +0 -46
  9. package/src/__tests__/unit/schema/marks/border.ts +0 -76
  10. package/src/__tests__/unit/schema/marks/breakout.ts +0 -24
  11. package/src/__tests__/unit/schema/marks/code.ts +0 -44
  12. package/src/__tests__/unit/schema/marks/confluence-inline-comment.ts +0 -25
  13. package/src/__tests__/unit/schema/marks/data-consumer.ts +0 -52
  14. package/src/__tests__/unit/schema/marks/em.ts +0 -37
  15. package/src/__tests__/unit/schema/marks/link.ts +0 -188
  16. package/src/__tests__/unit/schema/marks/strike.ts +0 -37
  17. package/src/__tests__/unit/schema/marks/strong.ts +0 -43
  18. package/src/__tests__/unit/schema/marks/subsup.ts +0 -50
  19. package/src/__tests__/unit/schema/marks/text-color.ts +0 -61
  20. package/src/__tests__/unit/schema/marks/underline.ts +0 -36
  21. package/src/__tests__/unit/schema/nodes/_consts.ts +0 -964
  22. package/src/__tests__/unit/schema/nodes/block-card.ts +0 -184
  23. package/src/__tests__/unit/schema/nodes/blockquote.ts +0 -44
  24. package/src/__tests__/unit/schema/nodes/bodied-extension.ts +0 -101
  25. package/src/__tests__/unit/schema/nodes/code-block.ts +0 -221
  26. package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +0 -32
  27. package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +0 -35
  28. package/src/__tests__/unit/schema/nodes/date.ts +0 -51
  29. package/src/__tests__/unit/schema/nodes/decision-item.ts +0 -46
  30. package/src/__tests__/unit/schema/nodes/decision-list.ts +0 -52
  31. package/src/__tests__/unit/schema/nodes/embed-card.ts +0 -60
  32. package/src/__tests__/unit/schema/nodes/emoji.ts +0 -71
  33. package/src/__tests__/unit/schema/nodes/expand.ts +0 -51
  34. package/src/__tests__/unit/schema/nodes/extension.ts +0 -101
  35. package/src/__tests__/unit/schema/nodes/hard-break.ts +0 -24
  36. package/src/__tests__/unit/schema/nodes/heading.ts +0 -56
  37. package/src/__tests__/unit/schema/nodes/image.ts +0 -32
  38. package/src/__tests__/unit/schema/nodes/inline-card.ts +0 -106
  39. package/src/__tests__/unit/schema/nodes/inline-extension.ts +0 -79
  40. package/src/__tests__/unit/schema/nodes/layout-column.ts +0 -54
  41. package/src/__tests__/unit/schema/nodes/layout-section.ts +0 -95
  42. package/src/__tests__/unit/schema/nodes/list-item.ts +0 -49
  43. package/src/__tests__/unit/schema/nodes/media-group.ts +0 -67
  44. package/src/__tests__/unit/schema/nodes/media-single.ts +0 -171
  45. package/src/__tests__/unit/schema/nodes/media.ts +0 -384
  46. package/src/__tests__/unit/schema/nodes/mention.ts +0 -115
  47. package/src/__tests__/unit/schema/nodes/nestedExpand.ts +0 -72
  48. package/src/__tests__/unit/schema/nodes/ordered-list.ts +0 -49
  49. package/src/__tests__/unit/schema/nodes/panel.ts +0 -180
  50. package/src/__tests__/unit/schema/nodes/paragraph.ts +0 -25
  51. package/src/__tests__/unit/schema/nodes/placeholder.ts +0 -46
  52. package/src/__tests__/unit/schema/nodes/rule.ts +0 -24
  53. package/src/__tests__/unit/schema/nodes/status.ts +0 -120
  54. package/src/__tests__/unit/schema/nodes/tableNodes.ts +0 -555
  55. package/src/__tests__/unit/schema/nodes/task-item.ts +0 -39
  56. package/src/__tests__/unit/schema/nodes/task-list.ts +0 -45
  57. package/src/__tests__/unit/schema/nodes/unknown-block.ts +0 -42
  58. package/src/__tests__/unit/schema/nodes/unsupported-block.ts +0 -42
  59. package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +0 -38
  60. package/src/__tests__/unit/utils/colors.ts +0 -42
  61. package/src/__tests__/unit/utils/url.ts +0 -209
  62. package/src/index.ts +0 -297
  63. package/src/json-schema/index.ts +0 -2
  64. package/src/schema/bitbucket-schema.ts +0 -43
  65. package/src/schema/confluence-schema.ts +0 -76
  66. package/src/schema/create-schema.ts +0 -337
  67. package/src/schema/default-schema.ts +0 -180
  68. package/src/schema/groups.ts +0 -30
  69. package/src/schema/index.ts +0 -238
  70. package/src/schema/inline-nodes.ts +0 -9
  71. package/src/schema/jira-schema.ts +0 -158
  72. package/src/schema/marks/__tests__/unit/annotation.ts +0 -18
  73. package/src/schema/marks/alignment.ts +0 -48
  74. package/src/schema/marks/annotation.ts +0 -107
  75. package/src/schema/marks/border.ts +0 -74
  76. package/src/schema/marks/breakout.ts +0 -42
  77. package/src/schema/marks/code.ts +0 -45
  78. package/src/schema/marks/confluence-inline-comment.ts +0 -32
  79. package/src/schema/marks/data-consumer.ts +0 -100
  80. package/src/schema/marks/em.ts +0 -19
  81. package/src/schema/marks/fragment.ts +0 -77
  82. package/src/schema/marks/indentation.ts +0 -47
  83. package/src/schema/marks/index.ts +0 -61
  84. package/src/schema/marks/link.ts +0 -139
  85. package/src/schema/marks/strike.ts +0 -26
  86. package/src/schema/marks/strong.ts +0 -45
  87. package/src/schema/marks/subsup.ts +0 -53
  88. package/src/schema/marks/text-color.ts +0 -172
  89. package/src/schema/marks/type-ahead-query.ts +0 -22
  90. package/src/schema/marks/underline.ts +0 -24
  91. package/src/schema/marks/unsupported-mark.ts +0 -9
  92. package/src/schema/marks/unsupported-node-attributes.ts +0 -8
  93. package/src/schema/nodes/block-card.ts +0 -121
  94. package/src/schema/nodes/blockquote.ts +0 -25
  95. package/src/schema/nodes/bodied-extension.ts +0 -75
  96. package/src/schema/nodes/bullet-list.ts +0 -17
  97. package/src/schema/nodes/caption.ts +0 -51
  98. package/src/schema/nodes/code-block.ts +0 -176
  99. package/src/schema/nodes/confluence-jira-issue.ts +0 -43
  100. package/src/schema/nodes/confluence-unsupported-block.ts +0 -29
  101. package/src/schema/nodes/confluence-unsupported-inline.ts +0 -30
  102. package/src/schema/nodes/date.ts +0 -38
  103. package/src/schema/nodes/decision-item.ts +0 -50
  104. package/src/schema/nodes/decision-list.ts +0 -56
  105. package/src/schema/nodes/doc.ts +0 -30
  106. package/src/schema/nodes/embed-card.ts +0 -62
  107. package/src/schema/nodes/emoji.ts +0 -89
  108. package/src/schema/nodes/expand.ts +0 -101
  109. package/src/schema/nodes/extension.ts +0 -60
  110. package/src/schema/nodes/hard-break.ts +0 -21
  111. package/src/schema/nodes/heading.ts +0 -64
  112. package/src/schema/nodes/image.ts +0 -32
  113. package/src/schema/nodes/index.ts +0 -184
  114. package/src/schema/nodes/inline-card.ts +0 -70
  115. package/src/schema/nodes/inline-extension.ts +0 -57
  116. package/src/schema/nodes/layout-column.ts +0 -68
  117. package/src/schema/nodes/layout-section.ts +0 -93
  118. package/src/schema/nodes/list-item.ts +0 -13
  119. package/src/schema/nodes/media-group.ts +0 -44
  120. package/src/schema/nodes/media-inline.ts +0 -19
  121. package/src/schema/nodes/media-single.ts +0 -179
  122. package/src/schema/nodes/media.ts +0 -253
  123. package/src/schema/nodes/mention.ts +0 -86
  124. package/src/schema/nodes/nested-expand.ts +0 -77
  125. package/src/schema/nodes/ordered-list.ts +0 -62
  126. package/src/schema/nodes/panel.ts +0 -133
  127. package/src/schema/nodes/paragraph.ts +0 -79
  128. package/src/schema/nodes/placeholder.ts +0 -40
  129. package/src/schema/nodes/rule.ts +0 -17
  130. package/src/schema/nodes/status.ts +0 -58
  131. package/src/schema/nodes/tableNodes.ts +0 -478
  132. package/src/schema/nodes/task-item.ts +0 -51
  133. package/src/schema/nodes/task-list.ts +0 -61
  134. package/src/schema/nodes/text.ts +0 -19
  135. package/src/schema/nodes/types/block-content.ts +0 -51
  136. package/src/schema/nodes/types/extensions.ts +0 -36
  137. package/src/schema/nodes/types/inline-content.ts +0 -56
  138. package/src/schema/nodes/types/list.ts +0 -54
  139. package/src/schema/nodes/types/mark.ts +0 -16
  140. package/src/schema/nodes/types/non-nestable-block-content.ts +0 -39
  141. package/src/schema/nodes/types/rich-media-common.ts +0 -51
  142. package/src/schema/nodes/unknown-block.ts +0 -13
  143. package/src/schema/nodes/unsupported-block.ts +0 -28
  144. package/src/schema/nodes/unsupported-inline.ts +0 -27
  145. package/src/schema/unsupported.ts +0 -4
  146. package/src/steps/__tests__/unit/analytics.ts +0 -72
  147. package/src/steps/__tests__/unit/link-meta-step.ts +0 -64
  148. package/src/steps/__tests__/unit/override-document-step.ts +0 -174
  149. package/src/steps/__tests__/unit/set-attrs.ts +0 -71
  150. package/src/steps/analytics.ts +0 -189
  151. package/src/steps/link-meta-step.ts +0 -105
  152. package/src/steps/override-document-step.ts +0 -97
  153. package/src/steps/set-attrs.tsx +0 -74
  154. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-0.json +0 -15
  155. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-1.json +0 -15
  156. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-2.json +0 -15
  157. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-3.json +0 -15
  158. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-0.json +0 -9
  159. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-1.json +0 -9
  160. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-2.json +0 -9
  161. package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row-inverted.json +0 -98
  162. package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row.json +0 -71
  163. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0-inverted.json +0 -19
  164. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0.json +0 -19
  165. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1-inverted.json +0 -21
  166. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1.json +0 -21
  167. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2-inverted.json +0 -21
  168. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2.json +0 -21
  169. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3-inverted.json +0 -19
  170. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3.json +0 -19
  171. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0-inverted.json +0 -63
  172. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0.json +0 -21
  173. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1-inverted.json +0 -64
  174. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1.json +0 -22
  175. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2-inverted.json +0 -63
  176. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2.json +0 -21
  177. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0-inverted.json +0 -19
  178. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0.json +0 -19
  179. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1-inverted.json +0 -19
  180. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1.json +0 -19
  181. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2-inverted.json +0 -19
  182. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2.json +0 -19
  183. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3-inverted.json +0 -19
  184. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3.json +0 -19
  185. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0-inverted.json +0 -52
  186. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0.json +0 -38
  187. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1-inverted.json +0 -52
  188. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1.json +0 -38
  189. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2-inverted.json +0 -25
  190. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2.json +0 -11
  191. package/src/steps/table/__tests__/_utils.ts +0 -102
  192. package/src/steps/table/__tests__/add-column-merge-columns.ts +0 -509
  193. package/src/steps/table/__tests__/add-column-merge-rows.ts +0 -466
  194. package/src/steps/table/__tests__/add-column.ts +0 -638
  195. package/src/steps/table/add-column.ts +0 -443
  196. package/src/steps/table/constants.ts +0 -4
  197. package/src/steps/table/sort-column.ts +0 -57
  198. package/src/steps/table/types.ts +0 -48
  199. package/src/steps/table/utils/cell-step.ts +0 -239
  200. package/src/steps/table/utils/cells-at-column.ts +0 -75
  201. package/src/steps/table/utils/find-column.ts +0 -90
  202. package/src/steps/table/utils/get-table-rect-from-doc.ts +0 -37
  203. package/src/steps/table/utils/side-effects/rows.ts +0 -327
  204. package/src/steps/table/utils/side-effects/side-effects.ts +0 -90
  205. package/src/steps/table/utils/side-effects/table.ts +0 -112
  206. package/src/steps/table/utils/side-effects/types.ts +0 -34
  207. package/src/steps/table/utils/table-map.ts +0 -28
  208. package/src/steps/type-ahead.ts +0 -100
  209. package/src/steps.ts +0 -16
  210. package/src/utils/colors.ts +0 -171
  211. package/src/utils/confluence/emoji.ts +0 -99
  212. package/src/utils/extensions.ts +0 -32
  213. package/src/utils/index.ts +0 -69
  214. package/src/utils/parseDOM.ts +0 -2
  215. package/src/utils/url.ts +0 -173
  216. package/src/utils/uuid.ts +0 -19
  217. package/src/version.json +0 -6
  218. package/tsconfig.json +0 -13
@@ -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
- });
package/src/index.ts DELETED
@@ -1,297 +0,0 @@
1
- export {
2
- PanelType,
3
- AnnotationTypes,
4
- alignment,
5
- alignmentPositionMap,
6
- annotation,
7
- blockCard,
8
- blockquote,
9
- bodiedExtension,
10
- breakout,
11
- bulletList,
12
- bulletListSelector,
13
- caption,
14
- code,
15
- codeBlock,
16
- codeBlockToJSON,
17
- colorPalette,
18
- /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
19
- colorPaletteExtended,
20
- confluenceInlineComment,
21
- confluenceJiraIssue,
22
- confluenceUnsupportedBlock,
23
- confluenceUnsupportedInline,
24
- copyPrivateMediaAttributes,
25
- createSchema,
26
- dataConsumer,
27
- dataConsumerToJSON,
28
- date,
29
- decisionItem,
30
- decisionList,
31
- decisionListSelector,
32
- doc,
33
- em,
34
- embedCard,
35
- emoji,
36
- expand,
37
- expandToJSON,
38
- extension,
39
- fragment,
40
- fragmentToJSON,
41
- hardBreak,
42
- heading,
43
- image,
44
- indentation,
45
- inlineCard,
46
- inlineExtension,
47
- inlineNodes,
48
- layoutColumn,
49
- layoutSection,
50
- link,
51
- linkToJSON,
52
- listItem,
53
- media,
54
- mediaGroup,
55
- mediaSingle,
56
- mediaSingleWithCaption,
57
- mediaSingleWithWidthType,
58
- mediaSingleFull,
59
- mediaSingleSpec,
60
- mediaInline,
61
- mediaSingleToJSON,
62
- mediaToJSON,
63
- mention,
64
- mentionToJSON,
65
- nestedExpand,
66
- orderedList,
67
- orderedListSelector,
68
- orderedListWithOrder,
69
- panel,
70
- paragraph,
71
- placeholder,
72
- rule,
73
- sanitizeNodes,
74
- getCellAttrs,
75
- getCellDomAttrs,
76
- status,
77
- strike,
78
- strong,
79
- subsup,
80
- table,
81
- tableWithCustomWidth,
82
- tableBackgroundBorderColor,
83
- tableBackgroundColorNames,
84
- tableBackgroundColorPalette,
85
- tableCell,
86
- tableCellContentDomSelector,
87
- tableCellContentWrapperSelector,
88
- tableCellSelector,
89
- tableHeader,
90
- tableHeaderSelector,
91
- tablePrefixSelector,
92
- tableRow,
93
- tableToJSON,
94
- taskItem,
95
- taskList,
96
- taskListSelector,
97
- text,
98
- textColor,
99
- toJSONTableCell,
100
- toJSONTableHeader,
101
- typeAheadQuery,
102
- underline,
103
- unknownBlock,
104
- unsupportedBlock,
105
- unsupportedInline,
106
- unsupportedNodeTypesForMediaCards,
107
- buildAnnotationMarkDataAttributes,
108
- AnnotationMarkStates,
109
- unsupportedMark,
110
- unsupportedNodeAttribute,
111
- border,
112
- borderColorPalette,
113
- } from './schema';
114
- export type {
115
- AlignmentAttributes,
116
- AlignmentMarkDefinition,
117
- AnnotationMarkAttributes,
118
- AnnotationMarkDefinition,
119
- BlockCardDefinition,
120
- BlockContent,
121
- BlockQuoteDefinition,
122
- BodiedExtensionDefinition,
123
- BreakoutMarkAttrs,
124
- BreakoutMarkDefinition,
125
- BulletListDefinition,
126
- CaptionDefinition,
127
- CardAttributes,
128
- CellAttributes,
129
- CodeBlockAttrs,
130
- CodeBlockBaseDefinition,
131
- CodeBlockDefinition,
132
- CodeBlockWithMarksDefinition,
133
- CodeDefinition,
134
- DatasourceAttributes,
135
- DataConsumerAttributes,
136
- DataConsumerDefinition,
137
- DataType,
138
- DateDefinition,
139
- DecisionItemDefinition,
140
- DecisionListDefinition,
141
- DocNode,
142
- EmbedCardDefinition,
143
- EmbedCardAttributes,
144
- EmDefinition,
145
- EmojiAttributes,
146
- EmojiDefinition,
147
- ExpandDefinition,
148
- ExtensionDefinition,
149
- ExtensionLayout,
150
- ExternalMediaAttributes,
151
- FragmentAttributes,
152
- FragmentDefinition,
153
- HardBreakDefinition,
154
- HeadingBaseDefinition,
155
- HeadingDefinition,
156
- HeadingWithAlignmentDefinition,
157
- HeadingWithIndentationDefinition,
158
- HeadingWithMarksDefinition,
159
- IndentationMarkAttributes,
160
- IndentationMarkDefinition,
161
- Inline,
162
- InlineAtomic,
163
- InlineCardDefinition,
164
- InlineCode,
165
- InlineExtensionDefinition,
166
- InlineFormattedText,
167
- InlineLinkText,
168
- LayoutColumnDefinition,
169
- LayoutSectionDefinition,
170
- LayoutSectionFullDefinition,
171
- LayoutSectionWithSingleColumnDefinition,
172
- LinkAttributes,
173
- LinkDefinition,
174
- ListItemArray,
175
- ListItemDefinition,
176
- MarksObject,
177
- MediaADFAttrs,
178
- MediaAttributes,
179
- MediaInlineAttributes,
180
- MediaInlineDefinition,
181
- MediaBaseAttributes,
182
- MediaDefinition,
183
- MediaDisplayType,
184
- MediaGroupDefinition,
185
- MediaSingleDefinition,
186
- MediaType,
187
- MentionAttributes,
188
- MentionDefinition,
189
- MentionUserType,
190
- NestedExpandContent,
191
- NestedExpandDefinition,
192
- NoMark,
193
- NonNestableBlockContent,
194
- OrderedListDefinition,
195
- PanelAttributes,
196
- PanelDefinition,
197
- ParagraphBaseDefinition,
198
- ParagraphDefinition,
199
- ParagraphWithAlignmentDefinition,
200
- ParagraphWithIndentationDefinition,
201
- ParagraphWithMarksDefinition,
202
- PlaceholderDefinition,
203
- RuleDefinition,
204
- StatusDefinition,
205
- StrikeDefinition,
206
- StrongDefinition,
207
- SubSupAttributes,
208
- SubSupDefinition,
209
- TableAttributes,
210
- TableCellDefinition,
211
- TableDefinition,
212
- TableHeaderDefinition,
213
- TableLayout,
214
- TableRowDefinition,
215
- TaskItemDefinition,
216
- TaskListContent,
217
- TaskListDefinition,
218
- TextColorAttributes,
219
- TextColorDefinition,
220
- TextDefinition,
221
- UnderlineDefinition,
222
- UrlType,
223
- AnnotationId,
224
- RichMediaAttributes,
225
- ExtendedMediaAttributes,
226
- RichMediaLayout,
227
- AnnotationDataAttributes,
228
- CellDomAttrs,
229
- BorderMarkAttributes,
230
- BorderMarkDefinition,
231
- } from './schema';
232
- export {
233
- B100,
234
- B400,
235
- B50,
236
- B500,
237
- B75,
238
- G200,
239
- G300,
240
- G400,
241
- G50,
242
- G500,
243
- G75,
244
- N0,
245
- N20,
246
- N200,
247
- N30,
248
- N300,
249
- N40,
250
- N50,
251
- N500,
252
- N60,
253
- N80,
254
- N800,
255
- N90,
256
- P100,
257
- P300,
258
- P400,
259
- P50,
260
- P500,
261
- P75,
262
- R100,
263
- R300,
264
- R400,
265
- R50,
266
- R500,
267
- R75,
268
- T100,
269
- T300,
270
- T50,
271
- T500,
272
- T75,
273
- Y200,
274
- Y400,
275
- Y50,
276
- Y500,
277
- Y75,
278
- acNameToEmoji,
279
- acShortcutToEmoji,
280
- emojiIdToAcName,
281
- generateUuid,
282
- getEmojiAcName,
283
- getLinkMatch,
284
- hexToRgb,
285
- hexToRgba,
286
- isHex,
287
- isRgb,
288
- isSafeUrl,
289
- linkify,
290
- linkifyMatch,
291
- normalizeHexColor,
292
- normalizeUrl,
293
- rgbToHex,
294
- uuid,
295
- } from './utils';
296
-
297
- export type { Match, NameToEmoji } from './utils';
@@ -1,2 +0,0 @@
1
- export { default as fullSchema } from '../../json-schema/v1/full.json';
2
- export { default as stageZeroSchema } from '../../json-schema/v1/stage-0.json';
@@ -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
- });