@atlaskit/adf-schema 28.1.12 → 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 (209) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +1 -1
  3. package/src/__tests__/unit/json-schema/v1.ts +0 -55
  4. package/src/__tests__/unit/schema/create-schema.ts +0 -214
  5. package/src/__tests__/unit/schema/default-schema.ts +0 -192
  6. package/src/__tests__/unit/schema/marks/annotation.ts +0 -46
  7. package/src/__tests__/unit/schema/marks/border.ts +0 -76
  8. package/src/__tests__/unit/schema/marks/breakout.ts +0 -24
  9. package/src/__tests__/unit/schema/marks/code.ts +0 -44
  10. package/src/__tests__/unit/schema/marks/confluence-inline-comment.ts +0 -25
  11. package/src/__tests__/unit/schema/marks/data-consumer.ts +0 -52
  12. package/src/__tests__/unit/schema/marks/em.ts +0 -37
  13. package/src/__tests__/unit/schema/marks/link.ts +0 -188
  14. package/src/__tests__/unit/schema/marks/strike.ts +0 -37
  15. package/src/__tests__/unit/schema/marks/strong.ts +0 -43
  16. package/src/__tests__/unit/schema/marks/subsup.ts +0 -50
  17. package/src/__tests__/unit/schema/marks/text-color.ts +0 -61
  18. package/src/__tests__/unit/schema/marks/underline.ts +0 -36
  19. package/src/__tests__/unit/schema/nodes/_consts.ts +0 -964
  20. package/src/__tests__/unit/schema/nodes/block-card.ts +0 -184
  21. package/src/__tests__/unit/schema/nodes/blockquote.ts +0 -44
  22. package/src/__tests__/unit/schema/nodes/bodied-extension.ts +0 -101
  23. package/src/__tests__/unit/schema/nodes/code-block.ts +0 -221
  24. package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +0 -32
  25. package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +0 -35
  26. package/src/__tests__/unit/schema/nodes/date.ts +0 -51
  27. package/src/__tests__/unit/schema/nodes/decision-item.ts +0 -46
  28. package/src/__tests__/unit/schema/nodes/decision-list.ts +0 -52
  29. package/src/__tests__/unit/schema/nodes/embed-card.ts +0 -60
  30. package/src/__tests__/unit/schema/nodes/emoji.ts +0 -71
  31. package/src/__tests__/unit/schema/nodes/expand.ts +0 -51
  32. package/src/__tests__/unit/schema/nodes/extension.ts +0 -101
  33. package/src/__tests__/unit/schema/nodes/hard-break.ts +0 -24
  34. package/src/__tests__/unit/schema/nodes/heading.ts +0 -56
  35. package/src/__tests__/unit/schema/nodes/image.ts +0 -32
  36. package/src/__tests__/unit/schema/nodes/inline-card.ts +0 -106
  37. package/src/__tests__/unit/schema/nodes/inline-extension.ts +0 -79
  38. package/src/__tests__/unit/schema/nodes/layout-column.ts +0 -54
  39. package/src/__tests__/unit/schema/nodes/layout-section.ts +0 -95
  40. package/src/__tests__/unit/schema/nodes/list-item.ts +0 -49
  41. package/src/__tests__/unit/schema/nodes/media-group.ts +0 -67
  42. package/src/__tests__/unit/schema/nodes/media-single.ts +0 -171
  43. package/src/__tests__/unit/schema/nodes/media.ts +0 -384
  44. package/src/__tests__/unit/schema/nodes/mention.ts +0 -115
  45. package/src/__tests__/unit/schema/nodes/nestedExpand.ts +0 -72
  46. package/src/__tests__/unit/schema/nodes/ordered-list.ts +0 -49
  47. package/src/__tests__/unit/schema/nodes/panel.ts +0 -180
  48. package/src/__tests__/unit/schema/nodes/paragraph.ts +0 -25
  49. package/src/__tests__/unit/schema/nodes/placeholder.ts +0 -46
  50. package/src/__tests__/unit/schema/nodes/rule.ts +0 -24
  51. package/src/__tests__/unit/schema/nodes/status.ts +0 -120
  52. package/src/__tests__/unit/schema/nodes/tableNodes.ts +0 -555
  53. package/src/__tests__/unit/schema/nodes/task-item.ts +0 -39
  54. package/src/__tests__/unit/schema/nodes/task-list.ts +0 -45
  55. package/src/__tests__/unit/schema/nodes/unknown-block.ts +0 -42
  56. package/src/__tests__/unit/schema/nodes/unsupported-block.ts +0 -42
  57. package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +0 -38
  58. package/src/__tests__/unit/utils/colors.ts +0 -42
  59. package/src/__tests__/unit/utils/url.ts +0 -209
  60. package/src/schema/bitbucket-schema.ts +0 -43
  61. package/src/schema/confluence-schema.ts +0 -76
  62. package/src/schema/create-schema.ts +0 -337
  63. package/src/schema/default-schema.ts +0 -180
  64. package/src/schema/groups.ts +0 -30
  65. package/src/schema/inline-nodes.ts +0 -9
  66. package/src/schema/jira-schema.ts +0 -158
  67. package/src/schema/marks/__tests__/unit/annotation.ts +0 -18
  68. package/src/schema/marks/alignment.ts +0 -48
  69. package/src/schema/marks/annotation.ts +0 -107
  70. package/src/schema/marks/border.ts +0 -74
  71. package/src/schema/marks/breakout.ts +0 -42
  72. package/src/schema/marks/code.ts +0 -45
  73. package/src/schema/marks/confluence-inline-comment.ts +0 -32
  74. package/src/schema/marks/data-consumer.ts +0 -100
  75. package/src/schema/marks/em.ts +0 -19
  76. package/src/schema/marks/fragment.ts +0 -77
  77. package/src/schema/marks/indentation.ts +0 -47
  78. package/src/schema/marks/link.ts +0 -139
  79. package/src/schema/marks/strike.ts +0 -26
  80. package/src/schema/marks/strong.ts +0 -45
  81. package/src/schema/marks/subsup.ts +0 -53
  82. package/src/schema/marks/text-color.ts +0 -172
  83. package/src/schema/marks/type-ahead-query.ts +0 -22
  84. package/src/schema/marks/underline.ts +0 -24
  85. package/src/schema/marks/unsupported-mark.ts +0 -9
  86. package/src/schema/marks/unsupported-node-attributes.ts +0 -8
  87. package/src/schema/nodes/block-card.ts +0 -121
  88. package/src/schema/nodes/blockquote.ts +0 -25
  89. package/src/schema/nodes/bodied-extension.ts +0 -75
  90. package/src/schema/nodes/bullet-list.ts +0 -17
  91. package/src/schema/nodes/caption.ts +0 -51
  92. package/src/schema/nodes/code-block.ts +0 -176
  93. package/src/schema/nodes/confluence-jira-issue.ts +0 -43
  94. package/src/schema/nodes/confluence-unsupported-block.ts +0 -29
  95. package/src/schema/nodes/confluence-unsupported-inline.ts +0 -30
  96. package/src/schema/nodes/date.ts +0 -38
  97. package/src/schema/nodes/decision-item.ts +0 -50
  98. package/src/schema/nodes/decision-list.ts +0 -56
  99. package/src/schema/nodes/doc.ts +0 -30
  100. package/src/schema/nodes/embed-card.ts +0 -62
  101. package/src/schema/nodes/emoji.ts +0 -89
  102. package/src/schema/nodes/expand.ts +0 -101
  103. package/src/schema/nodes/extension.ts +0 -60
  104. package/src/schema/nodes/hard-break.ts +0 -21
  105. package/src/schema/nodes/heading.ts +0 -64
  106. package/src/schema/nodes/image.ts +0 -32
  107. package/src/schema/nodes/inline-card.ts +0 -70
  108. package/src/schema/nodes/inline-extension.ts +0 -57
  109. package/src/schema/nodes/layout-column.ts +0 -68
  110. package/src/schema/nodes/layout-section.ts +0 -93
  111. package/src/schema/nodes/list-item.ts +0 -13
  112. package/src/schema/nodes/media-group.ts +0 -44
  113. package/src/schema/nodes/media-inline.ts +0 -19
  114. package/src/schema/nodes/media-single.ts +0 -179
  115. package/src/schema/nodes/media.ts +0 -253
  116. package/src/schema/nodes/mention.ts +0 -86
  117. package/src/schema/nodes/nested-expand.ts +0 -77
  118. package/src/schema/nodes/ordered-list.ts +0 -62
  119. package/src/schema/nodes/panel.ts +0 -133
  120. package/src/schema/nodes/paragraph.ts +0 -79
  121. package/src/schema/nodes/placeholder.ts +0 -40
  122. package/src/schema/nodes/rule.ts +0 -17
  123. package/src/schema/nodes/status.ts +0 -58
  124. package/src/schema/nodes/tableNodes.ts +0 -478
  125. package/src/schema/nodes/task-item.ts +0 -51
  126. package/src/schema/nodes/task-list.ts +0 -61
  127. package/src/schema/nodes/text.ts +0 -19
  128. package/src/schema/nodes/types/block-content.ts +0 -51
  129. package/src/schema/nodes/types/extensions.ts +0 -36
  130. package/src/schema/nodes/types/inline-content.ts +0 -56
  131. package/src/schema/nodes/types/list.ts +0 -54
  132. package/src/schema/nodes/types/mark.ts +0 -16
  133. package/src/schema/nodes/types/non-nestable-block-content.ts +0 -39
  134. package/src/schema/nodes/types/rich-media-common.ts +0 -51
  135. package/src/schema/nodes/unknown-block.ts +0 -13
  136. package/src/schema/nodes/unsupported-block.ts +0 -28
  137. package/src/schema/nodes/unsupported-inline.ts +0 -27
  138. package/src/schema/unsupported.ts +0 -4
  139. package/src/steps/__tests__/unit/analytics.ts +0 -72
  140. package/src/steps/__tests__/unit/link-meta-step.ts +0 -64
  141. package/src/steps/__tests__/unit/override-document-step.ts +0 -174
  142. package/src/steps/__tests__/unit/set-attrs.ts +0 -71
  143. package/src/steps/analytics.ts +0 -189
  144. package/src/steps/link-meta-step.ts +0 -105
  145. package/src/steps/override-document-step.ts +0 -97
  146. package/src/steps/set-attrs.tsx +0 -74
  147. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-0.json +0 -15
  148. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-1.json +0 -15
  149. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-2.json +0 -15
  150. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-3.json +0 -15
  151. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-0.json +0 -9
  152. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-1.json +0 -9
  153. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-2.json +0 -9
  154. package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row-inverted.json +0 -98
  155. package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row.json +0 -71
  156. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0-inverted.json +0 -19
  157. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0.json +0 -19
  158. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1-inverted.json +0 -21
  159. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1.json +0 -21
  160. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2-inverted.json +0 -21
  161. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2.json +0 -21
  162. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3-inverted.json +0 -19
  163. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3.json +0 -19
  164. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0-inverted.json +0 -63
  165. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0.json +0 -21
  166. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1-inverted.json +0 -64
  167. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1.json +0 -22
  168. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2-inverted.json +0 -63
  169. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2.json +0 -21
  170. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0-inverted.json +0 -19
  171. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0.json +0 -19
  172. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1-inverted.json +0 -19
  173. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1.json +0 -19
  174. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2-inverted.json +0 -19
  175. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2.json +0 -19
  176. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3-inverted.json +0 -19
  177. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3.json +0 -19
  178. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0-inverted.json +0 -52
  179. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0.json +0 -38
  180. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1-inverted.json +0 -52
  181. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1.json +0 -38
  182. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2-inverted.json +0 -25
  183. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2.json +0 -11
  184. package/src/steps/table/__tests__/_utils.ts +0 -102
  185. package/src/steps/table/__tests__/add-column-merge-columns.ts +0 -509
  186. package/src/steps/table/__tests__/add-column-merge-rows.ts +0 -466
  187. package/src/steps/table/__tests__/add-column.ts +0 -638
  188. package/src/steps/table/add-column.ts +0 -443
  189. package/src/steps/table/constants.ts +0 -4
  190. package/src/steps/table/sort-column.ts +0 -57
  191. package/src/steps/table/types.ts +0 -48
  192. package/src/steps/table/utils/cell-step.ts +0 -239
  193. package/src/steps/table/utils/cells-at-column.ts +0 -75
  194. package/src/steps/table/utils/find-column.ts +0 -90
  195. package/src/steps/table/utils/get-table-rect-from-doc.ts +0 -37
  196. package/src/steps/table/utils/side-effects/rows.ts +0 -327
  197. package/src/steps/table/utils/side-effects/side-effects.ts +0 -90
  198. package/src/steps/table/utils/side-effects/table.ts +0 -112
  199. package/src/steps/table/utils/side-effects/types.ts +0 -34
  200. package/src/steps/table/utils/table-map.ts +0 -28
  201. package/src/steps/type-ahead.ts +0 -100
  202. package/src/steps.ts +0 -16
  203. package/src/utils/colors.ts +0 -171
  204. package/src/utils/confluence/emoji.ts +0 -99
  205. package/src/utils/extensions.ts +0 -32
  206. package/src/utils/parseDOM.ts +0 -2
  207. package/src/utils/url.ts +0 -173
  208. package/src/utils/uuid.ts +0 -19
  209. package/src/version.json +0 -6
