@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 25.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`391a8ec684e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/391a8ec684e) - [ESS-3165] Move fragment mark and mediaInline node into the default schema
8
+
9
+ ## 25.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`4f6a895f1d5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4f6a895f1d5) - Set selectable property for selectable nodes
14
+ - [`5ac1c18bd04`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5ac1c18bd04) - [ux] Fix selection blocking issue where user cannot left/right arrow key past a mediaSingle
15
+ - Updated dependencies
16
+
3
17
  ## 25.1.0
4
18
 
5
19
  ### Minor Changes
package/dist/cjs/index.js CHANGED
@@ -999,7 +999,5 @@ Object.defineProperty(exports, "uuid", {
999
999
  return _utils.uuid;
1000
1000
  }
1001
1001
  });
1002
-
1003
1002
  var _schema = require("./schema");
1004
-
1005
1003
  var _utils = require("./utils");
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -17,7 +16,5 @@ Object.defineProperty(exports, "stageZeroSchema", {
17
16
  return _stage.default;
18
17
  }
19
18
  });
20
-
21
19
  var _full = _interopRequireDefault(require("../../json-schema/v1/full.json"));
22
-
23
20
  var _stage = _interopRequireDefault(require("../../json-schema/v1/stage-0.json"));
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bitbucketSchema = void 0;
7
-
8
7
  var _createSchema = require("./create-schema");
9
-
10
8
  /**
11
9
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
12
10
  **/
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.confluenceSchemaWithMediaSingle = exports.confluenceSchema = void 0;
7
-
8
7
  var _createSchema = require("./create-schema");
9
-
10
8
  var nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaInline', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
11
9
  var marks = ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'mentionQuery', 'code', 'textColor', 'confluenceInlineComment', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute'];
10
+
12
11
  /**
13
12
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
14
13
  **/
