@atlaskit/editor-core 203.2.2 → 203.2.3
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 +8 -0
- package/dist/cjs/composable-editor/editor-internal.js +2 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/editor-internal.js +2 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/editor-internal.js +2 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/create-universal-preset.d.ts +8 -1
- package/dist/types/presets/universal.d.ts +8 -1
- package/dist/types/presets/useUniversalPreset.d.ts +8 -1
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +8 -0
- package/dist/types-ts4.5/presets/universal.d.ts +8 -0
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +8 -0
- package/package.json +2 -2
- package/dist/cjs/nodeviews/context-adapter.js +0 -78
- package/dist/es2019/nodeviews/context-adapter.js +0 -48
- package/dist/esm/nodeviews/context-adapter.js +0 -71
- package/dist/types/nodeviews/context-adapter.d.ts +0 -2
- package/dist/types-ts4.5/nodeviews/context-adapter.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 203.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#176132](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/176132)
|
|
8
|
+
[`738d9aeecf5e1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/738d9aeecf5e1) -
|
|
9
|
+
[ED-24119] Replace Legacy React Context with proper React Context
|
|
10
|
+
|
|
3
11
|
## 203.2.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -17,7 +17,6 @@ var _ErrorBoundary = _interopRequireDefault(require("../create-editor/ErrorBound
|
|
|
17
17
|
var _featureFlagsFromProps = require("../create-editor/feature-flags-from-props");
|
|
18
18
|
var _ReactEditorView = _interopRequireDefault(require("../create-editor/ReactEditorView"));
|
|
19
19
|
var _ReactEditorViewNext = _interopRequireDefault(require("../create-editor/ReactEditorViewNext"));
|
|
20
|
-
var _contextAdapter = require("../nodeviews/context-adapter");
|
|
21
20
|
var _EditorContext = _interopRequireDefault(require("../ui/EditorContext"));
|
|
22
21
|
var _IntlProviderIfMissingWrapper = require("../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper");
|
|
23
22
|
var _RenderTracking = require("../utils/performance/components/RenderTracking");
|
|
@@ -84,7 +83,7 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
|
|
|
84
83
|
css: editorContainerStyles
|
|
85
84
|
}, (0, _react2.jsx)(_EditorContext.default, {
|
|
86
85
|
editorActions: editorActions
|
|
87
|
-
}, (0, _react2.jsx)(
|
|
86
|
+
}, (0, _react2.jsx)(_IntlProviderIfMissingWrapper.IntlProviderIfMissingWrapper, null, (0, _react2.jsx)(_react.Fragment, null, (0, _platformFeatureFlags.fg)('platform_editor_react_editor_view_react_18') ? (0, _react2.jsx)(_ReactEditorViewNext.default, {
|
|
88
87
|
editorProps: overriddenEditorProps,
|
|
89
88
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
90
89
|
portalProviderAPI: portalProviderAPI,
|
|
@@ -194,7 +193,7 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
|
|
|
194
193
|
pluginHooks: config.pluginHooks
|
|
195
194
|
}));
|
|
196
195
|
}
|
|
197
|
-
}), (0, _react2.jsx)(PortalRenderer, null), (0, _react2.jsx)(NodeViewPortalRenderer, null)))))))
|
|
196
|
+
}), (0, _react2.jsx)(PortalRenderer, null), (0, _react2.jsx)(NodeViewPortalRenderer, null)))))));
|
|
198
197
|
});
|
|
199
198
|
function ReactEditorViewContextWrapper(props) {
|
|
200
199
|
var _media, _linking;
|
|
@@ -14,7 +14,6 @@ import ErrorBoundary from '../create-editor/ErrorBoundary';
|
|
|
14
14
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
15
15
|
import ReactEditorView from '../create-editor/ReactEditorView';
|
|
16
16
|
import ReactEditorViewNext from '../create-editor/ReactEditorViewNext';
|
|
17
|
-
import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
18
17
|
import EditorContext from '../ui/EditorContext';
|
|
19
18
|
import { IntlProviderIfMissingWrapper } from '../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper';
|
|
20
19
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
@@ -72,7 +71,7 @@ export const EditorInternal = /*#__PURE__*/memo(({
|
|
|
72
71
|
css: editorContainerStyles
|
|
73
72
|
}, jsx(EditorContext, {
|
|
74
73
|
editorActions: editorActions
|
|
75
|
-
}, jsx(
|
|
74
|
+
}, jsx(IntlProviderIfMissingWrapper, null, jsx(Fragment, null, fg('platform_editor_react_editor_view_react_18') ? jsx(ReactEditorViewNext, {
|
|
76
75
|
editorProps: overriddenEditorProps,
|
|
77
76
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
78
77
|
portalProviderAPI: portalProviderAPI,
|
|
@@ -184,7 +183,7 @@ export const EditorInternal = /*#__PURE__*/memo(({
|
|
|
184
183
|
pluginHooks: config.pluginHooks
|
|
185
184
|
}));
|
|
186
185
|
}
|
|
187
|
-
}), jsx(PortalRenderer, null), jsx(NodeViewPortalRenderer, null)))))))
|
|
186
|
+
}), jsx(PortalRenderer, null), jsx(NodeViewPortalRenderer, null)))))));
|
|
188
187
|
});
|
|
189
188
|
function ReactEditorViewContextWrapper(props) {
|
|
190
189
|
var _media, _linking, _linking$smartLinks;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "203.2.
|
|
2
|
+
export const version = "203.2.3";
|
|
@@ -18,7 +18,6 @@ import ErrorBoundary from '../create-editor/ErrorBoundary';
|
|
|
18
18
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
19
19
|
import ReactEditorView from '../create-editor/ReactEditorView';
|
|
20
20
|
import ReactEditorViewNext from '../create-editor/ReactEditorViewNext';
|
|
21
|
-
import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
22
21
|
import EditorContext from '../ui/EditorContext';
|
|
23
22
|
import { IntlProviderIfMissingWrapper } from '../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper';
|
|
24
23
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
@@ -80,7 +79,7 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
|
|
|
80
79
|
css: editorContainerStyles
|
|
81
80
|
}, jsx(EditorContext, {
|
|
82
81
|
editorActions: editorActions
|
|
83
|
-
}, jsx(
|
|
82
|
+
}, jsx(IntlProviderIfMissingWrapper, null, jsx(Fragment, null, fg('platform_editor_react_editor_view_react_18') ? jsx(ReactEditorViewNext, {
|
|
84
83
|
editorProps: overriddenEditorProps,
|
|
85
84
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
86
85
|
portalProviderAPI: portalProviderAPI,
|
|
@@ -190,7 +189,7 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
|
|
|
190
189
|
pluginHooks: config.pluginHooks
|
|
191
190
|
}));
|
|
192
191
|
}
|
|
193
|
-
}), jsx(PortalRenderer, null), jsx(NodeViewPortalRenderer, null)))))))
|
|
192
|
+
}), jsx(PortalRenderer, null), jsx(NodeViewPortalRenderer, null)))))));
|
|
194
193
|
});
|
|
195
194
|
function ReactEditorViewContextWrapper(props) {
|
|
196
195
|
var _media, _linking;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "203.2.
|
|
2
|
+
export var version = "203.2.3";
|
|
@@ -1922,7 +1922,14 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
|
|
|
1922
1922
|
hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
1923
1923
|
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
1924
1924
|
};
|
|
1925
|
-
}, undefined>, import("@atlaskit/editor-common/types").
|
|
1925
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
1926
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined;
|
|
1927
|
+
actions: import("@atlaskit/editor-plugin-selection").EditorSelectionAPI;
|
|
1928
|
+
commands: {
|
|
1929
|
+
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
1930
|
+
};
|
|
1931
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
1932
|
+
}, import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
1926
1933
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
1927
1934
|
sharedState: {
|
|
1928
1935
|
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
@@ -1974,7 +1974,14 @@ export default function createUniversalPresetInternal({ appearance, props, featu
|
|
|
1974
1974
|
hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
1975
1975
|
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
1976
1976
|
};
|
|
1977
|
-
}, undefined>, import("@atlaskit/editor-common/types").
|
|
1977
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
1978
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined;
|
|
1979
|
+
actions: import("@atlaskit/editor-plugin-selection").EditorSelectionAPI;
|
|
1980
|
+
commands: {
|
|
1981
|
+
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
1982
|
+
};
|
|
1983
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
1984
|
+
}, import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
1978
1985
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
1979
1986
|
sharedState: {
|
|
1980
1987
|
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
@@ -1922,7 +1922,14 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
|
|
|
1922
1922
|
hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
1923
1923
|
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
1924
1924
|
};
|
|
1925
|
-
}, undefined>, import("@atlaskit/editor-common/types").
|
|
1925
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
1926
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined;
|
|
1927
|
+
actions: import("@atlaskit/editor-plugin-selection").EditorSelectionAPI;
|
|
1928
|
+
commands: {
|
|
1929
|
+
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
1930
|
+
};
|
|
1931
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
1932
|
+
}, import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
1926
1933
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
1927
1934
|
sharedState: {
|
|
1928
1935
|
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
@@ -2388,6 +2388,14 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
|
|
|
2388
2388
|
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
2389
2389
|
};
|
|
2390
2390
|
}, undefined>,
|
|
2391
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
2392
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined;
|
|
2393
|
+
actions: import("@atlaskit/editor-plugin-selection").EditorSelectionAPI;
|
|
2394
|
+
commands: {
|
|
2395
|
+
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
2396
|
+
};
|
|
2397
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
2398
|
+
}, import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined>,
|
|
2391
2399
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
2392
2400
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
2393
2401
|
sharedState: {
|
|
@@ -2440,6 +2440,14 @@ export default function createUniversalPresetInternal({ appearance, props, featu
|
|
|
2440
2440
|
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
2441
2441
|
};
|
|
2442
2442
|
}, undefined>,
|
|
2443
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
2444
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined;
|
|
2445
|
+
actions: import("@atlaskit/editor-plugin-selection").EditorSelectionAPI;
|
|
2446
|
+
commands: {
|
|
2447
|
+
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
2448
|
+
};
|
|
2449
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
2450
|
+
}, import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined>,
|
|
2443
2451
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
2444
2452
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
2445
2453
|
sharedState: {
|
|
@@ -2388,6 +2388,14 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
|
|
|
2388
2388
|
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
2389
2389
|
};
|
|
2390
2390
|
}, undefined>,
|
|
2391
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"selection", {
|
|
2392
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined;
|
|
2393
|
+
actions: import("@atlaskit/editor-plugin-selection").EditorSelectionAPI;
|
|
2394
|
+
commands: {
|
|
2395
|
+
displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
2396
|
+
};
|
|
2397
|
+
sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
|
|
2398
|
+
}, import("@atlaskit/editor-plugin-selection").SelectionPluginOptions | undefined>,
|
|
2391
2399
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
2392
2400
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
2393
2401
|
sharedState: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "203.2.
|
|
3
|
+
"version": "203.2.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@atlaskit/editor-plugin-card": "^4.5.0",
|
|
89
89
|
"@atlaskit/editor-plugin-list": "^3.9.0",
|
|
90
90
|
"@atlaskit/editor-plugin-paste": "^2.0.0",
|
|
91
|
-
"@atlaskit/link-provider": "^1.
|
|
91
|
+
"@atlaskit/link-provider": "^1.18.0",
|
|
92
92
|
"@atlaskit/logo": "^15.1.0",
|
|
93
93
|
"@atlaskit/media-core": "^34.3.0",
|
|
94
94
|
"@atlaskit/media-integration-test-helpers": "^3.1.0",
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ContextAdapter = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
var _analyticsNextStableReactContext = _interopRequireDefault(require("@atlaskit/analytics-next-stable-react-context"));
|
|
18
|
-
var _linkProvider = require("@atlaskit/link-provider");
|
|
19
|
-
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
20
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
-
function useContextMemoized(reactContext) {
|
|
22
|
-
var value = _react.default.useContext(reactContext);
|
|
23
|
-
var context = _react.default.useMemo(function () {
|
|
24
|
-
return {
|
|
25
|
-
Provider: reactContext.Provider,
|
|
26
|
-
Consumer: reactContext.Consumer,
|
|
27
|
-
value: value
|
|
28
|
-
};
|
|
29
|
-
}, [value, reactContext]);
|
|
30
|
-
return context;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// injects contexts via old context API to children
|
|
34
|
-
// and gives access to the original Provider so that
|
|
35
|
-
// the child can re-emit it
|
|
36
|
-
var ContextAdapter = exports.ContextAdapter = function ContextAdapter(_ref) {
|
|
37
|
-
var children = _ref.children;
|
|
38
|
-
var card = useContextMemoized(_linkProvider.SmartCardContext);
|
|
39
|
-
var analytics = useContextMemoized(_analyticsNextStableReactContext.default);
|
|
40
|
-
return /*#__PURE__*/_react.default.createElement(LegacyContextAdapter, {
|
|
41
|
-
card: card,
|
|
42
|
-
analytics: analytics
|
|
43
|
-
}, children);
|
|
44
|
-
};
|
|
45
|
-
var LegacyContextAdapter = /*#__PURE__*/function (_React$PureComponent) {
|
|
46
|
-
(0, _inherits2.default)(LegacyContextAdapter, _React$PureComponent);
|
|
47
|
-
var _super = _createSuper(LegacyContextAdapter);
|
|
48
|
-
function LegacyContextAdapter() {
|
|
49
|
-
var _this;
|
|
50
|
-
(0, _classCallCheck2.default)(this, LegacyContextAdapter);
|
|
51
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
52
|
-
args[_key] = arguments[_key];
|
|
53
|
-
}
|
|
54
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
55
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "contextState", {});
|
|
56
|
-
return _this;
|
|
57
|
-
}
|
|
58
|
-
(0, _createClass2.default)(LegacyContextAdapter, [{
|
|
59
|
-
key: "getChildContext",
|
|
60
|
-
value: function getChildContext() {
|
|
61
|
-
return {
|
|
62
|
-
contextAdapter: {
|
|
63
|
-
card: this.props.card,
|
|
64
|
-
analytics: this.props.analytics
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "render",
|
|
70
|
-
value: function render() {
|
|
71
|
-
return this.props.children;
|
|
72
|
-
}
|
|
73
|
-
}]);
|
|
74
|
-
return LegacyContextAdapter;
|
|
75
|
-
}(_react.default.PureComponent);
|
|
76
|
-
(0, _defineProperty2.default)(LegacyContextAdapter, "childContextTypes", {
|
|
77
|
-
contextAdapter: _propTypes.default.object
|
|
78
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
5
|
-
import { SmartCardContext } from '@atlaskit/link-provider';
|
|
6
|
-
function useContextMemoized(reactContext) {
|
|
7
|
-
const value = React.useContext(reactContext);
|
|
8
|
-
const context = React.useMemo(() => ({
|
|
9
|
-
Provider: reactContext.Provider,
|
|
10
|
-
Consumer: reactContext.Consumer,
|
|
11
|
-
value
|
|
12
|
-
}), [value, reactContext]);
|
|
13
|
-
return context;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// injects contexts via old context API to children
|
|
17
|
-
// and gives access to the original Provider so that
|
|
18
|
-
// the child can re-emit it
|
|
19
|
-
export const ContextAdapter = ({
|
|
20
|
-
children
|
|
21
|
-
}) => {
|
|
22
|
-
const card = useContextMemoized(SmartCardContext);
|
|
23
|
-
const analytics = useContextMemoized(AnalyticsReactContext);
|
|
24
|
-
return /*#__PURE__*/React.createElement(LegacyContextAdapter, {
|
|
25
|
-
card: card,
|
|
26
|
-
analytics: analytics
|
|
27
|
-
}, children);
|
|
28
|
-
};
|
|
29
|
-
class LegacyContextAdapter extends React.PureComponent {
|
|
30
|
-
constructor(...args) {
|
|
31
|
-
super(...args);
|
|
32
|
-
_defineProperty(this, "contextState", {});
|
|
33
|
-
}
|
|
34
|
-
getChildContext() {
|
|
35
|
-
return {
|
|
36
|
-
contextAdapter: {
|
|
37
|
-
card: this.props.card,
|
|
38
|
-
analytics: this.props.analytics
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
return this.props.children;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
_defineProperty(LegacyContextAdapter, "childContextTypes", {
|
|
47
|
-
contextAdapter: PropTypes.object
|
|
48
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
9
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import PropTypes from 'prop-types';
|
|
12
|
-
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
13
|
-
import { SmartCardContext } from '@atlaskit/link-provider';
|
|
14
|
-
function useContextMemoized(reactContext) {
|
|
15
|
-
var value = React.useContext(reactContext);
|
|
16
|
-
var context = React.useMemo(function () {
|
|
17
|
-
return {
|
|
18
|
-
Provider: reactContext.Provider,
|
|
19
|
-
Consumer: reactContext.Consumer,
|
|
20
|
-
value: value
|
|
21
|
-
};
|
|
22
|
-
}, [value, reactContext]);
|
|
23
|
-
return context;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// injects contexts via old context API to children
|
|
27
|
-
// and gives access to the original Provider so that
|
|
28
|
-
// the child can re-emit it
|
|
29
|
-
export var ContextAdapter = function ContextAdapter(_ref) {
|
|
30
|
-
var children = _ref.children;
|
|
31
|
-
var card = useContextMemoized(SmartCardContext);
|
|
32
|
-
var analytics = useContextMemoized(AnalyticsReactContext);
|
|
33
|
-
return /*#__PURE__*/React.createElement(LegacyContextAdapter, {
|
|
34
|
-
card: card,
|
|
35
|
-
analytics: analytics
|
|
36
|
-
}, children);
|
|
37
|
-
};
|
|
38
|
-
var LegacyContextAdapter = /*#__PURE__*/function (_React$PureComponent) {
|
|
39
|
-
_inherits(LegacyContextAdapter, _React$PureComponent);
|
|
40
|
-
var _super = _createSuper(LegacyContextAdapter);
|
|
41
|
-
function LegacyContextAdapter() {
|
|
42
|
-
var _this;
|
|
43
|
-
_classCallCheck(this, LegacyContextAdapter);
|
|
44
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
|
-
args[_key] = arguments[_key];
|
|
46
|
-
}
|
|
47
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "contextState", {});
|
|
49
|
-
return _this;
|
|
50
|
-
}
|
|
51
|
-
_createClass(LegacyContextAdapter, [{
|
|
52
|
-
key: "getChildContext",
|
|
53
|
-
value: function getChildContext() {
|
|
54
|
-
return {
|
|
55
|
-
contextAdapter: {
|
|
56
|
-
card: this.props.card,
|
|
57
|
-
analytics: this.props.analytics
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
key: "render",
|
|
63
|
-
value: function render() {
|
|
64
|
-
return this.props.children;
|
|
65
|
-
}
|
|
66
|
-
}]);
|
|
67
|
-
return LegacyContextAdapter;
|
|
68
|
-
}(React.PureComponent);
|
|
69
|
-
_defineProperty(LegacyContextAdapter, "childContextTypes", {
|
|
70
|
-
contextAdapter: PropTypes.object
|
|
71
|
-
});
|