@atlaskit/renderer 109.42.3 → 109.42.5
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 +29 -0
- package/dist/cjs/actions/index.js +31 -0
- package/dist/cjs/react/nodes/table.js +1 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/Renderer/style.js +21 -0
- package/dist/cjs/ui/annotations/draft/component.js +2 -0
- package/dist/cjs/ui/annotations/selection/mounter.js +15 -5
- package/dist/es2019/actions/index.js +31 -0
- package/dist/es2019/react/nodes/table.js +1 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/Renderer/style.js +21 -1
- package/dist/es2019/ui/annotations/draft/component.js +2 -0
- package/dist/es2019/ui/annotations/selection/mounter.js +15 -5
- package/dist/esm/actions/index.js +31 -0
- package/dist/esm/react/nodes/table.js +1 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/Renderer/style.js +21 -1
- package/dist/esm/ui/annotations/draft/component.js +2 -0
- package/dist/esm/ui/annotations/selection/mounter.js +15 -5
- package/dist/types/actions/index.d.ts +6 -0
- package/dist/types/ui/Renderer/style.d.ts +1 -2
- package/dist/types-ts4.5/actions/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/Renderer/style.d.ts +1 -2
- package/package.json +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 109.42.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#121315](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121315)
|
|
8
|
+
[`f550b1a0c6e85`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f550b1a0c6e85) -
|
|
9
|
+
[ux] ED-24237 Fix comment appearances in renderer to match editor
|
|
10
|
+
- [#121452](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121452)
|
|
11
|
+
[`9696ad7f5108a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9696ad7f5108a) -
|
|
12
|
+
ensure nested tables don't have left alignment styles
|
|
13
|
+
- [#120992](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/120992)
|
|
14
|
+
[`a61cfb5567823`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a61cfb5567823) -
|
|
15
|
+
ED-23357 Update annotation node name calculations to avoid crashes on invalid ranges
|
|
16
|
+
- [#121315](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121315)
|
|
17
|
+
[`f550b1a0c6e85`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f550b1a0c6e85) -
|
|
18
|
+
ED-24236 fix missing underline for draft annotations in renderer (when annotations on inline nodes
|
|
19
|
+
fg is on)
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
22
|
+
## 109.42.4
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#120324](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/120324)
|
|
27
|
+
[`9cb22ec2da5c2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9cb22ec2da5c2) -
|
|
28
|
+
ED-24236 fix missing underline for draft annotations in renderer (when annotations on inline nodes
|
|
29
|
+
fg is on)
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
|
|
3
32
|
## 109.42.3
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -177,6 +177,37 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
177
177
|
}
|
|
178
178
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
179
179
|
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "isRangeAnnotatable",
|
|
182
|
+
value: function isRangeAnnotatable(range) {
|
|
183
|
+
try {
|
|
184
|
+
var _startContainer$paren, _endContainer$parentE;
|
|
185
|
+
if (!range) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
var startContainer = range.startContainer,
|
|
189
|
+
endContainer = range.endContainer;
|
|
190
|
+
if ((_startContainer$paren = startContainer.parentElement) !== null && _startContainer$paren !== void 0 && _startContainer$paren.closest('.ak-renderer-extension') || (_endContainer$parentE = endContainer.parentElement) !== null && _endContainer$parentE !== void 0 && _endContainer$parentE.closest('.ak-renderer-extension')) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
return this.isValidAnnotationRange(range);
|
|
194
|
+
} catch (_unused) {
|
|
195
|
+
// isValidAnnotationRange can fail when called inside nested renderers.
|
|
196
|
+
// while isRendererWithinRange guards against this to some degree -- the classnames
|
|
197
|
+
// are controlled by product -- and we don't have platform guarantees on them.
|
|
198
|
+
//
|
|
199
|
+
// Currently there is a mix of logic across the platform and confluence on determining
|
|
200
|
+
// positions that are annotatable. This is a defensive check to ensure we don't throw an error
|
|
201
|
+
// in cases where the range is not valid.
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* This is replaced by `isRangeAnnotatable`.
|
|
208
|
+
*
|
|
209
|
+
* @deprecated
|
|
210
|
+
**/
|
|
180
211
|
}, {
|
|
181
212
|
key: "isRendererWithinRange",
|
|
182
213
|
value: function isRendererWithinRange(range) {
|
|
@@ -321,7 +321,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
321
321
|
var isTableAlignStart = (0, _appearance.isFullWidthOrFullPageAppearance)(rendererAppearance) && tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && (0, _platformFeatureFlags.fg)('platform.editor.table.allow-table-alignment');
|
|
322
322
|
var fullWidthLineLength = isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
323
323
|
var lineLength = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLength : lineLengthFixedWidth;
|
|
324
|
-
var shouldCalculateLeftForAlignment = isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidth <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance));
|
|
324
|
+
var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidth <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance));
|
|
325
325
|
if (shouldCalculateLeftForAlignment) {
|
|
326
326
|
left = (tableWidth - lineLength) / 2;
|
|
327
327
|
}
|
|
@@ -56,7 +56,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
56
56
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
57
57
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
58
58
|
var packageName = "@atlaskit/renderer";
|
|
59
|
-
var packageVersion = "109.42.
|
|
59
|
+
var packageVersion = "109.42.5";
|
|
60
60
|
var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
|
|
61
61
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
62
62
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
@@ -112,6 +112,27 @@ function getAnnotationStyles(_ref6) {
|
|
|
112
112
|
if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
113
113
|
return '';
|
|
114
114
|
}
|
|
115
|
+
if ((0, _platformFeatureFlags.fg)('annotations_align_editor_and_renderer_styles')) {
|
|
116
|
+
return (0, _react.css)({
|
|
117
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
118
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node]': {
|
|
119
|
+
borderBottom: '2px solid transparent',
|
|
120
|
+
cursor: 'pointer',
|
|
121
|
+
padding: '1px 0 2px',
|
|
122
|
+
background: "var(--ds-background-accent-yellow-subtler, ".concat(_colors.Y75, ")"),
|
|
123
|
+
borderBottomColor: "var(--ds-border-accent-yellow, ".concat(_colors.Y300, ")"),
|
|
124
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(_colors.N60A, ", -1px 2px 3px ").concat(_colors.N60A), ")")
|
|
125
|
+
},
|
|
126
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
127
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node][data-inline-card]': {
|
|
128
|
+
padding: '5px 0 3px 0'
|
|
129
|
+
},
|
|
130
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
131
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node].date-lozenger-container': {
|
|
132
|
+
paddingTop: "var(--ds-space-025, 2px)"
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
115
136
|
return (0, _react.css)({
|
|
116
137
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
117
138
|
"& [data-mark-type='annotation'][data-mark-annotation-state='active'] [data-annotation-mark], & [data-annotation-draft-mark][data-annotation-inline-node]": {
|
|
@@ -31,6 +31,8 @@ var markStyles = function markStyles() {
|
|
|
31
31
|
WebkitTapHighlightColor: 'transparent'
|
|
32
32
|
},
|
|
33
33
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
34
|
+
(0, _styles.AnnotationSharedCSSByState)().common,
|
|
35
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
34
36
|
(0, _styles.AnnotationSharedCSSByState)().focus);
|
|
35
37
|
};
|
|
36
38
|
var AnnotationDraft = exports.AnnotationDraft = function AnnotationDraft(_ref) {
|
|
@@ -39,16 +39,26 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
39
39
|
var providers = (0, _react.useContext)(_context.ProvidersContext);
|
|
40
40
|
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
41
41
|
var inlineNodeTypes = (0, _react.useMemo)(function () {
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
if ((0, _platformFeatureFlags.fg)('annotations_defensive_node_name_calculations')) {
|
|
43
|
+
if (!actions.isRangeAnnotatable(range)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
46
|
return (0, _getRendererRangeInlineNodeNames.getRendererRangeInlineNodeNames)({
|
|
47
47
|
pos: documentPosition,
|
|
48
48
|
actions: actions
|
|
49
49
|
});
|
|
50
50
|
} else {
|
|
51
|
-
|
|
51
|
+
if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
if (actions.isValidAnnotationRange(range)) {
|
|
55
|
+
return (0, _getRendererRangeInlineNodeNames.getRendererRangeInlineNodeNames)({
|
|
56
|
+
pos: documentPosition,
|
|
57
|
+
actions: actions
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
52
62
|
}
|
|
53
63
|
}, [documentPosition, actions, range]);
|
|
54
64
|
var onCreateCallback = (0, _react.useCallback)(function (annotationId) {
|
|
@@ -155,6 +155,37 @@ export default class RendererActions {
|
|
|
155
155
|
}
|
|
156
156
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
157
157
|
}
|
|
158
|
+
isRangeAnnotatable(range) {
|
|
159
|
+
try {
|
|
160
|
+
var _startContainer$paren, _endContainer$parentE;
|
|
161
|
+
if (!range) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
const {
|
|
165
|
+
startContainer,
|
|
166
|
+
endContainer
|
|
167
|
+
} = range;
|
|
168
|
+
if ((_startContainer$paren = startContainer.parentElement) !== null && _startContainer$paren !== void 0 && _startContainer$paren.closest('.ak-renderer-extension') || (_endContainer$parentE = endContainer.parentElement) !== null && _endContainer$parentE !== void 0 && _endContainer$parentE.closest('.ak-renderer-extension')) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return this.isValidAnnotationRange(range);
|
|
172
|
+
} catch {
|
|
173
|
+
// isValidAnnotationRange can fail when called inside nested renderers.
|
|
174
|
+
// while isRendererWithinRange guards against this to some degree -- the classnames
|
|
175
|
+
// are controlled by product -- and we don't have platform guarantees on them.
|
|
176
|
+
//
|
|
177
|
+
// Currently there is a mix of logic across the platform and confluence on determining
|
|
178
|
+
// positions that are annotatable. This is a defensive check to ensure we don't throw an error
|
|
179
|
+
// in cases where the range is not valid.
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* This is replaced by `isRangeAnnotatable`.
|
|
186
|
+
*
|
|
187
|
+
* @deprecated
|
|
188
|
+
**/
|
|
158
189
|
isRendererWithinRange(range) {
|
|
159
190
|
const {
|
|
160
191
|
startContainer,
|
|
@@ -268,7 +268,7 @@ export class TableContainer extends React.Component {
|
|
|
268
268
|
const isTableAlignStart = isFullWidthOrFullPageAppearance(rendererAppearance) && tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && fg('platform.editor.table.allow-table-alignment');
|
|
269
269
|
const fullWidthLineLength = isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
|
|
270
270
|
const lineLength = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLength : lineLengthFixedWidth;
|
|
271
|
-
const shouldCalculateLeftForAlignment = isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance));
|
|
271
|
+
const shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance));
|
|
272
272
|
if (shouldCalculateLeftForAlignment) {
|
|
273
273
|
left = (tableWidth - lineLength) / 2;
|
|
274
274
|
}
|
|
@@ -38,7 +38,7 @@ import { nodeToReact } from '../../react/nodes';
|
|
|
38
38
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
39
39
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
40
40
|
const packageName = "@atlaskit/renderer";
|
|
41
|
-
const packageVersion = "109.42.
|
|
41
|
+
const packageVersion = "109.42.5";
|
|
42
42
|
export const defaultNodeComponents = nodeToReact;
|
|
43
43
|
export class Renderer extends PureComponent {
|
|
44
44
|
constructor(props) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation */
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
|
-
|
|
5
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
5
|
import { css } from '@emotion/react';
|
|
7
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -371,6 +370,27 @@ function getAnnotationStyles({
|
|
|
371
370
|
if (!fg('editor_inline_comments_on_inline_nodes')) {
|
|
372
371
|
return '';
|
|
373
372
|
}
|
|
373
|
+
if (fg('annotations_align_editor_and_renderer_styles')) {
|
|
374
|
+
return css({
|
|
375
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
376
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node]': {
|
|
377
|
+
borderBottom: '2px solid transparent',
|
|
378
|
+
cursor: 'pointer',
|
|
379
|
+
padding: '1px 0 2px',
|
|
380
|
+
background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
|
|
381
|
+
borderBottomColor: `var(--ds-border-accent-yellow, ${Y300})`,
|
|
382
|
+
boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`
|
|
383
|
+
},
|
|
384
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
385
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node][data-inline-card]': {
|
|
386
|
+
padding: '5px 0 3px 0'
|
|
387
|
+
},
|
|
388
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
389
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node].date-lozenger-container': {
|
|
390
|
+
paddingTop: "var(--ds-space-025, 2px)"
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
}
|
|
374
394
|
return css({
|
|
375
395
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
376
396
|
"& [data-mark-type='annotation'][data-mark-annotation-state='active'] [data-annotation-mark], & [data-annotation-draft-mark][data-annotation-inline-node]": {
|
|
@@ -19,6 +19,8 @@ const markStyles = () => css({
|
|
|
19
19
|
WebkitTapHighlightColor: 'transparent'
|
|
20
20
|
},
|
|
21
21
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
22
|
+
AnnotationSharedCSSByState().common,
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
22
24
|
AnnotationSharedCSSByState().focus);
|
|
23
25
|
export const AnnotationDraft = ({
|
|
24
26
|
draftPosition,
|
|
@@ -27,16 +27,26 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
27
27
|
const providers = useContext(ProvidersContext);
|
|
28
28
|
const isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
29
29
|
const inlineNodeTypes = useMemo(() => {
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (fg('annotations_defensive_node_name_calculations')) {
|
|
31
|
+
if (!actions.isRangeAnnotatable(range)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
34
|
return getRendererRangeInlineNodeNames({
|
|
35
35
|
pos: documentPosition,
|
|
36
36
|
actions
|
|
37
37
|
});
|
|
38
38
|
} else {
|
|
39
|
-
|
|
39
|
+
if (!fg('editor_inline_comments_on_inline_nodes')) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
if (actions.isValidAnnotationRange(range)) {
|
|
43
|
+
return getRendererRangeInlineNodeNames({
|
|
44
|
+
pos: documentPosition,
|
|
45
|
+
actions
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
40
50
|
}
|
|
41
51
|
}, [documentPosition, actions, range]);
|
|
42
52
|
const onCreateCallback = useCallback(annotationId => {
|
|
@@ -170,6 +170,37 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
170
170
|
}
|
|
171
171
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
172
172
|
}
|
|
173
|
+
}, {
|
|
174
|
+
key: "isRangeAnnotatable",
|
|
175
|
+
value: function isRangeAnnotatable(range) {
|
|
176
|
+
try {
|
|
177
|
+
var _startContainer$paren, _endContainer$parentE;
|
|
178
|
+
if (!range) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
var startContainer = range.startContainer,
|
|
182
|
+
endContainer = range.endContainer;
|
|
183
|
+
if ((_startContainer$paren = startContainer.parentElement) !== null && _startContainer$paren !== void 0 && _startContainer$paren.closest('.ak-renderer-extension') || (_endContainer$parentE = endContainer.parentElement) !== null && _endContainer$parentE !== void 0 && _endContainer$parentE.closest('.ak-renderer-extension')) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
return this.isValidAnnotationRange(range);
|
|
187
|
+
} catch (_unused) {
|
|
188
|
+
// isValidAnnotationRange can fail when called inside nested renderers.
|
|
189
|
+
// while isRendererWithinRange guards against this to some degree -- the classnames
|
|
190
|
+
// are controlled by product -- and we don't have platform guarantees on them.
|
|
191
|
+
//
|
|
192
|
+
// Currently there is a mix of logic across the platform and confluence on determining
|
|
193
|
+
// positions that are annotatable. This is a defensive check to ensure we don't throw an error
|
|
194
|
+
// in cases where the range is not valid.
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* This is replaced by `isRangeAnnotatable`.
|
|
201
|
+
*
|
|
202
|
+
* @deprecated
|
|
203
|
+
**/
|
|
173
204
|
}, {
|
|
174
205
|
key: "isRendererWithinRange",
|
|
175
206
|
value: function isRendererWithinRange(range) {
|
|
@@ -314,7 +314,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
314
314
|
var isTableAlignStart = isFullWidthOrFullPageAppearance(rendererAppearance) && tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && fg('platform.editor.table.allow-table-alignment');
|
|
315
315
|
var fullWidthLineLength = isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
|
|
316
316
|
var lineLength = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLength : lineLengthFixedWidth;
|
|
317
|
-
var shouldCalculateLeftForAlignment = isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance));
|
|
317
|
+
var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance));
|
|
318
318
|
if (shouldCalculateLeftForAlignment) {
|
|
319
319
|
left = (tableWidth - lineLength) / 2;
|
|
320
320
|
}
|
|
@@ -48,7 +48,7 @@ import { nodeToReact } from '../../react/nodes';
|
|
|
48
48
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
49
49
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
50
50
|
var packageName = "@atlaskit/renderer";
|
|
51
|
-
var packageVersion = "109.42.
|
|
51
|
+
var packageVersion = "109.42.5";
|
|
52
52
|
export var defaultNodeComponents = nodeToReact;
|
|
53
53
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
54
54
|
_inherits(Renderer, _PureComponent);
|
|
@@ -3,7 +3,6 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
3
3
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation */
|
|
4
4
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
|
|
7
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
7
|
import { css } from '@emotion/react';
|
|
9
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -104,6 +103,27 @@ function getAnnotationStyles(_ref6) {
|
|
|
104
103
|
if (!fg('editor_inline_comments_on_inline_nodes')) {
|
|
105
104
|
return '';
|
|
106
105
|
}
|
|
106
|
+
if (fg('annotations_align_editor_and_renderer_styles')) {
|
|
107
|
+
return css({
|
|
108
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
109
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node]': {
|
|
110
|
+
borderBottom: '2px solid transparent',
|
|
111
|
+
cursor: 'pointer',
|
|
112
|
+
padding: '1px 0 2px',
|
|
113
|
+
background: "var(--ds-background-accent-yellow-subtler, ".concat(Y75, ")"),
|
|
114
|
+
borderBottomColor: "var(--ds-border-accent-yellow, ".concat(Y300, ")"),
|
|
115
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(N60A, ", -1px 2px 3px ").concat(N60A), ")")
|
|
116
|
+
},
|
|
117
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
118
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node][data-inline-card]': {
|
|
119
|
+
padding: '5px 0 3px 0'
|
|
120
|
+
},
|
|
121
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
122
|
+
'& [data-annotation-draft-mark][data-annotation-inline-node].date-lozenger-container': {
|
|
123
|
+
paddingTop: "var(--ds-space-025, 2px)"
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
107
127
|
return css({
|
|
108
128
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
109
129
|
"& [data-mark-type='annotation'][data-mark-annotation-state='active'] [data-annotation-mark], & [data-annotation-draft-mark][data-annotation-inline-node]": {
|
|
@@ -20,6 +20,8 @@ var markStyles = function markStyles() {
|
|
|
20
20
|
WebkitTapHighlightColor: 'transparent'
|
|
21
21
|
},
|
|
22
22
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
23
|
+
AnnotationSharedCSSByState().common,
|
|
24
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
23
25
|
AnnotationSharedCSSByState().focus);
|
|
24
26
|
};
|
|
25
27
|
export var AnnotationDraft = function AnnotationDraft(_ref) {
|
|
@@ -29,16 +29,26 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
29
29
|
var providers = useContext(ProvidersContext);
|
|
30
30
|
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
31
31
|
var inlineNodeTypes = useMemo(function () {
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
if (fg('annotations_defensive_node_name_calculations')) {
|
|
33
|
+
if (!actions.isRangeAnnotatable(range)) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
36
|
return getRendererRangeInlineNodeNames({
|
|
37
37
|
pos: documentPosition,
|
|
38
38
|
actions: actions
|
|
39
39
|
});
|
|
40
40
|
} else {
|
|
41
|
-
|
|
41
|
+
if (!fg('editor_inline_comments_on_inline_nodes')) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
if (actions.isValidAnnotationRange(range)) {
|
|
45
|
+
return getRendererRangeInlineNodeNames({
|
|
46
|
+
pos: documentPosition,
|
|
47
|
+
actions: actions
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
42
52
|
}
|
|
43
53
|
}, [documentPosition, actions, range]);
|
|
44
54
|
var onCreateCallback = useCallback(function (annotationId) {
|
|
@@ -51,6 +51,12 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
51
51
|
};
|
|
52
52
|
annotate(range: Range, annotationId: string, annotationType: 'inlineComment'): AnnotationActionResult;
|
|
53
53
|
isValidAnnotationRange(range: Range | null): boolean;
|
|
54
|
+
isRangeAnnotatable(range: Range | null): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* This is replaced by `isRangeAnnotatable`.
|
|
57
|
+
*
|
|
58
|
+
* @deprecated
|
|
59
|
+
**/
|
|
54
60
|
isRendererWithinRange(range: Range): boolean;
|
|
55
61
|
isValidAnnotationPosition(pos: Position): boolean;
|
|
56
62
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Theme } from '@emotion/react';
|
|
2
1
|
import type { RendererAppearance } from './types';
|
|
3
2
|
export declare const FullPagePadding = 32;
|
|
4
3
|
export type RendererWrapperProps = {
|
|
@@ -14,4 +13,4 @@ export declare const headingSizes: {
|
|
|
14
13
|
[key: string]: number;
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
|
-
export declare const rendererStyles: (wrapperProps: RendererWrapperProps) => (theme:
|
|
16
|
+
export declare const rendererStyles: (wrapperProps: RendererWrapperProps) => (theme: any) => import("@emotion/react").SerializedStyles;
|
|
@@ -51,6 +51,12 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
51
51
|
};
|
|
52
52
|
annotate(range: Range, annotationId: string, annotationType: 'inlineComment'): AnnotationActionResult;
|
|
53
53
|
isValidAnnotationRange(range: Range | null): boolean;
|
|
54
|
+
isRangeAnnotatable(range: Range | null): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* This is replaced by `isRangeAnnotatable`.
|
|
57
|
+
*
|
|
58
|
+
* @deprecated
|
|
59
|
+
**/
|
|
54
60
|
isRendererWithinRange(range: Range): boolean;
|
|
55
61
|
isValidAnnotationPosition(pos: Position): boolean;
|
|
56
62
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Theme } from '@emotion/react';
|
|
2
1
|
import type { RendererAppearance } from './types';
|
|
3
2
|
export declare const FullPagePadding = 32;
|
|
4
3
|
export type RendererWrapperProps = {
|
|
@@ -14,4 +13,4 @@ export declare const headingSizes: {
|
|
|
14
13
|
[key: string]: number;
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
|
-
export declare const rendererStyles: (wrapperProps: RendererWrapperProps) => (theme:
|
|
16
|
+
export declare const rendererStyles: (wrapperProps: RendererWrapperProps) => (theme: any) => import("@emotion/react").SerializedStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "109.42.
|
|
3
|
+
"version": "109.42.5",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@atlaskit/analytics-listeners": "^8.10.0",
|
|
30
30
|
"@atlaskit/analytics-namespaced-context": "^6.10.0",
|
|
31
31
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
32
|
-
"@atlaskit/button": "^
|
|
32
|
+
"@atlaskit/button": "^19.0.0",
|
|
33
33
|
"@atlaskit/code": "^15.4.0",
|
|
34
|
-
"@atlaskit/editor-common": "^86.
|
|
34
|
+
"@atlaskit/editor-common": "^86.2.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.15.0",
|
|
36
36
|
"@atlaskit/editor-palette": "1.6.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/status": "^1.4.0",
|
|
53
53
|
"@atlaskit/task-decision": "^17.10.0",
|
|
54
54
|
"@atlaskit/theme": "^12.11.0",
|
|
55
|
-
"@atlaskit/tokens": "^1.
|
|
55
|
+
"@atlaskit/tokens": "^1.56.0",
|
|
56
56
|
"@atlaskit/tooltip": "^18.5.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@atlaskit/linking-common": "^5.7.0",
|
|
80
80
|
"@atlaskit/media-core": "^34.2.0",
|
|
81
81
|
"@atlaskit/media-integration-test-helpers": "^3.0.0",
|
|
82
|
-
"@atlaskit/media-test-helpers": "^
|
|
82
|
+
"@atlaskit/media-test-helpers": "^34.0.0",
|
|
83
83
|
"@atlaskit/mention": "^23.2.0",
|
|
84
84
|
"@atlaskit/navigation-next": "^9.0.0",
|
|
85
85
|
"@atlaskit/util-data-test": "^17.9.0",
|
|
@@ -118,6 +118,9 @@
|
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
"platform-feature-flags": {
|
|
121
|
+
"annotations_defensive_node_name_calculations": {
|
|
122
|
+
"type": "boolean"
|
|
123
|
+
},
|
|
121
124
|
"platform.media-experience.media-viewer-v2_hgsii": {
|
|
122
125
|
"type": "boolean",
|
|
123
126
|
"referenceOnly": "true"
|
|
@@ -140,6 +143,9 @@
|
|
|
140
143
|
"platform.editor.table.allow-table-alignment": {
|
|
141
144
|
"type": "boolean"
|
|
142
145
|
},
|
|
146
|
+
"annotations_align_editor_and_renderer_styles": {
|
|
147
|
+
"type": "boolean"
|
|
148
|
+
},
|
|
143
149
|
"platform.comments-on-media.bug.incorrect-badge-highlight": {
|
|
144
150
|
"type": "boolean"
|
|
145
151
|
}
|