@atlaskit/adf-schema 25.1.0 → 25.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 (249) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/index.js +0 -2
  3. package/dist/cjs/json-schema/index.js +0 -3
  4. package/dist/cjs/schema/bitbucket-schema.js +0 -2
  5. package/dist/cjs/schema/confluence-schema.js +1 -4
  6. package/dist/cjs/schema/create-schema.js +12 -38
  7. package/dist/cjs/schema/default-schema.js +3 -16
  8. package/dist/cjs/schema/groups.js +13 -6
  9. package/dist/cjs/schema/index.js +0 -5
  10. package/dist/cjs/schema/inline-nodes.js +0 -5
  11. package/dist/cjs/schema/jira-schema.js +0 -36
  12. package/dist/cjs/schema/marks/alignment.js +0 -2
  13. package/dist/cjs/schema/marks/annotation.js +2 -14
  14. package/dist/cjs/schema/marks/code.js +0 -5
  15. package/dist/cjs/schema/marks/confluence-inline-comment.js +1 -1
  16. package/dist/cjs/schema/marks/data-consumer.js +2 -7
  17. package/dist/cjs/schema/marks/em.js +0 -2
  18. package/dist/cjs/schema/marks/fragment.js +0 -13
  19. package/dist/cjs/schema/marks/indentation.js +0 -2
  20. package/dist/cjs/schema/marks/index.js +0 -18
  21. package/dist/cjs/schema/marks/link.js +0 -17
  22. package/dist/cjs/schema/marks/strike.js +0 -2
  23. package/dist/cjs/schema/marks/strong.js +2 -3
  24. package/dist/cjs/schema/marks/subsup.js +0 -5
  25. package/dist/cjs/schema/marks/text-color.js +46 -37
  26. package/dist/cjs/schema/marks/type-ahead-query.js +0 -3
  27. package/dist/cjs/schema/marks/underline.js +0 -2
  28. package/dist/cjs/schema/nodes/block-card.js +1 -2
  29. package/dist/cjs/schema/nodes/blockquote.js +1 -1
  30. package/dist/cjs/schema/nodes/bodied-extension.js +0 -3
  31. package/dist/cjs/schema/nodes/caption.js +1 -1
  32. package/dist/cjs/schema/nodes/code-block.js +11 -29
  33. package/dist/cjs/schema/nodes/date.js +1 -1
  34. package/dist/cjs/schema/nodes/decision-item.js +2 -4
  35. package/dist/cjs/schema/nodes/decision-list.js +0 -2
  36. package/dist/cjs/schema/nodes/doc.js +1 -1
  37. package/dist/cjs/schema/nodes/embed-card.js +6 -6
  38. package/dist/cjs/schema/nodes/emoji.js +11 -9
  39. package/dist/cjs/schema/nodes/expand.js +1 -4
  40. package/dist/cjs/schema/nodes/extension.js +0 -3
  41. package/dist/cjs/schema/nodes/hard-break.js +1 -1
  42. package/dist/cjs/schema/nodes/heading.js +2 -2
  43. package/dist/cjs/schema/nodes/index.js +0 -45
  44. package/dist/cjs/schema/nodes/inline-card.js +4 -4
  45. package/dist/cjs/schema/nodes/inline-extension.js +0 -3
  46. package/dist/cjs/schema/nodes/layout-column.js +4 -5
  47. package/dist/cjs/schema/nodes/layout-section.js +1 -1
  48. package/dist/cjs/schema/nodes/media-group.js +1 -1
  49. package/dist/cjs/schema/nodes/media-inline.js +0 -2
  50. package/dist/cjs/schema/nodes/media-single.js +3 -14
  51. package/dist/cjs/schema/nodes/media.js +10 -28
  52. package/dist/cjs/schema/nodes/mention.js +4 -14
  53. package/dist/cjs/schema/nodes/nested-expand.js +1 -1
  54. package/dist/cjs/schema/nodes/ordered-list.js +3 -17
  55. package/dist/cjs/schema/nodes/panel.js +1 -13
  56. package/dist/cjs/schema/nodes/paragraph.js +1 -6
  57. package/dist/cjs/schema/nodes/placeholder.js +1 -1
  58. package/dist/cjs/schema/nodes/rule.js +1 -1
  59. package/dist/cjs/schema/nodes/status.js +4 -6
  60. package/dist/cjs/schema/nodes/tableNodes.js +12 -39
  61. package/dist/cjs/schema/nodes/task-item.js +2 -4
  62. package/dist/cjs/schema/nodes/task-list.js +0 -2
  63. package/dist/cjs/schema/nodes/text.js +1 -1
  64. package/dist/cjs/steps/analytics.js +4 -38
  65. package/dist/cjs/steps/set-attrs.js +0 -26
  66. package/dist/cjs/steps/table/add-column.js +33 -105
  67. package/dist/cjs/steps/table/constants.js +0 -1
  68. package/dist/cjs/steps/table/sort-column.js +0 -19
  69. package/dist/cjs/steps/table/utils/cell-step.js +18 -49
  70. package/dist/cjs/steps/table/utils/cells-at-column.js +2 -21
  71. package/dist/cjs/steps/table/utils/find-column.js +13 -17
  72. package/dist/cjs/steps/table/utils/get-table-rect-from-doc.js +6 -8
  73. package/dist/cjs/steps/table/utils/side-effects/rows.js +23 -78
  74. package/dist/cjs/steps/table/utils/side-effects/side-effects.js +0 -23
  75. package/dist/cjs/steps/table/utils/side-effects/table.js +2 -18
  76. package/dist/cjs/steps/table/utils/table-map.js +0 -6
  77. package/dist/cjs/steps/type-ahead.js +5 -25
  78. package/dist/cjs/steps.js +0 -6
  79. package/dist/cjs/utils/colors.js +13 -36
  80. package/dist/cjs/utils/confluence/emoji.js +6 -13
  81. package/dist/cjs/utils/extensions.js +0 -8
  82. package/dist/cjs/utils/index.js +0 -4
  83. package/dist/cjs/utils/parseDOM.js +0 -2
  84. package/dist/cjs/utils/url.js +3 -20
  85. package/dist/cjs/utils/uuid.js +0 -3
  86. package/dist/cjs/version.json +1 -1
  87. package/dist/es2019/index.js +1 -2
  88. package/dist/es2019/schema/bitbucket-schema.js +1 -1
  89. package/dist/es2019/schema/confluence-schema.js +1 -2
  90. package/dist/es2019/schema/create-schema.js +12 -25
  91. package/dist/es2019/schema/default-schema.js +3 -11
  92. package/dist/es2019/schema/groups.js +13 -6
  93. package/dist/es2019/schema/index.js +1 -2
  94. package/dist/es2019/schema/jira-schema.js +0 -24
  95. package/dist/es2019/schema/marks/alignment.js +1 -3
  96. package/dist/es2019/schema/marks/annotation.js +3 -9
  97. package/dist/es2019/schema/marks/breakout.js +0 -4
  98. package/dist/es2019/schema/marks/code.js +1 -5
  99. package/dist/es2019/schema/marks/confluence-inline-comment.js +1 -2
  100. package/dist/es2019/schema/marks/data-consumer.js +3 -5
  101. package/dist/es2019/schema/marks/em.js +1 -2
  102. package/dist/es2019/schema/marks/fragment.js +0 -8
  103. package/dist/es2019/schema/marks/indentation.js +0 -4
  104. package/dist/es2019/schema/marks/link.js +2 -11
  105. package/dist/es2019/schema/marks/strike.js +1 -2
  106. package/dist/es2019/schema/marks/strong.js +3 -7
  107. package/dist/es2019/schema/marks/subsup.js +0 -6
  108. package/dist/es2019/schema/marks/text-color.js +44 -29
  109. package/dist/es2019/schema/marks/type-ahead-query.js +0 -2
  110. package/dist/es2019/schema/marks/underline.js +1 -2
  111. package/dist/es2019/schema/marks/unsupported-mark.js +0 -1
  112. package/dist/es2019/schema/marks/unsupported-node-attributes.js +0 -1
  113. package/dist/es2019/schema/nodes/block-card.js +1 -3
  114. package/dist/es2019/schema/nodes/blockquote.js +1 -2
  115. package/dist/es2019/schema/nodes/bodied-extension.js +0 -4
  116. package/dist/es2019/schema/nodes/bullet-list.js +0 -2
  117. package/dist/es2019/schema/nodes/caption.js +1 -2
  118. package/dist/es2019/schema/nodes/code-block.js +11 -28
  119. package/dist/es2019/schema/nodes/confluence-jira-issue.js +0 -2
  120. package/dist/es2019/schema/nodes/confluence-unsupported-block.js +0 -4
  121. package/dist/es2019/schema/nodes/confluence-unsupported-inline.js +0 -4
  122. package/dist/es2019/schema/nodes/date.js +1 -2
  123. package/dist/es2019/schema/nodes/decision-item.js +0 -2
  124. package/dist/es2019/schema/nodes/decision-list.js +1 -2
  125. package/dist/es2019/schema/nodes/doc.js +1 -0
  126. package/dist/es2019/schema/nodes/embed-card.js +1 -2
  127. package/dist/es2019/schema/nodes/emoji.js +9 -6
  128. package/dist/es2019/schema/nodes/expand.js +1 -3
  129. package/dist/es2019/schema/nodes/extension.js +0 -4
  130. package/dist/es2019/schema/nodes/hard-break.js +1 -2
  131. package/dist/es2019/schema/nodes/heading.js +2 -3
  132. package/dist/es2019/schema/nodes/image.js +0 -4
  133. package/dist/es2019/schema/nodes/inline-card.js +4 -5
  134. package/dist/es2019/schema/nodes/inline-extension.js +0 -4
  135. package/dist/es2019/schema/nodes/layout-column.js +4 -6
  136. package/dist/es2019/schema/nodes/layout-section.js +1 -4
  137. package/dist/es2019/schema/nodes/list-item.js +0 -2
  138. package/dist/es2019/schema/nodes/media-group.js +1 -2
  139. package/dist/es2019/schema/nodes/media-single.js +3 -6
  140. package/dist/es2019/schema/nodes/media.js +10 -20
  141. package/dist/es2019/schema/nodes/mention.js +0 -11
  142. package/dist/es2019/schema/nodes/nested-expand.js +1 -2
  143. package/dist/es2019/schema/nodes/ordered-list.js +4 -14
  144. package/dist/es2019/schema/nodes/panel.js +3 -10
  145. package/dist/es2019/schema/nodes/paragraph.js +1 -7
  146. package/dist/es2019/schema/nodes/placeholder.js +1 -2
  147. package/dist/es2019/schema/nodes/rule.js +1 -2
  148. package/dist/es2019/schema/nodes/status.js +1 -2
  149. package/dist/es2019/schema/nodes/tableNodes.js +10 -26
  150. package/dist/es2019/schema/nodes/task-item.js +0 -2
  151. package/dist/es2019/schema/nodes/task-list.js +0 -2
  152. package/dist/es2019/schema/nodes/text.js +1 -0
  153. package/dist/es2019/schema/nodes/unknown-block.js +0 -2
  154. package/dist/es2019/schema/nodes/unsupported-block.js +0 -2
  155. package/dist/es2019/schema/nodes/unsupported-inline.js +0 -2
  156. package/dist/es2019/steps/analytics.js +13 -30
  157. package/dist/es2019/steps/set-attrs.js +3 -12
  158. package/dist/es2019/steps/table/add-column.js +33 -76
  159. package/dist/es2019/steps/table/constants.js +0 -1
  160. package/dist/es2019/steps/table/sort-column.js +1 -8
  161. package/dist/es2019/steps/table/utils/cell-step.js +15 -32
  162. package/dist/es2019/steps/table/utils/cells-at-column.js +6 -11
  163. package/dist/es2019/steps/table/utils/find-column.js +12 -15
  164. package/dist/es2019/steps/table/utils/get-table-rect-from-doc.js +7 -6
  165. package/dist/es2019/steps/table/utils/side-effects/rows.js +19 -59
  166. package/dist/es2019/steps/table/utils/side-effects/side-effects.js +0 -21
  167. package/dist/es2019/steps/table/utils/side-effects/table.js +0 -17
  168. package/dist/es2019/steps/type-ahead.js +3 -15
  169. package/dist/es2019/utils/colors.js +8 -18
  170. package/dist/es2019/utils/confluence/emoji.js +5 -8
  171. package/dist/es2019/utils/extensions.js +0 -4
  172. package/dist/es2019/utils/url.js +2 -12
  173. package/dist/es2019/utils/uuid.js +0 -2
  174. package/dist/es2019/version.json +1 -1
  175. package/dist/esm/index.js +1 -2
  176. package/dist/esm/schema/bitbucket-schema.js +1 -1
  177. package/dist/esm/schema/confluence-schema.js +1 -2
  178. package/dist/esm/schema/create-schema.js +12 -31
  179. package/dist/esm/schema/default-schema.js +3 -11
  180. package/dist/esm/schema/groups.js +13 -6
  181. package/dist/esm/schema/index.js +1 -2
  182. package/dist/esm/schema/jira-schema.js +0 -24
  183. package/dist/esm/schema/marks/alignment.js +1 -1
  184. package/dist/esm/schema/marks/annotation.js +3 -11
  185. package/dist/esm/schema/marks/code.js +1 -3
  186. package/dist/esm/schema/marks/confluence-inline-comment.js +1 -0
  187. package/dist/esm/schema/marks/data-consumer.js +3 -3
  188. package/dist/esm/schema/marks/em.js +1 -0
  189. package/dist/esm/schema/marks/fragment.js +0 -9
  190. package/dist/esm/schema/marks/link.js +0 -12
  191. package/dist/esm/schema/marks/strike.js +1 -0
  192. package/dist/esm/schema/marks/strong.js +3 -1
  193. package/dist/esm/schema/marks/subsup.js +0 -4
  194. package/dist/esm/schema/marks/text-color.js +46 -30
  195. package/dist/esm/schema/marks/underline.js +1 -0
  196. package/dist/esm/schema/nodes/block-card.js +1 -1
  197. package/dist/esm/schema/nodes/blockquote.js +1 -0
  198. package/dist/esm/schema/nodes/bodied-extension.js +0 -2
  199. package/dist/esm/schema/nodes/caption.js +1 -0
  200. package/dist/esm/schema/nodes/code-block.js +11 -26
  201. package/dist/esm/schema/nodes/date.js +1 -0
  202. package/dist/esm/schema/nodes/decision-item.js +2 -2
  203. package/dist/esm/schema/nodes/decision-list.js +1 -0
  204. package/dist/esm/schema/nodes/doc.js +1 -0
  205. package/dist/esm/schema/nodes/embed-card.js +6 -5
  206. package/dist/esm/schema/nodes/emoji.js +12 -7
  207. package/dist/esm/schema/nodes/expand.js +1 -1
  208. package/dist/esm/schema/nodes/extension.js +0 -2
  209. package/dist/esm/schema/nodes/hard-break.js +1 -0
  210. package/dist/esm/schema/nodes/heading.js +2 -1
  211. package/dist/esm/schema/nodes/inline-card.js +4 -3
  212. package/dist/esm/schema/nodes/inline-extension.js +0 -2
  213. package/dist/esm/schema/nodes/layout-column.js +4 -4
  214. package/dist/esm/schema/nodes/layout-section.js +1 -0
  215. package/dist/esm/schema/nodes/media-group.js +1 -0
  216. package/dist/esm/schema/nodes/media-single.js +3 -8
  217. package/dist/esm/schema/nodes/media.js +10 -18
  218. package/dist/esm/schema/nodes/mention.js +4 -13
  219. package/dist/esm/schema/nodes/nested-expand.js +1 -0
  220. package/dist/esm/schema/nodes/ordered-list.js +3 -13
  221. package/dist/esm/schema/nodes/panel.js +1 -10
  222. package/dist/esm/schema/nodes/paragraph.js +1 -5
  223. package/dist/esm/schema/nodes/placeholder.js +1 -0
  224. package/dist/esm/schema/nodes/rule.js +1 -0
  225. package/dist/esm/schema/nodes/status.js +5 -4
  226. package/dist/esm/schema/nodes/tableNodes.js +12 -25
  227. package/dist/esm/schema/nodes/task-item.js +2 -2
  228. package/dist/esm/schema/nodes/text.js +1 -0
  229. package/dist/esm/steps/analytics.js +5 -31
  230. package/dist/esm/steps/set-attrs.js +1 -17
  231. package/dist/esm/steps/table/add-column.js +33 -91
  232. package/dist/esm/steps/table/constants.js +0 -1
  233. package/dist/esm/steps/table/sort-column.js +1 -10
  234. package/dist/esm/steps/table/utils/cell-step.js +18 -42
  235. package/dist/esm/steps/table/utils/cells-at-column.js +2 -18
  236. package/dist/esm/steps/table/utils/find-column.js +13 -16
  237. package/dist/esm/steps/table/utils/get-table-rect-from-doc.js +7 -6
  238. package/dist/esm/steps/table/utils/side-effects/rows.js +23 -76
  239. package/dist/esm/steps/table/utils/side-effects/side-effects.js +0 -18
  240. package/dist/esm/steps/table/utils/side-effects/table.js +2 -13
  241. package/dist/esm/steps/type-ahead.js +6 -18
  242. package/dist/esm/utils/colors.js +12 -23
  243. package/dist/esm/utils/confluence/emoji.js +6 -10
  244. package/dist/esm/utils/extensions.js +0 -4
  245. package/dist/esm/utils/url.js +2 -12
  246. package/dist/esm/version.json +1 -1
  247. package/dist/types/schema/default-schema.d.ts +1 -1
  248. package/dist/types/utils/colors.d.ts +1 -1
  249. package/package.json +2 -2
