@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
@@ -3,37 +3,27 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
-
7
6
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
-
9
7
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
-
11
8
  import { Slice } from 'prosemirror-model';
12
9
  import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror-transform';
13
10
  export var insertTypeAheadStepType = 'atlaskit-insert-type-ahead';
14
11
  export var InsertTypeAheadStages;
15
-
16
12
  (function (InsertTypeAheadStages) {
17
13
  InsertTypeAheadStages["DELETING_RAW_QUERY"] = "DELETING_RAW_QUERY";
18
14
  InsertTypeAheadStages["INSERTING_ITEM"] = "INSERTING_ITEM";
19
15
  })(InsertTypeAheadStages || (InsertTypeAheadStages = {}));
20
-
21
16
  export var InsertTypeAheadStep = /*#__PURE__*/function (_Step) {
22
17
  _inherits(InsertTypeAheadStep, _Step);
23
-
24
18
  var _super = _createSuper(InsertTypeAheadStep);
25
-
26
19
  function InsertTypeAheadStep(_ref) {
27
20
  var _this;
28
-
29
21
  var stage = _ref.stage,
30
- query = _ref.query,
31
- trigger = _ref.trigger,
32
- selectedIndex = _ref.selectedIndex;
22
+ query = _ref.query,
23
+ trigger = _ref.trigger,
24
+ selectedIndex = _ref.selectedIndex;
33
25
  var isInvertStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
34
-
35
26
  _classCallCheck(this, InsertTypeAheadStep);
36
-
37
27
  _this = _super.call(this);
38
28
  _this.isInvertStep = isInvertStep;
39
29
  _this.stage = stage;
@@ -42,7 +32,6 @@ export var InsertTypeAheadStep = /*#__PURE__*/function (_Step) {
42
32
  _this.selectedIndex = selectedIndex;
43
33
  return _this;
44
34
  }
45
-
46
35
  _createClass(InsertTypeAheadStep, [{
47
36
  key: "invert",
48
37
  value: function invert() {
@@ -82,8 +71,8 @@ export var InsertTypeAheadStep = /*#__PURE__*/function (_Step) {
82
71
  query: this.query,
83
72
  trigger: this.trigger,
84
73
  selectedIndex: this.selectedIndex
85
- }; // Return the same events, this step will never be removed
86
-
74
+ };
75
+ // Return the same events, this step will never be removed
87
76
  return new InsertTypeAheadStep(config, this.isInvertStep);
88
77
  }
89
78
  }, {
@@ -109,9 +98,8 @@ export var InsertTypeAheadStep = /*#__PURE__*/function (_Step) {
109
98
  return new ReplaceStep(0, 0, Slice.empty);
110
99
  }
111
100
  }]);
112
-
113
101
  return InsertTypeAheadStep;
114
102
  }(Step);
115
- /** Register this step with Prosemirror */
116
103
 
104
+ /** Register this step with Prosemirror */
117
105
  Step.jsonID(insertTypeAheadStepType, InsertTypeAheadStep);
@@ -53,18 +53,17 @@ export var T75 = '#B3F5FF';
53
53
  export var T100 = '#79E2F2';
54
54
  export var T300 = '#00B8D9';
55
55
  export var T500 = '#008DA6';
56
+
56
57
  /**
57
- * @return String with HEX-coded color
58
+ * @return String with HEX-coded color.
58
59
  */
59
-
60
60
  export function normalizeHexColor(color, defaultColor) {
61
61
  if (!color) {
62
62
  return null;
63
- } // Normalize to hex
64
-
63
+ }
65
64
 
65
+ // Normalize to hex
66
66
  color = color.trim().toLowerCase();
67
-
68
67
  if (isHex(color)) {
69
68
  // Normalize 3-hex to 6-hex colours
70
69
  if (color.length === 4) {
@@ -86,66 +85,56 @@ export function normalizeHexColor(color, defaultColor) {
86
85
  return null;
87
86
  }
88
87
  }
89
-
90
88
  if (color === defaultColor) {
91
89
  return null;
92
90
  }
93
-
94
91
  return color;
95
92
  }
