@atlaskit/editor-common 63.0.1 → 66.0.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 (295) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/cjs/i18n/cs.js +3 -3
  3. package/dist/cjs/i18n/da.js +3 -3
  4. package/dist/cjs/i18n/de.js +3 -3
  5. package/dist/cjs/i18n/en_ZZ.js +27 -0
  6. package/dist/cjs/i18n/es.js +3 -3
  7. package/dist/cjs/i18n/fi.js +3 -3
  8. package/dist/cjs/i18n/fr.js +3 -3
  9. package/dist/cjs/i18n/hu.js +3 -3
  10. package/dist/cjs/i18n/it.js +3 -3
  11. package/dist/cjs/i18n/ja.js +3 -3
  12. package/dist/cjs/i18n/ko.js +3 -3
  13. package/dist/cjs/i18n/nb.js +3 -3
  14. package/dist/cjs/i18n/nl.js +3 -3
  15. package/dist/cjs/i18n/pl.js +3 -3
  16. package/dist/cjs/i18n/pt_BR.js +3 -3
  17. package/dist/cjs/i18n/ru.js +3 -3
  18. package/dist/cjs/i18n/sv.js +3 -3
  19. package/dist/cjs/i18n/th.js +3 -3
  20. package/dist/cjs/i18n/tr.js +3 -3
  21. package/dist/cjs/i18n/uk.js +3 -3
  22. package/dist/cjs/i18n/vi.js +3 -3
  23. package/dist/cjs/i18n/zh.js +3 -2
  24. package/dist/cjs/i18n/zh_TW.js +3 -3
  25. package/dist/cjs/index.js +1 -29
  26. package/dist/cjs/normalize-feature-flags.js +40 -4
  27. package/dist/cjs/{ui/IntlLegacyFallbackProvider → safe-plugin}/index.js +17 -35
  28. package/dist/cjs/styles/index.js +0 -8
  29. package/dist/cjs/styles/shared/annotation.js +25 -17
  30. package/dist/cjs/styles/shared/block-marks.js +2 -2
  31. package/dist/cjs/styles/shared/blockquote.js +2 -2
  32. package/dist/cjs/styles/shared/code-mark.js +9 -5
  33. package/dist/cjs/styles/shared/column-layout.js +2 -2
  34. package/dist/cjs/styles/shared/date.js +2 -2
  35. package/dist/cjs/styles/shared/headings.js +5 -2
  36. package/dist/cjs/styles/shared/indentation.js +2 -2
  37. package/dist/cjs/styles/shared/link.js +2 -2
  38. package/dist/cjs/styles/shared/lists.js +4 -2
  39. package/dist/cjs/styles/shared/media-single.js +2 -2
  40. package/dist/cjs/styles/shared/panel.js +7 -4
  41. package/dist/cjs/styles/shared/paragraph.js +2 -2
  42. package/dist/cjs/styles/shared/rule.js +5 -2
  43. package/dist/cjs/styles/shared/shadow.js +2 -2
  44. package/dist/cjs/styles/shared/table.js +37 -33
  45. package/dist/cjs/styles/shared/task-decision.js +2 -2
  46. package/dist/cjs/styles/shared/text-color.js +2 -2
  47. package/dist/cjs/styles/shared/whitespace.js +2 -2
  48. package/dist/cjs/types/collab.js +5 -0
  49. package/dist/cjs/ui/BaseTheme/index.js +27 -11
  50. package/dist/cjs/ui/Caption/index.js +10 -7
  51. package/dist/cjs/ui/Expand/index.js +84 -46
  52. package/dist/cjs/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +9 -9
  53. package/dist/cjs/ui/MediaSingle/index.js +15 -8
  54. package/dist/cjs/ui/MediaSingle/link.js +4 -6
  55. package/dist/cjs/ui/MediaSingle/styled.js +23 -20
  56. package/dist/cjs/ui/Mention/index.js +1 -3
  57. package/dist/cjs/ui/Mention/mention-with-profilecard.js +33 -194
  58. package/dist/cjs/ui/Mention/mention-with-providers.js +1 -5
  59. package/dist/cjs/ui/Messages/index.js +25 -22
  60. package/dist/cjs/ui/Popup/index.js +15 -1
  61. package/dist/cjs/ui/UnsupportedBlock/index.js +9 -6
  62. package/dist/cjs/ui/UnsupportedInline/index.js +8 -6
  63. package/dist/cjs/ui/WidthProvider/index.js +8 -9
  64. package/dist/cjs/ui/clear-next-sibling-margin-top.js +4 -5
  65. package/dist/cjs/ui/index.js +24 -34
  66. package/dist/cjs/utils/compare-props.js +136 -0
  67. package/dist/cjs/utils/index.js +23 -1
  68. package/dist/cjs/utils/performance/hooks/use-component-render-tracking/index.js +47 -0
  69. package/dist/cjs/utils/validator.js +1 -1
  70. package/dist/cjs/version.json +1 -1
  71. package/dist/es2019/i18n/cs.js +3 -3
  72. package/dist/es2019/i18n/da.js +3 -3
  73. package/dist/es2019/i18n/de.js +3 -3
  74. package/dist/es2019/i18n/en_ZZ.js +19 -0
  75. package/dist/es2019/i18n/es.js +3 -3
  76. package/dist/es2019/i18n/fi.js +3 -3
  77. package/dist/es2019/i18n/fr.js +3 -3
  78. package/dist/es2019/i18n/hu.js +3 -3
  79. package/dist/es2019/i18n/it.js +3 -3
  80. package/dist/es2019/i18n/ja.js +3 -3
  81. package/dist/es2019/i18n/ko.js +3 -3
  82. package/dist/es2019/i18n/nb.js +3 -3
  83. package/dist/es2019/i18n/nl.js +3 -3
  84. package/dist/es2019/i18n/pl.js +3 -3
  85. package/dist/es2019/i18n/pt_BR.js +3 -3
  86. package/dist/es2019/i18n/ru.js +3 -3
  87. package/dist/es2019/i18n/sv.js +3 -3
  88. package/dist/es2019/i18n/th.js +3 -3
  89. package/dist/es2019/i18n/tr.js +3 -3
  90. package/dist/es2019/i18n/uk.js +3 -3
  91. package/dist/es2019/i18n/vi.js +3 -3
  92. package/dist/es2019/i18n/zh.js +3 -2
  93. package/dist/es2019/i18n/zh_TW.js +3 -3
  94. package/dist/es2019/index.js +2 -7
  95. package/dist/es2019/normalize-feature-flags.js +40 -4
  96. package/dist/es2019/safe-plugin/index.js +10 -0
  97. package/dist/es2019/styles/index.js +0 -1
  98. package/dist/es2019/styles/shared/annotation.js +11 -11
  99. package/dist/es2019/styles/shared/block-marks.js +3 -2
  100. package/dist/es2019/styles/shared/blockquote.js +1 -1
  101. package/dist/es2019/styles/shared/code-mark.js +14 -11
  102. package/dist/es2019/styles/shared/column-layout.js +1 -1
  103. package/dist/es2019/styles/shared/date.js +1 -1
  104. package/dist/es2019/styles/shared/headings.js +8 -8
  105. package/dist/es2019/styles/shared/indentation.js +1 -1
  106. package/dist/es2019/styles/shared/link.js +1 -1
  107. package/dist/es2019/styles/shared/lists.js +19 -1
  108. package/dist/es2019/styles/shared/media-single.js +1 -1
  109. package/dist/es2019/styles/shared/panel.js +15 -15
  110. package/dist/es2019/styles/shared/paragraph.js +1 -1
  111. package/dist/es2019/styles/shared/rule.js +3 -3
  112. package/dist/es2019/styles/shared/shadow.js +1 -1
  113. package/dist/es2019/styles/shared/table.js +23 -13
  114. package/dist/es2019/styles/shared/task-decision.js +1 -1
  115. package/dist/es2019/styles/shared/text-color.js +1 -1
  116. package/dist/es2019/styles/shared/whitespace.js +1 -1
  117. package/dist/es2019/types/collab.js +1 -0
  118. package/dist/es2019/ui/BaseTheme/index.js +16 -5
  119. package/dist/es2019/ui/Caption/index.js +11 -5
  120. package/dist/es2019/ui/Expand/index.js +97 -67
  121. package/dist/es2019/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +1 -1
  122. package/dist/es2019/ui/MediaSingle/index.js +15 -9
  123. package/dist/es2019/ui/MediaSingle/link.js +3 -4
  124. package/dist/es2019/ui/MediaSingle/styled.js +13 -12
  125. package/dist/es2019/ui/Mention/index.js +1 -3
  126. package/dist/es2019/ui/Mention/mention-with-profilecard.js +33 -146
  127. package/dist/es2019/ui/Mention/mention-with-providers.js +1 -5
  128. package/dist/es2019/ui/Messages/index.js +30 -22
  129. package/dist/es2019/ui/Popup/index.js +16 -1
  130. package/dist/es2019/ui/UnsupportedBlock/index.js +9 -6
  131. package/dist/es2019/ui/UnsupportedInline/index.js +8 -5
  132. package/dist/es2019/ui/WidthProvider/index.js +10 -8
  133. package/dist/es2019/ui/clear-next-sibling-margin-top.js +2 -2
  134. package/dist/es2019/ui/index.js +4 -6
  135. package/dist/es2019/utils/compare-props.js +99 -0
  136. package/dist/es2019/utils/index.js +3 -1
  137. package/dist/es2019/utils/performance/hooks/use-component-render-tracking/index.js +36 -0
  138. package/dist/es2019/utils/validator.js +1 -1
  139. package/dist/es2019/version.json +1 -1
  140. package/dist/esm/i18n/cs.js +3 -3
  141. package/dist/esm/i18n/da.js +3 -3
  142. package/dist/esm/i18n/de.js +3 -3
  143. package/dist/esm/i18n/en_ZZ.js +19 -0
  144. package/dist/esm/i18n/es.js +3 -3
  145. package/dist/esm/i18n/fi.js +3 -3
  146. package/dist/esm/i18n/fr.js +3 -3
  147. package/dist/esm/i18n/hu.js +3 -3
  148. package/dist/esm/i18n/it.js +3 -3
  149. package/dist/esm/i18n/ja.js +3 -3
  150. package/dist/esm/i18n/ko.js +3 -3
  151. package/dist/esm/i18n/nb.js +3 -3
  152. package/dist/esm/i18n/nl.js +3 -3
  153. package/dist/esm/i18n/pl.js +3 -3
  154. package/dist/esm/i18n/pt_BR.js +3 -3
  155. package/dist/esm/i18n/ru.js +3 -3
  156. package/dist/esm/i18n/sv.js +3 -3
  157. package/dist/esm/i18n/th.js +3 -3
  158. package/dist/esm/i18n/tr.js +3 -3
  159. package/dist/esm/i18n/uk.js +3 -3
  160. package/dist/esm/i18n/vi.js +3 -3
  161. package/dist/esm/i18n/zh.js +3 -2
  162. package/dist/esm/i18n/zh_TW.js +3 -3
  163. package/dist/esm/index.js +2 -7
  164. package/dist/esm/normalize-feature-flags.js +39 -4
  165. package/dist/esm/{ui/IntlLegacyFallbackProvider → safe-plugin}/index.js +13 -31
  166. package/dist/esm/styles/index.js +0 -1
  167. package/dist/esm/styles/shared/annotation.js +21 -17
  168. package/dist/esm/styles/shared/block-marks.js +2 -2
  169. package/dist/esm/styles/shared/blockquote.js +1 -1
  170. package/dist/esm/styles/shared/code-mark.js +9 -6
  171. package/dist/esm/styles/shared/column-layout.js +1 -1
  172. package/dist/esm/styles/shared/date.js +1 -1
  173. package/dist/esm/styles/shared/headings.js +4 -2
  174. package/dist/esm/styles/shared/indentation.js +1 -1
  175. package/dist/esm/styles/shared/link.js +1 -1
  176. package/dist/esm/styles/shared/lists.js +3 -2
  177. package/dist/esm/styles/shared/media-single.js +1 -1
  178. package/dist/esm/styles/shared/panel.js +6 -4
  179. package/dist/esm/styles/shared/paragraph.js +1 -1
  180. package/dist/esm/styles/shared/rule.js +4 -2
  181. package/dist/esm/styles/shared/shadow.js +1 -1
  182. package/dist/esm/styles/shared/table.js +37 -33
  183. package/dist/esm/styles/shared/task-decision.js +1 -1
  184. package/dist/esm/styles/shared/text-color.js +1 -1
  185. package/dist/esm/styles/shared/whitespace.js +1 -1
  186. package/dist/esm/types/collab.js +1 -0
  187. package/dist/esm/ui/BaseTheme/index.js +23 -12
  188. package/dist/esm/ui/Caption/index.js +10 -5
  189. package/dist/esm/ui/Expand/index.js +79 -42
  190. package/dist/esm/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +7 -7
  191. package/dist/esm/ui/MediaSingle/index.js +16 -9
  192. package/dist/esm/ui/MediaSingle/link.js +2 -3
  193. package/dist/esm/ui/MediaSingle/styled.js +17 -10
  194. package/dist/esm/ui/Mention/index.js +1 -3
  195. package/dist/esm/ui/Mention/mention-with-profilecard.js +33 -189
  196. package/dist/esm/ui/Mention/mention-with-providers.js +1 -5
  197. package/dist/esm/ui/Messages/index.js +26 -20
  198. package/dist/esm/ui/Popup/index.js +16 -1
  199. package/dist/esm/ui/UnsupportedBlock/index.js +9 -5
  200. package/dist/esm/ui/UnsupportedInline/index.js +8 -5
  201. package/dist/esm/ui/WidthProvider/index.js +7 -6
  202. package/dist/esm/ui/clear-next-sibling-margin-top.js +2 -2
  203. package/dist/esm/ui/index.js +4 -6
  204. package/dist/esm/utils/compare-props.js +115 -0
  205. package/dist/esm/utils/index.js +3 -1
  206. package/dist/esm/utils/performance/hooks/use-component-render-tracking/index.js +37 -0
  207. package/dist/esm/utils/validator.js +1 -1
  208. package/dist/esm/version.json +1 -1
  209. package/dist/types/__tests_external__/page-objects/Editor.d.ts +0 -1
  210. package/dist/types/__tests_external__/page-objects/EditorMedia.d.ts +0 -1
  211. package/dist/types/__tests_external__/page-objects/EditorSmartLink.d.ts +0 -1
  212. package/dist/types/__tests_external__/page-objects/Renderer.d.ts +0 -1
  213. package/dist/types/collab/types.d.ts +14 -2
  214. package/dist/types/collab.d.ts +1 -1
  215. package/dist/types/extensions/types/field-definitions.d.ts +1 -1
  216. package/dist/types/i18n/cs.d.ts +2 -2
  217. package/dist/types/i18n/da.d.ts +2 -2
  218. package/dist/types/i18n/de.d.ts +2 -2
  219. package/dist/types/i18n/en_ZZ.d.ts +19 -0
  220. package/dist/types/i18n/es.d.ts +2 -2
  221. package/dist/types/i18n/fi.d.ts +2 -2
  222. package/dist/types/i18n/fr.d.ts +2 -2
  223. package/dist/types/i18n/hu.d.ts +2 -2
  224. package/dist/types/i18n/it.d.ts +2 -2
  225. package/dist/types/i18n/ja.d.ts +2 -2
  226. package/dist/types/i18n/ko.d.ts +2 -2
  227. package/dist/types/i18n/nb.d.ts +2 -2
  228. package/dist/types/i18n/nl.d.ts +2 -2
  229. package/dist/types/i18n/pl.d.ts +2 -2
  230. package/dist/types/i18n/pt_BR.d.ts +2 -2
  231. package/dist/types/i18n/ru.d.ts +2 -2
  232. package/dist/types/i18n/sv.d.ts +2 -2
  233. package/dist/types/i18n/th.d.ts +2 -2
  234. package/dist/types/i18n/tr.d.ts +2 -2
  235. package/dist/types/i18n/uk.d.ts +2 -2
  236. package/dist/types/i18n/vi.d.ts +2 -2
  237. package/dist/types/i18n/zh.d.ts +2 -2
  238. package/dist/types/i18n/zh_TW.d.ts +2 -2
  239. package/dist/types/index.d.ts +1 -14
  240. package/dist/types/normalize-feature-flags.d.ts +6 -3
  241. package/dist/types/safe-plugin/index.d.ts +6 -0
  242. package/dist/types/styles/index.d.ts +0 -1
  243. package/dist/types/styles/shared/annotation.d.ts +5 -4
  244. package/dist/types/styles/shared/block-marks.d.ts +1 -1
  245. package/dist/types/styles/shared/blockquote.d.ts +1 -1
  246. package/dist/types/styles/shared/code-mark.d.ts +2 -1
  247. package/dist/types/styles/shared/column-layout.d.ts +1 -1
  248. package/dist/types/styles/shared/date.d.ts +1 -1
  249. package/dist/types/styles/shared/headings.d.ts +2 -1
  250. package/dist/types/styles/shared/indentation.d.ts +1 -1
  251. package/dist/types/styles/shared/link.d.ts +1 -1
  252. package/dist/types/styles/shared/lists.d.ts +1 -1
  253. package/dist/types/styles/shared/media-single.d.ts +1 -1
  254. package/dist/types/styles/shared/panel.d.ts +1 -1
  255. package/dist/types/styles/shared/paragraph.d.ts +1 -1
  256. package/dist/types/styles/shared/rule.d.ts +2 -1
  257. package/dist/types/styles/shared/shadow.d.ts +1 -1
  258. package/dist/types/styles/shared/table.d.ts +2 -1
  259. package/dist/types/styles/shared/task-decision.d.ts +1 -1
  260. package/dist/types/styles/shared/text-color.d.ts +1 -1
  261. package/dist/types/styles/shared/whitespace.d.ts +1 -1
  262. package/dist/types/types/collab.d.ts +8 -0
  263. package/dist/types/types/index.d.ts +1 -0
  264. package/dist/types/ui/Caption/index.d.ts +3 -1
  265. package/dist/types/ui/Expand/index.d.ts +12 -10
  266. package/dist/types/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.d.ts +1 -1
  267. package/dist/types/ui/MediaSingle/index.d.ts +4 -1
  268. package/dist/types/ui/MediaSingle/link.d.ts +1 -2
  269. package/dist/types/ui/MediaSingle/styled.d.ts +10 -5
  270. package/dist/types/ui/Mention/index.d.ts +0 -3
  271. package/dist/types/ui/Mention/mention-with-profilecard.d.ts +2 -25
  272. package/dist/types/ui/Mention/mention-with-providers.d.ts +0 -3
  273. package/dist/types/ui/Messages/index.d.ts +5 -3
  274. package/dist/types/ui/Popup/index.d.ts +3 -0
  275. package/dist/types/ui/UnsupportedBlock/index.d.ts +1 -0
  276. package/dist/types/ui/UnsupportedInline/index.d.ts +1 -0
  277. package/dist/types/ui/WidthProvider/index.d.ts +3 -1
  278. package/dist/types/ui/clear-next-sibling-margin-top.d.ts +1 -2
  279. package/dist/types/ui/index.d.ts +5 -7
  280. package/dist/types/utils/compare-props.d.ts +32 -0
  281. package/dist/types/utils/getModeFromTheme.d.ts +1 -1
  282. package/dist/types/utils/index.d.ts +4 -0
  283. package/dist/types/utils/performance/hooks/use-component-render-tracking/index.d.ts +19 -0
  284. package/package.json +20 -19
  285. package/safe-plugin/package.json +7 -0
  286. package/dist/cjs/styles/shared/inline-nodes.js +0 -17
  287. package/dist/cjs/ui/LegacyToNextIntlProvider/index.js +0 -67
  288. package/dist/es2019/styles/shared/inline-nodes.js +0 -7
  289. package/dist/es2019/ui/IntlLegacyFallbackProvider/index.js +0 -21
  290. package/dist/es2019/ui/LegacyToNextIntlProvider/index.js +0 -24
  291. package/dist/esm/styles/shared/inline-nodes.js +0 -7
  292. package/dist/esm/ui/LegacyToNextIntlProvider/index.js +0 -51
  293. package/dist/types/styles/shared/inline-nodes.d.ts +0 -2
  294. package/dist/types/ui/IntlLegacyFallbackProvider/index.d.ts +0 -8
  295. package/dist/types/ui/LegacyToNextIntlProvider/index.d.ts +0 -8
