@atlaskit/renderer 118.6.2 → 118.6.4
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 +20 -0
- package/dist/cjs/ui/ExtensionRenderer.js +16 -7
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/element/index.js +2 -3
- package/dist/cjs/ui/annotations/index.js +2 -3
- package/dist/cjs/ui/annotations/selection/mounter.js +16 -16
- package/dist/es2019/ui/ExtensionRenderer.js +14 -6
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/element/index.js +2 -3
- package/dist/es2019/ui/annotations/index.js +2 -3
- package/dist/es2019/ui/annotations/selection/mounter.js +16 -16
- package/dist/esm/ui/ExtensionRenderer.js +16 -7
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/element/index.js +2 -3
- package/dist/esm/ui/annotations/index.js +2 -3
- package/dist/esm/ui/annotations/selection/mounter.js +16 -16
- package/dist/types/ui/ExtensionRenderer.d.ts +3 -1
- package/dist/types-ts4.5/ui/ExtensionRenderer.d.ts +3 -1
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 118.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 118.6.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#163358](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/163358)
|
|
14
|
+
[`a262d3094ad41`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a262d3094ad41) -
|
|
15
|
+
[ux] Allow remove 1px margin top from inline macro wrapper that causing element shift in initial
|
|
16
|
+
load
|
|
17
|
+
- [#163361](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/163361)
|
|
18
|
+
[`76c3619bccda1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/76c3619bccda1) -
|
|
19
|
+
Changed the annotation manager feature gate to instead use the existance of the manager rather
|
|
20
|
+
then a gate
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 118.6.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -19,6 +19,15 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
19
19
|
*/
|
|
20
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
21
21
|
|
|
22
|
+
// When running on server-side emotion will generate style tags before elements.
|
|
23
|
+
// This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
|
|
24
|
+
// However as soon as the styles are extracted to <head> it adds back the margin.
|
|
25
|
+
// The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
|
|
26
|
+
// This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
|
|
27
|
+
var forceMarginTopStyle = (0, _react.css)({
|
|
28
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
29
|
+
marginTop: "1px !important"
|
|
30
|
+
});
|
|
22
31
|
var inlineExtensionStyle = (0, _react.css)({
|
|
23
32
|
display: 'inline-block',
|
|
24
33
|
maxWidth: '100%',
|
|
@@ -128,12 +137,12 @@ function ExtensionRenderer(props) {
|
|
|
128
137
|
});
|
|
129
138
|
}
|
|
130
139
|
var InlineNodeRendererWrapper = exports.InlineNodeRendererWrapper = function InlineNodeRendererWrapper(_ref) {
|
|
131
|
-
var
|
|
132
|
-
|
|
140
|
+
var _ref$forceMarginTop = _ref.forceMarginTop,
|
|
141
|
+
forceMarginTop = _ref$forceMarginTop === void 0 ? false : _ref$forceMarginTop,
|
|
142
|
+
children = _ref.children;
|
|
143
|
+
return (0, _react.jsx)("div", {
|
|
133
144
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}, children)
|
|
138
|
-
);
|
|
145
|
+
className: "inline-extension-renderer",
|
|
146
|
+
css: [inlineExtensionStyle, forceMarginTop && forceMarginTopStyle]
|
|
147
|
+
}, children);
|
|
139
148
|
};
|
|
@@ -62,7 +62,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
62
62
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
63
63
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
64
64
|
var packageName = "@atlaskit/renderer";
|
|
65
|
-
var packageVersion = "118.6.
|
|
65
|
+
var packageVersion = "118.6.4";
|
|
66
66
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
|
@@ -8,7 +8,6 @@ exports.MarkElement = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _types = require("@atlaskit/editor-common/types");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _mark = require("./mark");
|
|
13
12
|
var _useInlineCommentsFilter = require("../hooks/use-inline-comments-filter");
|
|
14
13
|
var _useInlineCommentSubscriber = require("../hooks/use-inline-comment-subscriber");
|
|
@@ -45,11 +44,11 @@ var MarkElement = exports.MarkElement = function MarkElement(_ref) {
|
|
|
45
44
|
}
|
|
46
45
|
var eventTarget = props.eventTarget,
|
|
47
46
|
annotationIds = props.annotationIds;
|
|
48
|
-
if (
|
|
47
|
+
if (annotationManager) {
|
|
49
48
|
if (hasFocus) {
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
|
-
annotationManager
|
|
51
|
+
annotationManager.checkPreemptiveGate().then(function (canSelect) {
|
|
53
52
|
if (canSelect) {
|
|
54
53
|
// if there is a draft, clear it first
|
|
55
54
|
annotationManager === null || annotationManager === void 0 || annotationManager.clearDraft();
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.AnnotationsWrapperInner = exports.AnnotationsWrapper = exports.AnnotationsPositionContext = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var _view = require("./view");
|
|
12
11
|
var _wrapper = require("./wrapper");
|
|
13
12
|
var _context = require("./context");
|
|
@@ -77,7 +76,7 @@ var AnnotationsWrapper = exports.AnnotationsWrapper = function AnnotationsWrappe
|
|
|
77
76
|
adfDocument = props.adfDocument,
|
|
78
77
|
isNestedRender = props.isNestedRender,
|
|
79
78
|
onLoadComplete = props.onLoadComplete;
|
|
80
|
-
if (!isNestedRender &&
|
|
79
|
+
if (!isNestedRender && annotationProvider !== null && annotationProvider !== void 0 && annotationProvider.annotationManager) {
|
|
81
80
|
var _annotationProvider$i, _annotationProvider$i2;
|
|
82
81
|
// We need to ensure there is a single instance of the annotation manager for the whole document
|
|
83
82
|
// and that it is the same instance for all annotations.
|
|
@@ -86,7 +85,7 @@ var AnnotationsWrapper = exports.AnnotationsWrapper = function AnnotationsWrappe
|
|
|
86
85
|
return /*#__PURE__*/_react.default.createElement(_context.ProvidersContext.Provider, {
|
|
87
86
|
value: annotationProvider
|
|
88
87
|
}, /*#__PURE__*/_react.default.createElement(_AnnotationManagerContext.AnnotationManagerProvider, {
|
|
89
|
-
annotationManager: annotationProvider
|
|
88
|
+
annotationManager: annotationProvider.annotationManager,
|
|
90
89
|
updateSubscriber: (_annotationProvider$i = annotationProvider === null || annotationProvider === void 0 || (_annotationProvider$i2 = annotationProvider.inlineComment) === null || _annotationProvider$i2 === void 0 ? void 0 : _annotationProvider$i2.updateSubscriber) !== null && _annotationProvider$i !== void 0 ? _annotationProvider$i : undefined
|
|
91
90
|
}, /*#__PURE__*/_react.default.createElement(AnnotationsWrapperInner, {
|
|
92
91
|
rendererRef: rendererRef,
|
|
@@ -202,21 +202,21 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
202
202
|
onCloseProps();
|
|
203
203
|
}, [onCloseProps, removeDraftModeCallback, createAnalyticsEvent, inlineNodeTypes]);
|
|
204
204
|
(0, _react.useEffect)(function () {
|
|
205
|
-
if (
|
|
205
|
+
if (annotationManager) {
|
|
206
206
|
var allowAnnotation = function allowAnnotation() {
|
|
207
207
|
if (isDrafting) {
|
|
208
208
|
return false;
|
|
209
209
|
}
|
|
210
210
|
return isAnnotationAllowed;
|
|
211
211
|
};
|
|
212
|
-
annotationManager
|
|
212
|
+
annotationManager.hook('allowAnnotation', allowAnnotation);
|
|
213
213
|
return function () {
|
|
214
|
-
annotationManager
|
|
214
|
+
annotationManager.unhook('allowAnnotation', allowAnnotation);
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
217
|
}, [annotationManager, isAnnotationAllowed, isDrafting]);
|
|
218
218
|
(0, _react.useEffect)(function () {
|
|
219
|
-
if (
|
|
219
|
+
if (annotationManager) {
|
|
220
220
|
var startDraft = function startDraft() {
|
|
221
221
|
var _result$inlineNodeTyp;
|
|
222
222
|
if (isDrafting) {
|
|
@@ -265,14 +265,14 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
};
|
|
268
|
-
annotationManager
|
|
268
|
+
annotationManager.hook('startDraft', startDraft);
|
|
269
269
|
return function () {
|
|
270
|
-
annotationManager
|
|
270
|
+
annotationManager.unhook('startDraft', startDraft);
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
273
|
}, [annotationManager, isDrafting, applyDraftModeCallback, actions, range, dispatch]);
|
|
274
274
|
(0, _react.useEffect)(function () {
|
|
275
|
-
if (
|
|
275
|
+
if (annotationManager) {
|
|
276
276
|
var clearDraft = function clearDraft() {
|
|
277
277
|
if (!isDrafting) {
|
|
278
278
|
return {
|
|
@@ -293,14 +293,14 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
293
293
|
success: true
|
|
294
294
|
};
|
|
295
295
|
};
|
|
296
|
-
annotationManager
|
|
296
|
+
annotationManager.hook('clearDraft', clearDraft);
|
|
297
297
|
return function () {
|
|
298
|
-
annotationManager
|
|
298
|
+
annotationManager.unhook('clearDraft', clearDraft);
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
301
|
}, [annotationManager, onCloseCallback, isDrafting, dispatch]);
|
|
302
302
|
(0, _react.useEffect)(function () {
|
|
303
|
-
if (
|
|
303
|
+
if (annotationManager) {
|
|
304
304
|
var applyDraft = function applyDraft(id) {
|
|
305
305
|
if (!isDrafting || !draftId) {
|
|
306
306
|
return {
|
|
@@ -347,9 +347,9 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
347
347
|
} : undefined
|
|
348
348
|
};
|
|
349
349
|
};
|
|
350
|
-
annotationManager
|
|
350
|
+
annotationManager.hook('applyDraft', applyDraft);
|
|
351
351
|
return function () {
|
|
352
|
-
annotationManager
|
|
352
|
+
annotationManager.unhook('applyDraft', applyDraft);
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
355
|
}, [annotationManager, onCreateCallback, onCloseCallback, isDrafting, draftId, dispatch]);
|
|
@@ -368,11 +368,11 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
368
368
|
,
|
|
369
369
|
wrapperDOM: wrapperDOM.current,
|
|
370
370
|
isAnnotationAllowed: isAnnotationAllowed,
|
|
371
|
-
onClose:
|
|
372
|
-
onCreate:
|
|
371
|
+
onClose: annotationManager ? nop : onCloseCallback,
|
|
372
|
+
onCreate: annotationManager ? nop : onCreateCallback,
|
|
373
373
|
getAnnotationIndexMatch: createIndexCallback,
|
|
374
|
-
applyDraftMode:
|
|
375
|
-
removeDraftMode:
|
|
374
|
+
applyDraftMode: annotationManager ? nop : applyDraftModeCallback,
|
|
375
|
+
removeDraftMode: annotationManager ? nop : removeDraftModeCallback,
|
|
376
376
|
inlineNodeTypes: inlineNodeTypes
|
|
377
377
|
});
|
|
378
378
|
});
|
|
@@ -9,6 +9,15 @@ import memoizeOne from 'memoize-one';
|
|
|
9
9
|
import { getNodeRenderer } from '@atlaskit/editor-common/extensions';
|
|
10
10
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
11
11
|
import { getExtensionRenderer } from '@atlaskit/editor-common/utils';
|
|
12
|
+
// When running on server-side emotion will generate style tags before elements.
|
|
13
|
+
// This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
|
|
14
|
+
// However as soon as the styles are extracted to <head> it adds back the margin.
|
|
15
|
+
// The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
|
|
16
|
+
// This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
|
|
17
|
+
const forceMarginTopStyle = css({
|
|
18
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
19
|
+
marginTop: `1px !important`
|
|
20
|
+
});
|
|
12
21
|
const inlineExtensionStyle = css({
|
|
13
22
|
display: 'inline-block',
|
|
14
23
|
maxWidth: '100%',
|
|
@@ -113,13 +122,12 @@ export default function ExtensionRenderer(props) {
|
|
|
113
122
|
});
|
|
114
123
|
}
|
|
115
124
|
export const InlineNodeRendererWrapper = ({
|
|
125
|
+
forceMarginTop = false,
|
|
116
126
|
children
|
|
117
127
|
}) => {
|
|
118
|
-
return (
|
|
128
|
+
return jsx("div", {
|
|
119
129
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}, children)
|
|
124
|
-
);
|
|
130
|
+
className: "inline-extension-renderer",
|
|
131
|
+
css: [inlineExtensionStyle, forceMarginTop && forceMarginTopStyle]
|
|
132
|
+
}, children);
|
|
125
133
|
};
|
|
@@ -48,7 +48,7 @@ import { PortalContext } from './PortalContext';
|
|
|
48
48
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
49
49
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
50
50
|
const packageName = "@atlaskit/renderer";
|
|
51
|
-
const packageVersion = "118.6.
|
|
51
|
+
const packageVersion = "118.6.4";
|
|
52
52
|
const setAsQueryContainerStyles = css({
|
|
53
53
|
containerName: 'ak-renderer-wrapper',
|
|
54
54
|
containerType: 'inline-size'
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useMemo, useCallback, useContext } from 'react';
|
|
2
2
|
import { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
3
3
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { MarkComponent } from './mark';
|
|
6
5
|
import { useInlineCommentsFilter } from '../hooks/use-inline-comments-filter';
|
|
7
6
|
import { useInlineCommentSubscriberContext } from '../hooks/use-inline-comment-subscriber';
|
|
@@ -40,11 +39,11 @@ const MarkElement = ({
|
|
|
40
39
|
eventTarget,
|
|
41
40
|
annotationIds
|
|
42
41
|
} = props;
|
|
43
|
-
if (
|
|
42
|
+
if (annotationManager) {
|
|
44
43
|
if (hasFocus) {
|
|
45
44
|
return;
|
|
46
45
|
}
|
|
47
|
-
annotationManager
|
|
46
|
+
annotationManager.checkPreemptiveGate().then(canSelect => {
|
|
48
47
|
if (canSelect) {
|
|
49
48
|
// if there is a draft, clear it first
|
|
50
49
|
annotationManager === null || annotationManager === void 0 ? void 0 : annotationManager.clearDraft();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { AnnotationView } from './view';
|
|
5
4
|
import { AnnotationsContextWrapper } from './wrapper';
|
|
6
5
|
import { ProvidersContext, InlineCommentsStateContext } from './context';
|
|
@@ -75,7 +74,7 @@ export const AnnotationsWrapper = props => {
|
|
|
75
74
|
isNestedRender,
|
|
76
75
|
onLoadComplete
|
|
77
76
|
} = props;
|
|
78
|
-
if (!isNestedRender &&
|
|
77
|
+
if (!isNestedRender && annotationProvider !== null && annotationProvider !== void 0 && annotationProvider.annotationManager) {
|
|
79
78
|
var _annotationProvider$i, _annotationProvider$i2;
|
|
80
79
|
// We need to ensure there is a single instance of the annotation manager for the whole document
|
|
81
80
|
// and that it is the same instance for all annotations.
|
|
@@ -84,7 +83,7 @@ export const AnnotationsWrapper = props => {
|
|
|
84
83
|
return /*#__PURE__*/React.createElement(ProvidersContext.Provider, {
|
|
85
84
|
value: annotationProvider
|
|
86
85
|
}, /*#__PURE__*/React.createElement(AnnotationManagerProvider, {
|
|
87
|
-
annotationManager: annotationProvider
|
|
86
|
+
annotationManager: annotationProvider.annotationManager,
|
|
88
87
|
updateSubscriber: (_annotationProvider$i = annotationProvider === null || annotationProvider === void 0 ? void 0 : (_annotationProvider$i2 = annotationProvider.inlineComment) === null || _annotationProvider$i2 === void 0 ? void 0 : _annotationProvider$i2.updateSubscriber) !== null && _annotationProvider$i !== void 0 ? _annotationProvider$i : undefined
|
|
89
88
|
}, /*#__PURE__*/React.createElement(AnnotationsWrapperInner, {
|
|
90
89
|
rendererRef: rendererRef,
|
|
@@ -199,21 +199,21 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
199
199
|
onCloseProps();
|
|
200
200
|
}, [onCloseProps, removeDraftModeCallback, createAnalyticsEvent, inlineNodeTypes]);
|
|
201
201
|
useEffect(() => {
|
|
202
|
-
if (
|
|
202
|
+
if (annotationManager) {
|
|
203
203
|
const allowAnnotation = () => {
|
|
204
204
|
if (isDrafting) {
|
|
205
205
|
return false;
|
|
206
206
|
}
|
|
207
207
|
return isAnnotationAllowed;
|
|
208
208
|
};
|
|
209
|
-
annotationManager
|
|
209
|
+
annotationManager.hook('allowAnnotation', allowAnnotation);
|
|
210
210
|
return () => {
|
|
211
|
-
annotationManager
|
|
211
|
+
annotationManager.unhook('allowAnnotation', allowAnnotation);
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
}, [annotationManager, isAnnotationAllowed, isDrafting]);
|
|
215
215
|
useEffect(() => {
|
|
216
|
-
if (
|
|
216
|
+
if (annotationManager) {
|
|
217
217
|
const startDraft = () => {
|
|
218
218
|
var _result$inlineNodeTyp;
|
|
219
219
|
if (isDrafting) {
|
|
@@ -262,14 +262,14 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
};
|
|
265
|
-
annotationManager
|
|
265
|
+
annotationManager.hook('startDraft', startDraft);
|
|
266
266
|
return () => {
|
|
267
|
-
annotationManager
|
|
267
|
+
annotationManager.unhook('startDraft', startDraft);
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
}, [annotationManager, isDrafting, applyDraftModeCallback, actions, range, dispatch]);
|
|
271
271
|
useEffect(() => {
|
|
272
|
-
if (
|
|
272
|
+
if (annotationManager) {
|
|
273
273
|
const clearDraft = () => {
|
|
274
274
|
if (!isDrafting) {
|
|
275
275
|
return {
|
|
@@ -290,14 +290,14 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
290
290
|
success: true
|
|
291
291
|
};
|
|
292
292
|
};
|
|
293
|
-
annotationManager
|
|
293
|
+
annotationManager.hook('clearDraft', clearDraft);
|
|
294
294
|
return () => {
|
|
295
|
-
annotationManager
|
|
295
|
+
annotationManager.unhook('clearDraft', clearDraft);
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
}, [annotationManager, onCloseCallback, isDrafting, dispatch]);
|
|
299
299
|
useEffect(() => {
|
|
300
|
-
if (
|
|
300
|
+
if (annotationManager) {
|
|
301
301
|
const applyDraft = id => {
|
|
302
302
|
if (!isDrafting || !draftId) {
|
|
303
303
|
return {
|
|
@@ -344,9 +344,9 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
344
344
|
} : undefined
|
|
345
345
|
};
|
|
346
346
|
};
|
|
347
|
-
annotationManager
|
|
347
|
+
annotationManager.hook('applyDraft', applyDraft);
|
|
348
348
|
return () => {
|
|
349
|
-
annotationManager
|
|
349
|
+
annotationManager.unhook('applyDraft', applyDraft);
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
352
|
}, [annotationManager, onCreateCallback, onCloseCallback, isDrafting, draftId, dispatch]);
|
|
@@ -361,11 +361,11 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
361
361
|
,
|
|
362
362
|
wrapperDOM: wrapperDOM.current,
|
|
363
363
|
isAnnotationAllowed: isAnnotationAllowed,
|
|
364
|
-
onClose:
|
|
365
|
-
onCreate:
|
|
364
|
+
onClose: annotationManager ? nop : onCloseCallback,
|
|
365
|
+
onCreate: annotationManager ? nop : onCreateCallback,
|
|
366
366
|
getAnnotationIndexMatch: createIndexCallback,
|
|
367
|
-
applyDraftMode:
|
|
368
|
-
removeDraftMode:
|
|
367
|
+
applyDraftMode: annotationManager ? nop : applyDraftModeCallback,
|
|
368
|
+
removeDraftMode: annotationManager ? nop : removeDraftModeCallback,
|
|
369
369
|
inlineNodeTypes: inlineNodeTypes
|
|
370
370
|
});
|
|
371
371
|
});
|
|
@@ -10,6 +10,15 @@ import memoizeOne from 'memoize-one';
|
|
|
10
10
|
import { getNodeRenderer } from '@atlaskit/editor-common/extensions';
|
|
11
11
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
12
12
|
import { getExtensionRenderer } from '@atlaskit/editor-common/utils';
|
|
13
|
+
// When running on server-side emotion will generate style tags before elements.
|
|
14
|
+
// This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
|
|
15
|
+
// However as soon as the styles are extracted to <head> it adds back the margin.
|
|
16
|
+
// The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
|
|
17
|
+
// This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
|
|
18
|
+
var forceMarginTopStyle = css({
|
|
19
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
20
|
+
marginTop: "1px !important"
|
|
21
|
+
});
|
|
13
22
|
var inlineExtensionStyle = css({
|
|
14
23
|
display: 'inline-block',
|
|
15
24
|
maxWidth: '100%',
|
|
@@ -119,12 +128,12 @@ export default function ExtensionRenderer(props) {
|
|
|
119
128
|
});
|
|
120
129
|
}
|
|
121
130
|
export var InlineNodeRendererWrapper = function InlineNodeRendererWrapper(_ref) {
|
|
122
|
-
var
|
|
123
|
-
|
|
131
|
+
var _ref$forceMarginTop = _ref.forceMarginTop,
|
|
132
|
+
forceMarginTop = _ref$forceMarginTop === void 0 ? false : _ref$forceMarginTop,
|
|
133
|
+
children = _ref.children;
|
|
134
|
+
return jsx("div", {
|
|
124
135
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}, children)
|
|
129
|
-
);
|
|
136
|
+
className: "inline-extension-renderer",
|
|
137
|
+
css: [inlineExtensionStyle, forceMarginTop && forceMarginTopStyle]
|
|
138
|
+
}, children);
|
|
130
139
|
};
|
|
@@ -53,7 +53,7 @@ import { PortalContext } from './PortalContext';
|
|
|
53
53
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
54
54
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
55
55
|
var packageName = "@atlaskit/renderer";
|
|
56
|
-
var packageVersion = "118.6.
|
|
56
|
+
var packageVersion = "118.6.4";
|
|
57
57
|
var setAsQueryContainerStyles = css({
|
|
58
58
|
containerName: 'ak-renderer-wrapper',
|
|
59
59
|
containerType: 'inline-size'
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useMemo, useCallback, useContext } from 'react';
|
|
2
2
|
import { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
3
3
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { MarkComponent } from './mark';
|
|
6
5
|
import { useInlineCommentsFilter } from '../hooks/use-inline-comments-filter';
|
|
7
6
|
import { useInlineCommentSubscriberContext } from '../hooks/use-inline-comment-subscriber';
|
|
@@ -37,11 +36,11 @@ var MarkElement = function MarkElement(_ref) {
|
|
|
37
36
|
}
|
|
38
37
|
var eventTarget = props.eventTarget,
|
|
39
38
|
annotationIds = props.annotationIds;
|
|
40
|
-
if (
|
|
39
|
+
if (annotationManager) {
|
|
41
40
|
if (hasFocus) {
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
44
|
-
annotationManager
|
|
43
|
+
annotationManager.checkPreemptiveGate().then(function (canSelect) {
|
|
45
44
|
if (canSelect) {
|
|
46
45
|
// if there is a draft, clear it first
|
|
47
46
|
annotationManager === null || annotationManager === void 0 || annotationManager.clearDraft();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { AnnotationView } from './view';
|
|
5
4
|
import { AnnotationsContextWrapper } from './wrapper';
|
|
6
5
|
import { ProvidersContext, InlineCommentsStateContext } from './context';
|
|
@@ -69,7 +68,7 @@ export var AnnotationsWrapper = function AnnotationsWrapper(props) {
|
|
|
69
68
|
adfDocument = props.adfDocument,
|
|
70
69
|
isNestedRender = props.isNestedRender,
|
|
71
70
|
onLoadComplete = props.onLoadComplete;
|
|
72
|
-
if (!isNestedRender &&
|
|
71
|
+
if (!isNestedRender && annotationProvider !== null && annotationProvider !== void 0 && annotationProvider.annotationManager) {
|
|
73
72
|
var _annotationProvider$i, _annotationProvider$i2;
|
|
74
73
|
// We need to ensure there is a single instance of the annotation manager for the whole document
|
|
75
74
|
// and that it is the same instance for all annotations.
|
|
@@ -78,7 +77,7 @@ export var AnnotationsWrapper = function AnnotationsWrapper(props) {
|
|
|
78
77
|
return /*#__PURE__*/React.createElement(ProvidersContext.Provider, {
|
|
79
78
|
value: annotationProvider
|
|
80
79
|
}, /*#__PURE__*/React.createElement(AnnotationManagerProvider, {
|
|
81
|
-
annotationManager: annotationProvider
|
|
80
|
+
annotationManager: annotationProvider.annotationManager,
|
|
82
81
|
updateSubscriber: (_annotationProvider$i = annotationProvider === null || annotationProvider === void 0 || (_annotationProvider$i2 = annotationProvider.inlineComment) === null || _annotationProvider$i2 === void 0 ? void 0 : _annotationProvider$i2.updateSubscriber) !== null && _annotationProvider$i !== void 0 ? _annotationProvider$i : undefined
|
|
83
82
|
}, /*#__PURE__*/React.createElement(AnnotationsWrapperInner, {
|
|
84
83
|
rendererRef: rendererRef,
|
|
@@ -193,21 +193,21 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
193
193
|
onCloseProps();
|
|
194
194
|
}, [onCloseProps, removeDraftModeCallback, createAnalyticsEvent, inlineNodeTypes]);
|
|
195
195
|
useEffect(function () {
|
|
196
|
-
if (
|
|
196
|
+
if (annotationManager) {
|
|
197
197
|
var allowAnnotation = function allowAnnotation() {
|
|
198
198
|
if (isDrafting) {
|
|
199
199
|
return false;
|
|
200
200
|
}
|
|
201
201
|
return isAnnotationAllowed;
|
|
202
202
|
};
|
|
203
|
-
annotationManager
|
|
203
|
+
annotationManager.hook('allowAnnotation', allowAnnotation);
|
|
204
204
|
return function () {
|
|
205
|
-
annotationManager
|
|
205
|
+
annotationManager.unhook('allowAnnotation', allowAnnotation);
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
}, [annotationManager, isAnnotationAllowed, isDrafting]);
|
|
209
209
|
useEffect(function () {
|
|
210
|
-
if (
|
|
210
|
+
if (annotationManager) {
|
|
211
211
|
var startDraft = function startDraft() {
|
|
212
212
|
var _result$inlineNodeTyp;
|
|
213
213
|
if (isDrafting) {
|
|
@@ -256,14 +256,14 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
};
|
|
259
|
-
annotationManager
|
|
259
|
+
annotationManager.hook('startDraft', startDraft);
|
|
260
260
|
return function () {
|
|
261
|
-
annotationManager
|
|
261
|
+
annotationManager.unhook('startDraft', startDraft);
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
}, [annotationManager, isDrafting, applyDraftModeCallback, actions, range, dispatch]);
|
|
265
265
|
useEffect(function () {
|
|
266
|
-
if (
|
|
266
|
+
if (annotationManager) {
|
|
267
267
|
var clearDraft = function clearDraft() {
|
|
268
268
|
if (!isDrafting) {
|
|
269
269
|
return {
|
|
@@ -284,14 +284,14 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
284
284
|
success: true
|
|
285
285
|
};
|
|
286
286
|
};
|
|
287
|
-
annotationManager
|
|
287
|
+
annotationManager.hook('clearDraft', clearDraft);
|
|
288
288
|
return function () {
|
|
289
|
-
annotationManager
|
|
289
|
+
annotationManager.unhook('clearDraft', clearDraft);
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
}, [annotationManager, onCloseCallback, isDrafting, dispatch]);
|
|
293
293
|
useEffect(function () {
|
|
294
|
-
if (
|
|
294
|
+
if (annotationManager) {
|
|
295
295
|
var applyDraft = function applyDraft(id) {
|
|
296
296
|
if (!isDrafting || !draftId) {
|
|
297
297
|
return {
|
|
@@ -338,9 +338,9 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
338
338
|
} : undefined
|
|
339
339
|
};
|
|
340
340
|
};
|
|
341
|
-
annotationManager
|
|
341
|
+
annotationManager.hook('applyDraft', applyDraft);
|
|
342
342
|
return function () {
|
|
343
|
-
annotationManager
|
|
343
|
+
annotationManager.unhook('applyDraft', applyDraft);
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
346
|
}, [annotationManager, onCreateCallback, onCloseCallback, isDrafting, draftId, dispatch]);
|
|
@@ -359,11 +359,11 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
359
359
|
,
|
|
360
360
|
wrapperDOM: wrapperDOM.current,
|
|
361
361
|
isAnnotationAllowed: isAnnotationAllowed,
|
|
362
|
-
onClose:
|
|
363
|
-
onCreate:
|
|
362
|
+
onClose: annotationManager ? nop : onCloseCallback,
|
|
363
|
+
onCreate: annotationManager ? nop : onCreateCallback,
|
|
364
364
|
getAnnotationIndexMatch: createIndexCallback,
|
|
365
|
-
applyDraftMode:
|
|
366
|
-
removeDraftMode:
|
|
365
|
+
applyDraftMode: annotationManager ? nop : applyDraftModeCallback,
|
|
366
|
+
removeDraftMode: annotationManager ? nop : removeDraftModeCallback,
|
|
367
367
|
inlineNodeTypes: inlineNodeTypes
|
|
368
368
|
});
|
|
369
369
|
});
|
|
@@ -28,5 +28,7 @@ interface Props {
|
|
|
28
28
|
}) => JSX.Element;
|
|
29
29
|
}
|
|
30
30
|
export default function ExtensionRenderer(props: Props): JSX.Element;
|
|
31
|
-
export declare const InlineNodeRendererWrapper: ({ children }: React.PropsWithChildren<
|
|
31
|
+
export declare const InlineNodeRendererWrapper: ({ forceMarginTop, children, }: React.PropsWithChildren<{
|
|
32
|
+
forceMarginTop?: boolean | undefined;
|
|
33
|
+
}>) => jsx.JSX.Element;
|
|
32
34
|
export {};
|
|
@@ -28,5 +28,7 @@ interface Props {
|
|
|
28
28
|
}) => JSX.Element;
|
|
29
29
|
}
|
|
30
30
|
export default function ExtensionRenderer(props: Props): JSX.Element;
|
|
31
|
-
export declare const InlineNodeRendererWrapper: ({ children }: React.PropsWithChildren<
|
|
31
|
+
export declare const InlineNodeRendererWrapper: ({ forceMarginTop, children, }: React.PropsWithChildren<{
|
|
32
|
+
forceMarginTop?: boolean | undefined;
|
|
33
|
+
}>) => jsx.JSX.Element;
|
|
32
34
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "118.6.
|
|
3
|
+
"version": "118.6.4",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@atlaskit/adf-utils": "^19.20.0",
|
|
29
29
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
30
30
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
31
|
-
"@atlaskit/analytics-next": "^11.
|
|
31
|
+
"@atlaskit/analytics-next": "^11.1.0",
|
|
32
32
|
"@atlaskit/button": "^23.2.0",
|
|
33
33
|
"@atlaskit/code": "^17.2.0",
|
|
34
34
|
"@atlaskit/editor-common": "^106.1.0",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@atlaskit/status": "^3.0.0",
|
|
57
57
|
"@atlaskit/task-decision": "^19.2.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
60
|
-
"@atlaskit/tokens": "^
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^5.7.0",
|
|
60
|
+
"@atlaskit/tokens": "^5.0.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.2.0",
|
|
62
62
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
63
63
|
"@babel/runtime": "^7.0.0",
|
|
@@ -206,9 +206,6 @@
|
|
|
206
206
|
"platform_editor_comments_api_manager": {
|
|
207
207
|
"type": "boolean"
|
|
208
208
|
},
|
|
209
|
-
"platform_editor_comments_api_manager_select": {
|
|
210
|
-
"type": "boolean"
|
|
211
|
-
},
|
|
212
209
|
"platform_renderer_isPresentational": {
|
|
213
210
|
"type": "boolean"
|
|
214
211
|
},
|