93
+
96
94
  /**
97
95
  * Converts hex color format to rgb.
98
96
  * Works well with full hex color format and shortcut as well.
99
97
  *
100
98
  * @param hex - hex color string (#xxx, or #xxxxxx)
101
99
  */
102
-
103
100
  export function hexToRgb(color) {
104
101
  if (!isHex(color)) {
105
102
  return null;
106
103
  }
107
-
108
104
  var colorBits = color.substring(1).split('');
109
-
110
105
  if (colorBits.length === 3) {
111
106
  colorBits = [colorBits[0], colorBits[0], colorBits[1], colorBits[1], colorBits[2], colorBits[2]];
112
107
  }
113
-
114
- var rgb = Number("0x".concat(colorBits.join(''))); // eslint-disable-next-line no-bitwise
115
-
108
+ var rgb = Number("0x".concat(colorBits.join('')));
109
+ // eslint-disable-next-line no-bitwise
116
110
  return "rgb(".concat(rgb >> 16 & 255, ",").concat(rgb >> 8 & 255, ",").concat(rgb & 255, ")");
117
111
  }
112
+
118
113
  /**
119
114
  * Converts hex color format to rgba.
120
115
  *
121
116
  * @param hex - hex color string (#xxx, or #xxxxxx)
122
117
  */
123
-
124
118
  export function hexToRgba(rawColor, alpha) {
125
119
  var color = normalizeHexColor(rawColor);
126
-
127
120
  if (!color) {
128
121
  return null;
129
122
  }
130
-
131
123
  var hex2rgb = function hex2rgb(color) {
132
124
  return color.match(/[a-z0-9]{2}/gi).map(function (hex) {
133
125
  return parseInt(hex, 16);
134
126
  });
135
127
  };
136
-
137
128
  return "rgba(".concat(hex2rgb(color).concat(alpha).join(','), ")");
138
129
  }