@@ -1,148 +1,35 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React, { PureComponent } from 'react';
3
- import { findDOMNode } from 'react-dom';
1
+ import React, { useMemo } from 'react';
4
2
  import { ResourcedMention } from '@atlaskit/mention';
5
- import ProfileCard from '@atlaskit/profilecard';
6
- import Popup from '../Popup';
7
- import withOuterListeners from '../with-outer-listeners';
8
- const ProfilecardResourcedWithListeners = withOuterListeners(ProfileCard);
9
- export default class MentionWithProfileCard extends PureComponent {
10
- constructor(...args) {
11
- super(...args);
12
-
13
- _defineProperty(this, "state", {
14
- target: null,
15
- visible: false,
16
- popupAlignX: 'left',
17
- popupAlignY: 'top'
18
- });
19
-
20
- _defineProperty(this, "handleRef", target => {
21
- this.setState({
22
- target
23
- });
24
- });
25
-
26
- _defineProperty(this, "handleMentionNodeRef", component => {
27
- if (!component) {
28
- this.domNode = null;
29
- } else {
30
- this.domNode = findDOMNode(component);
31
- }
32
- });
33
-
34
- _defineProperty(this, "showProfilecard", event => {
35
- if (!this.domNode) {
36
- return;
37
- }
38
-
39
- event.stopPropagation();
40
- const [popupAlignX, popupAlignY] = this.calculateLayerPosition();
41
- this.setState({
42
- popupAlignX,
43
- popupAlignY,
44
- visible: true
45
- });
46
- });
47
-
48
- _defineProperty(this, "hideProfilecard", () => {
49
- this.setState({
50
- visible: false
51
- });
52
- });
53
- }
54
-
55
- calculateLayerPosition() {
56
- const domNodeCentreCoords = this.getDomNodeCenterCoords();
57
- const visibleAreaCentreCoords = this.getVisibleAreaCentreCoords();
58
- const popupAlignY = domNodeCentreCoords.y > visibleAreaCentreCoords.y ? 'top' : 'bottom';
59
- const popupAlignX = domNodeCentreCoords.x > visibleAreaCentreCoords.x ? 'right' : 'left';
60
- return [popupAlignX, popupAlignY];
61
- }
62
-
63
- getDomNodeCenterCoords() {
64
- const rect = this.domNode.getBoundingClientRect();
65
- return {
66
- x: rect.left + rect.width / 2,
67
- y: rect.top + rect.height / 2
68
- };
69
- }
70
-
71
- getVisibleAreaCentreCoords() {
72
- return {
73
- x: window.innerWidth / 2,
74
- y: window.innerHeight / 2
75
- };
76
- }
77
-
78
- getActions(id, text, accessLevel) {
79
- const {
80
- profilecardProvider
81
- } = this.props;
82
- const actions = profilecardProvider.getActions(id, text, accessLevel);
83
- return actions.map(action => {
84
- return { ...action,
85
- callback: () => {
86
- this.setState({
87
- visible: false
88
- });
89
-
90
- if (action && action.callback) {
91
- action.callback();
92
- }
93
- }
94
- };
95
- });
96
- }
97
-
98
- render() {
99
- const {
100
- accessLevel,
101
- id,
102
- mentionProvider,
103
- profilecardProvider,
104
- text,
105
- onClick,
106
- onMouseEnter,
107
- onMouseLeave,
108
- portal
109
- } = this.props;
110
- const {
111
- popupAlignX,
112
- popupAlignY,
113
- target,
114
- visible
115
- } = this.state;
116
- const {
117
- cloudId,
118
- resourceClient
119
- } = profilecardProvider;
120
- return /*#__PURE__*/React.createElement("span", {
121
- ref: this.handleRef,
122
- onClick: this.showProfilecard
123
- }, /*#__PURE__*/React.createElement(ResourcedMention, {
124
- ref: this.handleMentionNodeRef,
125
- id: id,
126
- text: text,
127
- accessLevel: accessLevel,
128
- mentionProvider: mentionProvider,
129
- onClick: onClick,
130
- onMouseEnter: onMouseEnter,
131
- onMouseLeave: onMouseLeave
132
- }), target && portal && visible && /*#__PURE__*/React.createElement(Popup, {
133
- offset: [0, 8],
134
- target: target,
135
- mountTo: portal,
136
- alignX: popupAlignX,
137
- alignY: popupAlignY
138
- }, /*#__PURE__*/React.createElement(ProfilecardResourcedWithListeners, {
139
- handleClickOutside: this.hideProfilecard,
140
- handleEscapeKeydown: this.hideProfilecard,
141
- cloudId: cloudId,
142
- userId: id,
143
- resourceClient: resourceClient,
144
- actions: this.getActions(id, text, accessLevel)
145
- })));
146
- }
147
-
3
+ import { ProfileCardTrigger } from '@atlaskit/profilecard';
4
+ export default function MentionWithProfileCard({
5
+ id,
6
+ text,
7
+ accessLevel,
8
+ mentionProvider,
9
+ profilecardProvider,
10
+ onClick,
11
+ onMouseEnter,
12
+ onMouseLeave
13
+ }) {
14
+ const {
15
+ cloudId,
16
+ resourceClient
17
+ } = profilecardProvider;
18
+ const actions = useMemo(() => profilecardProvider.getActions(id, text, accessLevel), [accessLevel, id, profilecardProvider, text]);
19
+ return /*#__PURE__*/React.createElement(ProfileCardTrigger, {
20
+ cloudId: cloudId,
21
+ userId: id,
22
+ resourceClient: resourceClient,
23
+ actions: actions,
24
+ trigger: "click",
25
+ position: "bottom-end"
26
+ }, /*#__PURE__*/React.createElement(ResourcedMention, {
27
+ id: id,
28
+ text: text,
29
+ accessLevel: accessLevel,
30
+ mentionProvider: mentionProvider,
31
+ onClick: onClick,
32
+ onMouseEnter: onMouseEnter,
33
+ onMouseLeave: onMouseLeave
34
+ }));
148
35
  }
@@ -51,11 +51,9 @@ export default class MentionWithProviders extends PureComponent {
51
51
  render() {
52
52
  const {
53
53
  accessLevel,
54
- userType,
55
54
  eventHandlers,
56
55
  id,
57
56
  mentionProvider,
58
- portal,
59
57
  text
60
58
  } = this.props;
61
59
  const {
@@ -70,10 +68,8 @@ export default class MentionWithProviders extends PureComponent {
70
68
  id: id,
71
69
  text: text,
72
70
  accessLevel: accessLevel,
73
- userType: userType,
74
71
  mentionProvider: mentionProvider,
75
- profilecardProvider: profilecardProvider,
76
- portal: portal
72
+ profilecardProvider: profilecardProvider
77
73
  }, actionHandlers));
78
74
  }
79
75
 
@@ -1,48 +1,56 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/react';
3
3
  import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
4
4
  import ErrorIcon from '@atlaskit/icon/glyph/error';
5
5
  import { G400, N200, R400 } from '@atlaskit/theme/colors';
6
6
  import { gridSize } from '@atlaskit/theme/constants';
7
7
  import { h200 } from '@atlaskit/theme/typography';
8
- const Message = styled.div`
9
- ${h200} font-weight: normal;
10
- color: ${props => {
11
- if (props.error) {
12
- return R400;
13
- }
14
-
15
- if (props.valid) {
16
- return G400;
17
- }
8
+ const errorColor = css`
9
+ color: ${R400};
10
+ `;
11
+ const validColor = css`
12
+ color: ${G400};
13
+ `;
18
14
 
19
- return N200;
20
- }};
15
+ const messageStyle = props => css`
16
+ ${h200(props)} font-weight: normal;
17
+ color: ${N200};
21
18
  margin-top: ${gridSize() / 2}px;
22
19
  display: flex;
23
20
  justify-content: baseline;
24
21
  `;
25
- const IconWrapper = styled.span`
22
+
23
+ const iconWrapperStyle = css`
26
24
  display: flex;
27
25
  margin-right: 4px;
28
26
  `;
29
27
  export const HelperMessage = ({
30
28
  children
31
- }) => /*#__PURE__*/React.createElement(Message, null, children);
29
+ }) => jsx("div", {
30
+ css: messageStyle
31
+ }, children);
32
32
  export const ErrorMessage = ({
33
33
  children
34
- }) => /*#__PURE__*/React.createElement(Message, {
35
- error: true
36
- }, /*#__PURE__*/React.createElement(IconWrapper, null, /*#__PURE__*/React.createElement(ErrorIcon, {
34
+ }) => jsx("div", {
35
+ css: theme => {
36
+ return [messageStyle(theme), errorColor];
37
+ }
38
+ }, jsx("span", {
39
+ css: iconWrapperStyle
40
+ }, jsx(ErrorIcon, {
37
41
  size: "small",
38
42
  label: "error",
39
43
  "aria-label": "error"
40
44
  })), children);
41
45
  export const ValidMessage = ({
42
46
  children
43
- }) => /*#__PURE__*/React.createElement(Message, {
44
- valid: true
45
- }, /*#__PURE__*/React.createElement(IconWrapper, null, /*#__PURE__*/React.createElement(SuccessIcon, {
47
+ }) => jsx("div", {
48
+ css: theme => {
49
+ return [messageStyle(theme), validColor];
50
+ }
51
+ }, jsx("span", {
52
+ css: iconWrapperStyle
53
+ }, jsx(SuccessIcon, {
46
54
  size: "small",
47
55
  label: "success"
48
56
  })), children);
@@ -6,6 +6,8 @@ import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
6
6
  import { calculatePlacement, calculatePosition, findOverflowScrollParent, validatePosition } from './utils';
7
7
  export default class Popup extends React.Component {
8
8
  constructor(...args) {
9
+ var _window;
10
+
9
11
  super(...args);
10
12
 
11
13
  _defineProperty(this, "state", {
@@ -25,6 +27,10 @@ export default class Popup extends React.Component {
25
27
  _defineProperty(this, "scheduledUpdatePosition", rafSchedule(props => this.updatePosition(props)));
26
28
 
27
29
  _defineProperty(this, "onResize", () => this.scheduledUpdatePosition(this.props));
30
+
31
+ _defineProperty(this, "resizeObserver", (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(() => {
32
+ this.scheduledUpdatePosition(this.props);
33
+ }) : undefined);
28
34
  }
29
35
 
30
36
  /**
@@ -147,9 +153,14 @@ export default class Popup extends React.Component {
147
153
  const {
148
154
  stick
149
155
  } = this.props;
156
+ this.scrollParentElement = findOverflowScrollParent(this.props.target);
157
+
158
+ if (this.scrollParentElement && this.resizeObserver) {
159
+ this.resizeObserver.observe(this.scrollParentElement);
160
+ }
150
161
 
151
162
  if (stick) {
152
- this.scrollElement = findOverflowScrollParent(this.props.target);
163
+ this.scrollElement = this.scrollParentElement;
153
164
  } else {
154
165
  this.scrollElement = this.props.scrollableElement;
155
166
  }
@@ -166,6 +177,10 @@ export default class Popup extends React.Component {
166
177
  this.scrollElement.removeEventListener('scroll', this.onResize);
167
178
  }
168
179
 
180
+ if (this.scrollParentElement && this.resizeObserver) {
181
+ this.resizeObserver.unobserve(this.scrollParentElement);
182
+ }
183
+
169
184
  this.scheduledUpdatePosition.cancel();
170
185
  }
171
186
 
@@ -1,6 +1,7 @@
1
+ /** @jsx jsx */
1
2
  import React, { useCallback, useRef } from 'react';
3
+ import { css, jsx } from '@emotion/react';
2
4
  import { injectIntl } from 'react-intl-next';
3
- import styled from 'styled-components';
4
5
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
5
6
  import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
6
7
  import { N30, N50 } from '@atlaskit/theme/colors';
@@ -10,8 +11,7 @@ import { unsupportedContentMessages } from '../../messages/unsupportedContent';
10
11
  import { ACTION_SUBJECT_ID } from '../../utils/analytics';
11
12
  import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
12
13
  import { getUnsupportedContent } from '../unsupported-content-helper';
13
- const BlockNode = styled.div`
14
- align-items: center;
14
+ const blockNodeStyle = css`
15
15
  background: ${N30};
16
16
  border: 1px dashed ${N50};
17
17
  border-radius: ${borderRadius()}px;
@@ -43,15 +43,18 @@ const UnsupportedBlockNode = ({
43
43
  });
44
44
  const originalNodeType = node === null || node === void 0 ? void 0 : node.attrs.originalValue.type;
45
45
  const tooltipOnShowHandler = useCallback(() => dispatchAnalyticsEvent && trackUnsupportedContentTooltipDisplayedFor(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.ON_UNSUPPORTED_BLOCK, originalNodeType), [dispatchAnalyticsEvent, originalNodeType]);
46
- return /*#__PURE__*/React.createElement(BlockNode, null, message, /*#__PURE__*/React.createElement(Tooltip, {
46
+ return jsx("div", {
47
+ css: blockNodeStyle,
48
+ className: "unsupported"
49
+ }, message, jsx(Tooltip, {
47
50
  content: tooltipContent,
48
51
  hideTooltipOnClick: false,
49
52
  position: "bottom",
50
53
  onShow: tooltipOnShowHandler,
51
54
  strategy: "absolute"
52
- }, /*#__PURE__*/React.createElement("span", {
55
+ }, jsx("span", {
53
56
  style: style
54
- }, /*#__PURE__*/React.createElement(QuestionsIcon, {
57
+ }, jsx(QuestionsIcon, {
55
58
  label: "?",
56
59
  size: "small"
57
60
  }))));
@@ -1,6 +1,7 @@
1
+ /** @jsx jsx */
1
2
  import React, { useCallback, useRef } from 'react';
3
+ import { css, jsx } from '@emotion/react';
2
4
  import { injectIntl } from 'react-intl-next';
3
- import styled from 'styled-components';
4
5
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
5
6
  import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
6
7
  import { N30, N50 } from '@atlaskit/theme/colors';
@@ -10,7 +11,7 @@ import { unsupportedContentMessages } from '../../messages/unsupportedContent';
10
11
  import { ACTION_SUBJECT_ID } from '../../utils/analytics';
11
12
  import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
12
13
  import { getUnsupportedContent } from '../unsupported-content-helper';
13
- const InlineNode = styled.span`
14
+ const inlineNodeStyle = css`
14
15
  align-items: center;
15
16
  background: ${N30};
16
17
  border: 1px dashed ${N50};
@@ -40,15 +41,17 @@ const UnsupportedInlineNode = ({
40
41
  });
41
42
  const originalNodeType = node === null || node === void 0 ? void 0 : node.attrs.originalValue.type;
42
43
  const tooltipOnShowHandler = useCallback(() => dispatchAnalyticsEvent && trackUnsupportedContentTooltipDisplayedFor(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.ON_UNSUPPORTED_INLINE, originalNodeType), [dispatchAnalyticsEvent, originalNodeType]);
43
- return /*#__PURE__*/React.createElement(InlineNode, null, message, /*#__PURE__*/React.createElement(Tooltip, {
44
+ return jsx("span", {
45
+ css: inlineNodeStyle
46
+ }, message, jsx(Tooltip, {
44
47
  content: tooltipContent,
45
48
  hideTooltipOnClick: false,
46
49
  position: "bottom",
47
50
  onShow: tooltipOnShowHandler,
48
51
  strategy: "absolute"
49
- }, /*#__PURE__*/React.createElement("span", {
52
+ }, jsx("span", {
50
53
  style: style
51
- }, /*#__PURE__*/React.createElement(QuestionsIcon, {
54
+ }, jsx(QuestionsIcon, {
52
55
  label: "?",
53
56
  size: "small"
54
57
  }))));
@@ -1,7 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ /** @jsx jsx */
2
4
  import React from 'react';
5
+ import { css, jsx } from '@emotion/react';
3
6
  import rafSchedule from 'raf-schd';
4
- import styled from 'styled-components';
5
7
  import { WidthObserver } from '@atlaskit/width-detector';
6
8
  const SCROLLBAR_WIDTH = 30;
7
9
  export function getBreakpoint(width = 0) {
@@ -27,10 +29,6 @@ const {
27
29
  Provider,
28
30
  Consumer
29
31
  } = WidthContext;
30
- const RelativeContainer = /*#__PURE__*/React.memo(styled.div`
31
- position: relative;
32
- width: 100%;
33
- `);
34
32
  export class WidthProvider extends React.Component {
35
33
  constructor(props) {
36
34
  super(props);
@@ -54,12 +52,16 @@ export class WidthProvider extends React.Component {
54
52
  }
55
53
 
56
54
  render() {
57
- return /*#__PURE__*/React.createElement(RelativeContainer, {
55
+ return jsx("div", {
56
+ css: css`
57
+ position: relative;
58
+ width: 100%;
59
+ `,
58
60
  className: this.props.className
59
- }, /*#__PURE__*/React.createElement(WidthObserver, {
61
+ }, jsx(WidthObserver, {
60
62
  setWidth: this.setWidth,
61
63
  offscreen: true
62
- }), /*#__PURE__*/React.createElement(Provider, {
64
+ }), jsx(Provider, {
63
65
  value: createWidthContext(this.state.width)
64
66
  }, this.props.children));
65
67
  }
@@ -1,6 +1,6 @@
1
- import styled from 'styled-components'; // We use !important to ensure next sibling gets the margin reset no matter what
1
+ import { css } from '@emotion/react'; // We use !important to ensure next sibling gets the margin reset no matter what
2
2
 
3
- export const ClearNextSiblingMarginTop = styled.div`
3
+ export const clearNextSiblingMarginTopStyle = css`
4
4
  & + * {
5
5
  margin-top: 0 !important;
6
6
  }
@@ -2,7 +2,7 @@ export { default as Caption } from './Caption';
2
2
  export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, shouldAddDefaultWrappedWidth } from './MediaSingle';
3
3
  export { MediaSingleDimensionHelper } from './MediaSingle/styled';
4
4
  export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid } from './MediaSingle/grid';
5
- export { MediaLink } from './MediaSingle/link';
5
+ export { mediaLinkStyle } from './MediaSingle/link';
6
6
  export { default as Popup, findOverflowScrollParent } from './Popup';
7
7
  export { default as UnsupportedBlock } from './UnsupportedBlock';
8
8
  export { default as UnsupportedInline } from './UnsupportedInline';
@@ -11,9 +11,7 @@ export { default as withOuterListeners } from './with-outer-listeners';
11
11
  export { WidthConsumer, WidthProvider, getBreakpoint } from './WidthProvider';
12
12
  export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
13
13
  export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
14
- export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, ExpandLayoutWrapper } from './Expand';
14
+ export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
15
15
  export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
16
- export { ClearNextSiblingMarginTop } from './clear-next-sibling-margin-top';
17
- export { IntlNextErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlNextErrorBoundary';
18
- export { IntlLegacyFallbackProvider } from './IntlLegacyFallbackProvider';
19
- export { LegacyToNextIntlProvider } from './LegacyToNextIntlProvider';
16
+ export { clearNextSiblingMarginTopStyle } from './clear-next-sibling-margin-top';
17
+ export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
@@ -0,0 +1,99 @@
1
+ import React from 'react';
2
+ export const getKeys = Object.keys;
3
+ export const getKeysAddedRemovedCommon = (object1, object2) => {
4
+ const oldKeys = object1 !== null ? getKeys(object1) : [];
5
+ const newKeys = object2 !== null ? getKeys(object2) : [];
6
+ const removed = oldKeys.filter(key => !newKeys.includes(key));
7
+ const added = newKeys.filter(key => !oldKeys.includes(key));
8
+ const common = oldKeys.filter(key => newKeys.includes(key));
9
+ return {
10
+ added,
11
+ common,
12
+ removed
13
+ };
14
+ };
15
+ export const serializeValue = value => {
16
+ const valueType = typeof value;
17
+
18
+ if (value === null) {
19
+ return 'null';
20
+ } else if (value === undefined) {
21
+ return 'undefined';
22
+ } else if (valueType === 'string' || valueType === 'number') {
23
+ return value;
24
+ } else if (valueType === 'symbol') {
25
+ return value.toString();
26
+ } // Calling toString of function returns whole function text with body.
27
+ // So, just return function with name.
28
+ else if (valueType === 'function') {
29
+ return `function:${value.name}`;
30
+ } else if (valueType === 'object') {
31
+ return {
32
+ type: 'object',
33
+ keys: Object.keys(value)
34
+ };
35
+ }
36
+ };
37
+ export const getPropsDifference = (object1, object2, curDepth = 0, maxDepth = 2, keysToIgnore = []) => {
38
+ const {
39
+ added,
40
+ common,
41
+ removed
42
+ } = getKeysAddedRemovedCommon(object1, object2);
43
+ const changed = [];
44
+ common.forEach(key => {
45
+ const value1 = object1[key];
46
+ const value2 = object2[key];
47
+ const value1Type = typeof value1;
48
+ const value2Type = typeof value2; // Do comparision only if values doesn't match (or reference to same object in memory).
49
+ // Or if key does not exist in keys to ignore.
50
+
51
+ if (value1 !== value2 && keysToIgnore.indexOf(key) === -1) {
52
+ // if both key value are objects and not referencing same object in memory.
53
+ // then get recursive difference.
54
+ if ( /*#__PURE__*/React.isValidElement(value1) || /*#__PURE__*/React.isValidElement(value2)) {
55
+ changed.push({
56
+ key,
57
+ reactElementChanged: true
58
+ });
59
+ } else if (value1Type === 'object' && value2Type === 'object') {
60
+ if (curDepth <= maxDepth) {
61
+ const difference = getPropsDifference(value1, value2, curDepth + 1, maxDepth);
62
+ changed.push({
63
+ key,
64
+ difference
65
+ });
66
+ } else {
67
+ changed.push({
68
+ key,
69
+ maxDepthReached: true
70
+ });
71
+ }
72
+ } else {
73
+ changed.push({
74
+ key,
75
+ oldValue: serializeValue(value1),
76
+ newValue: serializeValue(value2)
77
+ });
78
+ }
79
+ }
80
+ });
81
+ return {
82
+ added,
83
+ changed,
84
+ removed
85
+ };
86
+ };
87
+ export const getShallowPropsDifference = (object1, object2) => {
88
+ const {
89
+ added,
90
+ common,
91
+ removed
92
+ } = getKeysAddedRemovedCommon(object1, object2);
93
+ const changed = common.filter(key => object1[key] !== object2[key]);
94
+ return {
95
+ added,
96
+ changed,
97
+ removed
98
+ };
99
+ };
@@ -23,4 +23,6 @@ export { shouldForceTracking } from './should-force-tracking';
23
23
  export { getModeFromTheme } from './getModeFromTheme';
24
24
  export { sniffUserBrowserExtensions } from './browser-extensions';
25
25
  export { RenderCountProfiler } from './profiler/render-count';
26
- export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
26
+ export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
27
+ export { getShallowPropsDifference, getPropsDifference } from './compare-props';
28
+ export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
@@ -0,0 +1,36 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { uuid } from '@atlaskit/adf-schema';
3
+ import { getPropsDifference, getShallowPropsDifference } from '../../../compare-props';
4
+ export function useComponentRenderTracking({
5
+ onRender,
6
+ propsDiffingOptions,
7
+ zeroBasedCount = true
8
+ }) {
9
+ const propsRef = useRef();
10
+ const renderCountRef = useRef(zeroBasedCount ? 0 : 1);
11
+ const {
12
+ current: componentId
13
+ } = useRef(uuid.generate());
14
+ useEffect(() => {
15
+ const lastProps = propsRef.current;
16
+ const renderCount = renderCountRef.current;
17
+ let propsDifference;
18
+
19
+ if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled && lastProps) {
20
+ propsDifference = propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.useShallow ? getShallowPropsDifference(lastProps, propsDiffingOptions.props) : getPropsDifference(lastProps, propsDiffingOptions.props, 0, 2, propsDiffingOptions === null || propsDiffingOptions === void 0 ? void 0 : propsDiffingOptions.propsToIgnore);
21
+ }
22
+
23
+ const result = {
24
+ renderCount,
25
+ propsDifference,
26
+ componentId
27
+ };
28
+ onRender(result);
29
+
30
+ if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
31
+ propsRef.current = propsDiffingOptions.props;
32
+ }
33
+
34
+ renderCountRef.current = renderCountRef.current + 1;
35
+ }); // No dependencies run on each render
36
+ }
@@ -356,7 +356,7 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
356
356
  mediaCollection = collection;
357
357
  }
358
358
 
359
- if (mediaId && mediaCollection && adfStage === 'stage0') {
359
+ if (mediaId && mediaCollection) {
360
360
  return {
361
361
  type,
362
362
  attrs,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "63.0.1",
3
+ "version": "66.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * NOTE:
3
3
  *
4
- * This file is automatically generated by i18n-tools.
4
+ * This file is automatically generated by Traduki 2.0.
5
5
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
6
6
  */
7
- // Czech
7
+ //Czech
8
8
  export default {
9
- 'fabric.editor.codeBidiWarningLabel': 'Obousměrné znaky mění pořadí vykreslování textu. Může to být použito k zakrytí škodlivého kódu.',
10
9
  'fabric.editor.captionPlaceholder': 'Přidejte popisek',
10
+ 'fabric.editor.codeBidiWarningLabel': 'Obousměrné znaky mění pořadí vykreslování textu. Může to být použito k zakrytí škodlivého kódu.',
11
11
  'fabric.editor.collapseNode': 'Sbalit obsah',
12
12
  'fabric.editor.expandDefaultTitle': 'Klikněte sem pro rozbalení...',
13
13
  'fabric.editor.expandNode': 'Rozbalit obsah',