@atlaskit/editor-common 78.29.2 → 78.30.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 +12 -0
- package/dist/cjs/expand/index.js +8 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/react-node-view/generateUniqueNodeKey.js +11 -0
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +4 -2
- package/dist/cjs/react-node-view/index.js +4 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/PortalProvider/index.js +5 -4
- package/dist/es2019/expand/index.js +2 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/react-node-view/generateUniqueNodeKey.js +4 -0
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +4 -2
- package/dist/es2019/react-node-view/index.js +4 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/PortalProvider/index.js +4 -3
- package/dist/esm/expand/index.js +2 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/react-node-view/generateUniqueNodeKey.js +4 -0
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +4 -2
- package/dist/esm/react-node-view/index.js +4 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/PortalProvider/index.js +5 -4
- package/dist/types/expand/index.d.ts +2 -0
- package/dist/types/react-node-view/generateUniqueNodeKey.d.ts +1 -0
- package/dist/types/react-node-view/index.d.ts +1 -0
- package/dist/types/ui/PortalProvider/index.d.ts +3 -2
- package/dist/types-ts4.5/expand/index.d.ts +2 -0
- package/dist/types-ts4.5/react-node-view/generateUniqueNodeKey.d.ts +1 -0
- package/dist/types-ts4.5/react-node-view/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +3 -2
- package/expand/package.json +15 -0
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 78.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#91466](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91466) [`b55ddb9fd20c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b55ddb9fd20c) - Added `key` API to PortalProvider
|
|
8
|
+
|
|
9
|
+
## 78.29.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#90897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90897) [`412b090aa792`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/412b090aa792) - [ux] [ED-22841] Implement new state management for the single player expand using a WeakMap
|
|
14
|
+
|
|
3
15
|
## 78.29.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
16
16
|
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 && Object.prototype.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; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "78.
|
|
19
|
+
var packageVersion = "78.30.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.generateUniqueNodeKey = void 0;
|
|
8
|
+
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
9
|
+
var generateUniqueNodeKey = exports.generateUniqueNodeKey = function generateUniqueNodeKey() {
|
|
10
|
+
return (0, _v.default)();
|
|
11
|
+
};
|
|
@@ -12,6 +12,7 @@ var _react2 = require("@emotion/react");
|
|
|
12
12
|
var _analytics = require("../analytics");
|
|
13
13
|
var _ErrorBoundary = require("../ui/ErrorBoundary");
|
|
14
14
|
var _utils = require("../utils");
|
|
15
|
+
var _generateUniqueNodeKey = require("./generateUniqueNodeKey");
|
|
15
16
|
/** @jsx jsx */
|
|
16
17
|
|
|
17
18
|
var inlineNodeViewClassname = exports.inlineNodeViewClassname = 'inlineNodeView';
|
|
@@ -24,6 +25,7 @@ function createNodeView(_ref) {
|
|
|
24
25
|
// used for comparisions when doing updates, before being
|
|
25
26
|
// overwritten to the updated node.
|
|
26
27
|
var currentNode = nodeViewParams.node;
|
|
28
|
+
var key = (0, _generateUniqueNodeKey.generateUniqueNodeKey)();
|
|
27
29
|
|
|
28
30
|
// First we setup the dom element which will be rendered and "tracked" by prosemirror
|
|
29
31
|
// and also used as a "editor portal" (not react portal) target by the editor
|
|
@@ -60,7 +62,7 @@ function createNodeView(_ref) {
|
|
|
60
62
|
nodeViewParams: nodeViewParams,
|
|
61
63
|
Component: Component,
|
|
62
64
|
extraComponentProps: extraComponentProps
|
|
63
|
-
}), domRef, false,
|
|
65
|
+
}), domRef, key, false,
|
|
64
66
|
// node views should be rendered with intl context
|
|
65
67
|
true);
|
|
66
68
|
}
|
|
@@ -118,7 +120,7 @@ function createNodeView(_ref) {
|
|
|
118
120
|
// When prosemirror destroys the node view, we need to clean up
|
|
119
121
|
// what we have previously rendered using the editor portal
|
|
120
122
|
// provider api.
|
|
121
|
-
pmPluginFactoryParams.portalProviderAPI.remove(domRef);
|
|
123
|
+
pmPluginFactoryParams.portalProviderAPI.remove(key, domRef);
|
|
122
124
|
// @ts-expect-error Expect an error as domRef is expected to be
|
|
123
125
|
// of HTMLSpanElement type however once the node view has
|
|
124
126
|
// been destroyed no other consumers should still be using it.
|
|
@@ -27,6 +27,7 @@ var _eventDispatcher = require("../event-dispatcher");
|
|
|
27
27
|
var _ErrorBoundary = require("../ui/ErrorBoundary");
|
|
28
28
|
var _utils = require("../utils");
|
|
29
29
|
var _analytics2 = require("../utils/analytics");
|
|
30
|
+
var _generateUniqueNodeKey = require("./generateUniqueNodeKey");
|
|
30
31
|
var _getInlineNodeViewProducer = require("./getInlineNodeViewProducer");
|
|
31
32
|
var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
32
33
|
function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent) {
|
|
@@ -57,6 +58,7 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
57
58
|
this._viewShouldUpdate = viewShouldUpdate;
|
|
58
59
|
this.eventDispatcher = eventDispatcher;
|
|
59
60
|
this.hasIntlContext = hasIntlContext;
|
|
61
|
+
this.key = (0, _generateUniqueNodeKey.generateUniqueNodeKey)();
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
/**
|
|
@@ -124,7 +126,7 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
124
126
|
dispatchAnalyticsEvent: _this3.dispatchAnalyticsEvent
|
|
125
127
|
}, component());
|
|
126
128
|
};
|
|
127
|
-
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.hasAnalyticsContext, this.hasIntlContext);
|
|
129
|
+
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.key, this.hasAnalyticsContext, this.hasIntlContext);
|
|
128
130
|
}
|
|
129
131
|
}, {
|
|
130
132
|
key: "createDomRef",
|
|
@@ -221,7 +223,7 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
221
223
|
if (!this.domRef) {
|
|
222
224
|
return;
|
|
223
225
|
}
|
|
224
|
-
this.portalProviderAPI.remove(this.domRef);
|
|
226
|
+
this.portalProviderAPI.remove(this.key, this.domRef);
|
|
225
227
|
this.domRef = undefined;
|
|
226
228
|
this.contentDOM = undefined;
|
|
227
229
|
}
|
|
@@ -22,7 +22,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
22
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
23
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
|
|
24
24
|
var packageName = "@atlaskit/editor-common";
|
|
25
|
-
var packageVersion = "78.
|
|
25
|
+
var packageVersion = "78.30.0";
|
|
26
26
|
var halfFocusRing = 1;
|
|
27
27
|
var dropOffset = '0, 8';
|
|
28
28
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -42,10 +42,11 @@ var PortalProviderAPI = exports.PortalProviderAPI = /*#__PURE__*/function (_Even
|
|
|
42
42
|
}
|
|
43
43
|
(0, _createClass2.default)(PortalProviderAPI, [{
|
|
44
44
|
key: "render",
|
|
45
|
-
value: function render(children, container) {
|
|
46
|
-
var hasAnalyticsContext = arguments.length >
|
|
47
|
-
var hasIntlContext = arguments.length >
|
|
45
|
+
value: function render(children, container, key) {
|
|
46
|
+
var hasAnalyticsContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
47
|
+
var hasIntlContext = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
48
48
|
this.portals.set(container, {
|
|
49
|
+
key: key,
|
|
49
50
|
children: children,
|
|
50
51
|
hasAnalyticsContext: hasAnalyticsContext,
|
|
51
52
|
hasIntlContext: hasIntlContext
|
|
@@ -86,7 +87,7 @@ var PortalProviderAPI = exports.PortalProviderAPI = /*#__PURE__*/function (_Even
|
|
|
86
87
|
}
|
|
87
88
|
}, {
|
|
88
89
|
key: "remove",
|
|
89
|
-
value: function remove(container) {
|
|
90
|
+
value: function remove(key, container) {
|
|
90
91
|
this.portals.delete(container);
|
|
91
92
|
|
|
92
93
|
// There is a race condition that can happen caused by Prosemirror vs React,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "78.
|
|
3
|
+
const packageVersion = "78.30.0";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -6,6 +6,7 @@ import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
|
6
6
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
7
7
|
import { browser } from '../utils';
|
|
8
8
|
import { analyticsEventKey, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered, ZERO_WIDTH_SPACE } from '../utils';
|
|
9
|
+
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
9
10
|
export const inlineNodeViewClassname = 'inlineNodeView';
|
|
10
11
|
function createNodeView({
|
|
11
12
|
nodeViewParams,
|
|
@@ -17,6 +18,7 @@ function createNodeView({
|
|
|
17
18
|
// used for comparisions when doing updates, before being
|
|
18
19
|
// overwritten to the updated node.
|
|
19
20
|
let currentNode = nodeViewParams.node;
|
|
21
|
+
const key = generateUniqueNodeKey();
|
|
20
22
|
|
|
21
23
|
// First we setup the dom element which will be rendered and "tracked" by prosemirror
|
|
22
24
|
// and also used as a "editor portal" (not react portal) target by the editor
|
|
@@ -53,7 +55,7 @@ function createNodeView({
|
|
|
53
55
|
nodeViewParams,
|
|
54
56
|
Component,
|
|
55
57
|
extraComponentProps
|
|
56
|
-
}), domRef, false,
|
|
58
|
+
}), domRef, key, false,
|
|
57
59
|
// node views should be rendered with intl context
|
|
58
60
|
true);
|
|
59
61
|
}
|
|
@@ -112,7 +114,7 @@ function createNodeView({
|
|
|
112
114
|
// When prosemirror destroys the node view, we need to clean up
|
|
113
115
|
// what we have previously rendered using the editor portal
|
|
114
116
|
// provider api.
|
|
115
|
-
pmPluginFactoryParams.portalProviderAPI.remove(domRef);
|
|
117
|
+
pmPluginFactoryParams.portalProviderAPI.remove(key, domRef);
|
|
116
118
|
// @ts-expect-error Expect an error as domRef is expected to be
|
|
117
119
|
// of HTMLSpanElement type however once the node view has
|
|
118
120
|
// been destroyed no other consumers should still be using it.
|
|
@@ -6,6 +6,7 @@ import { createDispatch } from '../event-dispatcher';
|
|
|
6
6
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
7
7
|
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
8
8
|
import { analyticsEventKey } from '../utils/analytics';
|
|
9
|
+
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
9
10
|
export { getInlineNodeViewProducer, inlineNodeViewClassname } from './getInlineNodeViewProducer';
|
|
10
11
|
export default class ReactNodeView {
|
|
11
12
|
constructor(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, hasAnalyticsContext = false, viewShouldUpdate, hasIntlContext = false) {
|
|
@@ -29,6 +30,7 @@ export default class ReactNodeView {
|
|
|
29
30
|
this._viewShouldUpdate = viewShouldUpdate;
|
|
30
31
|
this.eventDispatcher = eventDispatcher;
|
|
31
32
|
this.hasIntlContext = hasIntlContext;
|
|
33
|
+
this.key = generateUniqueNodeKey();
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/**
|
|
@@ -90,7 +92,7 @@ export default class ReactNodeView {
|
|
|
90
92
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent
|
|
91
93
|
}, component());
|
|
92
94
|
};
|
|
93
|
-
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.hasAnalyticsContext, this.hasIntlContext);
|
|
95
|
+
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.key, this.hasAnalyticsContext, this.hasIntlContext);
|
|
94
96
|
}
|
|
95
97
|
createDomRef() {
|
|
96
98
|
if (!this.node.isInline) {
|
|
@@ -163,7 +165,7 @@ export default class ReactNodeView {
|
|
|
163
165
|
if (!this.domRef) {
|
|
164
166
|
return;
|
|
165
167
|
}
|
|
166
|
-
this.portalProviderAPI.remove(this.domRef);
|
|
168
|
+
this.portalProviderAPI.remove(this.key, this.domRef);
|
|
167
169
|
this.domRef = undefined;
|
|
168
170
|
this.contentDOM = undefined;
|
|
169
171
|
}
|
|
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
7
7
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
8
8
|
import Layer from '../Layer';
|
|
9
9
|
const packageName = "@atlaskit/editor-common";
|
|
10
|
-
const packageVersion = "78.
|
|
10
|
+
const packageVersion = "78.30.0";
|
|
11
11
|
const halfFocusRing = 1;
|
|
12
12
|
const dropOffset = '0, 8';
|
|
13
13
|
class DropList extends Component {
|
|
@@ -19,9 +19,10 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
19
19
|
this.onAnalyticsEvent = onAnalyticsEvent;
|
|
20
20
|
this.useAnalyticsContext = analyticsContext;
|
|
21
21
|
}
|
|
22
|
-
render(children, container, hasAnalyticsContext = false, hasIntlContext = false) {
|
|
22
|
+
render(children, container, key, hasAnalyticsContext = false, hasIntlContext = false) {
|
|
23
23
|
this.portals.set(container, {
|
|
24
|
-
|
|
24
|
+
key,
|
|
25
|
+
children,
|
|
25
26
|
hasAnalyticsContext,
|
|
26
27
|
hasIntlContext
|
|
27
28
|
});
|
|
@@ -57,7 +58,7 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
57
58
|
unstable_renderSubtreeIntoContainer(this.context, wrappedChildren, container);
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
|
-
remove(container) {
|
|
61
|
+
remove(key, container) {
|
|
61
62
|
this.portals.delete(container);
|
|
62
63
|
|
|
63
64
|
// There is a race condition that can happen caused by Prosemirror vs React,
|
|
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "78.
|
|
9
|
+
var packageVersion = "78.30.0";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -6,6 +6,7 @@ import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
|
6
6
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
7
7
|
import { browser } from '../utils';
|
|
8
8
|
import { analyticsEventKey, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered, ZERO_WIDTH_SPACE } from '../utils';
|
|
9
|
+
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
9
10
|
export var inlineNodeViewClassname = 'inlineNodeView';
|
|
10
11
|
function createNodeView(_ref) {
|
|
11
12
|
var nodeViewParams = _ref.nodeViewParams,
|
|
@@ -16,6 +17,7 @@ function createNodeView(_ref) {
|
|
|
16
17
|
// used for comparisions when doing updates, before being
|
|
17
18
|
// overwritten to the updated node.
|
|
18
19
|
var currentNode = nodeViewParams.node;
|
|
20
|
+
var key = generateUniqueNodeKey();
|
|
19
21
|
|
|
20
22
|
// First we setup the dom element which will be rendered and "tracked" by prosemirror
|
|
21
23
|
// and also used as a "editor portal" (not react portal) target by the editor
|
|
@@ -52,7 +54,7 @@ function createNodeView(_ref) {
|
|
|
52
54
|
nodeViewParams: nodeViewParams,
|
|
53
55
|
Component: Component,
|
|
54
56
|
extraComponentProps: extraComponentProps
|
|
55
|
-
}), domRef, false,
|
|
57
|
+
}), domRef, key, false,
|
|
56
58
|
// node views should be rendered with intl context
|
|
57
59
|
true);
|
|
58
60
|
}
|
|
@@ -110,7 +112,7 @@ function createNodeView(_ref) {
|
|
|
110
112
|
// When prosemirror destroys the node view, we need to clean up
|
|
111
113
|
// what we have previously rendered using the editor portal
|
|
112
114
|
// provider api.
|
|
113
|
-
pmPluginFactoryParams.portalProviderAPI.remove(domRef);
|
|
115
|
+
pmPluginFactoryParams.portalProviderAPI.remove(key, domRef);
|
|
114
116
|
// @ts-expect-error Expect an error as domRef is expected to be
|
|
115
117
|
// of HTMLSpanElement type however once the node view has
|
|
116
118
|
// been destroyed no other consumers should still be using it.
|
|
@@ -8,6 +8,7 @@ import { createDispatch } from '../event-dispatcher';
|
|
|
8
8
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
9
9
|
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
10
10
|
import { analyticsEventKey } from '../utils/analytics';
|
|
11
|
+
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
11
12
|
export { getInlineNodeViewProducer, inlineNodeViewClassname } from './getInlineNodeViewProducer';
|
|
12
13
|
var ReactNodeView = /*#__PURE__*/function () {
|
|
13
14
|
function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent) {
|
|
@@ -38,6 +39,7 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
38
39
|
this._viewShouldUpdate = viewShouldUpdate;
|
|
39
40
|
this.eventDispatcher = eventDispatcher;
|
|
40
41
|
this.hasIntlContext = hasIntlContext;
|
|
42
|
+
this.key = generateUniqueNodeKey();
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -105,7 +107,7 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
105
107
|
dispatchAnalyticsEvent: _this3.dispatchAnalyticsEvent
|
|
106
108
|
}, component());
|
|
107
109
|
};
|
|
108
|
-
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.hasAnalyticsContext, this.hasIntlContext);
|
|
110
|
+
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.key, this.hasAnalyticsContext, this.hasIntlContext);
|
|
109
111
|
}
|
|
110
112
|
}, {
|
|
111
113
|
key: "createDomRef",
|
|
@@ -202,7 +204,7 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
202
204
|
if (!this.domRef) {
|
|
203
205
|
return;
|
|
204
206
|
}
|
|
205
|
-
this.portalProviderAPI.remove(this.domRef);
|
|
207
|
+
this.portalProviderAPI.remove(this.key, this.domRef);
|
|
206
208
|
this.domRef = undefined;
|
|
207
209
|
this.contentDOM = undefined;
|
|
208
210
|
}
|
|
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
17
17
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
18
18
|
import Layer from '../Layer';
|
|
19
19
|
var packageName = "@atlaskit/editor-common";
|
|
20
|
-
var packageVersion = "78.
|
|
20
|
+
var packageVersion = "78.30.0";
|
|
21
21
|
var halfFocusRing = 1;
|
|
22
22
|
var dropOffset = '0, 8';
|
|
23
23
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -35,10 +35,11 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
35
35
|
}
|
|
36
36
|
_createClass(PortalProviderAPI, [{
|
|
37
37
|
key: "render",
|
|
38
|
-
value: function render(children, container) {
|
|
39
|
-
var hasAnalyticsContext = arguments.length >
|
|
40
|
-
var hasIntlContext = arguments.length >
|
|
38
|
+
value: function render(children, container, key) {
|
|
39
|
+
var hasAnalyticsContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
40
|
+
var hasIntlContext = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
41
41
|
this.portals.set(container, {
|
|
42
|
+
key: key,
|
|
42
43
|
children: children,
|
|
43
44
|
hasAnalyticsContext: hasAnalyticsContext,
|
|
44
45
|
hasIntlContext: hasIntlContext
|
|
@@ -79,7 +80,7 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
79
80
|
}
|
|
80
81
|
}, {
|
|
81
82
|
key: "remove",
|
|
82
|
-
value: function remove(container) {
|
|
83
|
+
value: function remove(key, container) {
|
|
83
84
|
this.portals.delete(container);
|
|
84
85
|
|
|
85
86
|
// There is a race condition that can happen caused by Prosemirror vs React,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateUniqueNodeKey: () => string;
|
|
@@ -22,6 +22,7 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
|
|
|
22
22
|
getPos: getPosHandler;
|
|
23
23
|
contentDOM: HTMLElement | null | undefined;
|
|
24
24
|
node: PMNode;
|
|
25
|
+
key: string;
|
|
25
26
|
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
|
|
26
27
|
/**
|
|
27
28
|
* This method exists to move initialization logic out of the constructor,
|
|
@@ -12,6 +12,7 @@ export type PortalRendererState = {
|
|
|
12
12
|
portals: Portals;
|
|
13
13
|
};
|
|
14
14
|
type MountedPortal = {
|
|
15
|
+
key: string;
|
|
15
16
|
children: () => React.ReactChild | null;
|
|
16
17
|
hasAnalyticsContext: boolean;
|
|
17
18
|
hasIntlContext: boolean;
|
|
@@ -24,11 +25,11 @@ export declare class PortalProviderAPI extends EventDispatcher {
|
|
|
24
25
|
useAnalyticsContext?: boolean;
|
|
25
26
|
constructor(intl: IntlShape, onAnalyticsEvent?: FireAnalyticsCallback, analyticsContext?: boolean);
|
|
26
27
|
setContext: (context: any) => void;
|
|
27
|
-
render(children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, hasAnalyticsContext?: boolean, hasIntlContext?: boolean): void;
|
|
28
|
+
render(children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string, hasAnalyticsContext?: boolean, hasIntlContext?: boolean): void;
|
|
28
29
|
forceUpdate({ intl }: {
|
|
29
30
|
intl: IntlShape;
|
|
30
31
|
}): void;
|
|
31
|
-
remove(container: HTMLElement): void;
|
|
32
|
+
remove(key: string, container: HTMLElement): void;
|
|
32
33
|
}
|
|
33
34
|
export declare const PortalProvider: React.FC<import("react-intl-next").WithIntlProps<BasePortalProviderProps>> & {
|
|
34
35
|
WrappedComponent: React.ComponentType<BasePortalProviderProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateUniqueNodeKey: () => string;
|
|
@@ -22,6 +22,7 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
|
|
|
22
22
|
getPos: getPosHandler;
|
|
23
23
|
contentDOM: HTMLElement | null | undefined;
|
|
24
24
|
node: PMNode;
|
|
25
|
+
key: string;
|
|
25
26
|
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
|
|
26
27
|
/**
|
|
27
28
|
* This method exists to move initialization logic out of the constructor,
|
|
@@ -12,6 +12,7 @@ export type PortalRendererState = {
|
|
|
12
12
|
portals: Portals;
|
|
13
13
|
};
|
|
14
14
|
type MountedPortal = {
|
|
15
|
+
key: string;
|
|
15
16
|
children: () => React.ReactChild | null;
|
|
16
17
|
hasAnalyticsContext: boolean;
|
|
17
18
|
hasIntlContext: boolean;
|
|
@@ -24,11 +25,11 @@ export declare class PortalProviderAPI extends EventDispatcher {
|
|
|
24
25
|
useAnalyticsContext?: boolean;
|
|
25
26
|
constructor(intl: IntlShape, onAnalyticsEvent?: FireAnalyticsCallback, analyticsContext?: boolean);
|
|
26
27
|
setContext: (context: any) => void;
|
|
27
|
-
render(children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, hasAnalyticsContext?: boolean, hasIntlContext?: boolean): void;
|
|
28
|
+
render(children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string, hasAnalyticsContext?: boolean, hasIntlContext?: boolean): void;
|
|
28
29
|
forceUpdate({ intl }: {
|
|
29
30
|
intl: IntlShape;
|
|
30
31
|
}): void;
|
|
31
|
-
remove(container: HTMLElement): void;
|
|
32
|
+
remove(key: string, container: HTMLElement): void;
|
|
32
33
|
}
|
|
33
34
|
export declare const PortalProvider: React.FC<import("react-intl-next").WithIntlProps<BasePortalProviderProps>> & {
|
|
34
35
|
WrappedComponent: React.ComponentType<BasePortalProviderProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/expand",
|
|
3
|
+
"main": "../dist/cjs/expand/index.js",
|
|
4
|
+
"module": "../dist/esm/expand/index.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/expand/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/expand/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.4": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/expand/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "78.
|
|
3
|
+
"version": "78.30.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/"
|
|
@@ -90,7 +90,8 @@
|
|
|
90
90
|
"./indentation": "./src/indentation/index.ts",
|
|
91
91
|
"./annotation": "./src/annotation/index.ts",
|
|
92
92
|
"./constants": "./src/link/constants.ts",
|
|
93
|
-
"./doc-utils": "./src/doc-utils/index.ts"
|
|
93
|
+
"./doc-utils": "./src/doc-utils/index.ts",
|
|
94
|
+
"./expand": "./src/expand/index.ts"
|
|
94
95
|
},
|
|
95
96
|
"dependencies": {
|
|
96
97
|
"@atlaskit/activity-provider": "^2.4.0",
|
|
@@ -161,6 +162,7 @@
|
|
|
161
162
|
"react-loadable": "^5.1.0",
|
|
162
163
|
"react-virtualized": "^9.8.0",
|
|
163
164
|
"rusha": "^0.8.13",
|
|
165
|
+
"uuid": "^3.1.0",
|
|
164
166
|
"w3c-keyname": "^2.1.8"
|
|
165
167
|
},
|
|
166
168
|
"peerDependencies": {
|