139
130
  export function rgbToHex(value) {
140
131
  var matches = value.match(/(0?\.?\d{1,3})%?\b/g);
141
-
142
132
  if (matches && matches.length >= 3) {
143
133
  var _matches$map = matches.map(Number),
144
- _matches$map2 = _slicedToArray(_matches$map, 3),
145
- red = _matches$map2[0],
146
- green = _matches$map2[1],
147
- blue = _matches$map2[2];
148
-
134
+ _matches$map2 = _slicedToArray(_matches$map, 3),
135
+ red = _matches$map2[0],
136
+ green = _matches$map2[1],
137
+ blue = _matches$map2[2];
149
138
  return '#' + (blue | green << 8 | red << 16 | 1 << 24).toString(16).slice(1) // eslint-disable-line no-bitwise
150
139
  ;
151
140
  }
@@ -1,9 +1,12 @@
1
1
  // Default emoji id for Confluence glyphs that has no match to Fabric Emoji
2
- var DEFAULT_EMOJI_ID = '2b50'; // Default ac:name for emoticons as a fallback is `blue-star`
2
+ var DEFAULT_EMOJI_ID = '2b50';
3
3
 
4
- var DEFAULT_EMOJI_ACNAME = 'blue-star'; // ac:hipchat-emoticon prefix when converting to Emoji ID
4
+ // Default ac:name for emoticons as a fallback is `blue-star`
5
+ var DEFAULT_EMOJI_ACNAME = 'blue-star';
5
6
 
7
+ // ac:hipchat-emoticon prefix when converting to Emoji ID
6
8
  var HC_EMOTICON_PREFIX = 'atlassian-';
9
+
7
10
  /**
8
11
  * Confluence glyphs ac:name of <ac:emoticon /> map to new emojis
9
12
  * {
@@ -13,7 +16,6 @@ var HC_EMOTICON_PREFIX = 'atlassian-';
13
16
  * Glyphs that do not map to Fabric Emoji
14
17
  * will be mapped to Emoji Id '2b50' (:star:) with preserving ac:name as shortName attribute;
15
18
  */
16
-
17
19
  var acNameToEmojiMap = {
18
20
  smile: ['1f642', ':slight_smile:', "\uD83D\uDE42"],
19
21
  sad: ['1f641', ':slight_frown:', "\uD83D\uDE41"],
@@ -54,7 +56,6 @@ export function emojiIdToAcName(emojiId) {
54
56
  var filterEmojis = function filterEmojis(acName) {
55
57
  return acNameToEmojiMap[acName] ? acNameToEmojiMap[acName][0] === emojiId : false;
56
58
  };
57
-
58
59
  return Object.keys(acNameToEmojiMap).filter(filterEmojis)[0];
59
60
  }
60
61
  export function acShortcutToEmoji(hipchatEmoticonShortName) {
@@ -64,22 +65,17 @@ export function acShortcutToEmoji(hipchatEmoticonShortName) {
64
65
  text: ''
65
66
  };
66
67
  }
67
-
68
68
  function getAcNameFromShortName(shortName) {
69
69
  return shortName.slice(shortName[0] === ':' ? 1 : 0, shortName[shortName.length - 1] === ':' ? -1 : shortName.length);
70
70
  }
71
-
72
71
  export function getEmojiAcName(_ref) {
73
72
  var id = _ref.id,
74
- shortName = _ref.shortName;
75
-
73
+ shortName = _ref.shortName;
76
74
  if (DEFAULT_EMOJI_ID === id) {
77
75
  var possibleName = getAcNameFromShortName(shortName);
78
-
79
76
  if (possibleName in acNameToEmojiMap) {
80
77
  return possibleName;
81
78
  }
82
79
  }
83
-
84
80
  return emojiIdToAcName(id) || DEFAULT_EMOJI_ACNAME;
85
81
  }
@@ -5,11 +5,9 @@ export var getExtensionAttrs = function getExtensionAttrs(dom) {
5
5
  var isInline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6
6
  var extensionType = dom.getAttribute('data-extension-type');
7
7
  var extensionKey = dom.getAttribute('data-extension-key');
8
-
9
8
  if (!extensionType || !extensionKey) {
10
9
  return false;
11
10
  }
12
-
13
11
  var attrs = {
14
12
  extensionType: extensionType,
15
13
  extensionKey: extensionKey,
@@ -17,11 +15,9 @@ export var getExtensionAttrs = function getExtensionAttrs(dom) {
17
15
  parameters: JSON.parse(dom.getAttribute('data-parameters') || '{}'),
18
16
  localId: dom.getAttribute('data-local-id') || undefined
19
17
  };
20
-
21
18
  if (!isInline) {
22
19
  var rawLayout = dom.getAttribute('data-layout');
23
20
  attrs.layout = isValidLayout(rawLayout) ? rawLayout : 'default';
24
21
  }
25
-
26
22
  return attrs;
27
23
  };
@@ -4,17 +4,15 @@
4
4
  */
5
5
  import LinkifyIt from 'linkify-it';
6
6
  var whitelistedURLPatterns = [/^https?:\/\//im, /^ftps?:\/\//im, /^jamfselfservice:\/\//im, /^\//im, /^mailto:/im, /^skype:/im, /^callto:/im, /^facetime:/im, /^git:/im, /^irc6?:/im, /^news:/im, /^nntp:/im, /^feed:/im, /^cvs:/im, /^svn:/im, /^mvn:/im, /^ssh:/im, /^scp:\/\//im, /^sftp:\/\//im, /^itms:/im, /^notes:/im, /^hipchat:\/\//im, /^sourcetree:/im, /^urn:/im, /^tel:/im, /^xmpp:/im, /^telnet:/im, /^vnc:/im, /^rdp:/im, /^whatsapp:/im, /^slack:/im, /^sips?:/im, /^magnet:/im, /^#/im];
7
+
7
8
  /**
8
9
  * Please notify the Editor Mobile team (Slack: #help-mobilekit) if the logic for this changes.
9
10
  */
10
-
11
11
  export var isSafeUrl = function isSafeUrl(url) {
12
12
  var urlTrimmed = url.trim();
13
-
14
13
  if (urlTrimmed.length === 0) {
15
14
  return true;
16
15
  }
17
-
18
16
  return whitelistedURLPatterns.some(function (p) {
19
17
  return p.test(urlTrimmed);
20
18
  });
@@ -29,17 +27,13 @@ linkify.tlds(tlds, false);
29
27
  export var LINK_REGEXP = /(https?|ftp|jamfselfservice):\/\/[^\s]+/;
30
28
  export var linkifyMatch = function linkifyMatch(text) {
31
29
  var matches = [];
32
-
33
30
  if (!LINK_REGEXP.test(text)) {
34
31
  return matches;
35
32
  }
36
-
37
33
  var startpos = 0;
38
34
  var substr;
39
-
40
35
  while (substr = text.substr(startpos)) {
41
36
  var link = (substr.match(LINK_REGEXP) || [''])[0];
42
-
43
37
  if (link) {
44
38
  var index = substr.search(LINK_REGEXP);
45
39
  var start = index >= 0 ? index + startpos : index;
@@ -57,26 +51,22 @@ export var linkifyMatch = function linkifyMatch(text) {
57
51
  break;
58
52
  }
59
53
  }
60
-
61
54
  return matches;
62
55
  };
63
56
  export function getLinkMatch(str) {
64
57
  if (!str) {
65
58
  return null;
66
59
  }
67
-
68
60
  var match = linkifyMatch(str);
69
-
70
61
  if (!match.length) {
71
62
  match = linkify.match(str);
72
63
  }
73
-
74
64
  return match && match[0];
75
65
  }
66
+
76
67
  /**
77
68
  * Adds protocol to url if needed.
78
69
  */
79
-
80
70
  export function normalizeUrl(url) {
81
71
  var match = getLinkMatch(url);
82
72
  return match && match.url || '';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "25.1.0",
3
+ "version": "25.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { SchemaConfig } from './create-schema';
2
2
  declare type DefaultSchemaNodes = 'doc' | 'paragraph' | 'text' | 'bulletList' | 'orderedList' | 'listItem' | 'heading' | 'blockquote' | 'codeBlock' | 'panel' | 'rule' | 'image' | 'mention' | 'media' | 'caption' | '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';
3
- declare type DefaultSchemaMarks = 'link' | 'em' | 'strong' | 'strike' | 'subsup' | 'underline' | 'code' | 'textColor' | 'confluenceInlineComment' | 'breakout' | 'alignment' | 'indentation' | 'annotation' | 'unsupportedMark' | 'unsupportedNodeAttribute' | 'typeAheadQuery' | 'dataConsumer';
3
+ declare type DefaultSchemaMarks = 'link' | 'em' | 'strong' | 'strike' | 'subsup' | 'underline' | 'code' | 'textColor' | 'confluenceInlineComment' | 'breakout' | 'alignment' | 'indentation' | 'annotation' | 'unsupportedMark' | 'unsupportedNodeAttribute' | 'typeAheadQuery' | 'dataConsumer' | 'fragment';
4
4
  export declare const defaultSchemaConfig: SchemaConfig<DefaultSchemaNodes, DefaultSchemaMarks>;
5
5
  export declare const getSchemaBasedOnStage: (stage?: string) => import("prosemirror-model").Schema<DefaultSchemaNodes, DefaultSchemaMarks>;
6
6
  export declare const defaultSchema: import("prosemirror-model").Schema<DefaultSchemaNodes, DefaultSchemaMarks>;
@@ -50,7 +50,7 @@ export declare const T100 = "#79E2F2";
50
50
  export declare const T300 = "#00B8D9";
51
51
  export declare const T500 = "#008DA6";
52
52
  /**
53
- * @return String with HEX-coded color
53
+ * @return String with HEX-coded color.
54
54
  */
55
55
  export declare function normalizeHexColor(color: string | null, defaultColor?: string): string | null;
56
56
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "25.1.0",
3
+ "version": "25.2.0",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@atlaskit/codemod-utils": "^4.1.0",
42
- "@atlaskit/editor-palette": "0.1.0",
42
+ "@atlaskit/editor-palette": "1.0.0",
43
43
  "@atlaskit/editor-tables": "^2.2.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@types/linkify-it": "^2.0.4",