@atlaskit/renderer 148.1.0 → 149.0.1
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 +35 -0
- package/dist/cjs/actions/index.js +35 -3
- package/dist/cjs/react/index.js +8 -0
- package/dist/cjs/react/marks/annotation.js +3 -1
- package/dist/cjs/react/nodes/extension-comments.compiled.css +4 -0
- package/dist/cjs/react/nodes/extension-comments.js +144 -0
- package/dist/cjs/react/nodes/extension.js +86 -11
- package/dist/cjs/react/nodes/layoutColumn-compiled.js +1 -2
- package/dist/cjs/react/nodes/layoutColumn-emotion.js +1 -2
- package/dist/cjs/react/nodes/table/colgroup.js +1 -2
- package/dist/cjs/steps/index.js +23 -0
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/contexts/AnnotationRangeContext.js +29 -11
- package/dist/cjs/ui/annotations/element/extension.compiled.css +6 -0
- package/dist/cjs/ui/annotations/element/extension.js +34 -0
- package/dist/cjs/ui/annotations/element/index.js +4 -2
- package/dist/cjs/ui/annotations/element/mark.js +11 -1
- package/dist/cjs/ui/annotations/index.js +2 -1
- package/dist/es2019/actions/index.js +33 -3
- package/dist/es2019/react/index.js +8 -0
- package/dist/es2019/react/marks/annotation.js +3 -1
- package/dist/es2019/react/nodes/extension-comments.compiled.css +4 -0
- package/dist/es2019/react/nodes/extension-comments.js +115 -0
- package/dist/es2019/react/nodes/extension.js +83 -7
- package/dist/es2019/react/nodes/layoutColumn-compiled.js +2 -2
- package/dist/es2019/react/nodes/layoutColumn-emotion.js +2 -2
- package/dist/es2019/react/nodes/table/colgroup.js +1 -2
- package/dist/es2019/steps/index.js +25 -0
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/contexts/AnnotationRangeContext.js +28 -12
- package/dist/es2019/ui/annotations/element/extension.compiled.css +6 -0
- package/dist/es2019/ui/annotations/element/extension.js +26 -0
- package/dist/es2019/ui/annotations/element/index.js +4 -2
- package/dist/es2019/ui/annotations/element/mark.js +11 -1
- package/dist/es2019/ui/annotations/index.js +2 -1
- package/dist/esm/actions/index.js +35 -3
- package/dist/esm/react/index.js +8 -0
- package/dist/esm/react/marks/annotation.js +3 -1
- package/dist/esm/react/nodes/extension-comments.compiled.css +4 -0
- package/dist/esm/react/nodes/extension-comments.js +135 -0
- package/dist/esm/react/nodes/extension.js +86 -7
- package/dist/esm/react/nodes/layoutColumn-compiled.js +2 -2
- package/dist/esm/react/nodes/layoutColumn-emotion.js +2 -2
- package/dist/esm/react/nodes/table/colgroup.js +1 -2
- package/dist/esm/steps/index.js +23 -0
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/contexts/AnnotationRangeContext.js +30 -12
- package/dist/esm/ui/annotations/element/extension.compiled.css +6 -0
- package/dist/esm/ui/annotations/element/extension.js +27 -0
- package/dist/esm/ui/annotations/element/index.js +4 -2
- package/dist/esm/ui/annotations/element/mark.js +11 -1
- package/dist/esm/ui/annotations/index.js +2 -1
- package/dist/types/actions/index.d.ts +13 -0
- package/dist/types/react/marks/annotation.d.ts +1 -1
- package/dist/types/react/nodes/extension-comments.d.ts +17 -0
- package/dist/types/react/nodes/extension.d.ts +12 -0
- package/dist/types/react/types.d.ts +1 -0
- package/dist/types/ui/annotations/contexts/AnnotationRangeContext.d.ts +4 -2
- package/dist/types/ui/annotations/element/extension.d.ts +17 -0
- package/dist/types/ui/annotations/element/index.d.ts +2 -1
- package/dist/types/ui/annotations/element/mark.d.ts +3 -107
- package/package.json +5 -11
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
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; }
|
|
2
5
|
/**
|
|
3
6
|
* @jsxRuntime classic
|
|
4
7
|
* @jsx jsx
|
|
5
8
|
*/
|
|
6
9
|
|
|
7
|
-
import React, { useEffect, useRef } from 'react';
|
|
10
|
+
import React, { useCallback, useContext, useEffect, useMemo, useRef } from 'react';
|
|
8
11
|
|
|
9
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
13
|
import { jsx, css } from '@emotion/react';
|
|
@@ -13,8 +16,12 @@ import { overflowShadow } from '@atlaskit/editor-common/ui';
|
|
|
13
16
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
14
17
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
18
|
import { RendererCssClassName } from '../../consts';
|
|
19
|
+
import { ProvidersContext } from '../../ui/annotations/context';
|
|
20
|
+
import { useAnnotationHoverDispatch } from '../../ui/annotations/contexts/AnnotationHoverContext';
|
|
21
|
+
import { useAnnotationRangeDispatch } from '../../ui/annotations/contexts/AnnotationRangeContext';
|
|
16
22
|
import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
17
23
|
import { calcBreakoutWidthCss } from '../utils/breakout';
|
|
24
|
+
import { ExtensionComments } from './extension-comments';
|
|
18
25
|
var FORGE_EXTENSION_TYPE = 'com.atlassian.ecosystem';
|
|
19
26
|
/**
|
|
20
27
|
* Mirrors `FORGE_INLINE_BODIED_PARAM` in `@atlassian/xen-editor-provider`. Duplicated rather than
|
|
@@ -69,7 +76,7 @@ var FireExtensionAsInlineAnalytics = function FireExtensionAsInlineAnalytics(_re
|
|
|
69
76
|
return null;
|
|
70
77
|
};
|
|
71
78
|
export var renderExtension = function renderExtension(content, layout) {
|
|
72
|
-
var _node$parameters, _node$parameters2;
|
|
79
|
+
var _node$parameters, _node$parameters2, _options$dataAttribut;
|
|
73
80
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
74
81
|
var removeOverflow = arguments.length > 3 ? arguments[3] : undefined;
|
|
75
82
|
var extensionId = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -157,11 +164,17 @@ export var renderExtension = function renderExtension(content, layout) {
|
|
|
157
164
|
},
|
|
158
165
|
"data-layout": layout,
|
|
159
166
|
"data-local-id": localId,
|
|
167
|
+
"data-renderer-start-pos": (_options$dataAttribut = options.dataAttributes) === null || _options$dataAttribut === void 0 ? void 0 : _options$dataAttribut['data-renderer-start-pos'],
|
|
160
168
|
"data-testid": "extension--wrapper",
|
|
161
169
|
"data-node-type": "extension",
|
|
170
|
+
"data-inline-comments-target": options.isCommentTarget || undefined,
|
|
162
171
|
"data-top-level": isTopLevel || undefined,
|
|
163
172
|
"data-forge-inline": isNativeForgeInline || undefined,
|
|
164
|
-
"data-migrated-inline": isMigratedInlineBodied || undefined
|
|
173
|
+
"data-migrated-inline": isMigratedInlineBodied || undefined,
|
|
174
|
+
onBlur: options.onBlur,
|
|
175
|
+
onFocus: options.onFocus,
|
|
176
|
+
onMouseEnter: options.onMouseEnter,
|
|
177
|
+
onMouseLeave: options.onMouseLeave
|
|
165
178
|
}, jsx("div", {
|
|
166
179
|
tabIndex: options.tabIndex
|
|
167
180
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -175,6 +188,7 @@ export var renderExtension = function renderExtension(content, layout) {
|
|
|
175
188
|
}, extensionDiv) : extensionDiv;
|
|
176
189
|
};
|
|
177
190
|
var Extension = function Extension(props) {
|
|
191
|
+
var _providers$inlineComm, _props$dataAttributes;
|
|
178
192
|
var text = props.text,
|
|
179
193
|
_props$layout = props.layout,
|
|
180
194
|
layout = _props$layout === void 0 ? 'default' : _props$layout,
|
|
@@ -187,6 +201,57 @@ var Extension = function Extension(props) {
|
|
|
187
201
|
nodeHeight = props.nodeHeight,
|
|
188
202
|
localId = props.localId,
|
|
189
203
|
isInsideOfInlineExtension = props.isInsideOfInlineExtension;
|
|
204
|
+
var providers = useContext(ProvidersContext);
|
|
205
|
+
var _useAnnotationRangeDi = useAnnotationRangeDispatch(),
|
|
206
|
+
setHoverTarget = _useAnnotationRangeDi.setHoverTarget;
|
|
207
|
+
var _useAnnotationHoverDi = useAnnotationHoverDispatch(),
|
|
208
|
+
cancelTimeout = _useAnnotationHoverDi.cancelTimeout,
|
|
209
|
+
initiateTimeout = _useAnnotationHoverDi.initiateTimeout,
|
|
210
|
+
setIsWithinRange = _useAnnotationHoverDi.setIsWithinRange;
|
|
211
|
+
var isBlockNodeSupported = providers === null || providers === void 0 || (_providers$inlineComm = providers.inlineComment) === null || _providers$inlineComm === void 0 ? void 0 : _providers$inlineComm.isBlockNodeSupported;
|
|
212
|
+
var isCommentTarget = useMemo(function () {
|
|
213
|
+
return Boolean(fg('cc_maui_annotations_on_extensions') && props.extensionNode && (isBlockNodeSupported === null || isBlockNodeSupported === void 0 ? void 0 : isBlockNodeSupported(props.extensionNode)) === true);
|
|
214
|
+
}, [props.extensionNode, isBlockNodeSupported]);
|
|
215
|
+
var isFullPageRenderer = props.rendererAppearance === 'full-page' || props.rendererAppearance === 'full-width';
|
|
216
|
+
var onMouseEnter = useCallback(function (event) {
|
|
217
|
+
cancelTimeout();
|
|
218
|
+
if (event.buttons === 0) {
|
|
219
|
+
setHoverTarget === null || setHoverTarget === void 0 || setHoverTarget(event.currentTarget);
|
|
220
|
+
setIsWithinRange(true);
|
|
221
|
+
}
|
|
222
|
+
}, [cancelTimeout, setHoverTarget, setIsWithinRange]);
|
|
223
|
+
var onMouseLeave = useCallback(function () {
|
|
224
|
+
return initiateTimeout();
|
|
225
|
+
}, [initiateTimeout]);
|
|
226
|
+
var onFocus = useCallback(function (event) {
|
|
227
|
+
if (event.currentTarget.contains(event.relatedTarget)) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
cancelTimeout();
|
|
231
|
+
setHoverTarget === null || setHoverTarget === void 0 || setHoverTarget(event.currentTarget);
|
|
232
|
+
setIsWithinRange(true);
|
|
233
|
+
}, [cancelTimeout, setHoverTarget, setIsWithinRange]);
|
|
234
|
+
var onBlur = useCallback(function (event) {
|
|
235
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
236
|
+
initiateTimeout();
|
|
237
|
+
}
|
|
238
|
+
}, [initiateTimeout]);
|
|
239
|
+
var commentTargetOptions = isCommentTarget && isFullPageRenderer ? {
|
|
240
|
+
isCommentTarget: true,
|
|
241
|
+
onBlur: onBlur,
|
|
242
|
+
onFocus: onFocus,
|
|
243
|
+
onMouseEnter: onMouseEnter,
|
|
244
|
+
onMouseLeave: onMouseLeave
|
|
245
|
+
} : {
|
|
246
|
+
isCommentTarget: isCommentTarget
|
|
247
|
+
};
|
|
248
|
+
var commentProps = {
|
|
249
|
+
enabled: isCommentTarget,
|
|
250
|
+
allowAnnotations: props.allowAnnotations && fg('cc_maui_annotations_on_extensions'),
|
|
251
|
+
allowAnnotationsDraftMode: props.allowAnnotationsDraftMode,
|
|
252
|
+
startPos: (_props$dataAttributes = props.dataAttributes) === null || _props$dataAttributes === void 0 ? void 0 : _props$dataAttributes['data-renderer-start-pos'],
|
|
253
|
+
marks: props.marks
|
|
254
|
+
};
|
|
190
255
|
return jsx(ExtensionRenderer
|
|
191
256
|
// Ignored via go/ees005
|
|
192
257
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -199,13 +264,20 @@ var Extension = function Extension(props) {
|
|
|
199
264
|
try {
|
|
200
265
|
// Return the result directly if it's a valid JSX.Element
|
|
201
266
|
if (result && /*#__PURE__*/React.isValidElement(result)) {
|
|
202
|
-
return renderExtension(
|
|
267
|
+
return renderExtension(jsx(ExtensionComments, {
|
|
268
|
+
enabled: commentProps.enabled,
|
|
269
|
+
allowAnnotations: commentProps.allowAnnotations,
|
|
270
|
+
allowAnnotationsDraftMode: commentProps.allowAnnotationsDraftMode,
|
|
271
|
+
startPos: commentProps.startPos,
|
|
272
|
+
marks: commentProps.marks
|
|
273
|
+
}, result), layout, _objectSpread({
|
|
274
|
+
dataAttributes: props.dataAttributes,
|
|
203
275
|
isTopLevel: path.length < 1,
|
|
204
276
|
handleRef: handleRef,
|
|
205
277
|
shadowClassNames: shadowClassNames,
|
|
206
278
|
tabIndex: props.tabIndex,
|
|
207
279
|
rendererAppearance: props.rendererAppearance
|
|
208
|
-
}, undefined, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, nodeHeight, localId, undefined, undefined, isInsideOfInlineExtension);
|
|
280
|
+
}, commentTargetOptions), undefined, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, nodeHeight, localId, undefined, undefined, isInsideOfInlineExtension);
|
|
209
281
|
}
|
|
210
282
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
211
283
|
} catch (e) {
|
|
@@ -217,13 +289,20 @@ var Extension = function Extension(props) {
|
|
|
217
289
|
}
|
|
218
290
|
|
|
219
291
|
// Always return default content if anything goes wrong
|
|
220
|
-
return renderExtension(
|
|
292
|
+
return renderExtension(jsx(ExtensionComments, {
|
|
293
|
+
enabled: commentProps.enabled,
|
|
294
|
+
allowAnnotations: commentProps.allowAnnotations,
|
|
295
|
+
allowAnnotationsDraftMode: commentProps.allowAnnotationsDraftMode,
|
|
296
|
+
startPos: commentProps.startPos,
|
|
297
|
+
marks: commentProps.marks
|
|
298
|
+
}, text || 'extension'), layout, _objectSpread({
|
|
299
|
+
dataAttributes: props.dataAttributes,
|
|
221
300
|
isTopLevel: path.length < 1,
|
|
222
301
|
handleRef: handleRef,
|
|
223
302
|
shadowClassNames: shadowClassNames,
|
|
224
303
|
tabIndex: props.tabIndex,
|
|
225
304
|
rendererAppearance: props.rendererAppearance
|
|
226
|
-
}, undefined, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, nodeHeight, localId, undefined, undefined, isInsideOfInlineExtension);
|
|
305
|
+
}, commentTargetOptions), undefined, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes, nodeHeight, localId, undefined, undefined, isInsideOfInlineExtension);
|
|
227
306
|
});
|
|
228
307
|
};
|
|
229
308
|
var _default_1 = overflowShadow(Extension, {
|
|
@@ -9,7 +9,7 @@ import "./layoutColumn-compiled.compiled.css";
|
|
|
9
9
|
import { ax, ix } from "@compiled/react/runtime";
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { WidthProvider } from '@atlaskit/editor-common/ui';
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
// localized styles, was from clearNextSiblingMarginTopStyle in @atlaskit/editor-common/ui
|
|
14
14
|
var clearNextSiblingMarginTopStyle = null;
|
|
15
15
|
var verticalAlignMiddleStyles = null;
|
|
@@ -30,7 +30,7 @@ export var LayoutSectionCompiled = function LayoutSectionCompiled(props) {
|
|
|
30
30
|
},
|
|
31
31
|
className: ax([props.valign === 'middle' && "_1e0c1txw _2lx21bp4 _1bah1h6o", props.valign === 'bottom' && "_1e0c1txw _2lx21bp4 _1bahesu3", "_1tihidpf _12kpidpf"])
|
|
32
32
|
}, /*#__PURE__*/React.createElement(WidthProvider, null, /*#__PURE__*/React.createElement("div", {
|
|
33
|
-
"data-layout-column-start":
|
|
33
|
+
"data-layout-column-start": "true",
|
|
34
34
|
className: ax(["_1skbgrf3", "_19segrf3 _1ki1grf3 _bmdegrf3 _166hgrf3 _7g1ogrf3 _sk2jgrf3 _hgeogrf3"])
|
|
35
35
|
}), props.children));
|
|
36
36
|
};
|
|
@@ -14,7 +14,7 @@ import React from 'react';
|
|
|
14
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- intentional: emotion fallback for compiled migration
|
|
15
15
|
import { css, jsx } from '@emotion/react';
|
|
16
16
|
import { WidthProvider } from '@atlaskit/editor-common/ui';
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
// localized styles, was from clearNextSiblingMarginTopStyle in @atlaskit/editor-common/ui
|
|
19
19
|
var clearNextSiblingMarginTopStyle = css({
|
|
20
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
@@ -61,7 +61,7 @@ export var LayoutSectionEmotion = function LayoutSectionEmotion(props) {
|
|
|
61
61
|
// Keep separate: Compiled crashes on ternary/object lookup here.
|
|
62
62
|
props.valign === 'middle' && verticalAlignMiddleStyles, props.valign === 'bottom' && verticalAlignBottomStyles, multipleWrappedImagesStyle]
|
|
63
63
|
}, jsx(WidthProvider, null, jsx("div", {
|
|
64
|
-
"data-layout-column-start":
|
|
64
|
+
"data-layout-column-start": "true",
|
|
65
65
|
css: [clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle]
|
|
66
66
|
}), props.children));
|
|
67
67
|
};
|
|
@@ -6,7 +6,6 @@ import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
|
6
6
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
7
7
|
import { WidthContext } from '@atlaskit/editor-common/ui';
|
|
8
8
|
import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth, akEditorTableCellMinWidth } from '@atlaskit/editor-shared-styles';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
9
|
import { useRendererContext } from '../../../renderer-context';
|
|
11
10
|
// we allow scaling down column widths by no more than 30%
|
|
12
11
|
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
@@ -188,7 +187,7 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
|
|
|
188
187
|
var skipMinWidth = !!(isInsideOfTable && isInsideOfSyncBlock);
|
|
189
188
|
if (!columnWidths || columnWidths.every(function (width) {
|
|
190
189
|
return width === 0;
|
|
191
|
-
})
|
|
190
|
+
})) {
|
|
192
191
|
return [];
|
|
193
192
|
}
|
|
194
193
|
var tableColumnResized = isTableColumnResized(columnWidths);
|
package/dist/esm/steps/index.js
CHANGED
|
@@ -216,11 +216,34 @@ export function resolvePos(node, offset) {
|
|
|
216
216
|
}
|
|
217
217
|
return resolvedPos + offset;
|
|
218
218
|
}
|
|
219
|
+
function getSelectedCommentTargetPosition(range) {
|
|
220
|
+
var startContainer = range.startContainer,
|
|
221
|
+
startOffset = range.startOffset,
|
|
222
|
+
endContainer = range.endContainer,
|
|
223
|
+
endOffset = range.endOffset;
|
|
224
|
+
if (startContainer !== endContainer || endOffset !== startOffset + 1) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
var selectedNode = startContainer.childNodes[startOffset];
|
|
228
|
+
if (!selectedNode || !isElementNode(selectedNode) || selectedNode.dataset.inlineCommentsTarget !== 'true' || !isPositionPointer(selectedNode)) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Subtract 1 from the renderer start position to get the position before the extension node.
|
|
233
|
+
return getStartPos(selectedNode) - 1;
|
|
234
|
+
}
|
|
219
235
|
export function getPosFromRange(range) {
|
|
220
236
|
var startContainer = range.startContainer,
|
|
221
237
|
startOffset = range.startOffset,
|
|
222
238
|
endContainer = range.endContainer,
|
|
223
239
|
endOffset = range.endOffset;
|
|
240
|
+
var selectedCommentTargetPosition = fg('cc_maui_annotations_on_extensions') && getSelectedCommentTargetPosition(range);
|
|
241
|
+
if (selectedCommentTargetPosition !== false) {
|
|
242
|
+
return {
|
|
243
|
+
from: selectedCommentTargetPosition,
|
|
244
|
+
to: selectedCommentTargetPosition
|
|
245
|
+
};
|
|
246
|
+
}
|
|
224
247
|
var possibleMediaOrMediaSingleElement = findParent(startContainer);
|
|
225
248
|
|
|
226
249
|
// Video hover targets return media single, not media, thus, the extra check in condition.
|
|
@@ -2324,7 +2324,7 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
|
|
|
2324
2324
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
2325
2325
|
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor, expandSsrMarginStyles,
|
|
2326
2326
|
// this should be placed after baseOtherStyles
|
|
2327
|
-
expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, tableContentModeScopedStyles, tableContentModeExtensionContainmentStyles, tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles,
|
|
2327
|
+
expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, tableContentModeScopedStyles, tableContentModeExtensionContainmentStyles, tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, blockSsrMarginStyles, layoutBlockSsrMarginStyles, browser.safari && codeBlockInListSsrMarginSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max') && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, contentMode === 'compact' ? scaledDenseUnicodeEmojiStylesNew : scaledUnicodeEmojiStylesNew, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2328
2328
|
"data-testid": testId
|
|
2329
2329
|
}, children);
|
|
2330
2330
|
};
|
|
@@ -62,7 +62,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
62
62
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
63
63
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
64
64
|
var packageName = "@atlaskit/renderer";
|
|
65
|
-
var packageVersion = "
|
|
65
|
+
var packageVersion = "149.0.0";
|
|
66
66
|
var setAsQueryContainerStyles = css({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
|
@@ -2,7 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
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; }
|
|
5
|
-
import React, { createContext, useCallback, useContext, useMemo, useReducer } from 'react';
|
|
5
|
+
import React, { createContext, useCallback, useContext, useMemo, useReducer, useRef } from 'react';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
7
|
|
|
7
8
|
// oxlint-disable-next-line eslint/no-redeclare
|
|
8
9
|
|
|
@@ -113,7 +114,9 @@ export var AnnotationRangeDispatchContext = /*#__PURE__*/createContext({
|
|
|
113
114
|
});
|
|
114
115
|
export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(_ref) {
|
|
115
116
|
var children = _ref.children,
|
|
116
|
-
allowCommentsOnMedia = _ref.allowCommentsOnMedia
|
|
117
|
+
allowCommentsOnMedia = _ref.allowCommentsOnMedia,
|
|
118
|
+
hasBlockNodeSupport = _ref.hasBlockNodeSupport;
|
|
119
|
+
var extensionCommentsEnabled = !!hasBlockNodeSupport && fg('cc_maui_annotations_on_extensions');
|
|
117
120
|
var _useReducer = useReducer(reducer, initialState),
|
|
118
121
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
119
122
|
_useReducer2$ = _useReducer2[0],
|
|
@@ -141,21 +144,34 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
|
|
|
141
144
|
range: range
|
|
142
145
|
});
|
|
143
146
|
}, []);
|
|
147
|
+
var hoverDraftRangeRef = useRef(hoverDraftRange);
|
|
148
|
+
hoverDraftRangeRef.current = hoverDraftRange;
|
|
144
149
|
var setHoverTarget = useCallback(function (target) {
|
|
145
|
-
|
|
146
|
-
var
|
|
147
|
-
if (
|
|
150
|
+
var draftRange = hoverDraftRangeRef.current;
|
|
151
|
+
var draftTarget = draftRange === null || draftRange === void 0 ? void 0 : draftRange.startContainer.childNodes[draftRange.startOffset];
|
|
152
|
+
if (extensionCommentsEnabled && draftTarget instanceof HTMLElement && draftTarget.matches('.ak-renderer-extension[data-inline-comments-target="true"]')) {
|
|
153
|
+
// Keep the composer callbacks bound to the chart chosen when its draft opened.
|
|
148
154
|
return;
|
|
149
155
|
}
|
|
150
|
-
//
|
|
156
|
+
// The HoverComponent expects an element deeply nested inside media or the eligible
|
|
157
|
+
// block node's wrapper. Each selector is only included when its comment type is
|
|
158
|
+
// supported, so hover targeting never activates on an ineligible block node.
|
|
159
|
+
var selectors = [allowCommentsOnMedia && '.media-card-inline-player, .media-file-card-view', extensionCommentsEnabled && '.ak-renderer-extension[data-inline-comments-target="true"]'].filter(function (selector) {
|
|
160
|
+
return Boolean(selector);
|
|
161
|
+
}).join(', ');
|
|
162
|
+
var hoverableNode = extensionCommentsEnabled && target.matches('.ak-renderer-extension[data-inline-comments-target="true"]') ? target : selectors ? target.querySelector(selectors) : null;
|
|
163
|
+
if (!hoverableNode) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- range for media/extension hover highlight
|
|
151
167
|
var range = document.createRange();
|
|
152
|
-
range.setStartBefore(
|
|
153
|
-
range.setEndAfter(
|
|
168
|
+
range.setStartBefore(hoverableNode);
|
|
169
|
+
range.setEndAfter(hoverableNode);
|
|
154
170
|
dispatch({
|
|
155
171
|
type: 'setHover',
|
|
156
172
|
range: range
|
|
157
173
|
});
|
|
158
|
-
}, []);
|
|
174
|
+
}, [allowCommentsOnMedia, extensionCommentsEnabled]);
|
|
159
175
|
var promoteSelectionToDraft = useCallback(function (position) {
|
|
160
176
|
dispatch({
|
|
161
177
|
type: 'promoteSelectionToDraft',
|
|
@@ -195,13 +211,13 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
|
|
|
195
211
|
clearSelectionRange: clearSelectionRange,
|
|
196
212
|
clearHoverRange: clearHoverRange,
|
|
197
213
|
setSelectionRange: setSelectionRange,
|
|
198
|
-
setHoverTarget:
|
|
214
|
+
setHoverTarget: allowCommentsOnMedia || extensionCommentsEnabled ? setHoverTarget : undefined,
|
|
199
215
|
promoteSelectionToDraft: promoteSelectionToDraft,
|
|
200
216
|
promoteHoverToDraft: promoteHoverToDraft,
|
|
201
217
|
clearSelectionDraft: clearSelectionDraft,
|
|
202
218
|
clearHoverDraft: clearHoverDraft
|
|
203
219
|
};
|
|
204
|
-
}, [allowCommentsOnMedia, clearSelectionRange, clearHoverRange, setSelectionRange, setHoverTarget, promoteSelectionToDraft, promoteHoverToDraft, clearSelectionDraft, clearHoverDraft]);
|
|
220
|
+
}, [allowCommentsOnMedia, extensionCommentsEnabled, clearSelectionRange, clearHoverRange, setSelectionRange, setHoverTarget, promoteSelectionToDraft, promoteHoverToDraft, clearSelectionDraft, clearHoverDraft]);
|
|
205
221
|
return /*#__PURE__*/React.createElement(AnnotationRangeStateContext.Provider, {
|
|
206
222
|
value: stateData
|
|
207
223
|
}, /*#__PURE__*/React.createElement(AnnotationRangeDispatchContext.Provider, {
|
|
@@ -211,6 +227,7 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
|
|
|
211
227
|
export var AnnotationRangeProvider = function AnnotationRangeProvider(_ref2) {
|
|
212
228
|
var children = _ref2.children,
|
|
213
229
|
allowCommentsOnMedia = _ref2.allowCommentsOnMedia,
|
|
230
|
+
hasBlockNodeSupport = _ref2.hasBlockNodeSupport,
|
|
214
231
|
isNestedRender = _ref2.isNestedRender;
|
|
215
232
|
/*
|
|
216
233
|
* If this is a nested render, we do not provide the context
|
|
@@ -218,7 +235,8 @@ export var AnnotationRangeProvider = function AnnotationRangeProvider(_ref2) {
|
|
|
218
235
|
* and we need the original context to create annotations on extensions.
|
|
219
236
|
*/
|
|
220
237
|
return isNestedRender ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : /*#__PURE__*/React.createElement(AnnotationRangeProviderInner, {
|
|
221
|
-
allowCommentsOnMedia: allowCommentsOnMedia
|
|
238
|
+
allowCommentsOnMedia: allowCommentsOnMedia,
|
|
239
|
+
hasBlockNodeSupport: hasBlockNodeSupport
|
|
222
240
|
}, children);
|
|
223
241
|
};
|
|
224
242
|
export var useAnnotationRangeState = function useAnnotationRangeState() {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* extension.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import "./extension.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
var styles = {
|
|
6
|
+
anchor: "_kqswstnw _154iidpf _1xi2idpf _94n5idpf _1ltvidpf _lcxvglyw"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/** Full-chart anchors for comment navigation, without wrapping or intercepting the iframe. */
|
|
10
|
+
export var ExtensionAnnotation = function ExtensionAnnotation(_ref) {
|
|
11
|
+
var id = _ref.id,
|
|
12
|
+
dataAttributes = _ref.dataAttributes,
|
|
13
|
+
markRef = _ref.markRef;
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
id: id,
|
|
16
|
+
ref: markRef,
|
|
17
|
+
"data-id": dataAttributes['data-id'],
|
|
18
|
+
"data-mark-type": dataAttributes['data-mark-type'],
|
|
19
|
+
"data-mark-annotation-type": dataAttributes['data-mark-annotation-type'],
|
|
20
|
+
"data-mark-annotation-state": dataAttributes['data-mark-annotation-state'],
|
|
21
|
+
"data-block-mark": dataAttributes['data-block-mark'],
|
|
22
|
+
"data-renderer-mark": dataAttributes['data-renderer-mark'],
|
|
23
|
+
"data-has-focus": dataAttributes['data-has-focus'],
|
|
24
|
+
"data-is-hovered": dataAttributes['data-is-hovered'],
|
|
25
|
+
className: ax([styles.anchor])
|
|
26
|
+
});
|
|
27
|
+
};
|
|
@@ -12,7 +12,8 @@ var MarkElement = function MarkElement(_ref) {
|
|
|
12
12
|
children = _ref.children,
|
|
13
13
|
dataAttributes = _ref.dataAttributes,
|
|
14
14
|
id = _ref.id,
|
|
15
|
-
useBlockLevel = _ref.useBlockLevel
|
|
15
|
+
useBlockLevel = _ref.useBlockLevel,
|
|
16
|
+
isExtension = _ref.isExtension;
|
|
16
17
|
var updateSubscriber = useInlineCommentSubscriberContext();
|
|
17
18
|
var states = useContext(InlineCommentsStateContext);
|
|
18
19
|
var _useHasFocusEvent = useHasFocusEvent({
|
|
@@ -90,7 +91,8 @@ var MarkElement = function MarkElement(_ref) {
|
|
|
90
91
|
hasFocus: hasFocus,
|
|
91
92
|
isHovered: isHovered,
|
|
92
93
|
state: states[id],
|
|
93
|
-
useBlockLevel: useBlockLevel
|
|
94
|
+
useBlockLevel: useBlockLevel,
|
|
95
|
+
isExtension: isExtension
|
|
94
96
|
}, children);
|
|
95
97
|
};
|
|
96
98
|
export { MarkElement };
|
|
@@ -16,6 +16,7 @@ import { AnnotationMarkStates } from '@atlaskit/adf-schema/annotation';
|
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
17
17
|
import { inlineCommentMessages } from '../../../messages';
|
|
18
18
|
import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
|
|
19
|
+
import { ExtensionAnnotation } from './extension';
|
|
19
20
|
var markStyles = css(_defineProperty({
|
|
20
21
|
color: 'inherit',
|
|
21
22
|
backgroundColor: 'unset',
|
|
@@ -120,7 +121,8 @@ export var MarkComponent = function MarkComponent(_ref) {
|
|
|
120
121
|
hasFocus = _ref.hasFocus,
|
|
121
122
|
isHovered = _ref.isHovered,
|
|
122
123
|
onClick = _ref.onClick,
|
|
123
|
-
useBlockLevel = _ref.useBlockLevel
|
|
124
|
+
useBlockLevel = _ref.useBlockLevel,
|
|
125
|
+
isExtension = _ref.isExtension;
|
|
124
126
|
var intl = useIntl();
|
|
125
127
|
var annotationIds = useMemo(function () {
|
|
126
128
|
return _toConsumableArray(new Set([].concat(_toConsumableArray(annotationParentIds), [id])));
|
|
@@ -210,6 +212,14 @@ export var MarkComponent = function MarkComponent(_ref) {
|
|
|
210
212
|
} : _objectSpread({
|
|
211
213
|
'aria-details': annotationIds.join(', ')
|
|
212
214
|
}, desktopAccessibilityAttributes);
|
|
215
|
+
if (isExtension && fg('cc_maui_annotations_on_extensions')) {
|
|
216
|
+
// The chart's badge owns interaction. Anchors only supply geometry and annotation state.
|
|
217
|
+
return jsx(ExtensionAnnotation, {
|
|
218
|
+
id: id,
|
|
219
|
+
dataAttributes: overriddenData,
|
|
220
|
+
markRef: id === currentSelectedAnnotationId ? markRef : undefined
|
|
221
|
+
});
|
|
222
|
+
}
|
|
213
223
|
return jsx(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread(_defineProperty({
|
|
214
224
|
ref: id === currentSelectedAnnotationId ? markRef : undefined,
|
|
215
225
|
id: id
|
|
@@ -29,7 +29,7 @@ export var AnnotationsPositionContext = /*#__PURE__*/React.createContext({
|
|
|
29
29
|
startPos: 1
|
|
30
30
|
});
|
|
31
31
|
export var AnnotationsWrapperInner = function AnnotationsWrapperInner(props) {
|
|
32
|
-
var _providers$inlineComm, _providers$inlineComm2;
|
|
32
|
+
var _providers$inlineComm, _providers$inlineComm2, _providers$inlineComm3;
|
|
33
33
|
var children = props.children,
|
|
34
34
|
rendererRef = props.rendererRef,
|
|
35
35
|
adfDocument = props.adfDocument,
|
|
@@ -47,6 +47,7 @@ export var AnnotationsWrapperInner = function AnnotationsWrapperInner(props) {
|
|
|
47
47
|
value: inlineCommentAnnotationsState
|
|
48
48
|
}, /*#__PURE__*/React.createElement(AnnotationRangeProvider, {
|
|
49
49
|
allowCommentsOnMedia: (_providers$inlineComm = providers === null || providers === void 0 || (_providers$inlineComm2 = providers.inlineComment) === null || _providers$inlineComm2 === void 0 ? void 0 : _providers$inlineComm2.allowCommentsOnMedia) !== null && _providers$inlineComm !== void 0 ? _providers$inlineComm : false,
|
|
50
|
+
hasBlockNodeSupport: Boolean(providers === null || providers === void 0 || (_providers$inlineComm3 = providers.inlineComment) === null || _providers$inlineComm3 === void 0 ? void 0 : _providers$inlineComm3.isBlockNodeSupported),
|
|
50
51
|
isNestedRender: isNestedRender
|
|
51
52
|
}, /*#__PURE__*/React.createElement(AnnotationHoverContext, null, /*#__PURE__*/React.createElement(AnnotationsContextWrapper, {
|
|
52
53
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
@@ -71,6 +71,19 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
71
71
|
annotate(range: Range, annotationId: string, _annotationType: 'inlineComment'): AnnotationActionResult;
|
|
72
72
|
isValidAnnotationRange(range: Range | null): boolean;
|
|
73
73
|
isRangeAnnotatable(range: Range | null): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* A range only threatens a nested renderer's own document (e.g. a bodiedExtension's macro
|
|
76
|
+
* body, which renders its own nested `<Renderer>`) when it sits inside that nested renderer's
|
|
77
|
+
* `.ak-renderer-document`. Landing directly on the extension's own outer wrapper -- with no
|
|
78
|
+
* nested document in between -- must stay annotatable so the whole chart/extension can be
|
|
79
|
+
* targeted (MAUI-1256), rather than being rejected outright the way any range touching
|
|
80
|
+
* `.ak-renderer-extension` previously was.
|
|
81
|
+
*
|
|
82
|
+
* Behind `cc_maui_annotations_on_extensions` -- the same gate MAUI-1255 added for extension
|
|
83
|
+
* node-mark support -- to preserve the previous behaviour (reject anything touching
|
|
84
|
+
* `.ak-renderer-extension`) while the feature is off.
|
|
85
|
+
*/
|
|
86
|
+
private isInsideNestedExtensionRenderer;
|
|
74
87
|
/**
|
|
75
88
|
* This is replaced by `isRangeAnnotatable`.
|
|
76
89
|
*
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { MarkProps, AnnotationMarkMeta } from '../types';
|
|
4
4
|
export declare const isAnnotationMark: (mark: Mark) => boolean;
|
|
5
|
-
declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, isMediaInline, }: MarkProps<AnnotationMarkMeta>) => React.JSX.Element;
|
|
5
|
+
declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, isExtension, isMediaInline, }: MarkProps<AnnotationMarkMeta>) => React.JSX.Element;
|
|
6
6
|
export default AnnotationComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
* @jsxFrag React.Fragment
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
type Props = React.PropsWithChildren<{
|
|
9
|
+
allowAnnotations?: boolean;
|
|
10
|
+
allowAnnotationsDraftMode?: boolean;
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
marks?: readonly Mark[];
|
|
13
|
+
startPos?: number;
|
|
14
|
+
}>;
|
|
15
|
+
/** Only node-aware provider-approved extensions receive comment visuals. */
|
|
16
|
+
export declare const ExtensionComments: (props: Props) => React.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -12,8 +12,14 @@ import type { AnalyticsEventPayload } from '../../analytics/events';
|
|
|
12
12
|
import type { RendererAppearance } from '../../ui/Renderer/types';
|
|
13
13
|
import type { RendererContext, ExtensionViewportSize } from '../types';
|
|
14
14
|
interface Props {
|
|
15
|
+
allowAnnotations?: boolean;
|
|
16
|
+
allowAnnotationsDraftMode?: boolean;
|
|
17
|
+
dataAttributes?: {
|
|
18
|
+
'data-renderer-start-pos': number;
|
|
19
|
+
};
|
|
15
20
|
extensionHandlers?: ExtensionHandlers;
|
|
16
21
|
extensionKey: string;
|
|
22
|
+
extensionNode?: PMNode;
|
|
17
23
|
extensionType: string;
|
|
18
24
|
extensionViewportSizes?: ExtensionViewportSize[];
|
|
19
25
|
/**
|
|
@@ -40,8 +46,14 @@ type AllOrNone<T> = T | {
|
|
|
40
46
|
[K in keyof T]?: never;
|
|
41
47
|
};
|
|
42
48
|
type RenderExtensionOptions = {
|
|
49
|
+
dataAttributes?: Props['dataAttributes'];
|
|
43
50
|
fireAnalyticsEvent?: (event: AnalyticsEventPayload) => void;
|
|
51
|
+
isCommentTarget?: boolean;
|
|
44
52
|
isTopLevel?: boolean;
|
|
53
|
+
onBlur?: React.FocusEventHandler<HTMLDivElement>;
|
|
54
|
+
onFocus?: React.FocusEventHandler<HTMLDivElement>;
|
|
55
|
+
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
56
|
+
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
|
45
57
|
rendererAppearance?: RendererAppearance;
|
|
46
58
|
} & AllOrNone<OverflowShadowProps>;
|
|
47
59
|
export declare const renderExtension: (content: any, layout: ExtensionLayout, options?: RenderExtensionOptions, removeOverflow?: boolean, extensionId?: string, extensionViewportSizes?: ExtensionViewportSize[], nodeHeight?: string, localId?: string, shouldDisplayExtensionAsInline?: (extensionParams?: ExtensionParams<Parameters>) => boolean, node?: ExtensionParams<Parameters>, isInsideOfInlineExtension?: boolean) => React.JSX.Element;
|
|
@@ -36,13 +36,15 @@ interface AnnotationRangeDispatchContext {
|
|
|
36
36
|
}
|
|
37
37
|
export declare const AnnotationRangeStateContext: React.Context<AnnotationRangeStateContext>;
|
|
38
38
|
export declare const AnnotationRangeDispatchContext: React.Context<AnnotationRangeDispatchContext>;
|
|
39
|
-
export declare const AnnotationRangeProviderInner: ({ children, allowCommentsOnMedia, }: {
|
|
39
|
+
export declare const AnnotationRangeProviderInner: ({ children, allowCommentsOnMedia, hasBlockNodeSupport, }: {
|
|
40
40
|
allowCommentsOnMedia?: boolean;
|
|
41
41
|
children?: ReactNode;
|
|
42
|
+
hasBlockNodeSupport?: boolean;
|
|
42
43
|
}) => React.JSX.Element;
|
|
43
|
-
export declare const AnnotationRangeProvider: ({ children, allowCommentsOnMedia, isNestedRender, }: {
|
|
44
|
+
export declare const AnnotationRangeProvider: ({ children, allowCommentsOnMedia, hasBlockNodeSupport, isNestedRender, }: {
|
|
44
45
|
allowCommentsOnMedia?: boolean;
|
|
45
46
|
children?: ReactNode;
|
|
47
|
+
hasBlockNodeSupport?: boolean;
|
|
46
48
|
isNestedRender?: boolean;
|
|
47
49
|
}) => React.JSX.Element;
|
|
48
50
|
export declare const useAnnotationRangeState: () => AnnotationRangeStateContext;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { AnnotationDataAttributes } from '@atlaskit/adf-schema/annotation';
|
|
7
|
+
/** Full-chart anchors for comment navigation, without wrapping or intercepting the iframe. */
|
|
8
|
+
export declare const ExtensionAnnotation: ({ id, dataAttributes, markRef, }: {
|
|
9
|
+
dataAttributes: AnnotationDataAttributes & {
|
|
10
|
+
'data-block-mark'?: boolean;
|
|
11
|
+
'data-has-focus'?: boolean;
|
|
12
|
+
'data-is-hovered'?: boolean;
|
|
13
|
+
'data-renderer-mark'?: boolean;
|
|
14
|
+
};
|
|
15
|
+
id: string;
|
|
16
|
+
markRef?: React.Ref<HTMLDivElement>;
|
|
17
|
+
}) => React.JSX.Element;
|
|
@@ -5,7 +5,8 @@ type MarkElementProps = React.PropsWithChildren<{
|
|
|
5
5
|
annotationType: AnnotationTypes;
|
|
6
6
|
dataAttributes: AnnotationDataAttributes;
|
|
7
7
|
id: AnnotationId;
|
|
8
|
+
isExtension?: boolean;
|
|
8
9
|
useBlockLevel?: boolean;
|
|
9
10
|
}>;
|
|
10
|
-
declare const MarkElement: ({ annotationParentIds, children, dataAttributes, id, useBlockLevel, }: MarkElementProps) => React.JSX.Element;
|
|
11
|
+
declare const MarkElement: ({ annotationParentIds, children, dataAttributes, id, useBlockLevel, isExtension, }: MarkElementProps) => React.JSX.Element;
|
|
11
12
|
export { MarkElement };
|