@atlaskit/node-data-provider 2.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 (60) hide show
  1. package/.eslintrc.js +14 -0
  2. package/CHANGELOG.md +24 -0
  3. package/LICENSE.md +11 -0
  4. package/README.md +48 -0
  5. package/cache/package.json +15 -0
  6. package/content/package.json +15 -0
  7. package/dist/cjs/cache.js +145 -0
  8. package/dist/cjs/consumption/_global-ndp-caches.js +21 -0
  9. package/dist/cjs/consumption/_internal-context.js +77 -0
  10. package/dist/cjs/consumption/_lru-cache.js +44 -0
  11. package/dist/cjs/consumption/content.js +53 -0
  12. package/dist/cjs/get-providers/confluence-page.js +15 -0
  13. package/dist/cjs/index.js +234 -0
  14. package/dist/cjs/internal-types.js +5 -0
  15. package/dist/cjs/plugin-hooks.js +97 -0
  16. package/dist/cjs/providers/emoji.js +54 -0
  17. package/dist/es2019/cache.js +96 -0
  18. package/dist/es2019/consumption/_global-ndp-caches.js +13 -0
  19. package/dist/es2019/consumption/_internal-context.js +71 -0
  20. package/dist/es2019/consumption/_lru-cache.js +28 -0
  21. package/dist/es2019/consumption/content.js +46 -0
  22. package/dist/es2019/get-providers/confluence-page.js +10 -0
  23. package/dist/es2019/index.js +193 -0
  24. package/dist/es2019/internal-types.js +1 -0
  25. package/dist/es2019/plugin-hooks.js +66 -0
  26. package/dist/es2019/providers/emoji.js +26 -0
  27. package/dist/esm/cache.js +141 -0
  28. package/dist/esm/consumption/_global-ndp-caches.js +13 -0
  29. package/dist/esm/consumption/_internal-context.js +71 -0
  30. package/dist/esm/consumption/_lru-cache.js +37 -0
  31. package/dist/esm/consumption/content.js +46 -0
  32. package/dist/esm/get-providers/confluence-page.js +9 -0
  33. package/dist/esm/index.js +230 -0
  34. package/dist/esm/internal-types.js +1 -0
  35. package/dist/esm/plugin-hooks.js +90 -0
  36. package/dist/esm/providers/emoji.js +47 -0
  37. package/dist/types/cache.d.ts +61 -0
  38. package/dist/types/consumption/_global-ndp-caches.d.ts +8 -0
  39. package/dist/types/consumption/_internal-context.d.ts +32 -0
  40. package/dist/types/consumption/_lru-cache.d.ts +7 -0
  41. package/dist/types/consumption/content.d.ts +65 -0
  42. package/dist/types/get-providers/confluence-page.d.ts +6 -0
  43. package/dist/types/index.d.ts +136 -0
  44. package/dist/types/internal-types.d.ts +2 -0
  45. package/dist/types/plugin-hooks.d.ts +32 -0
  46. package/dist/types/providers/emoji.d.ts +10 -0
  47. package/dist/types-ts4.5/cache.d.ts +61 -0
  48. package/dist/types-ts4.5/consumption/_global-ndp-caches.d.ts +8 -0
  49. package/dist/types-ts4.5/consumption/_internal-context.d.ts +32 -0
  50. package/dist/types-ts4.5/consumption/_lru-cache.d.ts +7 -0
  51. package/dist/types-ts4.5/consumption/content.d.ts +65 -0
  52. package/dist/types-ts4.5/get-providers/confluence-page.d.ts +6 -0
  53. package/dist/types-ts4.5/index.d.ts +136 -0
  54. package/dist/types-ts4.5/internal-types.d.ts +2 -0
  55. package/dist/types-ts4.5/plugin-hooks.d.ts +32 -0
  56. package/dist/types-ts4.5/providers/emoji.d.ts +10 -0
  57. package/emoji-provider/package.json +15 -0
  58. package/get-confluence-page-providers/package.json +15 -0
  59. package/package.json +73 -0
  60. package/plugin-hooks/package.json +15 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ rules: {
3
+ '@typescript-eslint/no-unused-vars': [
4
+ 'error',
5
+ {
6
+ args: 'none',
7
+ vars: 'local',
8
+ varsIgnorePattern: '^_',
9
+ ignoreRestSiblings: true,
10
+ },
11
+ ],
12
+ 'no-unused-vars': 'off',
13
+ },
14
+ };
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # @atlaskit/node-data-provider
2
+
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#130776](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130776)
8
+ [`78ef8af3a4eb6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/78ef8af3a4eb6) -
9
+ ED-23237 rename to node data provider
10
+
11
+ ### Minor Changes
12
+
13
+ - [#130350](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130350)
14
+ [`ec22c30b952b8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ec22c30b952b8) -
15
+ [ED-23237] Implement logic to avoid overlapping resolves for the same node, and introduce
16
+ consumption apis.
17
+
18
+ ## 1.2.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [#127511](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127511)
23
+ [`af3041afea66f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/af3041afea66f) -
24
+ ED-23237 iniital nodeview data provider functionality
package/LICENSE.md ADDED
@@ -0,0 +1,11 @@
1
+ Copyright 2023 Atlassian Pty Ltd
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
4
+ compliance with the License. You may obtain a copy of the License at
5
+
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ Unless required by applicable law or agreed to in writing, software distributed under the License is
9
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10
+ implied. See the License for the specific language governing permissions and limitations under the
11
+ License.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Editor Node Data Provider
2
+
3
+ Node Data Provider for use with @atlaskit/editor-core plugins.
4
+
5
+ **Note:** This component is designed for internal Atlassian development. External contributors will
6
+ be able to use this component but will not be able to submit issues.
7
+
8
+ ## Install
9
+
10
+ ---
11
+
12
+ - **Install** - _yarn add @atlaskit/node-data-provider_
13
+ - **npm** -
14
+ [@atlaskit/node-data-provider](https://www.npmjs.com/package/@atlaskit/node-data-provider)
15
+ - **Source** -
16
+ [Bitbucket](https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/editor/node-data-provider)
17
+ - **Bundle** - [unpkg.com](https://unpkg.com/@atlaskit/node-data-provider/dist/)
18
+
19
+ ## Usage
20
+
21
+ ---
22
+
23
+ **Internal use only**
24
+
25
+ @atlaskit/node-data-provider is intended for internal use by the @atlaskit/editor-core and as a
26
+ plugin dependency of the Editor within your product.
27
+
28
+ Direct use of this component is not supported.
29
+
30
+ Please see
31
+ [Atlaskit - Node data provider](https://atlaskit.atlassian.com/packages/editor/node-data-provider)
32
+ for documentation and examples for this package.
33
+
34
+ ## Support
35
+
36
+ ---
37
+
38
+ For internal Atlassian, visit the slack channel
39
+ [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit
40
+ [go/editor-help](https://go/editor-help) to submit a bug.
41
+
42
+ ## License
43
+
44
+ ---
45
+
46
+ Please see
47
+ [Atlassian Frontend - License](https://developer.atlassian.com/cloud/framework/atlassian-frontend/#license)
48
+ for more licensing information.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/node-data-provider/cache",
3
+ "main": "../dist/cjs/cache.js",
4
+ "module": "../dist/esm/cache.js",
5
+ "module:es2019": "../dist/es2019/cache.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/cache.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.4": {
10
+ "*": [
11
+ "../dist/types-ts4.5/cache.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/node-data-provider/content",
3
+ "main": "../dist/cjs/consumption/content.js",
4
+ "module": "../dist/esm/consumption/content.js",
5
+ "module:es2019": "../dist/es2019/consumption/content.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/consumption/content.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.4": {
10
+ "*": [
11
+ "../dist/types-ts4.5/consumption/content.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.buildCaches = buildCaches;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _traverse = require("@atlaskit/adf-utils/traverse");
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ /**
15
+ * Builds {@link NodeDataProvider}s caches for a document.
16
+ *
17
+ * It will traverse the document and call the resolve method for each node.
18
+ * When all promises are resolved, NodeDataProviders will have their caches populated.
19
+ *
20
+ * The providers will then be ready for use with an Editor.
21
+ *
22
+ * To limit the time spent building the cache, a signal can be provided to abort the request.
23
+ *
24
+ * ## Usage
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * buildCaches({
29
+ * adf: doc,
30
+ * nodeDataProviders: { emoji: emojiNodeDataProvider, ... },
31
+ * signal: AbortSignal.timeout(5000),
32
+ * });
33
+ * ```
34
+ *
35
+ * ### Using caches
36
+ *
37
+ * To make use of a cache in another provider (ie. for a cache created on the server), you can retrieve the cache
38
+ * from the provider and pass it to the new provider.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * // SSR env
43
+ * const ssrProvidersCaches = await buildCaches({adf, nodeDataProviders: { emoji }})
44
+ *
45
+ * // Client env (providersCaches is the cache from the server)
46
+ * <ContentNodeDataProviders ... existingProvidersCache={ssrProvidersCaches} />
47
+ * ```
48
+ *
49
+ * *Note:* On the client - buildCache is not expected to be used directly.
50
+ *
51
+ * @see {@link ContentNodeDataProviders} for expected client usage.
52
+ */
53
+ function buildCaches(_x) {
54
+ return _buildCaches.apply(this, arguments);
55
+ }
56
+ function _buildCaches() {
57
+ _buildCaches = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
58
+ var adf, nodeDataProviders, _ref$signal, signal, existingProvidersCache, visitors, promises, _loop, _i, _Object$values, caches, _i2, _Object$values2, nodeDataProvider;
59
+ return _regenerator.default.wrap(function _callee$(_context2) {
60
+ while (1) switch (_context2.prev = _context2.next) {
61
+ case 0:
62
+ adf = _ref.adf, nodeDataProviders = _ref.nodeDataProviders, _ref$signal = _ref.signal, signal = _ref$signal === void 0 ? new AbortController().signal : _ref$signal, existingProvidersCache = _ref.existingProvidersCache;
63
+ visitors = {};
64
+ promises = [];
65
+ _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
66
+ var _nodeDataProvider, nodeDataProvider;
67
+ return _regenerator.default.wrap(function _loop$(_context) {
68
+ while (1) switch (_context.prev = _context.next) {
69
+ case 0:
70
+ _nodeDataProvider = _Object$values[_i];
71
+ // widen type to avoid typescript errors with the specific node data provider types
72
+ nodeDataProvider = _nodeDataProvider;
73
+ if (existingProvidersCache && existingProvidersCache[nodeDataProvider.nodeName]) {
74
+ nodeDataProvider.updateCache(existingProvidersCache[nodeDataProvider.nodeName], {
75
+ strategy: 'merge-override'
76
+ });
77
+ }
78
+ visitors[nodeDataProvider.nodeName] = function (node) {
79
+ var result = nodeDataProvider.get(node, {
80
+ signal: signal
81
+ });
82
+ if (!isPromise(result)) {
83
+ nodeDataProvider.cache[nodeDataProvider.nodeToKey(node)] = result;
84
+ return;
85
+ }
86
+ promises.push(result);
87
+ result.then(function (resolvedValue) {
88
+ var signalAborted = signal ? signal.aborted : false;
89
+ if (!signalAborted && resolvedValue !== undefined) {
90
+ nodeDataProvider.cache[nodeDataProvider.nodeToKey(node)] = resolvedValue;
91
+ }
92
+ });
93
+ return undefined;
94
+ };
95
+ case 4:
96
+ case "end":
97
+ return _context.stop();
98
+ }
99
+ }, _loop);
100
+ });
101
+ _i = 0, _Object$values = Object.values(nodeDataProviders);
102
+ case 5:
103
+ if (!(_i < _Object$values.length)) {
104
+ _context2.next = 10;
105
+ break;
106
+ }
107
+ return _context2.delegateYield(_loop(), "t0", 7);
108
+ case 7:
109
+ _i++;
110
+ _context2.next = 5;
111
+ break;
112
+ case 10:
113
+ if (!adf) {
114
+ _context2.next = 16;
115
+ break;
116
+ }
117
+ (0, _traverse.traverse)(adf, visitors);
118
+ _context2.next = 14;
119
+ return Promise.all(promises);
120
+ case 14:
121
+ _context2.next = 18;
122
+ break;
123
+ case 16:
124
+ _context2.next = 18;
125
+ return Promise.resolve();
126
+ case 18:
127
+ caches = {};
128
+ for (_i2 = 0, _Object$values2 = Object.values(nodeDataProviders); _i2 < _Object$values2.length; _i2++) {
129
+ nodeDataProvider = _Object$values2[_i2];
130
+ caches[nodeDataProvider.nodeName] = nodeDataProvider.cache;
131
+ }
132
+ return _context2.abrupt("return", caches);
133
+ case 21:
134
+ case "end":
135
+ return _context2.stop();
136
+ }
137
+ }, _callee);
138
+ }));
139
+ return _buildCaches.apply(this, arguments);
140
+ }
141
+ function isPromise(obj) {
142
+ return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') &&
143
+ // @ts-ignore
144
+ typeof obj.then === 'function';
145
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports._resetGlobalNdpCachesContext = _resetGlobalNdpCachesContext;
8
+ exports.useGlobalNdpCachesContext = useGlobalNdpCachesContext;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var GlobalNdpCachesContext = /*#__PURE__*/_react.default.createContext({});
11
+ function useGlobalNdpCachesContext() {
12
+ var globalNdpCachesContextValue = _react.default.useContext(GlobalNdpCachesContext);
13
+ return globalNdpCachesContextValue;
14
+ }
15
+
16
+ // The ndp caches currently use module scope to store the caches. This is not ideal, and a global provider
17
+ // will avoid the need for this.
18
+ // This function is used to reset the global ndp caches context in tests.
19
+ function _resetGlobalNdpCachesContext() {
20
+ GlobalNdpCachesContext = /*#__PURE__*/_react.default.createContext({});
21
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useContentNodeDataProvidersSetup = useContentNodeDataProvidersSetup;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _cache = require("../cache");
10
+ var _globalNdpCaches = require("./_global-ndp-caches");
11
+ var _lruCache = require("./_lru-cache");
12
+ /**
13
+ * The settings for the data providers lru cache,
14
+ * increasing the value will increase the number of data providers that can be stored in the cache.
15
+ */
16
+ var lruCacheSettings = {
17
+ page: 5,
18
+ default: 1
19
+ };
20
+
21
+ /**
22
+ * Sets up nodeview data providers for a content node.
23
+ *
24
+ * This will return the cached node data providers if they exist, otherwise it will call the provided getNodeDataProviders function.
25
+ *
26
+ * Note: Calling this has side effects where caches for the nodeview data providers will continue to be built
27
+ * in the background after this resolves to a set of nodeview data providers that can be used.
28
+ */
29
+ function useContentNodeDataProvidersSetup(content,
30
+ /**
31
+ * Note: changes to this object will not be reflected in the cache.
32
+ */
33
+ setupOptions) {
34
+ var _globalNdpCachesContextValue = (0, _globalNdpCaches.useGlobalNdpCachesContext)();
35
+ // Create a cache for the content type if it doesn't exist
36
+ // While this will not result in any existing context consumers getting the updated value.
37
+ // It will ensure that the cache is available for future consumers.
38
+ if (_globalNdpCachesContextValue[content.contentType] === undefined) {
39
+ var _lruCacheSettings$con;
40
+ _globalNdpCachesContextValue[content.contentType] = new _lruCache.LRUCache((_lruCacheSettings$con = lruCacheSettings[content.contentType]) !== null && _lruCacheSettings$con !== void 0 ? _lruCacheSettings$con : lruCacheSettings.default);
41
+ }
42
+ var contentTypeNdpCaches = _globalNdpCachesContextValue[content.contentType];
43
+
44
+ // The node data providers should only be rebuilt if the content changes
45
+ // to avoid unnecessary rebuilding of the cache.
46
+ // useRef is used over useMemo as use memo is not a guarantee that the value will be reused
47
+ // - in development it can be called twice
48
+ // - react have made clear that in future versions useMemo may add features that throw away the cache, and [recommend refs](https://react.dev/reference/react/useMemo#caveats) for this use case.
49
+ var currentContentKey = "".concat(content.contentType, "-").concat(content.contentId);
50
+ var contentKeyRef = _react.default.useRef();
51
+ var nodeDataProvidersRef = _react.default.useRef();
52
+ if (contentKeyRef.current !== currentContentKey) {
53
+ contentKeyRef.current = currentContentKey;
54
+ var cachedContentNdps = contentTypeNdpCaches === null || contentTypeNdpCaches === void 0 ? void 0 : contentTypeNdpCaches.get(content.contentId);
55
+ var nodeDataProviders = cachedContentNdps || setupOptions.getNodeDataProviders();
56
+
57
+ /**
58
+ * Note: while this will remove old NodeDataProviders from the cache -- these are passed directly to consumers,
59
+ * so removing from the cache will not result in actively used NodeDataProviders being deleted in some way.
60
+ *
61
+ */
62
+ contentTypeNdpCaches.set(content.contentId, nodeDataProviders);
63
+ (0, _cache.buildCaches)({
64
+ adf: setupOptions.adfToUpdateWith,
65
+ nodeDataProviders: nodeDataProviders,
66
+ existingProvidersCache: setupOptions.existingProvidersCache
67
+ }).then(function (warmedNodeDataProvidersCache) {
68
+ var _setupOptions$onCache;
69
+ (_setupOptions$onCache = setupOptions.onCacheWarmed) === null || _setupOptions$onCache === void 0 || _setupOptions$onCache.call(setupOptions, {
70
+ warmedNodeDataProvidersCache: warmedNodeDataProvidersCache,
71
+ nodeDataProviders: nodeDataProviders
72
+ });
73
+ });
74
+ nodeDataProvidersRef.current = nodeDataProviders;
75
+ }
76
+ return nodeDataProvidersRef.current;
77
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.LRUCache = void 0;
8
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var LRUCache = exports.LRUCache = /*#__PURE__*/function () {
11
+ function LRUCache(capacity) {
12
+ (0, _classCallCheck2.default)(this, LRUCache);
13
+ this.capacity = capacity;
14
+ this.cache = new Map();
15
+ }
16
+ (0, _createClass2.default)(LRUCache, [{
17
+ key: "get",
18
+ value: function get(key) {
19
+ if (!this.cache.has(key)) {
20
+ return undefined;
21
+ }
22
+
23
+ // Move the used key to the end to mark it as most recently used
24
+ var value = this.cache.get(key);
25
+ this.cache.delete(key);
26
+ this.cache.set(key, value);
27
+ return value;
28
+ }
29
+ }, {
30
+ key: "set",
31
+ value: function set(key, value) {
32
+ // Check if the key already exists and delete it to update its position
33
+ if (this.cache.has(key)) {
34
+ this.cache.delete(key);
35
+ } else if (this.cache.size >= this.capacity) {
36
+ // Remove the first (least recently used) cache item if we're at capacity
37
+ var firstKey = this.cache.keys().next().value;
38
+ this.cache.delete(firstKey);
39
+ }
40
+ this.cache.set(key, value);
41
+ }
42
+ }]);
43
+ return LRUCache;
44
+ }();
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ContentNodeDataProviders = ContentNodeDataProviders;
8
+ Object.defineProperty(exports, "__testOnly_resetGlobalNdpCachesContext", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _globalNdpCaches._resetGlobalNdpCachesContext;
12
+ }
13
+ });
14
+ exports.useContentNodeDataProviders = useContentNodeDataProviders;
15
+ var _react = _interopRequireDefault(require("react"));
16
+ var _globalNdpCaches = require("./_global-ndp-caches");
17
+ var _internalContext = require("./_internal-context");
18
+ var ContentNodeDataProvidersContext = /*#__PURE__*/_react.default.createContext(undefined);
19
+
20
+ /**
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <ContentNodeDataProviders
25
+ * contentType="page" contentId="9001"
26
+ * adf={doc}
27
+ * placeholder={<Spinner />}
28
+ * existingProvidersCache={ssrProvidersCache}
29
+ * getNodeDataProviders={getPageNodeDataProviders}
30
+ * onCacheWarmed={trackCacheWarmed}
31
+ * >
32
+ * <Editor />
33
+ * </ContentNodeDataProviders>
34
+ * ```
35
+ */
36
+ function ContentNodeDataProviders(props) {
37
+ var contentNodeDataProviders = (0, _internalContext.useContentNodeDataProvidersSetup)({
38
+ contentType: props.contentType,
39
+ contentId: props.contentId
40
+ }, {
41
+ adfToUpdateWith: props.adf,
42
+ existingProvidersCache: props.existingProvidersCache,
43
+ getNodeDataProviders: props.getNodeDataProviders,
44
+ onCacheWarmed: props.onCacheWarmed
45
+ });
46
+ return /*#__PURE__*/_react.default.createElement(ContentNodeDataProvidersContext.Provider, {
47
+ value: contentNodeDataProviders
48
+ }, props.children);
49
+ }
50
+ function useContentNodeDataProviders() {
51
+ var contentNodeDataProvidersContext = _react.default.useContext(ContentNodeDataProvidersContext);
52
+ return contentNodeDataProvidersContext;
53
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getConfluencePageProviders = getConfluencePageProviders;
7
+ var _emoji = require("../providers/emoji");
8
+ function getConfluencePageProviders(_ref) {
9
+ var emojiProvider = _ref.emojiProvider;
10
+ return {
11
+ emoji: (0, _emoji.createEmojiNodeDataProvider)({
12
+ emojiProvider: emojiProvider
13
+ })
14
+ };
15
+ }