@@ -1,57 +1,44 @@
1
1
  import { createSchema } from './create-schema';
2
-
3
2
  /**
4
3
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
5
4
  **/
6
5
  export default function makeSchema(config) {
7
6
  const nodes = ['doc', 'paragraph', 'text', 'hardBreak', 'heading', 'rule'];
8
7
  const marks = ['strong', 'em', 'underline', 'typeAheadQuery', 'unsupportedMark', 'unsupportedNodeAttribute'];
9
-
10
8
  if (config.allowLinks) {
11
9
  marks.push('link');
12
10
  }
13
-
14
11
  if (config.allowLists) {
15
12
  nodes.push('orderedList', 'bulletList', 'listItem');
16
13
  }
17
-
18
14
  if (config.allowMentions) {
19
15
  nodes.push('mention');
20
16
  marks.push('mentionQuery');
21
17
  }
22
-
23
18
  if (config.allowEmojis) {
24
19
  nodes.push('emoji');
25
20
  }
26
-
27
21
  if (config.allowAdvancedTextFormatting) {
28
22
  marks.push('strike', 'code');
29
23
  }
30
-
31
24
  if (config.allowSubSup) {
32
25
  marks.push('subsup');
33
26
  }
34
-
35
27
  if (config.allowCodeBlock) {
36
28
  nodes.push('codeBlock');
37
29
  }
38
-
39
30
  if (config.allowBlockQuote) {
40
31
  nodes.push('blockquote');
41
32
  }
42
-
43
33
  if (config.allowMedia) {
44
34
  nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption', 'mediaInline');
45
35
  }
46
-
47
36
  if (config.allowTextColor) {
48
37
  marks.push('textColor');
49
38
  }
50
-
51
39
  if (config.allowTables) {
52
40
  nodes.push('table', 'tableCell', 'tableHeader', 'tableRow');
53
41
  }
54
-
55
42
  return createSchema({
56
43
  nodes,
57
44
  marks
@@ -60,77 +47,66 @@ export default function makeSchema(config) {
60
47
  /**
61
48
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
62
49
  **/
63
-
64
50
  export function isSchemaWithLists(schema) {
65
51
  return !!schema.nodes.bulletList;
66
52
  }
67
53
  /**
68
54
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
69
55
  **/
70
-
71
56
  export function isSchemaWithMentions(schema) {
72
57
  return !!schema.nodes.mention;
73
58
  }
74
59
  /**
75
60
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
76
61
  **/
77
-
78
62
  export function isSchemaWithEmojis(schema) {
79
63
  return !!schema.nodes.emoji;
80
64
  }
81
65
  /**
82
66
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
83
67
  **/
84
-
85
68
  export function isSchemaWithLinks(schema) {
86
69
  return !!schema.marks.link;
87
70
  }
88
71
  /**
89
72
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
90
73
  **/
91
-
92
74
  export function isSchemaWithAdvancedTextFormattingMarks(schema) {
93
75
  return !!schema.marks.code && !!schema.marks.strike;
94
76
  }
95
77
  /**
96
78
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
97
79
  **/
98
-
99
80
  export function isSchemaWithSubSupMark(schema) {
100
81
  return !!schema.marks.subsup;
101
82
  }
102
83
  /**
103
84
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
104
85
  **/
105
-
106
86
  export function isSchemaWithCodeBlock(schema) {
107
87
  return !!schema.nodes.codeBlock;
108
88
  }
109
89
  /**
110
90
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
111
91
  **/
112
-
113
92
  export function isSchemaWithBlockQuotes(schema) {
114
93
  return !!schema.nodes.blockquote;
115
94
  }
116
95
  /**
117
96
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
118
97
  **/
119
-
120
98
  export function isSchemaWithMedia(schema) {
121
99
  return !!schema.nodes.mediaGroup && !!schema.nodes.media && !!schema.nodes.mediaInline;
122
100
  }
123
101
  /**
124
102
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
125
103
  **/
126
-
127
104
  export function isSchemaWithTextColor(schema) {
128
105
  return !!schema.marks.textColor;
129
106
  }
130
107
  /**
131
108
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
132
109
  **/
133
-
134
110
  export function isSchemaWithTables(schema) {
135
111
  return !!schema.nodes.table && !!schema.nodes.tableCell && !!schema.nodes.tableHeader && !!schema.nodes.tableRow;
136
112
  }
@@ -1,6 +1,6 @@
1
1
  import { ALIGNMENT, INDENTATION } from '../groups';
2
- /** TODO: Flip these positions for RTL */
3
2
 
3
+ /** TODO: Flip these positions for RTL */
4
4
  export const alignmentPositionMap = {
5
5
  end: 'right',
6
6
  right: 'end',
@@ -21,12 +21,10 @@ export const alignment = {
21
21
  } : false;
22
22
  }
23
23
  }],
24
-
25
24
  toDOM(mark) {
26
25
  return ['div', {
27
26
  class: `fabric-editor-block-mark fabric-editor-alignment fabric-editor-align-${mark.attrs.align}`,
28
27
  'data-align': mark.attrs.align
29
28
  }, 0];
30
29
  }
31
-
32
30
  };
@@ -1,19 +1,16 @@
1
1
  /**
2
2
  * @name annotation_mark
3
3
  */
4
- export let AnnotationTypes;
5
4
 
5
+ export let AnnotationTypes;
6
6
  (function (AnnotationTypes) {
7
7
  AnnotationTypes["INLINE_COMMENT"] = "inlineComment";
8
8
  })(AnnotationTypes || (AnnotationTypes = {}));
9
-
10
9
  export let AnnotationMarkStates;
11
-
12
10
  (function (AnnotationMarkStates) {
13
11
  AnnotationMarkStates["RESOLVED"] = "resolved";
14
12
  AnnotationMarkStates["ACTIVE"] = "active";
15
13
  })(AnnotationMarkStates || (AnnotationMarkStates = {}));
16
-
17
14
  export function buildDataAttributes({
18
15
  id,
19
16
  annotationType,
@@ -24,13 +21,12 @@ export function buildDataAttributes({
24
21
  'data-mark-annotation-type': annotationType,
25
22
  'data-id': id
26
23
  };
27
-
28
24
  if (state) {
29
- return { ...data,
25
+ return {
26
+ ...data,
30
27
  'data-mark-annotation-state': state
31
28
  };
32
29
  }
33
-
34
30
  return data;
35
31
  }
36
32
  export const annotation = {
@@ -57,7 +53,6 @@ export const annotation = {
57
53
  return attrs;
58
54
  }
59
55
  }],
60
-
61
56
  toDOM(node) {
62
57
  /*
63
58
  Data attributes on the DOM node are a temporary means of
@@ -76,5 +71,4 @@ export const annotation = {
76
71
  })
77
72
  }, 0];
78
73
  }
79
-
80
74
  };
@@ -4,26 +4,22 @@ export const breakout = {
4
4
  inclusive: false,
5
5
  parseDOM: [{
6
6
  tag: 'div.fabric-editor-breakout-mark',
7
-
8
7
  getAttrs(dom) {
9
8
  const mode = dom.getAttribute('data-mode');
10
9
  return {
11
10
  mode: allowedTypes.indexOf(mode || '') === -1 ? 'wide' : mode
12
11
  };
13
12
  }
14
-
15
13
  }],
16
14
  attrs: {
17
15
  mode: {
18
16
  default: 'wide'
19
17
  }
20
18
  },
21
-
22
19
  toDOM(mark) {
23
20
  return ['div', {
24
21
  class: 'fabric-editor-breakout-mark',
25
22
  'data-mode': mark.attrs.mode
26
23
  }, 0];
27
24
  }
28
-
29
25
  };
@@ -1,4 +1,5 @@
1
1
  import { COLOR, FONT_STYLE, LINK, SEARCH_QUERY } from '../groups';
2
+
2
3
  /**
3
4
  * @name code_mark
4
5
  */
@@ -20,24 +21,19 @@ export const code = {
20
21
  preserveWhitespace: true,
21
22
  getAttrs: domNode => {
22
23
  let dom = domNode;
23
-
24
24
  if (dom.style.whiteSpace === 'pre') {
25
25
  return {};
26
26
  }
27
-
28
27
  if (dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') >= 0) {
29
28
  return {};
30
29
  }
31
-
32
30
  return false;
33
31
  }
34
32
  }],
35
-
36
33
  toDOM() {
37
34
  return ['span', {
38
35
  class: 'code',
39
36
  spellcheck: 'false'
40
37
  }];
41
38
  }
42
-
43
39
  };
@@ -2,6 +2,7 @@
2
2
  * @name inline_comment_marker
3
3
  * @description This temporary mark represents a Confluence-backed inline comment that wraps a piece of text. It will be replaced with a cross-product inline comment solution at later date.
4
4
  */
5
+
5
6
  export const confluenceInlineComment = {
6
7
  inclusive: false,
7
8
  excludes: '',
@@ -13,12 +14,10 @@ export const confluenceInlineComment = {
13
14
  parseDOM: [{
14
15
  tag: 'span[data-mark-type="confluenceInlineComment"]'
15
16
  }],
16
-
17
17
  toDOM(node) {
18
18
  return ['span', {
19
19
  'data-mark-type': 'confluenceInlineComment',
20
20
  'data-reference': node.attrs.reference
21
21
  }];
22
22
  }
23
-
24
23
  };
@@ -1,4 +1,5 @@
1
1
  import { isDOMElement } from '../../utils/parseDOM';
2
+
2
3
  /**
3
4
  * This annotation is purely for reference, & does _nothing_ given annotating
4
5
  * `minLength` on an array of strings is not supported with our schema+spec
@@ -12,7 +13,6 @@ import { isDOMElement } from '../../utils/parseDOM';
12
13
 
13
14
  const parseDataConsumer = maybeValue => {
14
15
  const sources = isDOMElement(maybeValue) && maybeValue.getAttribute('data-sources');
15
-
16
16
  try {
17
17
  return sources ? {
18
18
  sources: JSON.parse(sources)
@@ -21,7 +21,6 @@ const parseDataConsumer = maybeValue => {
21
21
  return false;
22
22
  }
23
23
  };
24
-
25
24
  export const dataConsumer = {
26
25
  attrs: {
27
26
  sources: {
@@ -32,7 +31,6 @@ export const dataConsumer = {
32
31
  tag: '[data-mark-type="dataConsumer"]',
33
32
  getAttrs: maybeValue => parseDataConsumer(maybeValue)
34
33
  }],
35
-
36
34
  toDOM(mark, inline) {
37
35
  const wrapperStyle = inline ? 'span' : 'div';
38
36
  return [wrapperStyle, {
@@ -40,8 +38,8 @@ export const dataConsumer = {
40
38
  'data-sources': JSON.stringify(mark.attrs.sources)
41
39
  }];
42
40
  }
43
-
44
41
  };
42
+
45
43
  /**
46
44
  * We want to ensure any "invalid ADF" doesn't get serialised, but the entire
47
45
  * mark itself is not valid without a non-empty `sources`.
@@ -52,12 +50,12 @@ export const dataConsumer = {
52
50
  * So we'll leave any extra transformation checks in
53
51
  * `editor-json-transformer`(?)
54
52
  */
55
-
56
53
  export const toJSON = mark => {
57
54
  // // Remove intemediary state if we don't have any sources on data consumer
58
55
  // if (mark.attrs?.sources?.length < 1) {
59
56
  // return null;
60
57
  // }
58
+
61
59
  return {
62
60
  type: mark.type.name,
63
61
  attrs: Object.keys(mark.attrs).filter(key => key === 'sources' && mark.attrs[key].length > 0 && mark.attrs[key] !== null).reduce((acc, key) => {
@@ -1,4 +1,5 @@
1
1
  import { FONT_STYLE } from '../groups';
2
+
2
3
  /**
3
4
  * @name em_mark
4
5
  */
@@ -14,9 +15,7 @@ export const em = {
14
15
  }, {
15
16
  style: 'font-style=italic'
16
17
  }],
17
-
18
18
  toDOM() {
19
19
  return emDOM;
20
20
  }
21
-
22
21
  };
@@ -1,25 +1,19 @@
1
1
  import { isDOMElement } from '../../utils/parseDOM';
2
-
3
2
  const parseFragment = maybeValue => {
4
3
  var _maybeValue$getAttrib;
5
-
6
4
  if (!isDOMElement(maybeValue)) {
7
5
  return false;
8
6
  }
9
-
10
7
  const name = (_maybeValue$getAttrib = maybeValue.getAttribute('data-name')) !== null && _maybeValue$getAttrib !== void 0 ? _maybeValue$getAttrib : undefined;
11
8
  const localId = maybeValue.getAttribute('data-localId');
12
-
13
9
  if (!localId) {
14
10
  return false;
15
11
  }
16
-
17
12
  return {
18
13
  localId,
19
14
  name
20
15
  };
21
16
  };
22
-
23
17
  export const fragment = {
24
18
  inclusive: false,
25
19
  excludes: '',
@@ -35,7 +29,6 @@ export const fragment = {
35
29
  tag: '[data-mark-type="fragment"]',
36
30
  getAttrs: maybeValue => parseFragment(maybeValue)
37
31
  }],
38
-
39
32
  toDOM(mark, inline) {
40
33
  const wrapperStyle = inline ? 'span' : 'div';
41
34
  return [wrapperStyle, {
@@ -44,7 +37,6 @@ export const fragment = {
44
37
  'data-localId': mark.attrs.localId
45
38
  }];
46
39
  }
47
-
48
40
  };
49
41
  export const toJSON = mark => {
50
42
  return {
@@ -7,21 +7,17 @@ export const indentation = {
7
7
  },
8
8
  parseDOM: [{
9
9
  tag: 'div.fabric-editor-indentation-mark',
10
-
11
10
  getAttrs(dom) {
12
11
  const level = +(dom.getAttribute('data-level') || '0');
13
12
  return {
14
13
  level: level > 6 ? 6 : level < 1 ? false : level
15
14
  };
16
15
  }
17
-
18
16
  }],
19
-
20
17
  toDOM(mark) {
21
18
  return ['div', {
22
19
  class: 'fabric-editor-block-mark fabric-editor-indentation-mark',
23
20
  'data-level': mark.attrs.level
24
21
  }, 0];
25
22
  }
26
-
27
23
  };
@@ -1,22 +1,18 @@
1
1
  import { LINK } from '../groups';
2
2
  import { isSafeUrl, normalizeUrl } from '../../utils/url';
3
-
4
3
  const getLinkAttrs = attribute => domNode => {
5
4
  const dom = domNode;
6
5
  const href = dom.getAttribute(attribute) || '';
7
6
  const attrs = {
8
7
  __confluenceMetadata: dom.hasAttribute('__confluenceMetadata') ? JSON.parse(dom.getAttribute('__confluenceMetadata') || '') : undefined
9
8
  };
10
-
11
9
  if (isSafeUrl(href)) {
12
10
  attrs.href = normalizeUrl(href);
13
11
  } else {
14
12
  return false;
15
13
  }
16
-
17
14
  return attrs;
18
15
  };
19
-
20
16
  export const link = {
21
17
  excludes: `${LINK}`,
22
18
  // ED-5844 No multiple links in media node
@@ -43,7 +39,6 @@ export const link = {
43
39
  tag: 'a[href]',
44
40
  getAttrs: getLinkAttrs('href')
45
41
  }],
46
-
47
42
  toDOM(node, isInline) {
48
43
  const attrs = Object.keys(node.attrs).reduce((attrs, key) => {
49
44
  if (key === '__confluenceMetadata') {
@@ -55,20 +50,17 @@ export const link = {
55
50
  } else {
56
51
  attrs[key] = node.attrs[key];
57
52
  }
58
-
59
53
  return attrs;
60
54
  }, {});
61
-
62
55
  if (isInline) {
63
56
  return ['a', attrs];
64
57
  }
65
-
66
- return ['a', { ...attrs,
58
+ return ['a', {
59
+ ...attrs,
67
60
  ['data-block-link']: 'true',
68
61
  class: 'blockLink'
69
62
  }, 0];
70
63
  }
71
-
72
64
  };
73
65
  const OPTIONAL_ATTRS = ['title', 'id', 'collection', 'occurrenceKey', '__confluenceMetadata'];
74
66
  export const toJSON = mark => ({
@@ -77,7 +69,6 @@ export const toJSON = mark => ({
77
69
  if (OPTIONAL_ATTRS.indexOf(key) === -1 || mark.attrs[key] !== null) {
78
70
  attrs[key] = mark.attrs[key];
79
71
  }
80
-
81
72
  return attrs;
82
73
  }, {})
83
74
  });
@@ -1,4 +1,5 @@
1
1
  import { FONT_STYLE } from '../groups';
2
+
2
3
  /**
3
4
  * @name strike_mark
4
5
  */
@@ -16,9 +17,7 @@ export const strike = {
16
17
  style: 'text-decoration',
17
18
  getAttrs: value => value === 'line-through' && null
18
19
  }],
19
-
20
20
  toDOM() {
21
21
  return ['s'];
22
22
  }
23
-
24
23
  };
@@ -1,4 +1,5 @@
1
1
  import { FONT_STYLE } from '../groups';
2
+
2
3
  /**
3
4
  * @name strong_mark
4
5
  */
@@ -9,20 +10,18 @@ export const strong = {
9
10
  group: FONT_STYLE,
10
11
  parseDOM: [{
11
12
  tag: 'strong'
12
- }, // This works around a Google Docs misbehavior where
13
+ },
14
+ // This works around a Google Docs misbehavior where
13
15
  // pasted content will be inexplicably wrapped in `<b>`
14
16
  // tags with a font-weight normal.
15
17
  {
16
18
  tag: 'b',
17
-
18
19
  getAttrs(node) {
19
20
  const element = node;
20
21
  return element.style.fontWeight !== 'normal' && null;
21
22
  }
22
-
23
23
  }, {
24
24
  tag: 'span',
25
-
26
25
  getAttrs(node) {
27
26
  const element = node;
28
27
  const {
@@ -30,11 +29,8 @@ export const strong = {
30
29
  } = element.style;
31
30
  return typeof fontWeight === 'string' && (fontWeight === 'bold' || fontWeight === 'bolder' || /^(bold(er)?|[5-9]\d{2,})$/.test(fontWeight)) && null;
32
31
  }
33
-
34
32
  }],
35
-
36
33
  toDOM() {
37
34
  return strongDOM;
38
35
  }
39
-
40
36
  };
@@ -1,19 +1,15 @@
1
1
  import { FONT_STYLE } from '../groups';
2
-
3
2
  function getAttrFromVerticalAlign(node) {
4
3
  if (node.style.verticalAlign) {
5
4
  const type = node.style.verticalAlign.slice(0, 3);
6
-
7
5
  if (type === 'sub' || type === 'sup') {
8
6
  return {
9
7
  type
10
8
  };
11
9
  }
12
10
  }
13
-
14
11
  return false;
15
12
  }
16
-
17
13
  export const subsup = {
18
14
  inclusive: true,
19
15
  group: FONT_STYLE,
@@ -43,9 +39,7 @@ export const subsup = {
43
39
  style: 'vertical-align=sub',
44
40
  getAttrs: node => getAttrFromVerticalAlign(node)
45
41
  }],
46
-
47
42
  toDOM(mark) {
48
43
  return [mark.attrs.type];
49
44
  }
50
-
51
45
  };
@@ -2,34 +2,53 @@ import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
2
2
  import { COLOR } from '../groups';
3
3
  import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500 } from '../../utils/colors';
4
4
  // used for extended palette in text color picker
5
- const colorArrayPalette = [// default row - first color is added programatically
5
+ const colorArrayPalette = [
6
+ // default row - first color is added programatically
6
7
  // [N800, 'Squid ink'], // default dark gray
7
- [B500, 'Dark blue'], // Chore coat
8
- [T500, 'Dark teal'], // Shabby chic
9
- [G500, 'Dark green'], // Keen green
10
- [Y400, 'Orange'], // Cheezy blasters
11
- [R500, 'Dark red'], // Dragon's blood
12
- [P500, 'Dark purple'], // Prince
8
+ [B500, 'Dark blue'],
9
+ // Chore coat
10
+ [T500, 'Dark teal'],
11
+ // Shabby chic
12
+ [G500, 'Dark green'],
13
+ // Keen green
14
+ [Y400, 'Orange'],
15
+ // Cheezy blasters
16
+ [R500, 'Dark red'],
17
+ // Dragon's blood
18
+ [P500, 'Dark purple'],
19
+ // Prince
13
20
  // row 2
14
- [N80, 'Light gray'], // Spooky ghost
15
- [B100, 'Blue'], // Arvo breeze
16
- [T300, 'Teal'], // Tamarama
17
- [G300, 'Green'], // Fine pine
18
- [Y200, 'Yellow'], // Pub mix
19
- [R300, 'Red'], // Poppy surprise
20
- [P300, 'Purple'], // Da' juice
21
+ [N80, 'Light gray'],
22
+ // Spooky ghost
23
+ [B100, 'Blue'],
24
+ // Arvo breeze
25
+ [T300, 'Teal'],
26
+ // Tamarama
27
+ [G300, 'Green'],
28
+ // Fine pine
29
+ [Y200, 'Yellow'],
30
+ // Pub mix
31
+ [R300, 'Red'],
32
+ // Poppy surprise
33
+ [P300, 'Purple'],
34
+ // Da' juice
21
35
  // row 3
22
- [N0, 'White'], [B75, 'Light blue'], // Schwag
23
- [T75, 'Light teal'], // Arctic chill
24
- [G75, 'Light green'], // Mintie
25
- [Y75, 'Light yellow'], // Dandelion whisper
26
- [R75, 'Light red'], // Bondi sunburn
36
+ [N0, 'White'], [B75, 'Light blue'],
37
+ // Schwag
38
+ [T75, 'Light teal'],
39
+ // Arctic chill
40
+ [G75, 'Light green'],
41
+ // Mintie
42
+ [Y75, 'Light yellow'],
43
+ // Dandelion whisper
44
+ [R75, 'Light red'],
45
+ // Bondi sunburn
27
46
  [P50, 'Light purple'] // Lavender secret
28
- ]; // @see https://product-fabric.atlassian.net/wiki/spaces/E/pages/55979455/Colour+picker+decisions#Colourpickerdecisions-Visualdesigndecisions
47
+ ];
29
48
 
49
+ // @see https://product-fabric.atlassian.net/wiki/spaces/E/pages/55979455/Colour+picker+decisions#Colourpickerdecisions-Visualdesigndecisions
30
50
  export const colorPalette = new Map();
31
51
  /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
32
-
33
52
  export const colorPaletteExtended = colorPalette;
34
53
  colorArrayPalette.forEach(([color, label]) => colorPalette.set(color.toLowerCase(), label));
35
54
  export const textColor = {
@@ -43,19 +62,18 @@ export const textColor = {
43
62
  getAttrs: maybeValue => {
44
63
  const value = maybeValue;
45
64
  let hexColor;
46
-
47
65
  if (value.match(/^rgb/i)) {
48
66
  hexColor = rgbToHex(value);
49
67
  } else if (value[0] === '#') {
50
68
  hexColor = value.toLowerCase();
51
- } // else handle other colour formats
52
-
53
-
69
+ }
70
+ // else handle other colour formats
54
71
  return hexColor && colorPalette.has(hexColor) ? {
55
72
  color: hexColor
56
73
  } : false;
57
74
  }
58
- }, // This rule ensures when loading from a renderer or editor where the
75
+ },
76
+ // This rule ensures when loading from a renderer or editor where the
59
77
  // presented text color does not match the stored hex color -- that the
60
78
  // text color is preserved.
61
79
  //
@@ -69,14 +87,12 @@ export const textColor = {
69
87
  if (!(maybeElement instanceof HTMLElement)) {
70
88
  return false;
71
89
  }
72
-
73
90
  const hexColor = maybeElement.dataset.textCustomColor;
74
91
  return hexColor && colorPalette.has(hexColor) ? {
75
92
  color: hexColor
76
93
  } : false;
77
94
  }
78
95
  }],
79
-
80
96
  toDOM(mark) {
81
97
  // Note -- while there is no way to create custom colors using default tooling
82
98
  // the editor does supported ad hoc color values -- and there may be content
@@ -88,5 +104,4 @@ export const textColor = {
88
104
  ['data-text-custom-color']: mark.attrs.color
89
105
  }];
90
106
  }
91
-
92
107
  };