@atlaskit/editor-common 105.9.0 → 105.10.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 +42 -0
- package/dist/cjs/extensibility/Extension/Lozenge/ExtensionLabel.js +0 -12
- package/dist/cjs/extensions/combine-extension-providers.js +5 -13
- package/dist/cjs/extensions/extension-handlers.js +5 -6
- package/dist/cjs/extensions/manifest-helpers.js +10 -7
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/node-visibility/node-visibility-manager.js +81 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/extensibility/Extension/Lozenge/ExtensionLabel.js +0 -12
- package/dist/es2019/extensions/combine-extension-providers.js +5 -13
- package/dist/es2019/extensions/extension-handlers.js +6 -7
- package/dist/es2019/extensions/manifest-helpers.js +4 -2
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/node-visibility/node-visibility-manager.js +72 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/extensibility/Extension/Lozenge/ExtensionLabel.js +0 -12
- package/dist/esm/extensions/combine-extension-providers.js +5 -13
- package/dist/esm/extensions/extension-handlers.js +6 -7
- package/dist/esm/extensions/manifest-helpers.js +9 -6
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/node-visibility/node-visibility-manager.js +75 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/extensions/manifest-helpers.d.ts +2 -1
- package/dist/types/node-visibility/node-visibility-manager.d.ts +29 -0
- package/dist/types-ts4.5/extensions/manifest-helpers.d.ts +2 -1
- package/dist/types-ts4.5/node-visibility/node-visibility-manager.d.ts +29 -0
- package/node-visibility/package.json +17 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 105.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#156919](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/156919)
|
|
8
|
+
[`379f5c27f4939`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/379f5c27f4939) -
|
|
9
|
+
delay table sticky headers until table is in viewport
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#160973](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160973)
|
|
14
|
+
[`9f2837a46dd98`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9f2837a46dd98) -
|
|
15
|
+
Ignore error thrown from getPreloadedExtension fallback to sync method
|
|
16
|
+
- [#159655](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159655)
|
|
17
|
+
[`24f8c627d50f2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/24f8c627d50f2) - ##
|
|
18
|
+
WHAT? Remove experimental graceful edit mode from view mode plugin and associated props.
|
|
19
|
+
|
|
20
|
+
## WHY?
|
|
21
|
+
|
|
22
|
+
This experiment is being cleaned up and we are no longer proceeding in this direction.
|
|
23
|
+
|
|
24
|
+
## HOW to adjust?
|
|
25
|
+
|
|
26
|
+
This experiment was only enabled for Confluence and should not have been enabled in other places.
|
|
27
|
+
If for some reason any of the following props/state/methdos were used please remove them:
|
|
28
|
+
|
|
29
|
+
- isConsumption
|
|
30
|
+
- contentMode
|
|
31
|
+
- initialContentMode
|
|
32
|
+
- updateContentMode
|
|
33
|
+
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
|
|
36
|
+
## 105.9.1
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- [#159910](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159910)
|
|
41
|
+
[`795f5ed29ca14`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/795f5ed29ca14) -
|
|
42
|
+
Make getNodeRenderer synchronous so loading state never appear in Confluence
|
|
43
|
+
- Updated dependencies
|
|
44
|
+
|
|
3
45
|
## 105.9.0
|
|
4
46
|
|
|
5
47
|
### Minor Changes
|
|
@@ -11,7 +11,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
var _reactIntlNext = require("react-intl-next");
|
|
12
12
|
var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
|
|
13
13
|
var _primitives = require("@atlaskit/primitives");
|
|
14
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
14
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
16
15
|
/**
|
|
17
16
|
* @jsxRuntime classic
|
|
@@ -168,17 +167,6 @@ var ExtensionLabel = exports.ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
168
167
|
onMouseLeave: function onMouseLeave() {
|
|
169
168
|
setIsNodeHovered === null || setIsNodeHovered === void 0 || setIsNodeHovered(false);
|
|
170
169
|
},
|
|
171
|
-
onClick: function onClick() {
|
|
172
|
-
if ((0, _experiments.editorExperiment)('live_pages_graceful_edit', 'text-click-delayed') || (0, _experiments.editorExperiment)('live_pages_graceful_edit', 'text-click-no-delay')) {
|
|
173
|
-
var _pluginInjectionApi$c, _pluginInjectionApi$e;
|
|
174
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.execute( // Extensions are not yet using the new plugin architecture, and the use of the pluginInjectionApi
|
|
175
|
-
// is not type safe in editor-common.
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.updateContentMode({
|
|
178
|
-
type: 'intent-to-edit'
|
|
179
|
-
}));
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
170
|
"data-testid": "new-lozenge-container",
|
|
183
171
|
contentEditable: false
|
|
184
172
|
}, (0, _react.jsx)(_tooltip.default, {
|
|
@@ -57,37 +57,29 @@ var _default = exports.default = function _default(extensionProviders) {
|
|
|
57
57
|
// preload() has not been called yet
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
var error;
|
|
61
60
|
var _iterator = _createForOfIteratorHelper(providersCache),
|
|
62
61
|
_step;
|
|
63
62
|
try {
|
|
64
63
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
65
64
|
var provider = _step.value;
|
|
66
|
-
// Similar to invokeSingle. We are returning the first result that not throwing an error.
|
|
67
|
-
// It's OK to get exception here because we have a lot of providers.
|
|
68
|
-
// The current provider may not have the extension type we are looking for.
|
|
69
65
|
try {
|
|
70
66
|
var _provider$getPreloade;
|
|
71
67
|
var result = provider === null || provider === void 0 || (_provider$getPreloade = provider.getPreloadedExtension) === null || _provider$getPreloade === void 0 ? void 0 : _provider$getPreloade.call(provider, type, key);
|
|
72
68
|
if (result) {
|
|
73
69
|
return result;
|
|
74
70
|
}
|
|
75
|
-
} catch (
|
|
76
|
-
|
|
71
|
+
} catch (_unused) {
|
|
72
|
+
// Not every provider will implement this method.
|
|
73
|
+
// In that case we would get error from other providers in the loop
|
|
74
|
+
// and undefined from that particular provider.
|
|
75
|
+
// We can safely ignore it and fallback to the async getExtension when nothing was found.
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
|
-
|
|
80
|
-
// If we exhausted all providers and none of them returned a result, we throw the last error.
|
|
81
|
-
// However as a extra precaution, we only throw in the dev environment.
|
|
82
|
-
// In production we will return undefined and getExtensionModuleNodeMaybePreloaded will fallback to regular getExtension call.
|
|
83
78
|
} catch (err) {
|
|
84
79
|
_iterator.e(err);
|
|
85
80
|
} finally {
|
|
86
81
|
_iterator.f();
|
|
87
82
|
}
|
|
88
|
-
if (error && process.env.NODE_ENV !== 'production') {
|
|
89
|
-
throw error;
|
|
90
|
-
}
|
|
91
83
|
},
|
|
92
84
|
getExtension: function getExtension(type, key) {
|
|
93
85
|
return invokeSingle('getExtension', [type, key]);
|
|
@@ -116,8 +116,6 @@ function getNodeRenderer(extensionProvider, extensionType, extensionKey) {
|
|
|
116
116
|
return (0, _reactLoadable.default)({
|
|
117
117
|
loader: function loader() {
|
|
118
118
|
if ((0, _platformFeatureFlags.fg)('confluence_preload_extension_providers')) {
|
|
119
|
-
// Logic here is specific to Confluence because it doesn't use the original react-loadable.
|
|
120
|
-
// The library is replaced with a custom one that supports synchronous return value from loader.
|
|
121
119
|
var maybePromise = getExtensionModuleNodeMaybePreloaded(extensionProvider, extensionType, extensionKey);
|
|
122
120
|
if (maybePromise instanceof Promise) {
|
|
123
121
|
return maybePromise.then(function (node) {
|
|
@@ -125,11 +123,12 @@ function getNodeRenderer(extensionProvider, extensionType, extensionKey) {
|
|
|
125
123
|
});
|
|
126
124
|
} else {
|
|
127
125
|
var _renderSync, _ref;
|
|
128
|
-
// maybePromise is sync here
|
|
129
126
|
var preloaded = maybePromise === null || maybePromise === void 0 || (_renderSync = (_ref = maybePromise).renderSync) === null || _renderSync === void 0 ? void 0 : _renderSync.call(_ref);
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
return
|
|
127
|
+
// Only product implemented preloading will return sync result
|
|
128
|
+
// However the out-of-box won't handle this. Confluence uses a custom implementation
|
|
129
|
+
return preloaded
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
131
|
+
? (0, _manifestHelpers.resolveImportSync)(preloaded) : (0, _manifestHelpers.resolveImport)(maybePromise.render());
|
|
133
132
|
}
|
|
134
133
|
} else {
|
|
135
134
|
return getExtensionModuleNode(extensionProvider, extensionType, extensionKey).then(function (node) {
|
|
@@ -8,7 +8,7 @@ exports.FORGE_EXTENSION_TYPE = void 0;
|
|
|
8
8
|
exports.buildAction = buildAction;
|
|
9
9
|
exports.buildExtensionKeyAndNodeKey = void 0;
|
|
10
10
|
exports.buildNode = buildNode;
|
|
11
|
-
exports.resolveImport = exports.getExtensionKeyAndNodeKey = void 0;
|
|
11
|
+
exports.resolveImportSync = exports.resolveImport = exports.getExtensionKeyAndNodeKey = void 0;
|
|
12
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -44,18 +44,21 @@ function buildAction(action, manifest) {
|
|
|
44
44
|
return buildNode(action, manifest);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
var resolveImportSync = exports.resolveImportSync = function resolveImportSync(importedModule) {
|
|
48
|
+
return importedModule && importedModule.__esModule ? importedModule.default : importedModule;
|
|
49
|
+
};
|
|
47
50
|
var resolveImport = exports.resolveImport = /*#__PURE__*/function () {
|
|
48
51
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(importPromise) {
|
|
49
|
-
var importedModule;
|
|
50
52
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
51
53
|
while (1) switch (_context.prev = _context.next) {
|
|
52
54
|
case 0:
|
|
53
|
-
_context.
|
|
55
|
+
_context.t0 = resolveImportSync;
|
|
56
|
+
_context.next = 3;
|
|
54
57
|
return importPromise;
|
|
55
|
-
case
|
|
56
|
-
|
|
57
|
-
return _context.abrupt("return",
|
|
58
|
-
case
|
|
58
|
+
case 3:
|
|
59
|
+
_context.t1 = _context.sent;
|
|
60
|
+
return _context.abrupt("return", (0, _context.t0)(_context.t1));
|
|
61
|
+
case 5:
|
|
59
62
|
case "end":
|
|
60
63
|
return _context.stop();
|
|
61
64
|
}
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "105.
|
|
20
|
+
var packageVersion = "105.10.0";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.nodeVisibilityManager = void 0;
|
|
7
|
+
// Use this selector to set the intersection observer boundary for editor's inline node views
|
|
8
|
+
// If this does not exist, it will use the IntersectionObserver's default root
|
|
9
|
+
var INTERSECTION_OBSERVER_ROOT_SELECTOR = '[data-editor-scroll-container="true"]';
|
|
10
|
+
var editorObservers = new WeakMap();
|
|
11
|
+
var callbackMap = new WeakMap();
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a node visibility manager
|
|
15
|
+
* @param editorElement
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
var nodeVisibilityManager = exports.nodeVisibilityManager = function nodeVisibilityManager(editorElement) {
|
|
19
|
+
// Warning! do not reference editorElement outside of internal functions.
|
|
20
|
+
// editorElement is passed to allow support for multiple editors,
|
|
21
|
+
|
|
22
|
+
var unObserveInternal = function unObserveInternal(nodeElement) {
|
|
23
|
+
var _editorObservers$get;
|
|
24
|
+
(_editorObservers$get = editorObservers.get(editorElement)) === null || _editorObservers$get === void 0 || _editorObservers$get.unobserve(nodeElement);
|
|
25
|
+
callbackMap.delete(nodeElement);
|
|
26
|
+
};
|
|
27
|
+
var observe = function observe(observerConfig) {
|
|
28
|
+
var _editorObservers$get2;
|
|
29
|
+
callbackMap.set(observerConfig.element, observerConfig);
|
|
30
|
+
(_editorObservers$get2 = editorObservers.get(editorElement)) === null || _editorObservers$get2 === void 0 || _editorObservers$get2.observe(observerConfig.element);
|
|
31
|
+
|
|
32
|
+
// return clean up
|
|
33
|
+
return function () {
|
|
34
|
+
// consumer needs to unobserve on destroy if their element
|
|
35
|
+
// was observed but never scrolled into view
|
|
36
|
+
unObserveInternal(observerConfig.element);
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var initialiseNodeObserver = function initialiseNodeObserver() {
|
|
40
|
+
if (editorObservers.has(editorElement)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
var intersectionObserverOptions = {
|
|
44
|
+
root: editorElement.closest(INTERSECTION_OBSERVER_ROOT_SELECTOR),
|
|
45
|
+
rootMargin: '0px 0px 100px 0px',
|
|
46
|
+
threshold: 0
|
|
47
|
+
};
|
|
48
|
+
var editorObserver = new IntersectionObserver(function (entries) {
|
|
49
|
+
return entries.map(function (entry) {
|
|
50
|
+
return {
|
|
51
|
+
entry: entry,
|
|
52
|
+
callback: callbackMap.get(entry.target)
|
|
53
|
+
};
|
|
54
|
+
})
|
|
55
|
+
// Invoke callbacks together to group browser rendering
|
|
56
|
+
// Avoiding requestAnimationFrame to reduce visual flickering
|
|
57
|
+
.forEach(function (_ref) {
|
|
58
|
+
var entry = _ref.entry,
|
|
59
|
+
callback = _ref.callback;
|
|
60
|
+
if (entry.isIntersecting) {
|
|
61
|
+
callback === null || callback === void 0 || callback.onFirstVisible();
|
|
62
|
+
if (entry.target instanceof HTMLElement) {
|
|
63
|
+
// immediately unobserve the element after it is visible
|
|
64
|
+
unObserveInternal(entry.target);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}, intersectionObserverOptions);
|
|
69
|
+
editorObservers.set(editorElement, editorObserver);
|
|
70
|
+
};
|
|
71
|
+
var disconnect = function disconnect() {
|
|
72
|
+
var _editorObservers$get3;
|
|
73
|
+
(_editorObservers$get3 = editorObservers.get(editorElement)) === null || _editorObservers$get3 === void 0 || _editorObservers$get3.disconnect();
|
|
74
|
+
editorObservers.delete(editorElement);
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
initialiseNodeObserver: initialiseNodeObserver,
|
|
78
|
+
observe: observe,
|
|
79
|
+
disconnect: disconnect
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "105.
|
|
26
|
+
var packageVersion = "105.10.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -10,7 +10,6 @@ import classnames from 'classnames';
|
|
|
10
10
|
import { FormattedMessage, defineMessages } from 'react-intl-next';
|
|
11
11
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
12
12
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
13
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
13
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
14
|
const containerStyles = css({
|
|
16
15
|
textAlign: 'left',
|
|
@@ -161,17 +160,6 @@ export const ExtensionLabel = ({
|
|
|
161
160
|
onMouseLeave: () => {
|
|
162
161
|
setIsNodeHovered === null || setIsNodeHovered === void 0 ? void 0 : setIsNodeHovered(false);
|
|
163
162
|
},
|
|
164
|
-
onClick: () => {
|
|
165
|
-
if (editorExperiment('live_pages_graceful_edit', 'text-click-delayed') || editorExperiment('live_pages_graceful_edit', 'text-click-no-delay')) {
|
|
166
|
-
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$e;
|
|
167
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.execute( // Extensions are not yet using the new plugin architecture, and the use of the pluginInjectionApi
|
|
168
|
-
// is not type safe in editor-common.
|
|
169
|
-
// @ts-ignore
|
|
170
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.updateContentMode({
|
|
171
|
-
type: 'intent-to-edit'
|
|
172
|
-
}));
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
163
|
"data-testid": "new-lozenge-container",
|
|
176
164
|
contentEditable: false
|
|
177
165
|
}, jsx(Tooltip, {
|
|
@@ -27,28 +27,20 @@ export default (extensionProviders => {
|
|
|
27
27
|
// preload() has not been called yet
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
let error;
|
|
31
30
|
for (const provider of providersCache) {
|
|
32
|
-
// Similar to invokeSingle. We are returning the first result that not throwing an error.
|
|
33
|
-
// It's OK to get exception here because we have a lot of providers.
|
|
34
|
-
// The current provider may not have the extension type we are looking for.
|
|
35
31
|
try {
|
|
36
32
|
var _provider$getPreloade;
|
|
37
33
|
const result = provider === null || provider === void 0 ? void 0 : (_provider$getPreloade = provider.getPreloadedExtension) === null || _provider$getPreloade === void 0 ? void 0 : _provider$getPreloade.call(provider, type, key);
|
|
38
34
|
if (result) {
|
|
39
35
|
return result;
|
|
40
36
|
}
|
|
41
|
-
} catch
|
|
42
|
-
|
|
37
|
+
} catch {
|
|
38
|
+
// Not every provider will implement this method.
|
|
39
|
+
// In that case we would get error from other providers in the loop
|
|
40
|
+
// and undefined from that particular provider.
|
|
41
|
+
// We can safely ignore it and fallback to the async getExtension when nothing was found.
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
// If we exhausted all providers and none of them returned a result, we throw the last error.
|
|
47
|
-
// However as a extra precaution, we only throw in the dev environment.
|
|
48
|
-
// In production we will return undefined and getExtensionModuleNodeMaybePreloaded will fallback to regular getExtension call.
|
|
49
|
-
if (error && process.env.NODE_ENV !== 'production') {
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
44
|
},
|
|
53
45
|
getExtension(type, key) {
|
|
54
46
|
return invokeSingle('getExtension', [type, key]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Loadable from 'react-loadable';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { getExtensionKeyAndNodeKey, resolveImport } from './manifest-helpers';
|
|
4
|
+
import { getExtensionKeyAndNodeKey, resolveImport, resolveImportSync } from './manifest-helpers';
|
|
5
5
|
function getNodeFromManifest(
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
7
|
manifest, extKey, nodeKey, extensionType, extensionKey) {
|
|
@@ -60,18 +60,17 @@ export function getNodeRenderer(extensionProvider, extensionType, extensionKey)
|
|
|
60
60
|
return Loadable({
|
|
61
61
|
loader: () => {
|
|
62
62
|
if (fg('confluence_preload_extension_providers')) {
|
|
63
|
-
// Logic here is specific to Confluence because it doesn't use the original react-loadable.
|
|
64
|
-
// The library is replaced with a custom one that supports synchronous return value from loader.
|
|
65
63
|
const maybePromise = getExtensionModuleNodeMaybePreloaded(extensionProvider, extensionType, extensionKey);
|
|
66
64
|
if (maybePromise instanceof Promise) {
|
|
67
65
|
return maybePromise.then(node => resolveImport(node.render()));
|
|
68
66
|
} else {
|
|
69
67
|
var _renderSync, _ref;
|
|
70
|
-
// maybePromise is sync here
|
|
71
68
|
const preloaded = maybePromise === null || maybePromise === void 0 ? void 0 : (_renderSync = (_ref = maybePromise).renderSync) === null || _renderSync === void 0 ? void 0 : _renderSync.call(_ref);
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
return
|
|
69
|
+
// Only product implemented preloading will return sync result
|
|
70
|
+
// However the out-of-box won't handle this. Confluence uses a custom implementation
|
|
71
|
+
return preloaded
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
? resolveImportSync(preloaded) : resolveImport(maybePromise.render());
|
|
75
74
|
}
|
|
76
75
|
} else {
|
|
77
76
|
return getExtensionModuleNode(extensionProvider, extensionType, extensionKey).then(node => resolveImport(node.render()));
|
|
@@ -23,10 +23,12 @@ export function buildAction(action, manifest) {
|
|
|
23
23
|
return buildNode(action, manifest);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
export const
|
|
27
|
-
const importedModule = await importPromise;
|
|
26
|
+
export const resolveImportSync = importedModule => {
|
|
28
27
|
return importedModule && importedModule.__esModule ? importedModule.default : importedModule;
|
|
29
28
|
};
|
|
29
|
+
export const resolveImport = async importPromise => {
|
|
30
|
+
return resolveImportSync(await importPromise);
|
|
31
|
+
};
|
|
30
32
|
export function buildNode(action, manifest) {
|
|
31
33
|
if (!manifest.modules.nodes) {
|
|
32
34
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "105.
|
|
4
|
+
const packageVersion = "105.10.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Use this selector to set the intersection observer boundary for editor's inline node views
|
|
2
|
+
// If this does not exist, it will use the IntersectionObserver's default root
|
|
3
|
+
const INTERSECTION_OBSERVER_ROOT_SELECTOR = '[data-editor-scroll-container="true"]';
|
|
4
|
+
const editorObservers = new WeakMap();
|
|
5
|
+
const callbackMap = new WeakMap();
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates a node visibility manager
|
|
9
|
+
* @param editorElement
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export const nodeVisibilityManager = editorElement => {
|
|
13
|
+
// Warning! do not reference editorElement outside of internal functions.
|
|
14
|
+
// editorElement is passed to allow support for multiple editors,
|
|
15
|
+
|
|
16
|
+
const unObserveInternal = nodeElement => {
|
|
17
|
+
var _editorObservers$get;
|
|
18
|
+
(_editorObservers$get = editorObservers.get(editorElement)) === null || _editorObservers$get === void 0 ? void 0 : _editorObservers$get.unobserve(nodeElement);
|
|
19
|
+
callbackMap.delete(nodeElement);
|
|
20
|
+
};
|
|
21
|
+
const observe = observerConfig => {
|
|
22
|
+
var _editorObservers$get2;
|
|
23
|
+
callbackMap.set(observerConfig.element, observerConfig);
|
|
24
|
+
(_editorObservers$get2 = editorObservers.get(editorElement)) === null || _editorObservers$get2 === void 0 ? void 0 : _editorObservers$get2.observe(observerConfig.element);
|
|
25
|
+
|
|
26
|
+
// return clean up
|
|
27
|
+
return () => {
|
|
28
|
+
// consumer needs to unobserve on destroy if their element
|
|
29
|
+
// was observed but never scrolled into view
|
|
30
|
+
unObserveInternal(observerConfig.element);
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const initialiseNodeObserver = () => {
|
|
34
|
+
if (editorObservers.has(editorElement)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const intersectionObserverOptions = {
|
|
38
|
+
root: editorElement.closest(INTERSECTION_OBSERVER_ROOT_SELECTOR),
|
|
39
|
+
rootMargin: '0px 0px 100px 0px',
|
|
40
|
+
threshold: 0
|
|
41
|
+
};
|
|
42
|
+
const editorObserver = new IntersectionObserver(entries => entries.map(entry => ({
|
|
43
|
+
entry,
|
|
44
|
+
callback: callbackMap.get(entry.target)
|
|
45
|
+
}))
|
|
46
|
+
// Invoke callbacks together to group browser rendering
|
|
47
|
+
// Avoiding requestAnimationFrame to reduce visual flickering
|
|
48
|
+
.forEach(({
|
|
49
|
+
entry,
|
|
50
|
+
callback
|
|
51
|
+
}) => {
|
|
52
|
+
if (entry.isIntersecting) {
|
|
53
|
+
callback === null || callback === void 0 ? void 0 : callback.onFirstVisible();
|
|
54
|
+
if (entry.target instanceof HTMLElement) {
|
|
55
|
+
// immediately unobserve the element after it is visible
|
|
56
|
+
unObserveInternal(entry.target);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}), intersectionObserverOptions);
|
|
60
|
+
editorObservers.set(editorElement, editorObserver);
|
|
61
|
+
};
|
|
62
|
+
const disconnect = () => {
|
|
63
|
+
var _editorObservers$get3;
|
|
64
|
+
(_editorObservers$get3 = editorObservers.get(editorElement)) === null || _editorObservers$get3 === void 0 ? void 0 : _editorObservers$get3.disconnect();
|
|
65
|
+
editorObservers.delete(editorElement);
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
initialiseNodeObserver,
|
|
69
|
+
observe,
|
|
70
|
+
disconnect
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "105.
|
|
16
|
+
const packageVersion = "105.10.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -10,7 +10,6 @@ import classnames from 'classnames';
|
|
|
10
10
|
import { FormattedMessage, defineMessages } from 'react-intl-next';
|
|
11
11
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
12
12
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
13
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
13
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
14
|
var containerStyles = css({
|
|
16
15
|
textAlign: 'left',
|
|
@@ -160,17 +159,6 @@ export var ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
160
159
|
onMouseLeave: function onMouseLeave() {
|
|
161
160
|
setIsNodeHovered === null || setIsNodeHovered === void 0 || setIsNodeHovered(false);
|
|
162
161
|
},
|
|
163
|
-
onClick: function onClick() {
|
|
164
|
-
if (editorExperiment('live_pages_graceful_edit', 'text-click-delayed') || editorExperiment('live_pages_graceful_edit', 'text-click-no-delay')) {
|
|
165
|
-
var _pluginInjectionApi$c, _pluginInjectionApi$e;
|
|
166
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.execute( // Extensions are not yet using the new plugin architecture, and the use of the pluginInjectionApi
|
|
167
|
-
// is not type safe in editor-common.
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.updateContentMode({
|
|
170
|
-
type: 'intent-to-edit'
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
162
|
"data-testid": "new-lozenge-container",
|
|
175
163
|
contentEditable: false
|
|
176
164
|
}, jsx(Tooltip, {
|
|
@@ -50,37 +50,29 @@ export default (function (extensionProviders) {
|
|
|
50
50
|
// preload() has not been called yet
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
var error;
|
|
54
53
|
var _iterator = _createForOfIteratorHelper(providersCache),
|
|
55
54
|
_step;
|
|
56
55
|
try {
|
|
57
56
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
58
57
|
var provider = _step.value;
|
|
59
|
-
// Similar to invokeSingle. We are returning the first result that not throwing an error.
|
|
60
|
-
// It's OK to get exception here because we have a lot of providers.
|
|
61
|
-
// The current provider may not have the extension type we are looking for.
|
|
62
58
|
try {
|
|
63
59
|
var _provider$getPreloade;
|
|
64
60
|
var result = provider === null || provider === void 0 || (_provider$getPreloade = provider.getPreloadedExtension) === null || _provider$getPreloade === void 0 ? void 0 : _provider$getPreloade.call(provider, type, key);
|
|
65
61
|
if (result) {
|
|
66
62
|
return result;
|
|
67
63
|
}
|
|
68
|
-
} catch (
|
|
69
|
-
|
|
64
|
+
} catch (_unused) {
|
|
65
|
+
// Not every provider will implement this method.
|
|
66
|
+
// In that case we would get error from other providers in the loop
|
|
67
|
+
// and undefined from that particular provider.
|
|
68
|
+
// We can safely ignore it and fallback to the async getExtension when nothing was found.
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
// If we exhausted all providers and none of them returned a result, we throw the last error.
|
|
74
|
-
// However as a extra precaution, we only throw in the dev environment.
|
|
75
|
-
// In production we will return undefined and getExtensionModuleNodeMaybePreloaded will fallback to regular getExtension call.
|
|
76
71
|
} catch (err) {
|
|
77
72
|
_iterator.e(err);
|
|
78
73
|
} finally {
|
|
79
74
|
_iterator.f();
|
|
80
75
|
}
|
|
81
|
-
if (error && process.env.NODE_ENV !== 'production') {
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
76
|
},
|
|
85
77
|
getExtension: function getExtension(type, key) {
|
|
86
78
|
return invokeSingle('getExtension', [type, key]);
|
|
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Loadable from 'react-loadable';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { getExtensionKeyAndNodeKey, resolveImport } from './manifest-helpers';
|
|
7
|
+
import { getExtensionKeyAndNodeKey, resolveImport, resolveImportSync } from './manifest-helpers';
|
|
8
8
|
function getNodeFromManifest(
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
manifest, extKey, nodeKey, extensionType, extensionKey) {
|
|
@@ -106,8 +106,6 @@ export function getNodeRenderer(extensionProvider, extensionType, extensionKey)
|
|
|
106
106
|
return Loadable({
|
|
107
107
|
loader: function loader() {
|
|
108
108
|
if (fg('confluence_preload_extension_providers')) {
|
|
109
|
-
// Logic here is specific to Confluence because it doesn't use the original react-loadable.
|
|
110
|
-
// The library is replaced with a custom one that supports synchronous return value from loader.
|
|
111
109
|
var maybePromise = getExtensionModuleNodeMaybePreloaded(extensionProvider, extensionType, extensionKey);
|
|
112
110
|
if (maybePromise instanceof Promise) {
|
|
113
111
|
return maybePromise.then(function (node) {
|
|
@@ -115,11 +113,12 @@ export function getNodeRenderer(extensionProvider, extensionType, extensionKey)
|
|
|
115
113
|
});
|
|
116
114
|
} else {
|
|
117
115
|
var _renderSync, _ref;
|
|
118
|
-
// maybePromise is sync here
|
|
119
116
|
var preloaded = maybePromise === null || maybePromise === void 0 || (_renderSync = (_ref = maybePromise).renderSync) === null || _renderSync === void 0 ? void 0 : _renderSync.call(_ref);
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
return
|
|
117
|
+
// Only product implemented preloading will return sync result
|
|
118
|
+
// However the out-of-box won't handle this. Confluence uses a custom implementation
|
|
119
|
+
return preloaded
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
121
|
+
? resolveImportSync(preloaded) : resolveImport(maybePromise.render());
|
|
123
122
|
}
|
|
124
123
|
} else {
|
|
125
124
|
return getExtensionModuleNode(extensionProvider, extensionType, extensionKey).then(function (node) {
|
|
@@ -33,18 +33,21 @@ export function buildAction(action, manifest) {
|
|
|
33
33
|
return buildNode(action, manifest);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
export var resolveImportSync = function resolveImportSync(importedModule) {
|
|
37
|
+
return importedModule && importedModule.__esModule ? importedModule.default : importedModule;
|
|
38
|
+
};
|
|
36
39
|
export var resolveImport = /*#__PURE__*/function () {
|
|
37
40
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(importPromise) {
|
|
38
|
-
var importedModule;
|
|
39
41
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
42
|
while (1) switch (_context.prev = _context.next) {
|
|
41
43
|
case 0:
|
|
42
|
-
_context.
|
|
44
|
+
_context.t0 = resolveImportSync;
|
|
45
|
+
_context.next = 3;
|
|
43
46
|
return importPromise;
|
|
44
|
-
case
|
|
45
|
-
|
|
46
|
-
return _context.abrupt("return",
|
|
47
|
-
case
|
|
47
|
+
case 3:
|
|
48
|
+
_context.t1 = _context.sent;
|
|
49
|
+
return _context.abrupt("return", (0, _context.t0)(_context.t1));
|
|
50
|
+
case 5:
|
|
48
51
|
case "end":
|
|
49
52
|
return _context.stop();
|
|
50
53
|
}
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "105.
|
|
10
|
+
var packageVersion = "105.10.0";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Use this selector to set the intersection observer boundary for editor's inline node views
|
|
2
|
+
// If this does not exist, it will use the IntersectionObserver's default root
|
|
3
|
+
var INTERSECTION_OBSERVER_ROOT_SELECTOR = '[data-editor-scroll-container="true"]';
|
|
4
|
+
var editorObservers = new WeakMap();
|
|
5
|
+
var callbackMap = new WeakMap();
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates a node visibility manager
|
|
9
|
+
* @param editorElement
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export var nodeVisibilityManager = function nodeVisibilityManager(editorElement) {
|
|
13
|
+
// Warning! do not reference editorElement outside of internal functions.
|
|
14
|
+
// editorElement is passed to allow support for multiple editors,
|
|
15
|
+
|
|
16
|
+
var unObserveInternal = function unObserveInternal(nodeElement) {
|
|
17
|
+
var _editorObservers$get;
|
|
18
|
+
(_editorObservers$get = editorObservers.get(editorElement)) === null || _editorObservers$get === void 0 || _editorObservers$get.unobserve(nodeElement);
|
|
19
|
+
callbackMap.delete(nodeElement);
|
|
20
|
+
};
|
|
21
|
+
var observe = function observe(observerConfig) {
|
|
22
|
+
var _editorObservers$get2;
|
|
23
|
+
callbackMap.set(observerConfig.element, observerConfig);
|
|
24
|
+
(_editorObservers$get2 = editorObservers.get(editorElement)) === null || _editorObservers$get2 === void 0 || _editorObservers$get2.observe(observerConfig.element);
|
|
25
|
+
|
|
26
|
+
// return clean up
|
|
27
|
+
return function () {
|
|
28
|
+
// consumer needs to unobserve on destroy if their element
|
|
29
|
+
// was observed but never scrolled into view
|
|
30
|
+
unObserveInternal(observerConfig.element);
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
var initialiseNodeObserver = function initialiseNodeObserver() {
|
|
34
|
+
if (editorObservers.has(editorElement)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
var intersectionObserverOptions = {
|
|
38
|
+
root: editorElement.closest(INTERSECTION_OBSERVER_ROOT_SELECTOR),
|
|
39
|
+
rootMargin: '0px 0px 100px 0px',
|
|
40
|
+
threshold: 0
|
|
41
|
+
};
|
|
42
|
+
var editorObserver = new IntersectionObserver(function (entries) {
|
|
43
|
+
return entries.map(function (entry) {
|
|
44
|
+
return {
|
|
45
|
+
entry: entry,
|
|
46
|
+
callback: callbackMap.get(entry.target)
|
|
47
|
+
};
|
|
48
|
+
})
|
|
49
|
+
// Invoke callbacks together to group browser rendering
|
|
50
|
+
// Avoiding requestAnimationFrame to reduce visual flickering
|
|
51
|
+
.forEach(function (_ref) {
|
|
52
|
+
var entry = _ref.entry,
|
|
53
|
+
callback = _ref.callback;
|
|
54
|
+
if (entry.isIntersecting) {
|
|
55
|
+
callback === null || callback === void 0 || callback.onFirstVisible();
|
|
56
|
+
if (entry.target instanceof HTMLElement) {
|
|
57
|
+
// immediately unobserve the element after it is visible
|
|
58
|
+
unObserveInternal(entry.target);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}, intersectionObserverOptions);
|
|
63
|
+
editorObservers.set(editorElement, editorObserver);
|
|
64
|
+
};
|
|
65
|
+
var disconnect = function disconnect() {
|
|
66
|
+
var _editorObservers$get3;
|
|
67
|
+
(_editorObservers$get3 = editorObservers.get(editorElement)) === null || _editorObservers$get3 === void 0 || _editorObservers$get3.disconnect();
|
|
68
|
+
editorObservers.delete(editorElement);
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
initialiseNodeObserver: initialiseNodeObserver,
|
|
72
|
+
observe: observe,
|
|
73
|
+
disconnect: disconnect
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "105.
|
|
23
|
+
var packageVersion = "105.10.0";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -5,5 +5,6 @@ export declare const FORGE_EXTENSION_TYPE = "com.atlassian.ecosystem";
|
|
|
5
5
|
export declare const getExtensionKeyAndNodeKey: (extensionKey: ExtensionKey, extensionType: ExtensionType) => string[];
|
|
6
6
|
export declare const buildExtensionKeyAndNodeKey: (extensionKey: ExtensionKey, nodeKey?: ExtensionModuleKey) => string;
|
|
7
7
|
export declare function buildAction<T extends Parameters>(action: ExtensionModuleAction<T>, manifest: ExtensionManifest<T>): ADFEntity | import("./types/extension-manifest").ExtensionModuleActionHandler | undefined;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const resolveImportSync: <T extends Parameters>(importedModule: Module<T>) => T;
|
|
9
|
+
export declare const resolveImport: <T extends Parameters>(importPromise: Promise<Module<T>> | Module<T>) => Promise<T>;
|
|
9
10
|
export declare function buildNode<T extends Parameters>(action: ExtensionModuleActionObject<T>, manifest: ExtensionManifest<T>): ADFEntity | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type NodeObservationConfig = {
|
|
2
|
+
element: HTMLElement;
|
|
3
|
+
onFirstVisible: () => void;
|
|
4
|
+
};
|
|
5
|
+
export type NodeVisibilityManager = {
|
|
6
|
+
/**
|
|
7
|
+
* Establishes IntersectionObserver for the editor to monitor all node viewport visibility
|
|
8
|
+
* @param editorDivElement
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
initialiseNodeObserver: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* observes specific node element with callbacks for triggering when the node is visible or hidden
|
|
14
|
+
*/
|
|
15
|
+
observe: (observeConfig: NodeObservationConfig) => () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Kills the IntersectionObserver and all callbacks
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
disconnect: () => void;
|
|
21
|
+
};
|
|
22
|
+
type NodeVisibilityManagerFn = (editorElement: HTMLElement) => NodeVisibilityManager;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a node visibility manager
|
|
25
|
+
* @param editorElement
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare const nodeVisibilityManager: NodeVisibilityManagerFn;
|
|
29
|
+
export {};
|
|
@@ -5,5 +5,6 @@ export declare const FORGE_EXTENSION_TYPE = "com.atlassian.ecosystem";
|
|
|
5
5
|
export declare const getExtensionKeyAndNodeKey: (extensionKey: ExtensionKey, extensionType: ExtensionType) => string[];
|
|
6
6
|
export declare const buildExtensionKeyAndNodeKey: (extensionKey: ExtensionKey, nodeKey?: ExtensionModuleKey) => string;
|
|
7
7
|
export declare function buildAction<T extends Parameters>(action: ExtensionModuleAction<T>, manifest: ExtensionManifest<T>): ADFEntity | import("./types/extension-manifest").ExtensionModuleActionHandler | undefined;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const resolveImportSync: <T extends Parameters>(importedModule: Module<T>) => T;
|
|
9
|
+
export declare const resolveImport: <T extends Parameters>(importPromise: Promise<Module<T>> | Module<T>) => Promise<T>;
|
|
9
10
|
export declare function buildNode<T extends Parameters>(action: ExtensionModuleActionObject<T>, manifest: ExtensionManifest<T>): ADFEntity | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type NodeObservationConfig = {
|
|
2
|
+
element: HTMLElement;
|
|
3
|
+
onFirstVisible: () => void;
|
|
4
|
+
};
|
|
5
|
+
export type NodeVisibilityManager = {
|
|
6
|
+
/**
|
|
7
|
+
* Establishes IntersectionObserver for the editor to monitor all node viewport visibility
|
|
8
|
+
* @param editorDivElement
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
initialiseNodeObserver: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* observes specific node element with callbacks for triggering when the node is visible or hidden
|
|
14
|
+
*/
|
|
15
|
+
observe: (observeConfig: NodeObservationConfig) => () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Kills the IntersectionObserver and all callbacks
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
disconnect: () => void;
|
|
21
|
+
};
|
|
22
|
+
type NodeVisibilityManagerFn = (editorElement: HTMLElement) => NodeVisibilityManager;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a node visibility manager
|
|
25
|
+
* @param editorElement
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare const nodeVisibilityManager: NodeVisibilityManagerFn;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/node-visibility",
|
|
3
|
+
"main": "../dist/cjs/node-visibility/node-visibility-manager.js",
|
|
4
|
+
"module": "../dist/esm/node-visibility/node-visibility-manager.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/node-visibility/node-visibility-manager.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/node-visibility/node-visibility-manager.d.ts",
|
|
10
|
+
"typesVersions": {
|
|
11
|
+
">=4.5 <5.4": {
|
|
12
|
+
"*": [
|
|
13
|
+
"../dist/types-ts4.5/node-visibility/node-visibility-manager.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "105.
|
|
3
|
+
"version": "105.10.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"./media-single": "./src/media-single/index.ts",
|
|
78
78
|
"./media": "./src/media/index.ts",
|
|
79
79
|
"./monitoring": "./src/monitoring/index.ts",
|
|
80
|
+
"./node-visibility": "./src/node-visibility/node-visibility-manager.ts",
|
|
80
81
|
"./paste": "./src/paste/index.ts",
|
|
81
82
|
"./resizer": "./src/resizer/index.ts",
|
|
82
83
|
"./editor-analytics": "./src/editor-analytics/index.ts",
|
|
@@ -139,7 +140,7 @@
|
|
|
139
140
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
140
141
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
141
142
|
"@atlaskit/emoji": "^69.2.0",
|
|
142
|
-
"@atlaskit/icon": "^26.
|
|
143
|
+
"@atlaskit/icon": "^26.3.0",
|
|
143
144
|
"@atlaskit/icon-object": "^7.1.0",
|
|
144
145
|
"@atlaskit/link": "^3.2.0",
|
|
145
146
|
"@atlaskit/link-datasource": "^4.11.0",
|
|
@@ -168,7 +169,7 @@
|
|
|
168
169
|
"@atlaskit/task-decision": "^19.2.0",
|
|
169
170
|
"@atlaskit/textfield": "^8.0.0",
|
|
170
171
|
"@atlaskit/theme": "^18.0.0",
|
|
171
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
172
|
+
"@atlaskit/tmp-editor-statsig": "^5.0.0",
|
|
172
173
|
"@atlaskit/tokens": "^4.9.0",
|
|
173
174
|
"@atlaskit/tooltip": "^20.0.0",
|
|
174
175
|
"@atlaskit/width-detector": "^5.0.0",
|