15
-
16
14
  var confluenceSchema = (0, _createSchema.createSchema)({
17
15
  nodes: nodes,
18
16
  marks: marks
@@ -20,7 +18,6 @@ var confluenceSchema = (0, _createSchema.createSchema)({
20
18
  /**
21
19
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
22
20
  **/
23
-
24
21
  exports.confluenceSchema = confluenceSchema;
25
22
  var confluenceSchemaWithMediaSingle = (0, _createSchema.createSchema)({
26
23
  nodes: nodes.concat('mediaSingle'),
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -9,63 +8,50 @@ exports.allowCustomPanel = void 0;
9
8
  exports.createSchema = createSchema;
10
9
  exports.sanitizeNodeSpecContent = sanitizeNodeSpecContent;
11
10
  exports.sanitizeNodes = sanitizeNodes;
12
-
13
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
-
15
12
  var _prosemirrorModel = require("prosemirror-model");
16
-
17
13
  var _groups = require("./groups");
18
-
19
14
  var _marks = require("./marks");
20
-
21
15
  var _nodes = require("./nodes");
22
-
23
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
-
25
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
-
27
18
  function addItems(builtInItems, config) {
28
19
  var customSpecs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
29
-
30
20
  if (!config) {
31
21
  return {};
32
22
  }
23
+
33
24
  /**
34
25
  * Add built-in Node / Mark specs
35
26
  */
36
-
37
-
38
27
  var items = builtInItems.reduce(function (items, _ref) {
39
28
  var name = _ref.name,
40
- spec = _ref.spec;
41
-
29
+ spec = _ref.spec;
42
30
  if (config.indexOf(name) !== -1) {
43
31
  items[name] = customSpecs[name] || spec;
44
32
  }
45
-
46
33
  return items;
47
34
  }, {});
35
+
48
36
  /**
49
37
  * Add Custom Node / Mark specs
50
38
  */
51
-
52
39
  return Object.keys(customSpecs).reduce(function (items, name) {
53
40
  if (items[name]) {
54
41
  return items;
55
42
  }
56
-
57
43
  items[name] = customSpecs[name];
58
44
  return items;
59
45
  }, items);
60
- } // We use groups to allow schemas to be constructed in different shapes without changing node/mark
46
+ }
47
+
48
+ // We use groups to allow schemas to be constructed in different shapes without changing node/mark
61
49
  // specs, but this means nodes/marks are defined with groups that might never be used in the schema.
62
50
  // In this scenario ProseMirror will complain and prevent the schema from being constructed.
63
51
  //
64
52
  // To avoid the problem, we include items that serve to "declare" the groups in the schema. This
65
53
  // approach unfortunately leaves unused items in the schema, but has the benefit of avoiding the
66
54
  // need to manipulate `exclude` or content expression values for potentially every schema item.
67
-
68
-
69
55
  function groupDeclaration(name) {
70
56
  return {
71
57
  name: "__".concat(name, "GroupDeclaration"),
@@ -74,7 +60,6 @@ function groupDeclaration(name) {
74
60
  }
75
61
  };
76
62
  }
77
-
78
63
  var markGroupDeclarations = [groupDeclaration(_groups.COLOR), groupDeclaration(_groups.FONT_STYLE), groupDeclaration(_groups.SEARCH_QUERY), groupDeclaration(_groups.LINK)];
79
64
  var markGroupDeclarationsNames = markGroupDeclarations.map(function (groupMark) {
80
65
  return groupMark.name;
@@ -276,13 +261,13 @@ var marksInOrder = [{
276
261
  name: 'unsupportedNodeAttribute',
277
262
  spec: _marks.unsupportedNodeAttribute
278
263
  }]);
264
+
279
265
  /**
280
266
  * Creates a schema preserving order of marks and nodes.
281
267
  */
282
-
283
268
  function createSchema(config) {
284
269
  var customNodeSpecs = config.customNodeSpecs,
285
- customMarkSpecs = config.customMarkSpecs;
270
+ customMarkSpecs = config.customMarkSpecs;
286
271
  var nodesConfig = Object.keys(customNodeSpecs || {}).concat(config.nodes);
287
272
  var marksConfig = Object.keys(customMarkSpecs || {}).concat(config.marks || []).concat(markGroupDeclarationsNames);
288
273
  var nodes = addItems(nodesInOrder, nodesConfig, customNodeSpecs);
@@ -293,27 +278,22 @@ function createSchema(config) {
293
278
  marks: marks
294
279
  });
295
280
  }
296
-
297
281
  function sanitizeNodes(nodes, supportedMarks) {
298
282
  var nodeNames = Object.keys(nodes);
299
283
  nodeNames.forEach(function (nodeKey) {
300
284
  var nodeSpec = _objectSpread({}, nodes[nodeKey]);
301
-
302
285
  if (nodeSpec.marks && nodeSpec.marks !== '_') {
303
286
  nodeSpec.marks = nodeSpec.marks.split(' ').filter(function (mark) {
304
287
  return !!supportedMarks[mark];
305
288
  }).join(' ');
306
289
  }
307
-
308
290
  if (nodeSpec.content) {
309
291
  nodeSpec.content = sanitizeNodeSpecContent(nodes, nodeSpec.content);
310
292
  }
311
-
312
293
  nodes[nodeKey] = nodeSpec;
313
294
  });
314
295
  return nodes;
315
296
  }
316
-
317
297
  function sanitizeNodeSpecContent(nodes, rawContent) {
318
298
  var content = rawContent.replace(/\W/g, ' ');
319
299
  var contentKeys = content.split(' ');
@@ -324,38 +304,32 @@ function sanitizeNodeSpecContent(nodes, rawContent) {
324
304
  return sanitizedContent(newContent, nodeName);
325
305
  }, rawContent);
326
306
  }
327
-
328
307
  function sanitizedContent(content, invalidContent) {
329
308
  if (!invalidContent.length) {
330
309
  return content || '';
331
310
  }
332
-
333
311
  if (!content || !content.match(/\w/)) {
334
312
  return '';
335
313
  }
336
-
337
314
  var pattern = "(".concat(invalidContent, "((\\s)*\\|)+)|((\\|(\\s)*)+").concat(invalidContent, ")|(").concat(invalidContent, "$)|(").concat(invalidContent, "(\\+|\\*))");
338
315
  return content.replace(new RegExp(pattern, 'g'), '').replace(' ', ' ').trim();
339
316
  }
340
-
341
317
  function isContentSupported(nodes, contentKey) {
342
- var nodeKeys = Object.keys(nodes); // content is with valid node
318
+ var nodeKeys = Object.keys(nodes);
343
319
 
320
+ // content is with valid node
344
321
  if (nodeKeys.indexOf(contentKey) > -1) {
345
322
  return true;
346
- } // content is with valid group
347
-
323
+ }
348
324
 
325
+ // content is with valid group
349
326
  for (var supportedKey in nodes) {
350
327
  var nodeSpec = nodes[supportedKey];
351
-
352
328
  if (nodeSpec && nodeSpec.group === contentKey) {
353
329
  return true;
354
330
  }
355
331
  }
356
-
357
332
  return false;
358
333
  }
359
-
360
334
  var allowCustomPanel = true;
361
335
  exports.allowCustomPanel = allowCustomPanel;
@@ -4,42 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getSchemaBasedOnStage = exports.defaultSchemaConfig = exports.defaultSchema = void 0;
7
-
8
7
  var _nodes = require("./nodes");
9
-
10
- var _marks = require("./marks");
11
-
12
8
  var _createSchema = require("./create-schema");
13
-
14
9
  var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
15
10
  var defaultSchemaConfig = {
16
11
  nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'caption', 'mention', 'media', 'mediaGroup', 'mediaSingle', 'mediaInline', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'hardBreak', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'decisionList', 'decisionItem', 'taskList', 'taskItem', 'unknownBlock', 'date', 'status', 'placeholder', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard', 'unsupportedBlock', 'unsupportedInline'],
17
- marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery' // https://product-fabric.atlassian.net/browse/ED-10214,
18
- ]
12
+ marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery',
13
+ // https://product-fabric.atlassian.net/browse/ED-10214,
14
+ 'fragment']
19
15
  };
20
16
  return defaultSchemaConfig;
21
17
  };
