@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,77 +0,0 @@
1
- import { Node as PMNode, NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
- import { NoMark } from './types/mark';
3
- import { ParagraphDefinition as Paragraph } from './paragraph';
4
- import { HeadingDefinition as Heading } from './heading';
5
- import { MediaSingleDefinition as MediaSingle } from './media-single';
6
- import { MediaGroupDefinition as MediaGroup } from './media-group';
7
-
8
- /**
9
- * @name nestedExpand_content
10
- * @minItems 1
11
- * @allowUnsupportedBlock true
12
- */
13
- export type NestedExpandContent = Array<
14
- Paragraph | Heading | MediaSingle | MediaGroup
15
- >;
16
-
17
- /**
18
- * @name nestedExpand_node
19
- */
20
- export interface NestedExpandBaseDefinition {
21
- type: 'nestedExpand';
22
- attrs: {
23
- title?: string;
24
- };
25
- content: NestedExpandContent;
26
- }
27
-
28
- /**
29
- * @name nestedExpand_with_no_marks_node
30
- */
31
- export type NestedExpandDefinition = NestedExpandBaseDefinition & NoMark;
32
-
33
- export const nestedExpand: NodeSpec = {
34
- inline: false,
35
- marks: 'unsupportedMark unsupportedNodeAttribute',
36
- content:
37
- '(paragraph | heading | mediaSingle | mediaGroup | unsupportedBlock)+',
38
- isolating: true,
39
- selectable: true,
40
- attrs: {
41
- title: { default: '' },
42
- __expanded: { default: true },
43
- },
44
- parseDOM: [
45
- {
46
- context: 'nestedExpand//',
47
- tag: '[data-node-type="nestedExpand"]',
48
- skip: true,
49
- },
50
- {
51
- tag: '[data-node-type="nestedExpand"] button',
52
- ignore: true,
53
- },
54
- {
55
- tag: '[data-node-type="expand"] button',
56
- ignore: true,
57
- },
58
- {
59
- tag: 'div[data-node-type="nestedExpand"]',
60
- getAttrs: (domNode) => {
61
- const dom = domNode as HTMLElement;
62
- return {
63
- title: dom.getAttribute('data-title'),
64
- __expanded: true,
65
- };
66
- },
67
- },
68
- ],
69
- toDOM(node: PMNode) {
70
- const attrs = {
71
- 'data-node-type': 'nestedExpand',
72
- 'data-title': node.attrs.title,
73
- 'data-expanded': node.attrs.__expanded,
74
- };
75
- return ['div', attrs, 0];
76
- },
77
- };
@@ -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
- };