@@ -1,62 +0,0 @@
1
- import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
-
3
- export const orderedListSelector = '.ak-ol';
4
-
5
- export const orderedList: NodeSpec = {
6
- group: 'block',
7
- attrs: {
8
- order: { default: 1 },
9
- },
10
- content: 'listItem+',
11
- marks: 'unsupportedMark unsupportedNodeAttribute',
12
- selectable: false,
13
- parseDOM: [{ tag: 'ol' }],
14
- toDOM() {
15
- const attrs = {
16
- class: orderedListSelector.substr(1),
17
- };
18
- return ['ol', attrs, 0];
19
- },
20
- };
21
-
22
- // resolve "start" to a safe, 0+ integer, otherwise return undefined
23
- // Note: Any changes to this function should also be made to "resolveOrder"
24
- // in packages/editor/editor-common/src/utils/list.ts
25
- const resolveStart = (start: any): number | undefined => {
26
- const num = Number(start);
27
- if (Number.isNaN(num)) {
28
- return;
29
- }
30
- if (num < 0) {
31
- return;
32
- }
33
- return Math.floor(Math.max(num, 0));
34
- };
35
-
36
- export const orderedListWithOrder: NodeSpec = {
37
- ...orderedList,
38
- parseDOM: [
39
- {
40
- tag: 'ol',
41
- getAttrs: (domNode) => {
42
- const dom = domNode as HTMLElement;
43
- let startDOMAttr = dom.getAttribute('start');
44
- if (startDOMAttr) {
45
- const start = resolveStart(startDOMAttr);
46
- if (typeof start === 'number') {
47
- return { order: start };
48
- }
49
- }
50
- return null;
51
- },
52
- },
53
- ],
54
- toDOM(node) {
55
- const start = resolveStart(node?.attrs?.order);
56
- const attrs = {
57
- start: typeof start === 'number' ? String(start) : undefined,
58
- class: orderedListSelector.substr(1),
59
- };
60
- return ['ol', attrs, 0];
61
- },
62
- };
@@ -1,133 +0,0 @@
1
- import {
2
- NodeSpec,
3
- Node,
4
- AttributeSpec,
5
- } from '@atlaskit/editor-prosemirror/model';
6
- import { ParagraphDefinition as Paragraph } from './paragraph';
7
- import { OrderedListDefinition as OrderedList } from './types/list';
8
- import { BulletListDefinition as BulletList } from './types/list';
9
- import { HeadingDefinition as Heading } from './heading';
10
- import { BlockCardDefinition as BlockCard } from './block-card';
11
-
12
- export enum PanelType {
13
- INFO = 'info',
14
- NOTE = 'note',
15
- TIP = 'tip',
16
- WARNING = 'warning',
17
- ERROR = 'error',
18
- SUCCESS = 'success',
19
- CUSTOM = 'custom',
20
- }
21
- export interface PanelAttributes {
22
- panelType: PanelType;
23
- panelIcon?: string; // To identify emojis by shortName
24
- panelIconId?: string; // To uniquely identify emojis by id
25
- panelIconText?: string; // falling back to Unicode representation of standard emojis when image representation cannot be loaded
26
- panelColor?: string;
27
- }
28
-
29
- /**
30
- * @name panel_node
31
- */
32
- export interface PanelDefinition {
33
- type: 'panel';
34
- attrs: PanelAttributes;
35
- /**
36
- * @minItems 1
37
- * @allowUnsupportedBlock true
38
- */
39
- content: Array<Paragraph | Heading | OrderedList | BulletList | BlockCard>;
40
- }
41
-
42
- export interface DOMAttributes {
43
- [propName: string]: string;
44
- }
45
-
46
- type NodeSpecAttributes = {
47
- [name: string]: AttributeSpec;
48
- };
49
-
50
- type ParseDOMAttrs = {
51
- panelType: string;
52
- panelIcon?: string;
53
- panelIconId?: string;
54
- panelIconText?: string;
55
- panelColor?: string;
56
- };
57
-
58
- const getDefaultAttrs = (): NodeSpecAttributes => {
59
- let attrs: NodeSpecAttributes = {
60
- panelType: { default: 'info' },
61
- panelIcon: { default: null },
62
- panelIconId: { default: null },
63
- panelIconText: { default: null },
64
- panelColor: { default: null },
65
- };
66
-
67
- return attrs;
68
- };
69
-
70
- const getDomAttrs = (nodeAttrs: { [key: string]: any }): DOMAttributes => {
71
- let attrs: DOMAttributes = {
72
- 'data-panel-type': nodeAttrs.panelType,
73
- 'data-panel-icon': nodeAttrs.panelIcon,
74
- 'data-panel-icon-id': nodeAttrs.panelIconId,
75
- 'data-panel-icon-text': nodeAttrs.panelIconText,
76
- 'data-panel-color': nodeAttrs.panelColor,
77
- };
78
-
79
- return attrs;
80
- };
81
-
82
- const getParseDOMAttrs = (
83
- allowCustomPanel: boolean,
84
- dom: string | globalThis.Node,
85
- ): ParseDOMAttrs => {
86
- let parseDOMAttrs: ParseDOMAttrs = {
87
- panelType: (dom as HTMLElement).getAttribute('data-panel-type')!,
88
- };
89
-
90
- if (allowCustomPanel) {
91
- parseDOMAttrs = {
92
- ...parseDOMAttrs,
93
- panelIcon: (dom as HTMLElement).getAttribute('data-panel-icon')!,
94
- panelIconId: (dom as HTMLElement).getAttribute('data-panel-icon-id')!,
95
- panelIconText: (dom as HTMLElement).getAttribute('data-panel-icon-text')!,
96
- panelColor: (dom as HTMLElement).getAttribute('data-panel-color')!,
97
- };
98
- } else {
99
- parseDOMAttrs.panelType =
100
- parseDOMAttrs.panelType === PanelType.CUSTOM
101
- ? PanelType.INFO
102
- : parseDOMAttrs.panelType;
103
- }
104
-
105
- return parseDOMAttrs;
106
- };
107
-
108
- export const panel = (allowCustomPanel: boolean): NodeSpec => {
109
- const panelNodeSpec: NodeSpec = {
110
- group: 'block',
111
- content:
112
- '(paragraph | heading | bulletList | orderedList | blockCard | unsupportedBlock)+',
113
- marks: 'unsupportedMark unsupportedNodeAttribute',
114
- attrs: getDefaultAttrs(),
115
- selectable: true,
116
- parseDOM: [
117
- {
118
- tag: 'div[data-panel-type]',
119
- getAttrs: (dom) => getParseDOMAttrs(allowCustomPanel, dom),
120
- },
121
- ],
122
- toDOM(node: Node) {
123
- const attrs: DOMAttributes = getDomAttrs(node.attrs);
124
-
125
- const contentAttrs: Record<string, string> = {
126
- 'data-panel-content': 'true',
127
- };
128
-
129
- return ['div', attrs, ['div', contentAttrs, 0]];
130
- },
131
- };
132
- return panelNodeSpec;
133
- };
@@ -1,79 +0,0 @@
1
- import { NodeSpec, DOMOutputSpec } 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 paragraph_node
8
- */
9
- export interface ParagraphBaseDefinition {
10
- type: 'paragraph';
11
- /**
12
- * @allowUnsupportedInline true
13
- */
14
- content?: Array<Inline>;
15
- marks?: Array<any>;
16
- }
17
-
18
- /**
19
- * @name paragraph_with_no_marks_node
20
- */
21
- export type ParagraphDefinition = ParagraphBaseDefinition & NoMark;
22
-
23
- /**
24
- * NOTE: Need this because TS is too smart and inline everything.
25
- * So we need to give them separate identity.
26
- * Probably there's a way to solve it but that will need time and exploration.
27
- * // http://bit.ly/2raXFX5
28
- * type T1 = X | Y
29
- * type T2 = A | T1 | B // T2 = A | X | Y | B
30
- */
31
-
32
- /**
33
- * @name paragraph_with_alignment_node
34
- */
35
- export type ParagraphWithAlignmentDefinition = ParagraphBaseDefinition &
36
- MarksObject<AlignmentMarkDefinition>;
37
-
38
- /**
39
- * @name paragraph_with_indentation_node
40
- */
41
- export type ParagraphWithIndentationDefinition = ParagraphBaseDefinition &
42
- MarksObject<IndentationMarkDefinition>;
43
-
44
- export type ParagraphWithMarksDefinition =
45
- | ParagraphWithAlignmentDefinition
46
- | ParagraphWithIndentationDefinition;
47
-
48
- const isImageNode = (node: Node | null): boolean => {
49
- return Boolean(node && node.nodeName.toLowerCase() === 'img');
50
- };
51
-
52
- const hasInlineImage = (node: Node | null): boolean => {
53
- if (!node) {
54
- return false;
55
- }
56
-
57
- return Array.from(node.childNodes).some((child) => {
58
- const isImage = isImageNode(child);
59
-
60
- if (!isImage && child.childNodes) {
61
- return Array.from(node.childNodes).some((node) => hasInlineImage(node));
62
- }
63
-
64
- return isImage;
65
- });
66
- };
67
-
68
- const pDOM: DOMOutputSpec = ['p', 0];
69
- export const paragraph: NodeSpec = {
70
- selectable: false,
71
- content: 'inline*',
72
- group: 'block',
73
- marks:
74
- 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
75
- parseDOM: [{ tag: 'p' }],
76
- toDOM() {
77
- return pDOM;
78
- },
79
- };
@@ -1,40 +0,0 @@
1
- import { Node, NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
-
3
- /**
4
- * @name placeholder_node
5
- */
6
- export interface PlaceholderDefinition {
7
- type: 'placeholder';
8
- attrs: {
9
- text: string;
10
- };
11
- }
12
-
13
- export const placeholder: NodeSpec = {
14
- inline: true,
15
- group: 'inline',
16
- selectable: false,
17
- marks: '',
18
- attrs: {
19
- text: { default: '' },
20
- },
21
- parseDOM: [
22
- {
23
- tag: 'span[data-placeholder]',
24
- getAttrs: (dom) => ({
25
- text:
26
- (dom as HTMLElement).getAttribute('data-placeholder') ||
27
- placeholder.attrs!.text.default,
28
- }),
29
- },
30
- ],
31
- toDOM(node: Node) {
32
- const { text } = node.attrs;
33
- const attrs = {
34
- 'data-placeholder': text,
35
- // Needs to be edtiable for mobile to not close keyboard
36
- contenteditable: 'true',
37
- };
38
- return ['span', attrs, text];
39
- },
40
- };
@@ -1,17 +0,0 @@
1
- import { NodeSpec, DOMOutputSpec } from '@atlaskit/editor-prosemirror/model';
2
-
3
- /**
4
- * @name rule_node
5
- */
6
- export interface RuleDefinition {
7
- type: 'rule';
8
- }
9
-
10
- const hrDOM: DOMOutputSpec = ['hr'];
11
- export const rule: NodeSpec = {
12
- group: 'block',
13
- parseDOM: [{ tag: 'hr' }],
14
- toDOM() {
15
- return hrDOM;
16
- },
17
- };
@@ -1,58 +0,0 @@
1
- import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import { uuid } from '../../utils/uuid';
3
-
4
- /**
5
- * @name status_node
6
- */
7
- export interface StatusDefinition {
8
- type: 'status';
9
- attrs: {
10
- /**
11
- * @minLength 1
12
- */
13
- text: string;
14
- color: 'neutral' | 'purple' | 'blue' | 'red' | 'yellow' | 'green';
15
- localId?: string;
16
- /**
17
- * Supported values are bold and subtle
18
- */
19
- style?: string;
20
- };
21
- }
22
-
23
- export const status: NodeSpec = {
24
- inline: true,
25
- group: 'inline',
26
- selectable: true,
27
- attrs: {
28
- text: { default: '' },
29
- color: { default: '' },
30
- localId: { default: uuid.generate() },
31
- style: { default: '' },
32
- },
33
- parseDOM: [
34
- {
35
- tag: 'span[data-node-type="status"]',
36
- getAttrs: (domNode) => {
37
- const dom = domNode as HTMLElement;
38
- return {
39
- text: dom.textContent!.replace(/\n/, '').trim(),
40
- color: dom.getAttribute('data-color'),
41
- localId: uuid.generate(),
42
- style: dom.getAttribute('data-style'),
43
- };
44
- },
45
- },
46
- ],
47
- toDOM(node: PMNode) {
48
- const { text, color, localId, style } = node.attrs;
49
- const attrs = {
50
- 'data-node-type': 'status',
51
- 'data-color': color,
52
- 'data-local-id': localId,
53
- 'data-style': style,
54
- contenteditable: 'false',
55
- };
56
- return ['span', attrs, text];
57
- },
58
- };