22
-
23
18
  var defaultSchemaConfig = getDefaultSchemaConfig();
24
19
  exports.defaultSchemaConfig = defaultSchemaConfig;
25
-
26
20
  var getSchemaBasedOnStage = function getSchemaBasedOnStage() {
27
21
  var stage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'final';
28
22
  var defaultSchemaConfig = getDefaultSchemaConfig();
29
-
30
23
  if (stage === 'stage0') {
31
24
  defaultSchemaConfig.customNodeSpecs = {
32
25
  layoutSection: _nodes.layoutSectionWithSingleColumn
33
26
  };
34
- defaultSchemaConfig.customMarkSpecs = {
35
- fragment: _marks.fragment
36
- };
37
- defaultSchemaConfig.nodes.push('mediaInline');
38
27
  }
39
-
40
28
  return (0, _createSchema.createSchema)(defaultSchemaConfig);
41
29
  };
42
-
43
30
  exports.getSchemaBasedOnStage = getSchemaBasedOnStage;
44
31
  var defaultSchema = getSchemaBasedOnStage();
45
32
  exports.defaultSchema = defaultSchema;
@@ -13,23 +13,30 @@ exports.SEARCH_QUERY = exports.LINK = exports.INDENTATION = exports.FONT_STYLE =
13
13
  //
14
14
  // Groups provide a level of indirection, and solve this problem. For the immediate use-case, one
15
15
  // group called "not_code" would have sufficed, but this an ultra-specialised to code.
16
+
16
17
  // Mark group for font styling (e.g. bold, italic, underline, superscript).
17
- var FONT_STYLE = 'fontStyle'; // Marks group for search queries.
18
+ var FONT_STYLE = 'fontStyle';
18
19
 
20
+ // Marks group for search queries.
19
21
  exports.FONT_STYLE = FONT_STYLE;
20
- var SEARCH_QUERY = 'searchQuery'; // Marks group for links.
22
+ var SEARCH_QUERY = 'searchQuery';
21
23
 
24
+ // Marks group for links.
22
25
  exports.SEARCH_QUERY = SEARCH_QUERY;
23
- var LINK = 'link'; // Marks group for colors (text-color, background-color, etc).
26
+ var LINK = 'link';
24
27
 
28
+ // Marks group for colors (text-color, background-color, etc).
25
29
  exports.LINK = LINK;
26
- var COLOR = 'color'; // They need to be on their own group so that they can exclude each other
30
+ var COLOR = 'color';
31
+
32
+ // They need to be on their own group so that they can exclude each other
27
33
  // and also work when one of them is disabled.
28
- // Marks group for alignment.
29
34
 
35
+ // Marks group for alignment.
30
36
  exports.COLOR = COLOR;
31
- var ALIGNMENT = 'alignment'; // Marks group for indentation.
37
+ var ALIGNMENT = 'alignment';
32
38
 
39
+ // Marks group for indentation.
33
40
  exports.ALIGNMENT = ALIGNMENT;
34
41
  var INDENTATION = 'indentation';
35
42
  exports.INDENTATION = INDENTATION;
@@ -633,13 +633,8 @@ Object.defineProperty(exports, "unsupportedNodeTypesForMediaCards", {
633
633
  return _unsupported.unsupportedNodeTypesForMediaCards;
634
634
  }
635
635
  });
