@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,89 +0,0 @@
1
- import { Node, NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
- import { acNameToEmoji, acShortcutToEmoji } from '../../utils/confluence/emoji';
3
-
4
- /**
5
- * @name emoji_node
6
- */
7
- export interface EmojiDefinition {
8
- type: 'emoji';
9
- attrs: EmojiAttributes;
10
- }
11
-
12
- export interface EmojiAttributes {
13
- id?: string; // Optional to support legacy formats
14
- shortName: string;
15
- text?: string;
16
- }
17
-
18
- export const emoji: NodeSpec = {
19
- inline: true,
20
- group: 'inline',
21
- selectable: true,
22
- attrs: {
23
- shortName: { default: '' },
24
- id: { default: '' },
25
- text: { default: '' },
26
- },
27
- parseDOM: [
28
- // Handle copy/paste beautiful panel from renderer />
29
- {
30
- tag: 'div.ak-editor-panel__icon span',
31
- ignore: true,
32
- },
33
- {
34
- tag: 'span[data-emoji-short-name]',
35
- getAttrs: (domNode) => {
36
- const dom = domNode as HTMLElement;
37
- return {
38
- shortName:
39
- dom.getAttribute('data-emoji-short-name') ||
40
- emoji.attrs!.shortName.default,
41
- id: dom.getAttribute('data-emoji-id') || emoji.attrs!.id.default,
42
- text:
43
- dom.getAttribute('data-emoji-text') || emoji.attrs!.text.default,
44
- };
45
- },
46
- },
47
- // Handle copy/paste from old <ac:emoticon />
48
- {
49
- tag: 'img[data-emoticon-name]',
50
- getAttrs: (dom) =>
51
- acNameToEmoji(
52
- (dom as Element).getAttribute('data-emoticon-name') as any,
53
- ),
54
- },
55
- // Handle copy/paste from old <ac:hipchat-emoticons />
56
- {
57
- tag: 'img[data-hipchat-emoticon]',
58
- getAttrs: (dom) =>
59
- acShortcutToEmoji(
60
- (dom as Element).getAttribute('data-hipchat-emoticon')!,
61
- ),
62
- },
63
- // Handle copy/paste from bitbucket's <img class="emoji" />
64
- {
65
- tag: 'img.emoji[data-emoji-short-name]',
66
- getAttrs: (domNode) => {
67
- const dom = domNode as HTMLElement;
68
- return {
69
- shortName:
70
- dom.getAttribute('data-emoji-short-name') ||
71
- emoji.attrs!.shortName.default,
72
- id: dom.getAttribute('data-emoji-id') || emoji.attrs!.id.default,
73
- text:
74
- dom.getAttribute('data-emoji-text') || emoji.attrs!.text.default,
75
- };
76
- },
77
- },
78
- ],
79
- toDOM(node: Node) {
80
- const { shortName, id, text } = node.attrs;
81
- const attrs = {
82
- 'data-emoji-short-name': shortName,
83
- 'data-emoji-id': id,
84
- 'data-emoji-text': text,
85
- contenteditable: 'false',
86
- };
87
- return ['span', attrs, text];
88
- },
89
- };
@@ -1,101 +0,0 @@
1
- import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import { BreakoutMarkDefinition } from '../marks';
3
- import { MarksObject, NoMark } from './types/mark';
4
- import { NonNestableBlockContent } from './types/non-nestable-block-content';
5
-
6
- /**
7
- * @name expand_node
8
- */
9
- export interface ExpandBaseDefinition {
10
- type: 'expand';
11
- attrs: {
12
- title?: string;
13
- };
14
- /**
15
- * @minItems 1
16
- * @allowUnsupportedBlock true
17
- */
18
- content: Array<NonNestableBlockContent>;
19
- marks?: Array<any>;
20
- }
21
-
22
- /**
23
- * @name expand_with_no_mark_node
24
- */
25
- export type ExpandDefinition = ExpandBaseDefinition & NoMark;
26
-
27
- /**
28
- * @name expand_with_breakout_mark_node
29
- */
30
- export type ExpandWithBreakoutDefinition = ExpandBaseDefinition &
31
- MarksObject<BreakoutMarkDefinition>;
32
-
33
- function getExpandAttrs(domNode: Node | string) {
34
- const dom = domNode as HTMLElement;
35
- return {
36
- title: dom.getAttribute('data-title'),
37
- __expanded: true,
38
- };
39
- }
40
-
41
- export const expand: NodeSpec = {
42
- inline: false,
43
- group: 'block',
44
- marks: 'dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
45
- content:
46
- '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | blockCard | embedCard | extension | unsupportedBlock)+',
47
- isolating: true,
48
- selectable: true,
49
- attrs: {
50
- title: { default: '' },
51
- __expanded: { default: true },
52
- },
53
- parseDOM: [
54
- {
55
- context: 'table//',
56
- tag: 'div[data-node-type="expand"]',
57
- getAttrs: getExpandAttrs,
58
- },
59
- {
60
- context: 'expand//',
61
- tag: '[data-node-type="expand"]',
62
- skip: true,
63
- },
64
- {
65
- context: 'nestedExpand//',
66
- tag: '[data-node-type="expand"]',
67
- skip: true,
68
- },
69
- {
70
- tag: '[data-node-type="nestedExpand"] button',
71
- ignore: true,
72
- },
73
- {
74
- tag: '[data-node-type="expand"] button',
75
- ignore: true,
76
- },
77
- {
78
- tag: 'div[data-node-type="expand"]',
79
- getAttrs: getExpandAttrs,
80
- },
81
- ],
82
- toDOM(node: PMNode) {
83
- const attrs = {
84
- 'data-node-type': 'expand',
85
- 'data-title': node.attrs.title,
86
- 'data-expanded': node.attrs.__expanded,
87
- };
88
- return ['div', attrs, 0];
89
- },
90
- };
91
-
92
- export const toJSON = (node: PMNode) => ({
93
- attrs: Object.keys(node.attrs)
94
- .filter((key) => !key.startsWith('__'))
95
- .reduce<typeof node.attrs>((obj, key) => {
96
- return {
97
- ...obj,
98
- [key]: node.attrs[key],
99
- };
100
- }, {}),
101
- });
@@ -1,60 +0,0 @@
1
- import { Node as PMNode, NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
- import { ExtensionAttributes } from './types/extensions';
3
- import { getExtensionAttrs } from '../../utils/extensions';
4
- import { MarksObject } from './types/mark';
5
- import { DataConsumerDefinition } from '../marks/data-consumer';
6
- import { FragmentDefinition } from '../marks/fragment';
7
-
8
- /**
9
- * @name extension_node
10
- */
11
- export interface ExtensionBaseDefinition {
12
- type: 'extension';
13
- attrs: ExtensionAttributes;
14
- marks?: Array<any>;
15
- }
16
-
17
- /**
18
- * @name extension_with_marks_node
19
- */
20
- export type ExtensionDefinition = ExtensionBaseDefinition &
21
- MarksObject<DataConsumerDefinition | FragmentDefinition>;
22
-
23
- const createExtensionNodeSpec = (): NodeSpec => {
24
- const nodeSpec: NodeSpec = {
25
- inline: false,
26
- group: 'block',
27
- atom: true,
28
- selectable: true,
29
- attrs: {
30
- extensionType: { default: '' },
31
- extensionKey: { default: '' },
32
- parameters: { default: null },
33
- text: { default: null },
34
- layout: { default: 'default' },
35
- localId: { default: null },
36
- },
37
- parseDOM: [
38
- {
39
- tag: '[data-node-type="extension"]',
40
- getAttrs: (domNode) => getExtensionAttrs(domNode as HTMLElement),
41
- },
42
- ],
43
- toDOM(node: PMNode) {
44
- const attrs = {
45
- 'data-node-type': 'extension',
46
- 'data-extension-type': node.attrs.extensionType,
47
- 'data-extension-key': node.attrs.extensionKey,
48
- 'data-text': node.attrs.text,
49
- 'data-parameters': JSON.stringify(node.attrs.parameters),
50
- 'data-layout': node.attrs.layout,
51
- 'data-local-id:': node.attrs.localId,
52
- };
53
- return ['div', attrs];
54
- },
55
- };
56
-
57
- return nodeSpec;
58
- };
59
-
60
- export const extension = createExtensionNodeSpec();
@@ -1,21 +0,0 @@
1
- import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
-
3
- /**
4
- * @name hardBreak_node
5
- */
6
- export interface HardBreakDefinition {
7
- type: 'hardBreak';
8
- attrs?: {
9
- text?: '\n';
10
- };
11
- }
12
-
13
- export const hardBreak: NodeSpec = {
14
- inline: true,
15
- group: 'inline',
16
- selectable: false,
17
- parseDOM: [{ tag: 'br' }],
18
- toDOM() {
19
- return ['br'];
20
- },
21
- };
@@ -1,64 +0,0 @@
1
- import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
- import { AlignmentMarkDefinition, IndentationMarkDefinition } from '../marks';
3
- import { MarksObject, NoMark } from './types/mark';
4
- import { Inline } from './types/inline-content';
5
-
6
- /**
7
- * @name heading_node
8
- */
9
- export interface HeadingBaseDefinition {
10
- type: 'heading';
11
- /**
12
- * @allowUnsupportedInline true
13
- */
14
- content?: Array<Inline>;
15
- marks?: Array<any>;
16
- attrs: {
17
- /**
18
- * @minimum 1
19
- * @maximum 6
20
- */
21
- level: number;
22
- };
23
- }
24
-
25
- /**
26
- * @name heading_with_no_marks_node
27
- */
28
- export type HeadingDefinition = HeadingBaseDefinition & NoMark;
29
-
30
- // Check `paragraph` node for why we are doing things like this
31
- /**
32
- * @name heading_with_alignment_node
33
- */
34
- export type HeadingWithAlignmentDefinition = HeadingBaseDefinition &
35
- MarksObject<AlignmentMarkDefinition>;
36
-
37
- /**
38
- * @name heading_with_indentation_node
39
- */
40
- export type HeadingWithIndentationDefinition = HeadingBaseDefinition &
41
- MarksObject<IndentationMarkDefinition>;
42
-
43
- export type HeadingWithMarksDefinition =
44
- | HeadingWithAlignmentDefinition
45
- | HeadingWithIndentationDefinition;
46
-
47
- export const heading: NodeSpec = {
48
- attrs: { level: { default: 1 } },
49
- content: `inline*`,
50
- group: 'block',
51
- defining: true,
52
- selectable: false,
53
- parseDOM: [
54
- { tag: 'h1', attrs: { level: 1 } },
55
- { tag: 'h2', attrs: { level: 2 } },
56
- { tag: 'h3', attrs: { level: 3 } },
57
- { tag: 'h4', attrs: { level: 4 } },
58
- { tag: 'h5', attrs: { level: 5 } },
59
- { tag: 'h6', attrs: { level: 6 } },
60
- ],
61
- toDOM(node) {
62
- return ['h' + node.attrs['level'], 0];
63
- },
64
- };
@@ -1,32 +0,0 @@
1
- import { NodeSpec, Node } from '@atlaskit/editor-prosemirror/model';
2
-
3
- export const image: NodeSpec = {
4
- group: 'inline',
5
- inline: true,
6
- attrs: {
7
- src: { default: '' },
8
- alt: { default: '' },
9
- title: { default: null },
10
- },
11
- draggable: true,
12
- parseDOM: [
13
- {
14
- tag: 'img[src^="data:image/"]',
15
- ignore: true,
16
- },
17
- {
18
- tag: 'img[src]',
19
- getAttrs(domNode) {
20
- const dom = domNode as HTMLElement;
21
- return {
22
- src: dom.getAttribute('src'),
23
- alt: dom.getAttribute('alt'),
24
- title: dom.getAttribute('title'),
25
- };
26
- },
27
- },
28
- ],
29
- toDOM(node: Node) {
30
- return ['img', node.attrs];
31
- },
32
- };
@@ -1,70 +0,0 @@
1
- import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import { CardAttributes } from './block-card';
3
-
4
- /**
5
- * @name inlineCard_node
6
- */
7
- export interface InlineCardDefinition {
8
- type: 'inlineCard';
9
- attrs: CardAttributes;
10
- }
11
-
12
- export const inlineCard: NodeSpec = {
13
- inline: true,
14
- group: 'inline',
15
- selectable: true,
16
- draggable: true,
17
- attrs: {
18
- url: { default: null },
19
- data: { default: null },
20
- },
21
- parseDOM: [
22
- {
23
- tag: 'a[data-inline-card], span[data-inline-card]',
24
-
25
- // bump priority higher than hyperlink
26
- priority: 100,
27
-
28
- getAttrs: (dom) => {
29
- const anchor = dom as HTMLAnchorElement;
30
- const data = anchor.getAttribute('data-card-data');
31
-
32
- /* Support attrs from Editor and Renderer */
33
- return {
34
- url:
35
- anchor.getAttribute('href') ||
36
- anchor.getAttribute('data-card-url') ||
37
- null,
38
- data: data ? JSON.parse(data) : null,
39
- };
40
- },
41
- },
42
-
43
- // for renderer
44
- {
45
- tag: 'div[data-inline-card]',
46
-
47
- getAttrs: (dom) => {
48
- const anchor = dom as HTMLDivElement;
49
- const data = anchor.getAttribute('data-card-data');
50
-
51
- return {
52
- url: anchor.getAttribute('data-card-url'),
53
- data: data ? JSON.parse(data) : null,
54
- };
55
- },
56
- },
57
- ],
58
- toDOM(node: PMNode) {
59
- const attrs = {
60
- 'data-inline-card': '',
61
- href: node.attrs.url || '',
62
- 'data-card-data': node.attrs.data ? JSON.stringify(node.attrs.data) : '',
63
- };
64
- if (node.attrs.url) {
65
- return ['a', attrs, node.attrs.url];
66
- } else {
67
- return ['a', attrs];
68
- }
69
- },
70
- };
@@ -1,57 +0,0 @@
1
- import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import { getExtensionAttrs } from '../../utils/extensions';
3
- import { InlineExtensionAttributes } from './types/extensions';
4
- import { MarksObject } from './types/mark';
5
- import { DataConsumerDefinition } from '../marks/data-consumer';
6
- import { FragmentDefinition } from '../marks/fragment';
7
-
8
- /**
9
- * @name inlineExtension_node
10
- */
11
- export interface InlineExtensionBaseDefinition {
12
- type: 'inlineExtension';
13
- attrs: InlineExtensionAttributes;
14
- marks?: Array<any>;
15
- }
16
-
17
- /**
18
- * @name inlineExtension_with_marks_node
19
- */
20
- export type InlineExtensionDefinition = InlineExtensionBaseDefinition &
21
- MarksObject<DataConsumerDefinition | FragmentDefinition>;
22
-
23
- const createInlineExtensionNodeSpec = (): NodeSpec => {
24
- const nodeSpec: NodeSpec = {
25
- inline: true,
26
- group: 'inline',
27
- selectable: true,
28
- attrs: {
29
- extensionType: { default: '' },
30
- extensionKey: { default: '' },
31
- parameters: { default: null },
32
- text: { default: null },
33
- localId: { default: null },
34
- },
35
- parseDOM: [
36
- {
37
- tag: 'span[data-extension-type]',
38
- getAttrs: (domNode) => getExtensionAttrs(domNode as HTMLElement, true),
39
- },
40
- ],
41
- toDOM(node: PMNode) {
42
- const attrs = {
43
- 'data-extension-type': node.attrs.extensionType,
44
- 'data-extension-key': node.attrs.extensionKey,
45
- 'data-text': node.attrs.text,
46
- 'data-parameters': JSON.stringify(node.attrs.parameters),
47
- 'data-local-id:': node.attrs.localId,
48
- contenteditable: 'false',
49
- };
50
- return ['span', attrs];
51
- },
52
- };
53
-
54
- return nodeSpec;
55
- };
56
-
57
- export const inlineExtension = createInlineExtensionNodeSpec();
@@ -1,68 +0,0 @@
1
- import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
- import { BlockContent } from './types/block-content';
3
-
4
- /**
5
- * @name layoutColumn_node
6
- */
7
- export interface LayoutColumnDefinition {
8
- type: 'layoutColumn';
9
- attrs: {
10
- /**
11
- * @minimum 0
12
- * @maximum 100
13
- */
14
- width: number;
15
- };
16
- /**
17
- * @minItems 1
18
- * @allowUnsupportedBlock true
19
- */
20
- content: Array<BlockContent>;
21
- }
22
-
23
- export const layoutColumn: NodeSpec = {
24
- content: '(block|unsupportedBlock)+',
25
- isolating: true,
26
- marks:
27
- 'alignment indentation dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
28
- selectable: false,
29
- attrs: {
30
- width: {
31
- default: undefined,
32
- },
33
- },
34
- parseDOM: [
35
- {
36
- context: 'layoutColumn//',
37
- tag: 'div[data-layout-column]',
38
- skip: true,
39
- },
40
- {
41
- tag: 'div[data-layout-column]',
42
- getAttrs: (domNode) => {
43
- const dom = domNode as HTMLElement;
44
- return {
45
- width: Number(dom.getAttribute('data-column-width')) || undefined,
46
- };
47
- },
48
- },
49
- ],
50
- toDOM(node) {
51
- const attrs: Record<string, string> = {
52
- 'data-layout-column': 'true',
53
- };
54
- const { width } = node.attrs;
55
- if (width) {
56
- attrs['style'] = `flex-basis: ${width}%`;
57
- attrs['data-column-width'] = width;
58
- }
59
-
60
- // We need to apply a attribute to the inner most child to help
61
- // ProseMirror identify its boundaries better.
62
- const contentAttrs: Record<string, string> = {
63
- 'data-layout-content': 'true',
64
- };
65
-
66
- return ['div', attrs, ['div', contentAttrs, 0]];
67
- },
68
- };
@@ -1,93 +0,0 @@
1
- import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
- import { LayoutColumnDefinition } from './layout-column';
3
- import { BreakoutMarkDefinition } from '../marks';
4
-
5
- /**
6
- * @name layoutSection_node
7
- */
8
- export type LayoutSectionBaseDefinition = {
9
- type: 'layoutSection';
10
- marks?: Array<BreakoutMarkDefinition>;
11
- // Can't use Array<any> because `prosemirror-schema-compatibility-tests` can't handle it.
12
- content: Array<LayoutColumnDefinition>;
13
- };
14
-
15
- /**
16
- * Need duplicate `type` and `marks` to make both validator and json-schema satisfied
17
- */
18
-
19
- /**
20
- * @name layoutSection_full_node
21
- */
22
- export type LayoutSectionFullDefinition = LayoutSectionBaseDefinition & {
23
- type: 'layoutSection';
24
- marks?: Array<BreakoutMarkDefinition>;
25
- /**
26
- * @minItems 2
27
- * @maxItems 3
28
- * @allowUnsupportedBlock true
29
- */
30
- content: Array<LayoutColumnDefinition>;
31
- };
32
-
33
- /**
34
- * @stage 0
35
- * @name layoutSection_with_single_column_node
36
- */
37
- export type LayoutSectionWithSingleColumnDefinition =
38
- LayoutSectionBaseDefinition & {
39
- type: 'layoutSection';
40
- marks?: Array<BreakoutMarkDefinition>;
41
- /**
42
- * @minItems 1
43
- * @maxItems 3
44
- * @allowUnsupportedBlock true
45
- */
46
- content: Array<LayoutColumnDefinition>;
47
- };
48
-
49
- export type LayoutSectionDefinition =
50
- | LayoutSectionFullDefinition
51
- | LayoutSectionWithSingleColumnDefinition;
52
-
53
- export const layoutSection: NodeSpec = {
54
- content:
55
- '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
56
- marks: 'unsupportedMark unsupportedNodeAttribute',
57
- isolating: true,
58
- parseDOM: [
59
- {
60
- context: 'layoutSection//|layoutColumn//',
61
- tag: 'div[data-layout-section]',
62
- skip: true,
63
- },
64
- {
65
- tag: 'div[data-layout-section]',
66
- },
67
- ],
68
- toDOM() {
69
- const attrs = { 'data-layout-section': 'true' };
70
- return ['div', attrs, 0];
71
- },
72
- };
73
-
74
- export const layoutSectionWithSingleColumn: NodeSpec = {
75
- content:
76
- '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
77
- marks: 'unsupportedMark unsupportedNodeAttribute',
78
- isolating: true,
79
- parseDOM: [
80
- {
81
- context: 'layoutSection//|layoutColumn//',
82
- tag: 'div[data-layout-section]',
83
- skip: true,
84
- },
85
- {
86
- tag: 'div[data-layout-section]',
87
- },
88
- ],
89
- toDOM() {
90
- const attrs = { 'data-layout-section': 'true' };
91
- return ['div', attrs, 0];
92
- },
93
- };
@@ -1,13 +0,0 @@
1
- import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
-
3
- export const listItem: NodeSpec = {
4
- content:
5
- '(paragraph | mediaSingle | codeBlock | unsupportedBlock) (paragraph | bulletList | orderedList | mediaSingle | codeBlock | unsupportedBlock)*',
6
- marks: 'unsupportedMark unsupportedNodeAttribute',
7
- defining: true,
8
- selectable: false,
9
- parseDOM: [{ tag: 'li' }],
10
- toDOM() {
11
- return ['li', 0];
12
- },
13
- };