@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.
- package/CHANGELOG.md +68 -0
- package/dist/cjs/i18n/cs.js +3 -3
- package/dist/cjs/i18n/da.js +3 -3
- package/dist/cjs/i18n/de.js +3 -3
- package/dist/cjs/i18n/en_ZZ.js +27 -0
- package/dist/cjs/i18n/es.js +3 -3
- package/dist/cjs/i18n/fi.js +3 -3
- package/dist/cjs/i18n/fr.js +3 -3
- package/dist/cjs/i18n/hu.js +3 -3
- package/dist/cjs/i18n/it.js +3 -3
- package/dist/cjs/i18n/ja.js +3 -3
- package/dist/cjs/i18n/ko.js +3 -3
- package/dist/cjs/i18n/nb.js +3 -3
- package/dist/cjs/i18n/nl.js +3 -3
- package/dist/cjs/i18n/pl.js +3 -3
- package/dist/cjs/i18n/pt_BR.js +3 -3
- package/dist/cjs/i18n/ru.js +3 -3
- package/dist/cjs/i18n/sv.js +3 -3
- package/dist/cjs/i18n/th.js +3 -3
- package/dist/cjs/i18n/tr.js +3 -3
- package/dist/cjs/i18n/uk.js +3 -3
- package/dist/cjs/i18n/vi.js +3 -3
- package/dist/cjs/i18n/zh.js +3 -2
- package/dist/cjs/i18n/zh_TW.js +3 -3
- package/dist/cjs/index.js +1 -29
- package/dist/cjs/normalize-feature-flags.js +40 -4
- package/dist/cjs/{ui/IntlLegacyFallbackProvider → safe-plugin}/index.js +17 -35
- package/dist/cjs/styles/index.js +0 -8
- package/dist/cjs/styles/shared/annotation.js +25 -17
- package/dist/cjs/styles/shared/block-marks.js +2 -2
- package/dist/cjs/styles/shared/blockquote.js +2 -2
- package/dist/cjs/styles/shared/code-mark.js +9 -5
- package/dist/cjs/styles/shared/column-layout.js +2 -2
- package/dist/cjs/styles/shared/date.js +2 -2
- package/dist/cjs/styles/shared/headings.js +5 -2
- package/dist/cjs/styles/shared/indentation.js +2 -2
- package/dist/cjs/styles/shared/link.js +2 -2
- package/dist/cjs/styles/shared/lists.js +4 -2
- package/dist/cjs/styles/shared/media-single.js +2 -2
- package/dist/cjs/styles/shared/panel.js +7 -4
- package/dist/cjs/styles/shared/paragraph.js +2 -2
- package/dist/cjs/styles/shared/rule.js +5 -2
- package/dist/cjs/styles/shared/shadow.js +2 -2
- package/dist/cjs/styles/shared/table.js +37 -33
- package/dist/cjs/styles/shared/task-decision.js +2 -2
- package/dist/cjs/styles/shared/text-color.js +2 -2
- package/dist/cjs/styles/shared/whitespace.js +2 -2
- package/dist/cjs/types/collab.js +5 -0
- package/dist/cjs/ui/BaseTheme/index.js +27 -11
- package/dist/cjs/ui/Caption/index.js +10 -7
- package/dist/cjs/ui/Expand/index.js +84 -46
- package/dist/cjs/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +9 -9
- package/dist/cjs/ui/MediaSingle/index.js +15 -8
- package/dist/cjs/ui/MediaSingle/link.js +4 -6
- package/dist/cjs/ui/MediaSingle/styled.js +23 -20
- package/dist/cjs/ui/Mention/index.js +1 -3
- package/dist/cjs/ui/Mention/mention-with-profilecard.js +33 -194
- package/dist/cjs/ui/Mention/mention-with-providers.js +1 -5
- package/dist/cjs/ui/Messages/index.js +25 -22
- package/dist/cjs/ui/Popup/index.js +15 -1
- package/dist/cjs/ui/UnsupportedBlock/index.js +9 -6
- package/dist/cjs/ui/UnsupportedInline/index.js +8 -6
- package/dist/cjs/ui/WidthProvider/index.js +8 -9
- package/dist/cjs/ui/clear-next-sibling-margin-top.js +4 -5
- package/dist/cjs/ui/index.js +24 -34
- package/dist/cjs/utils/compare-props.js +136 -0
- package/dist/cjs/utils/index.js +23 -1
- package/dist/cjs/utils/performance/hooks/use-component-render-tracking/index.js +47 -0
- package/dist/cjs/utils/validator.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/i18n/cs.js +3 -3
- package/dist/es2019/i18n/da.js +3 -3
- package/dist/es2019/i18n/de.js +3 -3
- package/dist/es2019/i18n/en_ZZ.js +19 -0
- package/dist/es2019/i18n/es.js +3 -3
- package/dist/es2019/i18n/fi.js +3 -3
- package/dist/es2019/i18n/fr.js +3 -3
- package/dist/es2019/i18n/hu.js +3 -3
- package/dist/es2019/i18n/it.js +3 -3
- package/dist/es2019/i18n/ja.js +3 -3
- package/dist/es2019/i18n/ko.js +3 -3
- package/dist/es2019/i18n/nb.js +3 -3
- package/dist/es2019/i18n/nl.js +3 -3
- package/dist/es2019/i18n/pl.js +3 -3
- package/dist/es2019/i18n/pt_BR.js +3 -3
- package/dist/es2019/i18n/ru.js +3 -3
- package/dist/es2019/i18n/sv.js +3 -3
- package/dist/es2019/i18n/th.js +3 -3
- package/dist/es2019/i18n/tr.js +3 -3
- package/dist/es2019/i18n/uk.js +3 -3
- package/dist/es2019/i18n/vi.js +3 -3
- package/dist/es2019/i18n/zh.js +3 -2
- package/dist/es2019/i18n/zh_TW.js +3 -3
- package/dist/es2019/index.js +2 -7
- package/dist/es2019/normalize-feature-flags.js +40 -4
- package/dist/es2019/safe-plugin/index.js +10 -0
- package/dist/es2019/styles/index.js +0 -1
- package/dist/es2019/styles/shared/annotation.js +11 -11
- package/dist/es2019/styles/shared/block-marks.js +3 -2
- package/dist/es2019/styles/shared/blockquote.js +1 -1
- package/dist/es2019/styles/shared/code-mark.js +14 -11
- package/dist/es2019/styles/shared/column-layout.js +1 -1
- package/dist/es2019/styles/shared/date.js +1 -1
- package/dist/es2019/styles/shared/headings.js +8 -8
- package/dist/es2019/styles/shared/indentation.js +1 -1
- package/dist/es2019/styles/shared/link.js +1 -1
- package/dist/es2019/styles/shared/lists.js +19 -1
- package/dist/es2019/styles/shared/media-single.js +1 -1
- package/dist/es2019/styles/shared/panel.js +15 -15
- package/dist/es2019/styles/shared/paragraph.js +1 -1
- package/dist/es2019/styles/shared/rule.js +3 -3
- package/dist/es2019/styles/shared/shadow.js +1 -1
- package/dist/es2019/styles/shared/table.js +23 -13
- package/dist/es2019/styles/shared/task-decision.js +1 -1
- package/dist/es2019/styles/shared/text-color.js +1 -1
- package/dist/es2019/styles/shared/whitespace.js +1 -1
- package/dist/es2019/types/collab.js +1 -0
- package/dist/es2019/ui/BaseTheme/index.js +16 -5
- package/dist/es2019/ui/Caption/index.js +11 -5
- package/dist/es2019/ui/Expand/index.js +97 -67
- package/dist/es2019/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/index.js +15 -9
- package/dist/es2019/ui/MediaSingle/link.js +3 -4
- package/dist/es2019/ui/MediaSingle/styled.js +13 -12
- package/dist/es2019/ui/Mention/index.js +1 -3
- package/dist/es2019/ui/Mention/mention-with-profilecard.js +33 -146
- package/dist/es2019/ui/Mention/mention-with-providers.js +1 -5
- package/dist/es2019/ui/Messages/index.js +30 -22
- package/dist/es2019/ui/Popup/index.js +16 -1
- package/dist/es2019/ui/UnsupportedBlock/index.js +9 -6
- package/dist/es2019/ui/UnsupportedInline/index.js +8 -5
- package/dist/es2019/ui/WidthProvider/index.js +10 -8
- package/dist/es2019/ui/clear-next-sibling-margin-top.js +2 -2
- package/dist/es2019/ui/index.js +4 -6
- package/dist/es2019/utils/compare-props.js +99 -0
- package/dist/es2019/utils/index.js +3 -1
- package/dist/es2019/utils/performance/hooks/use-component-render-tracking/index.js +36 -0
- package/dist/es2019/utils/validator.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/i18n/cs.js +3 -3
- package/dist/esm/i18n/da.js +3 -3
- package/dist/esm/i18n/de.js +3 -3
- package/dist/esm/i18n/en_ZZ.js +19 -0
- package/dist/esm/i18n/es.js +3 -3
- package/dist/esm/i18n/fi.js +3 -3
- package/dist/esm/i18n/fr.js +3 -3
- package/dist/esm/i18n/hu.js +3 -3
- package/dist/esm/i18n/it.js +3 -3
- package/dist/esm/i18n/ja.js +3 -3
- package/dist/esm/i18n/ko.js +3 -3
- package/dist/esm/i18n/nb.js +3 -3
- package/dist/esm/i18n/nl.js +3 -3
- package/dist/esm/i18n/pl.js +3 -3
- package/dist/esm/i18n/pt_BR.js +3 -3
- package/dist/esm/i18n/ru.js +3 -3
- package/dist/esm/i18n/sv.js +3 -3
- package/dist/esm/i18n/th.js +3 -3
- package/dist/esm/i18n/tr.js +3 -3
- package/dist/esm/i18n/uk.js +3 -3
- package/dist/esm/i18n/vi.js +3 -3
- package/dist/esm/i18n/zh.js +3 -2
- package/dist/esm/i18n/zh_TW.js +3 -3
- package/dist/esm/index.js +2 -7
- package/dist/esm/normalize-feature-flags.js +39 -4
- package/dist/esm/{ui/IntlLegacyFallbackProvider → safe-plugin}/index.js +13 -31
- package/dist/esm/styles/index.js +0 -1
- package/dist/esm/styles/shared/annotation.js +21 -17
- package/dist/esm/styles/shared/block-marks.js +2 -2
- package/dist/esm/styles/shared/blockquote.js +1 -1
- package/dist/esm/styles/shared/code-mark.js +9 -6
- package/dist/esm/styles/shared/column-layout.js +1 -1
- package/dist/esm/styles/shared/date.js +1 -1
- package/dist/esm/styles/shared/headings.js +4 -2
- package/dist/esm/styles/shared/indentation.js +1 -1
- package/dist/esm/styles/shared/link.js +1 -1
- package/dist/esm/styles/shared/lists.js +3 -2
- package/dist/esm/styles/shared/media-single.js +1 -1
- package/dist/esm/styles/shared/panel.js +6 -4
- package/dist/esm/styles/shared/paragraph.js +1 -1
- package/dist/esm/styles/shared/rule.js +4 -2
- package/dist/esm/styles/shared/shadow.js +1 -1
- package/dist/esm/styles/shared/table.js +37 -33
- package/dist/esm/styles/shared/task-decision.js +1 -1
- package/dist/esm/styles/shared/text-color.js +1 -1
- package/dist/esm/styles/shared/whitespace.js +1 -1
- package/dist/esm/types/collab.js +1 -0
- package/dist/esm/ui/BaseTheme/index.js +23 -12
- package/dist/esm/ui/Caption/index.js +10 -5
- package/dist/esm/ui/Expand/index.js +79 -42
- package/dist/esm/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +7 -7
- package/dist/esm/ui/MediaSingle/index.js +16 -9
- package/dist/esm/ui/MediaSingle/link.js +2 -3
- package/dist/esm/ui/MediaSingle/styled.js +17 -10
- package/dist/esm/ui/Mention/index.js +1 -3
- package/dist/esm/ui/Mention/mention-with-profilecard.js +33 -189
- package/dist/esm/ui/Mention/mention-with-providers.js +1 -5
- package/dist/esm/ui/Messages/index.js +26 -20
- package/dist/esm/ui/Popup/index.js +16 -1
- package/dist/esm/ui/UnsupportedBlock/index.js +9 -5
- package/dist/esm/ui/UnsupportedInline/index.js +8 -5
- package/dist/esm/ui/WidthProvider/index.js +7 -6
- package/dist/esm/ui/clear-next-sibling-margin-top.js +2 -2
- package/dist/esm/ui/index.js +4 -6
- package/dist/esm/utils/compare-props.js +115 -0
- package/dist/esm/utils/index.js +3 -1
- package/dist/esm/utils/performance/hooks/use-component-render-tracking/index.js +37 -0
- package/dist/esm/utils/validator.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/__tests_external__/page-objects/Editor.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/EditorMedia.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/EditorSmartLink.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/Renderer.d.ts +0 -1
- package/dist/types/collab/types.d.ts +14 -2
- package/dist/types/collab.d.ts +1 -1
- package/dist/types/extensions/types/field-definitions.d.ts +1 -1
- package/dist/types/i18n/cs.d.ts +2 -2
- package/dist/types/i18n/da.d.ts +2 -2
- package/dist/types/i18n/de.d.ts +2 -2
- package/dist/types/i18n/en_ZZ.d.ts +19 -0
- package/dist/types/i18n/es.d.ts +2 -2
- package/dist/types/i18n/fi.d.ts +2 -2
- package/dist/types/i18n/fr.d.ts +2 -2
- package/dist/types/i18n/hu.d.ts +2 -2
- package/dist/types/i18n/it.d.ts +2 -2
- package/dist/types/i18n/ja.d.ts +2 -2
- package/dist/types/i18n/ko.d.ts +2 -2
- package/dist/types/i18n/nb.d.ts +2 -2
- package/dist/types/i18n/nl.d.ts +2 -2
- package/dist/types/i18n/pl.d.ts +2 -2
- package/dist/types/i18n/pt_BR.d.ts +2 -2
- package/dist/types/i18n/ru.d.ts +2 -2
- package/dist/types/i18n/sv.d.ts +2 -2
- package/dist/types/i18n/th.d.ts +2 -2
- package/dist/types/i18n/tr.d.ts +2 -2
- package/dist/types/i18n/uk.d.ts +2 -2
- package/dist/types/i18n/vi.d.ts +2 -2
- package/dist/types/i18n/zh.d.ts +2 -2
- package/dist/types/i18n/zh_TW.d.ts +2 -2
- package/dist/types/index.d.ts +1 -14
- package/dist/types/normalize-feature-flags.d.ts +6 -3
- package/dist/types/safe-plugin/index.d.ts +6 -0
- package/dist/types/styles/index.d.ts +0 -1
- package/dist/types/styles/shared/annotation.d.ts +5 -4
- package/dist/types/styles/shared/block-marks.d.ts +1 -1
- package/dist/types/styles/shared/blockquote.d.ts +1 -1
- package/dist/types/styles/shared/code-mark.d.ts +2 -1
- package/dist/types/styles/shared/column-layout.d.ts +1 -1
- package/dist/types/styles/shared/date.d.ts +1 -1
- package/dist/types/styles/shared/headings.d.ts +2 -1
- package/dist/types/styles/shared/indentation.d.ts +1 -1
- package/dist/types/styles/shared/link.d.ts +1 -1
- package/dist/types/styles/shared/lists.d.ts +1 -1
- package/dist/types/styles/shared/media-single.d.ts +1 -1
- package/dist/types/styles/shared/panel.d.ts +1 -1
- package/dist/types/styles/shared/paragraph.d.ts +1 -1
- package/dist/types/styles/shared/rule.d.ts +2 -1
- package/dist/types/styles/shared/shadow.d.ts +1 -1
- package/dist/types/styles/shared/table.d.ts +2 -1
- package/dist/types/styles/shared/task-decision.d.ts +1 -1
- package/dist/types/styles/shared/text-color.d.ts +1 -1
- package/dist/types/styles/shared/whitespace.d.ts +1 -1
- package/dist/types/types/collab.d.ts +8 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/ui/Caption/index.d.ts +3 -1
- package/dist/types/ui/Expand/index.d.ts +12 -10
- package/dist/types/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.d.ts +1 -1
- package/dist/types/ui/MediaSingle/index.d.ts +4 -1
- package/dist/types/ui/MediaSingle/link.d.ts +1 -2
- package/dist/types/ui/MediaSingle/styled.d.ts +10 -5
- package/dist/types/ui/Mention/index.d.ts +0 -3
- package/dist/types/ui/Mention/mention-with-profilecard.d.ts +2 -25
- package/dist/types/ui/Mention/mention-with-providers.d.ts +0 -3
- package/dist/types/ui/Messages/index.d.ts +5 -3
- package/dist/types/ui/Popup/index.d.ts +3 -0
- package/dist/types/ui/UnsupportedBlock/index.d.ts +1 -0
- package/dist/types/ui/UnsupportedInline/index.d.ts +1 -0
- package/dist/types/ui/WidthProvider/index.d.ts +3 -1
- package/dist/types/ui/clear-next-sibling-margin-top.d.ts +1 -2
- package/dist/types/ui/index.d.ts +5 -7
- package/dist/types/utils/compare-props.d.ts +32 -0
- package/dist/types/utils/getModeFromTheme.d.ts +1 -1
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/performance/hooks/use-component-render-tracking/index.d.ts +19 -0
- package/package.json +20 -19
- package/safe-plugin/package.json +7 -0
- package/dist/cjs/styles/shared/inline-nodes.js +0 -17
- package/dist/cjs/ui/LegacyToNextIntlProvider/index.js +0 -67
- package/dist/es2019/styles/shared/inline-nodes.js +0 -7
- package/dist/es2019/ui/IntlLegacyFallbackProvider/index.js +0 -21
- package/dist/es2019/ui/LegacyToNextIntlProvider/index.js +0 -24
- package/dist/esm/styles/shared/inline-nodes.js +0 -7
- package/dist/esm/ui/LegacyToNextIntlProvider/index.js +0 -51
- package/dist/types/styles/shared/inline-nodes.d.ts +0 -2
- package/dist/types/ui/IntlLegacyFallbackProvider/index.d.ts +0 -8
- package/dist/types/ui/LegacyToNextIntlProvider/index.d.ts +0 -8
|
@@ -1,148 +1,35 @@
|
|
|
1
|
-
import
|
|
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
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
2
|
-
import
|
|
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
|
|
9
|
-
${
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}) =>
|
|
29
|
+
}) => jsx("div", {
|
|
30
|
+
css: messageStyle
|
|
31
|
+
}, children);
|
|
32
32
|
export const ErrorMessage = ({
|
|
33
33
|
children
|
|
34
|
-
}) =>
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
}) =>
|
|
44
|
-
|
|
45
|
-
|
|
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 =
|
|
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
|
|
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
|
|
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
|
-
},
|
|
55
|
+
}, jsx("span", {
|
|
53
56
|
style: style
|
|
54
|
-
},
|
|
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
|
|
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
|
|
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
|
-
},
|
|
52
|
+
}, jsx("span", {
|
|
50
53
|
style: style
|
|
51
|
-
},
|
|
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
|
|
55
|
+
return jsx("div", {
|
|
56
|
+
css: css`
|
|
57
|
+
position: relative;
|
|
58
|
+
width: 100%;
|
|
59
|
+
`,
|
|
58
60
|
className: this.props.className
|
|
59
|
-
},
|
|
61
|
+
}, jsx(WidthObserver, {
|
|
60
62
|
setWidth: this.setWidth,
|
|
61
63
|
offscreen: true
|
|
62
|
-
}),
|
|
64
|
+
}), jsx(Provider, {
|
|
63
65
|
value: createWidthContext(this.state.width)
|
|
64
66
|
}, this.props.children));
|
|
65
67
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
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
|
|
3
|
+
export const clearNextSiblingMarginTopStyle = css`
|
|
4
4
|
& + * {
|
|
5
5
|
margin-top: 0 !important;
|
|
6
6
|
}
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -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 {
|
|
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,
|
|
14
|
+
export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
|
|
15
15
|
export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
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
|
|
359
|
+
if (mediaId && mediaCollection) {
|
|
360
360
|
return {
|
|
361
361
|
type,
|
|
362
362
|
attrs,
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/i18n/cs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NOTE:
|
|
3
3
|
*
|
|
4
|
-
* This file is automatically generated by
|
|
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
|
-
//
|
|
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',
|