636
-
637
636
  var _nodes = require("./nodes");
638
-
639
637
  var _marks = require("./marks");
640
-
641
638
  var _unsupported = require("./unsupported");
642
-
643
639
  var _inlineNodes = require("./inline-nodes");
644
-
645
640
  var _createSchema = require("./create-schema");
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.inlineNodes = void 0;
9
-
10
8
  var nodes = _interopRequireWildcard(require("./nodes"));
11
-
12
9
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
-
14
10
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
-
16
11
  var typedNodes = nodes;
17
12
  var inlineNodes = new Set(Object.keys(typedNodes).filter(function (key) {
18
13
  return typedNodes[key] && typedNodes[key].group === 'inline';
@@ -15,61 +15,47 @@ exports.isSchemaWithMentions = isSchemaWithMentions;
15
15
  exports.isSchemaWithSubSupMark = isSchemaWithSubSupMark;
16
16
  exports.isSchemaWithTables = isSchemaWithTables;
17
17
  exports.isSchemaWithTextColor = isSchemaWithTextColor;
18
-
19
18
  var _createSchema = require("./create-schema");
20
-
21
19
  /**
22
20
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
23
21
  **/
24
22
  function makeSchema(config) {
25
23
  var nodes = ['doc', 'paragraph', 'text', 'hardBreak', 'heading', 'rule'];
26
24
  var marks = ['strong', 'em', 'underline', 'typeAheadQuery', 'unsupportedMark', 'unsupportedNodeAttribute'];
27
-
28
25
  if (config.allowLinks) {
29
26
  marks.push('link');
30
27
  }
31
-
32
28
  if (config.allowLists) {
33
29
  nodes.push('orderedList', 'bulletList', 'listItem');
34
30
  }
35
-
36
31
  if (config.allowMentions) {
37
32
  nodes.push('mention');
38
33
  marks.push('mentionQuery');
39
34
  }
40
-
41
35
  if (config.allowEmojis) {
42
36
  nodes.push('emoji');
43
37
  }
44
-
45
38
  if (config.allowAdvancedTextFormatting) {
46
39
  marks.push('strike', 'code');
47
40
  }
48
-
49
41
  if (config.allowSubSup) {
50
42
  marks.push('subsup');
51
43
  }
52
-
53
44
  if (config.allowCodeBlock) {
54
45
  nodes.push('codeBlock');
55
46
  }
56
-
57
47
  if (config.allowBlockQuote) {
58
48
  nodes.push('blockquote');
59
49
  }
60
-
61
50
  if (config.allowMedia) {
62
51
  nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption', 'mediaInline');
63
52
  }
64
-
65
53
  if (config.allowTextColor) {
66
54
  marks.push('textColor');
67
55
  }
68
-
69
56
  if (config.allowTables) {
70
57
  nodes.push('table', 'tableCell', 'tableHeader', 'tableRow');
71
58
  }
72
-
73
59
  return (0, _createSchema.createSchema)({
74
60
  nodes: nodes,
75
61
  marks: marks
@@ -78,88 +64,66 @@ function makeSchema(config) {
78
64
  /**
79
65
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
80
66
  **/
81
-
82
-
83
67
  function isSchemaWithLists(schema) {
84
68
  return !!schema.nodes.bulletList;
85
69
  }
86
70
  /**
87
71
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
88
72
  **/
89
-
90
-
91
73
  function isSchemaWithMentions(schema) {
92
74
  return !!schema.nodes.mention;
93
75
  }
94
76
  /**
95
77
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
96
78
  **/
97
-
98
-
99
79
  function isSchemaWithEmojis(schema) {
100
80
  return !!schema.nodes.emoji;
101
81
  }
102
82
  /**
103
83
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
104
84
  **/
105
-
106
-
107
85
  function isSchemaWithLinks(schema) {
108
86
  return !!schema.marks.link;
109
87
  }
110
88
  /**
111
89
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
112
90
  **/
113
-
114
-
115
91
  function isSchemaWithAdvancedTextFormattingMarks(schema) {
116
92
  return !!schema.marks.code && !!schema.marks.strike;
117
93
  }
118
94
  /**
119
95
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
120
96
  **/
121
-
122
-
123
97
  function isSchemaWithSubSupMark(schema) {
124
98
  return !!schema.marks.subsup;
125
99
  }
126
100
  /**
127
101
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
128
102
  **/
129
-
130
-
131
103
  function isSchemaWithCodeBlock(schema) {
132
104
  return !!schema.nodes.codeBlock;
133
105
  }
134
106
  /**
135
107
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
136
108
  **/
137
-
138
-
139
109
  function isSchemaWithBlockQuotes(schema) {
140
110
  return !!schema.nodes.blockquote;
141
111
  }
142
112
  /**
143
113
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
144
114
  **/
145
-
146
-
147
115
  function isSchemaWithMedia(schema) {
148
116
  return !!schema.nodes.mediaGroup && !!schema.nodes.media && !!schema.nodes.mediaInline;
149
117
  }
150
118
  /**
151
119
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
152
120
  **/
153
-
154
-
155
121
  function isSchemaWithTextColor(schema) {
156
122
  return !!schema.marks.textColor;
157
123
  }
158
124
  /**
159
125
  * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
160
126
  **/
161
-
162
-
163
127
  function isSchemaWithTables(schema) {
164
128
  return !!schema.nodes.table && !!schema.nodes.tableCell && !!schema.nodes.tableHeader && !!schema.nodes.tableRow;
165
129
  }
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.alignmentPositionMap = exports.alignment = void 0;
7
-
8
7
  var _groups = require("../groups");
9
-
10
8
  /** TODO: Flip these positions for RTL */
11
9
  var alignmentPositionMap = {
12
10
  end: 'right',
@@ -1,56 +1,44 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.annotation = exports.AnnotationTypes = exports.AnnotationMarkStates = void 0;
9
8
  exports.buildDataAttributes = buildDataAttributes;
10
-
11
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
-
13
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
-
15
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
-
17
12
  /**
18
13
  * @name annotation_mark
19
14
  */
20
15
  var AnnotationTypes;
21
16
  exports.AnnotationTypes = AnnotationTypes;
22
-
23
17
  (function (AnnotationTypes) {
24
18
  AnnotationTypes["INLINE_COMMENT"] = "inlineComment";
25
19
  })(AnnotationTypes || (exports.AnnotationTypes = AnnotationTypes = {}));
26
-
27
20
  var AnnotationMarkStates;
28
21
  exports.AnnotationMarkStates = AnnotationMarkStates;
29
-
30
22
  (function (AnnotationMarkStates) {
31
23
  AnnotationMarkStates["RESOLVED"] = "resolved";
32
24
  AnnotationMarkStates["ACTIVE"] = "active";
33
25
  })(AnnotationMarkStates || (exports.AnnotationMarkStates = AnnotationMarkStates = {}));
34
-
35
26
  function buildDataAttributes(_ref) {
36
27
  var id = _ref.id,
37
- annotationType = _ref.annotationType,
38
- state = _ref.state;
28
+ annotationType = _ref.annotationType,
29
+ state = _ref.state;
39
30
  var data = {
40
31
  'data-mark-type': 'annotation',
41
32
  'data-mark-annotation-type': annotationType,
42
33
  'data-id': id
43
34
  };
44
-
45
35
  if (state) {
46
36
  return _objectSpread(_objectSpread({}, data), {}, {
47
37
  'data-mark-annotation-state': state
48
38
  });
49
39
  }
50
-
51
40
  return data;
52
41
  }
53
-
54
42
  var annotation = {
55
43
  inclusive: true,
56
44
  group: 'annotation',
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.code = void 0;
7
-
8
7
  var _groups = require("../groups");
9
-
10
8
  var code = {
11
9
  excludes: "".concat(_groups.FONT_STYLE, " ").concat(_groups.LINK, " ").concat(_groups.SEARCH_QUERY, " ").concat(_groups.COLOR),
12
10
  inclusive: true,
@@ -24,15 +22,12 @@ var code = {
24
22
  preserveWhitespace: true,
25
23
  getAttrs: function getAttrs(domNode) {
26
24
  var dom = domNode;
27
-
28
25
  if (dom.style.whiteSpace === 'pre') {
29
26
  return {};
30
27
  }
31
-
32
28
  if (dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') >= 0) {
33
29
  return {};
34
30
  }
35
-
36
31
  return false;
37
32
  }
38
33
  }],
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.confluenceInlineComment = void 0;
7
-
8
7
  /**
9
8
  * @name inline_comment_marker
10
9
  * @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.
11
10
  */
11
+
12
12
  var confluenceInlineComment = {
13
13
  inclusive: false,
14
14
  excludes: '',