@atlaskit/renderer 112.7.12 → 112.7.13
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 +8 -0
- package/dist/cjs/actions/index.js +6 -0
- package/dist/cjs/actions/matches-utils.js +6 -0
- package/dist/cjs/analytics/unsupported-content.js +7 -0
- package/dist/cjs/react/index.js +61 -10
- package/dist/cjs/react/marks/alignment.js +5 -5
- package/dist/cjs/react/marks/annotation.js +8 -3
- package/dist/cjs/react/marks/breakout.js +2 -0
- package/dist/cjs/react/marks/code.js +2 -0
- package/dist/cjs/react/marks/confluence-inline-comment.js +2 -0
- package/dist/cjs/react/marks/data-consumer.js +2 -0
- package/dist/cjs/react/marks/em.js +2 -0
- package/dist/cjs/react/marks/fragment.js +2 -0
- package/dist/cjs/react/marks/index.js +3 -0
- package/dist/cjs/react/marks/link.js +2 -0
- package/dist/cjs/react/marks/strike.js +5 -8
- package/dist/cjs/react/marks/strong.js +2 -0
- package/dist/cjs/react/marks/subsup.js +5 -0
- package/dist/cjs/react/marks/underline.js +2 -0
- package/dist/cjs/react/marks/unsupportedMark.js +2 -0
- package/dist/cjs/react/marks/unsupportedNodeAttribute.js +2 -0
- package/dist/cjs/react/nodes/TableStickyScrollbar.js +17 -1
- package/dist/cjs/react/nodes/blockCard.js +6 -0
- package/dist/cjs/react/nodes/bodiedExtension.js +8 -2
- package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +7 -3
- package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +5 -1
- package/dist/cjs/react/nodes/date.js +13 -11
- package/dist/cjs/react/nodes/decisionList.js +2 -0
- package/dist/cjs/react/nodes/doc.js +5 -0
- package/dist/cjs/react/nodes/embedCard.js +42 -36
- package/dist/cjs/react/nodes/emoji.js +13 -9
- package/dist/cjs/react/nodes/extension.js +8 -2
- package/dist/cjs/react/nodes/fallback.js +6 -1
- package/dist/cjs/react/nodes/heading-anchor.js +9 -6
- package/dist/cjs/react/nodes/heading.js +16 -11
- package/dist/cjs/react/nodes/index.js +12 -1
- package/dist/cjs/react/nodes/inline.js +2 -0
- package/dist/cjs/react/nodes/inlineCard.js +8 -0
- package/dist/cjs/react/nodes/inlineExtension.js +20 -15
- package/dist/cjs/react/nodes/media/index.js +17 -1
- package/dist/cjs/react/nodes/mediaGroup.js +21 -7
- package/dist/cjs/react/nodes/mediaInline.js +2 -0
- package/dist/cjs/react/nodes/mediaSingle/index.js +21 -0
- package/dist/cjs/react/nodes/mention.js +13 -8
- package/dist/cjs/react/nodes/multiBodiedExtension.js +10 -2
- package/dist/cjs/react/nodes/orderedList.js +2 -0
- package/dist/cjs/react/nodes/panel.js +3 -1
- package/dist/cjs/react/nodes/paragraph.js +2 -0
- package/dist/cjs/react/nodes/status.js +16 -11
- package/dist/cjs/react/nodes/table/colgroup.js +6 -2
- package/dist/cjs/react/nodes/table/sticky.js +13 -0
- package/dist/cjs/react/nodes/table.js +31 -2
- package/dist/cjs/react/nodes/tableCell.js +18 -1
- package/dist/cjs/react/nodes/tableRow.js +2 -0
- package/dist/cjs/react/nodes/task-item-with-providers.js +3 -0
- package/dist/cjs/react/nodes/taskItem.js +4 -0
- package/dist/cjs/react/nodes/taskList.js +2 -0
- package/dist/cjs/react/utils/render-text-segments.js +2 -0
- package/dist/cjs/react/utils/segment-text.js +4 -1
- package/dist/cjs/react/utils/use-select-all-trap.js +11 -0
- package/dist/cjs/render-document.js +11 -2
- package/dist/cjs/steps/index.js +6 -1
- package/dist/cjs/text/index.js +3 -0
- package/dist/cjs/ui/Expand.js +7 -3
- package/dist/cjs/ui/ExtensionRenderer.js +3 -0
- package/dist/cjs/ui/MediaCard.js +34 -19
- package/dist/cjs/ui/Renderer/ErrorBoundary.js +4 -0
- package/dist/cjs/ui/Renderer/breakout-ssr.js +28 -2
- package/dist/cjs/ui/Renderer/count-nodes.js +2 -0
- package/dist/cjs/ui/Renderer/index.js +68 -7
- package/dist/cjs/ui/Renderer/style.js +12 -7
- package/dist/cjs/ui/Renderer/truncated-wrapper.js +3 -0
- package/dist/cjs/ui/SmartCardStorage.js +6 -1
- package/dist/cjs/ui/annotations/context.js +3 -0
- package/dist/cjs/ui/annotations/draft/component.js +24 -12
- package/dist/cjs/ui/annotations/element/mark.js +5 -0
- package/dist/cjs/ui/annotations/element/useInlineAnnotationProps.js +7 -1
- package/dist/cjs/ui/annotations/hooks/user-selection.js +9 -1
- package/dist/cjs/ui/annotations/hover/mounter.js +4 -1
- package/dist/cjs/ui/annotations/selection/mounter.js +4 -1
- package/dist/cjs/ui/annotations/wrapper.js +8 -2
- package/dist/cjs/utils.js +9 -1
- package/dist/es2019/actions/index.js +6 -0
- package/dist/es2019/actions/matches-utils.js +6 -0
- package/dist/es2019/analytics/unsupported-content.js +8 -0
- package/dist/es2019/react/index.js +67 -10
- package/dist/es2019/react/marks/alignment.js +5 -5
- package/dist/es2019/react/marks/annotation.js +8 -3
- package/dist/es2019/react/marks/breakout.js +2 -0
- package/dist/es2019/react/marks/code.js +2 -0
- package/dist/es2019/react/marks/confluence-inline-comment.js +2 -0
- package/dist/es2019/react/marks/data-consumer.js +2 -0
- package/dist/es2019/react/marks/em.js +2 -0
- package/dist/es2019/react/marks/fragment.js +2 -0
- package/dist/es2019/react/marks/index.js +3 -0
- package/dist/es2019/react/marks/link.js +2 -0
- package/dist/es2019/react/marks/strike.js +5 -8
- package/dist/es2019/react/marks/strong.js +2 -0
- package/dist/es2019/react/marks/subsup.js +5 -0
- package/dist/es2019/react/marks/underline.js +2 -0
- package/dist/es2019/react/marks/unsupportedMark.js +2 -0
- package/dist/es2019/react/marks/unsupportedNodeAttribute.js +2 -0
- package/dist/es2019/react/nodes/TableStickyScrollbar.js +16 -1
- package/dist/es2019/react/nodes/blockCard.js +6 -0
- package/dist/es2019/react/nodes/bodiedExtension.js +8 -2
- package/dist/es2019/react/nodes/codeBlock/components/lightWeightCodeBlock.js +4 -1
- package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +4 -1
- package/dist/es2019/react/nodes/date.js +13 -11
- package/dist/es2019/react/nodes/decisionList.js +2 -0
- package/dist/es2019/react/nodes/doc.js +6 -0
- package/dist/es2019/react/nodes/embedCard.js +42 -36
- package/dist/es2019/react/nodes/emoji.js +13 -9
- package/dist/es2019/react/nodes/extension.js +8 -2
- package/dist/es2019/react/nodes/fallback.js +6 -1
- package/dist/es2019/react/nodes/heading-anchor.js +10 -6
- package/dist/es2019/react/nodes/heading.js +16 -11
- package/dist/es2019/react/nodes/index.js +13 -1
- package/dist/es2019/react/nodes/inline.js +3 -0
- package/dist/es2019/react/nodes/inlineCard.js +8 -0
- package/dist/es2019/react/nodes/inlineExtension.js +21 -16
- package/dist/es2019/react/nodes/media/index.js +17 -1
- package/dist/es2019/react/nodes/mediaGroup.js +14 -1
- package/dist/es2019/react/nodes/mediaInline.js +2 -0
- package/dist/es2019/react/nodes/mediaSingle/index.js +21 -0
- package/dist/es2019/react/nodes/mention.js +13 -8
- package/dist/es2019/react/nodes/multiBodiedExtension.js +10 -2
- package/dist/es2019/react/nodes/orderedList.js +2 -0
- package/dist/es2019/react/nodes/panel.js +3 -1
- package/dist/es2019/react/nodes/paragraph.js +2 -0
- package/dist/es2019/react/nodes/status.js +16 -11
- package/dist/es2019/react/nodes/table/colgroup.js +6 -2
- package/dist/es2019/react/nodes/table/sticky.js +13 -0
- package/dist/es2019/react/nodes/table.js +32 -3
- package/dist/es2019/react/nodes/tableCell.js +18 -1
- package/dist/es2019/react/nodes/tableRow.js +2 -0
- package/dist/es2019/react/nodes/task-item-with-providers.js +3 -0
- package/dist/es2019/react/nodes/taskItem.js +4 -0
- package/dist/es2019/react/nodes/taskList.js +2 -0
- package/dist/es2019/react/utils/render-text-segments.js +2 -0
- package/dist/es2019/react/utils/segment-text.js +4 -1
- package/dist/es2019/react/utils/use-select-all-trap.js +11 -0
- package/dist/es2019/render-document.js +11 -2
- package/dist/es2019/steps/index.js +6 -1
- package/dist/es2019/text/index.js +3 -0
- package/dist/es2019/ui/Expand.js +7 -3
- package/dist/es2019/ui/ExtensionRenderer.js +3 -0
- package/dist/es2019/ui/MediaCard.js +34 -19
- package/dist/es2019/ui/Renderer/ErrorBoundary.js +4 -0
- package/dist/es2019/ui/Renderer/breakout-ssr.js +28 -2
- package/dist/es2019/ui/Renderer/count-nodes.js +3 -0
- package/dist/es2019/ui/Renderer/index.js +68 -7
- package/dist/es2019/ui/Renderer/style.js +47 -37
- package/dist/es2019/ui/Renderer/truncated-wrapper.js +3 -0
- package/dist/es2019/ui/SmartCardStorage.js +6 -1
- package/dist/es2019/ui/annotations/context.js +3 -0
- package/dist/es2019/ui/annotations/draft/component.js +24 -12
- package/dist/es2019/ui/annotations/element/mark.js +5 -0
- package/dist/es2019/ui/annotations/element/useInlineAnnotationProps.js +7 -1
- package/dist/es2019/ui/annotations/hooks/user-selection.js +9 -1
- package/dist/es2019/ui/annotations/hover/mounter.js +4 -1
- package/dist/es2019/ui/annotations/selection/mounter.js +4 -1
- package/dist/es2019/ui/annotations/wrapper.js +8 -2
- package/dist/es2019/utils.js +12 -1
- package/dist/esm/actions/index.js +6 -0
- package/dist/esm/actions/matches-utils.js +6 -0
- package/dist/esm/analytics/unsupported-content.js +8 -0
- package/dist/esm/react/index.js +61 -10
- package/dist/esm/react/marks/alignment.js +5 -5
- package/dist/esm/react/marks/annotation.js +8 -3
- package/dist/esm/react/marks/breakout.js +2 -0
- package/dist/esm/react/marks/code.js +2 -0
- package/dist/esm/react/marks/confluence-inline-comment.js +2 -0
- package/dist/esm/react/marks/data-consumer.js +2 -0
- package/dist/esm/react/marks/em.js +2 -0
- package/dist/esm/react/marks/fragment.js +2 -0
- package/dist/esm/react/marks/index.js +3 -0
- package/dist/esm/react/marks/link.js +2 -0
- package/dist/esm/react/marks/strike.js +5 -8
- package/dist/esm/react/marks/strong.js +2 -0
- package/dist/esm/react/marks/subsup.js +5 -0
- package/dist/esm/react/marks/underline.js +2 -0
- package/dist/esm/react/marks/unsupportedMark.js +2 -0
- package/dist/esm/react/marks/unsupportedNodeAttribute.js +2 -0
- package/dist/esm/react/nodes/TableStickyScrollbar.js +17 -1
- package/dist/esm/react/nodes/blockCard.js +6 -0
- package/dist/esm/react/nodes/bodiedExtension.js +8 -2
- package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +7 -3
- package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +5 -1
- package/dist/esm/react/nodes/date.js +13 -11
- package/dist/esm/react/nodes/decisionList.js +2 -0
- package/dist/esm/react/nodes/doc.js +6 -0
- package/dist/esm/react/nodes/embedCard.js +42 -36
- package/dist/esm/react/nodes/emoji.js +13 -9
- package/dist/esm/react/nodes/extension.js +8 -2
- package/dist/esm/react/nodes/fallback.js +6 -1
- package/dist/esm/react/nodes/heading-anchor.js +9 -6
- package/dist/esm/react/nodes/heading.js +16 -11
- package/dist/esm/react/nodes/index.js +13 -1
- package/dist/esm/react/nodes/inline.js +3 -0
- package/dist/esm/react/nodes/inlineCard.js +8 -0
- package/dist/esm/react/nodes/inlineExtension.js +20 -15
- package/dist/esm/react/nodes/media/index.js +17 -1
- package/dist/esm/react/nodes/mediaGroup.js +21 -7
- package/dist/esm/react/nodes/mediaInline.js +2 -0
- package/dist/esm/react/nodes/mediaSingle/index.js +21 -0
- package/dist/esm/react/nodes/mention.js +13 -8
- package/dist/esm/react/nodes/multiBodiedExtension.js +10 -2
- package/dist/esm/react/nodes/orderedList.js +2 -0
- package/dist/esm/react/nodes/panel.js +3 -1
- package/dist/esm/react/nodes/paragraph.js +2 -0
- package/dist/esm/react/nodes/status.js +16 -11
- package/dist/esm/react/nodes/table/colgroup.js +6 -2
- package/dist/esm/react/nodes/table/sticky.js +13 -0
- package/dist/esm/react/nodes/table.js +31 -2
- package/dist/esm/react/nodes/tableCell.js +18 -1
- package/dist/esm/react/nodes/tableRow.js +2 -0
- package/dist/esm/react/nodes/task-item-with-providers.js +3 -0
- package/dist/esm/react/nodes/taskItem.js +4 -0
- package/dist/esm/react/nodes/taskList.js +2 -0
- package/dist/esm/react/utils/render-text-segments.js +2 -0
- package/dist/esm/react/utils/segment-text.js +4 -1
- package/dist/esm/react/utils/use-select-all-trap.js +11 -0
- package/dist/esm/render-document.js +11 -2
- package/dist/esm/steps/index.js +6 -1
- package/dist/esm/text/index.js +3 -0
- package/dist/esm/ui/Expand.js +7 -3
- package/dist/esm/ui/ExtensionRenderer.js +3 -0
- package/dist/esm/ui/MediaCard.js +34 -19
- package/dist/esm/ui/Renderer/ErrorBoundary.js +4 -0
- package/dist/esm/ui/Renderer/breakout-ssr.js +28 -2
- package/dist/esm/ui/Renderer/count-nodes.js +3 -0
- package/dist/esm/ui/Renderer/index.js +68 -7
- package/dist/esm/ui/Renderer/style.js +12 -7
- package/dist/esm/ui/Renderer/truncated-wrapper.js +3 -0
- package/dist/esm/ui/SmartCardStorage.js +6 -1
- package/dist/esm/ui/annotations/context.js +3 -0
- package/dist/esm/ui/annotations/draft/component.js +24 -12
- package/dist/esm/ui/annotations/element/mark.js +5 -0
- package/dist/esm/ui/annotations/element/useInlineAnnotationProps.js +7 -1
- package/dist/esm/ui/annotations/hooks/user-selection.js +9 -1
- package/dist/esm/ui/annotations/hover/mounter.js +4 -1
- package/dist/esm/ui/annotations/selection/mounter.js +4 -1
- package/dist/esm/ui/annotations/wrapper.js +8 -2
- package/dist/esm/utils.js +10 -1
- package/dist/types/analytics/events.d.ts +1 -2
- package/dist/types/react/marks/confluence-inline-comment.d.ts +1 -1
- package/dist/types/react/nodes/decisionList.d.ts +1 -1
- package/dist/types/react/nodes/index.d.ts +1 -1
- package/dist/types/react/nodes/taskItem.d.ts +1 -1
- package/dist/types/react/nodes/taskList.d.ts +1 -1
- package/dist/types/react/types.d.ts +2 -2
- package/dist/types/utils.d.ts +1 -2
- package/dist/types-ts4.5/analytics/events.d.ts +1 -2
- package/dist/types-ts4.5/react/marks/confluence-inline-comment.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/decisionList.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/index.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/taskItem.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/taskList.d.ts +1 -1
- package/dist/types-ts4.5/react/types.d.ts +2 -2
- package/dist/types-ts4.5/utils.d.ts +1 -2
- package/docs/0-intro.tsx +14 -1
- package/package.json +1 -1
- package/tsconfig.json +0 -1
|
@@ -47,6 +47,9 @@ export const breakoutInlineScriptContext = `
|
|
|
47
47
|
breakoutConsts.calcWideWidth = ${breakoutConsts.calcWideWidth.toString()};
|
|
48
48
|
breakoutConsts.FullPagePadding = ${FullPagePadding.toString()};
|
|
49
49
|
`;
|
|
50
|
+
|
|
51
|
+
// Ignored via go/ees005
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
53
|
function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
|
|
51
54
|
const MEDIA_NODE_TYPE = 'mediaSingle';
|
|
52
55
|
const WIDE_LAYOUT_MODES = ['full-width', 'wide', 'custom'];
|
|
@@ -73,6 +76,9 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
|
|
|
73
76
|
if (item.target.nodeType !== Node.ELEMENT_NODE) {
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
79
|
+
|
|
80
|
+
// Ignored via go/ees005
|
|
81
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
76
82
|
if (item.target.classList.contains('ak-renderer-document')) {
|
|
77
83
|
item.addedNodes.forEach(maybeNode => {
|
|
78
84
|
// maybeNode may contain comments which doesn't have a dataset property
|
|
@@ -80,6 +86,8 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
|
|
|
80
86
|
return;
|
|
81
87
|
}
|
|
82
88
|
let width;
|
|
89
|
+
// Ignored via go/ees005
|
|
90
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
83
91
|
const node = maybeNode;
|
|
84
92
|
const mode = node.dataset.mode || node.dataset.layout || '';
|
|
85
93
|
const resizedBreakout = node.dataset.hasWidth === 'true';
|
|
@@ -90,12 +98,19 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
|
|
|
90
98
|
// When flag is on we are using CSS to calculate the table width thus don't need logic below to set the width and left.
|
|
91
99
|
if (!shouldFixTableResizing) {
|
|
92
100
|
if (node.classList.contains('pm-table-container') && mode === 'custom') {
|
|
101
|
+
// Ignored via go/ees005
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
93
103
|
const rendererWidth = renderer.offsetWidth;
|
|
94
104
|
const effectiveWidth = rendererWidth - breakoutConsts.padding;
|
|
95
105
|
width = `${Math.min(parseInt(node.style.width), effectiveWidth)}px`;
|
|
96
106
|
} else if (resizedBreakout) {
|
|
97
|
-
width = breakoutConsts.calcBreakoutWithCustomWidth(mode, node.dataset.width || null,
|
|
107
|
+
width = breakoutConsts.calcBreakoutWithCustomWidth(mode, node.dataset.width || null,
|
|
108
|
+
// Ignored via go/ees005
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
110
|
+
renderer.offsetWidth);
|
|
98
111
|
} else {
|
|
112
|
+
// Ignored via go/ees005
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
99
114
|
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
100
115
|
}
|
|
101
116
|
if (node.style.width === width) {
|
|
@@ -106,7 +121,10 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
|
|
|
106
121
|
// Tables require some special logic, as they are not using common css transform approach,
|
|
107
122
|
// because it breaks with sticky headers. This logic is copied from a table node:
|
|
108
123
|
// https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
|
|
109
|
-
if (node.classList.contains('pm-table-container') &&
|
|
124
|
+
if (node.classList.contains('pm-table-container') &&
|
|
125
|
+
// Ignored via go/ees005
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
127
|
+
!renderer.classList.contains('is-full-width')) {
|
|
110
128
|
const lineLength = breakoutConsts.calcLineLength();
|
|
111
129
|
const left = lineLength / 2 - parseInt(width) / 2;
|
|
112
130
|
if (left < 0 && parseInt(width) > lineLength) {
|
|
@@ -125,7 +143,11 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
|
|
|
125
143
|
* So nested media elements which are not immediately loaded as sub children are not available in the above conditional.
|
|
126
144
|
* Thus adding this conditional to deal with all media elements directly.
|
|
127
145
|
*/
|
|
146
|
+
// Ignored via go/ees005
|
|
147
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
128
148
|
item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
|
|
149
|
+
// Ignored via go/ees005
|
|
150
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
129
151
|
applyMediaBreakout(item.target);
|
|
130
152
|
}
|
|
131
153
|
});
|
|
@@ -170,8 +192,12 @@ function applyBreakoutAfterSSR(id, breakoutConsts, shouldFixTableResizing) {
|
|
|
170
192
|
*/
|
|
171
193
|
const disconnect = () => {
|
|
172
194
|
observer.disconnect();
|
|
195
|
+
// Ignored via go/ees005
|
|
196
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
173
197
|
window.removeEventListener('load', disconnect);
|
|
174
198
|
};
|
|
199
|
+
// Ignored via go/ees005
|
|
200
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
175
201
|
window.addEventListener('load', disconnect);
|
|
176
202
|
}
|
|
177
203
|
export const calcLineLength = breakoutConsts.calcLineLength;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { reduce } from '@atlaskit/adf-utils/traverse';
|
|
2
|
+
|
|
3
|
+
// Ignored via go/ees005
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
5
|
export function countNodes(adfDocument) {
|
|
3
6
|
return reduce(adfDocument, (acc, node) => {
|
|
4
7
|
acc[node.type] = (acc[node.type] || 0) + 1;
|
|
@@ -45,7 +45,7 @@ import { TruncatedWrapper } from './truncated-wrapper';
|
|
|
45
45
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
46
46
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
47
47
|
const packageName = "@atlaskit/renderer";
|
|
48
|
-
const packageVersion = "112.7.
|
|
48
|
+
const packageVersion = "112.7.13";
|
|
49
49
|
const setAsQueryContainerStyles = css({
|
|
50
50
|
containerName: 'ak-renderer-wrapper',
|
|
51
51
|
containerType: 'inline-size',
|
|
@@ -118,13 +118,19 @@ export class __RendererClassComponent extends PureComponent {
|
|
|
118
118
|
if (!rangeSelection) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
+
// Ignored via go/ees005
|
|
122
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
121
123
|
const target = event.target;
|
|
122
124
|
const tableCell = target.closest('td,th');
|
|
123
125
|
const clickedInCell = Boolean(tableCell);
|
|
124
126
|
if (!clickedInCell) {
|
|
125
127
|
return;
|
|
126
128
|
}
|
|
129
|
+
// Ignored via go/ees005
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
127
131
|
const anchorInCell = tableCell.contains(anchorNode);
|
|
132
|
+
// Ignored via go/ees005
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
128
134
|
const focusInCell = tableCell.contains(focusNode);
|
|
129
135
|
const selectionStartsOrEndsOutsideClickedCell = !(anchorInCell && focusInCell);
|
|
130
136
|
if (!selectionStartsOrEndsOutsideClickedCell) {
|
|
@@ -135,7 +141,11 @@ export class __RendererClassComponent extends PureComponent {
|
|
|
135
141
|
// cell, we select the cell's contents instead). We want to select the nearest
|
|
136
142
|
// parent block, so that a whole line of text/content is selected (rather than
|
|
137
143
|
// selecting a span that would select one specific chunk of text).
|
|
138
|
-
const elementToSelect = anchorInCell ?
|
|
144
|
+
const elementToSelect = anchorInCell ? // Ignored via go/ees005
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
146
|
+
(_parentElement = anchorNode.parentElement) === null || _parentElement === void 0 ? void 0 : _parentElement.closest('div,p') : focusInCell ? // Ignored via go/ees005
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
148
|
+
(_parentElement2 = focusNode.parentElement) === null || _parentElement2 === void 0 ? void 0 : _parentElement2.closest('div,p') : tableCell;
|
|
139
149
|
if (elementToSelect) {
|
|
140
150
|
selection.selectAllChildren(elementToSelect);
|
|
141
151
|
}
|
|
@@ -197,7 +207,10 @@ export class __RendererClassComponent extends PureComponent {
|
|
|
197
207
|
attributes: {
|
|
198
208
|
platform: PLATFORM.WEB,
|
|
199
209
|
duration,
|
|
200
|
-
distortedDuration:
|
|
210
|
+
distortedDuration:
|
|
211
|
+
// Ignored via go/ees005
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
213
|
+
this.renderedMeasurementDistortedDurationMonitor.distortedDuration,
|
|
201
214
|
ttfb: getResponseEndTime(),
|
|
202
215
|
nodes: countNodes(this.props.document),
|
|
203
216
|
severity
|
|
@@ -205,12 +218,18 @@ export class __RendererClassComponent extends PureComponent {
|
|
|
205
218
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
206
219
|
});
|
|
207
220
|
}
|
|
221
|
+
|
|
222
|
+
// Ignored via go/ees005
|
|
223
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
208
224
|
this.renderedMeasurementDistortedDurationMonitor.cleanup();
|
|
209
225
|
delete this.renderedMeasurementDistortedDurationMonitor;
|
|
210
226
|
});
|
|
211
227
|
this.anchorLinkAnalytics();
|
|
212
228
|
});
|
|
213
229
|
}
|
|
230
|
+
|
|
231
|
+
// Ignored via go/ees005
|
|
232
|
+
// eslint-disable-next-line react/no-unsafe
|
|
214
233
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
215
234
|
const nextMedia = nextProps.media || {};
|
|
216
235
|
const media = this.props.media || {};
|
|
@@ -299,6 +318,8 @@ export class __RendererClassComponent extends PureComponent {
|
|
|
299
318
|
*/
|
|
300
319
|
const handleWrapperOnClick = event => {
|
|
301
320
|
var _this$props$eventHand;
|
|
321
|
+
// Ignored via go/ees005
|
|
322
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
302
323
|
const targetElement = event.target;
|
|
303
324
|
|
|
304
325
|
// ED-14862: When a user triple clicks to select a line of content inside a
|
|
@@ -312,6 +333,9 @@ export class __RendererClassComponent extends PureComponent {
|
|
|
312
333
|
if (!(targetElement instanceof window.Element)) {
|
|
313
334
|
return;
|
|
314
335
|
}
|
|
336
|
+
|
|
337
|
+
// Ignored via go/ees005
|
|
338
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
315
339
|
const rendererWrapper = event.currentTarget;
|
|
316
340
|
|
|
317
341
|
// Check if the click was on an interactive element
|
|
@@ -442,13 +466,19 @@ const handleMouseTripleClickInTables = event => {
|
|
|
442
466
|
if (!rangeSelection) {
|
|
443
467
|
return;
|
|
444
468
|
}
|
|
469
|
+
// Ignored via go/ees005
|
|
470
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
445
471
|
const target = event.target;
|
|
446
472
|
const tableCell = target.closest('td,th');
|
|
447
473
|
const clickedInCell = Boolean(tableCell);
|
|
448
474
|
if (!clickedInCell) {
|
|
449
475
|
return;
|
|
450
476
|
}
|
|
477
|
+
// Ignored via go/ees005
|
|
478
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
451
479
|
const anchorInCell = tableCell.contains(anchorNode);
|
|
480
|
+
// Ignored via go/ees005
|
|
481
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
452
482
|
const focusInCell = tableCell.contains(focusNode);
|
|
453
483
|
const selectionStartsOrEndsOutsideClickedCell = !(anchorInCell && focusInCell);
|
|
454
484
|
if (!selectionStartsOrEndsOutsideClickedCell) {
|
|
@@ -463,7 +493,11 @@ const handleMouseTripleClickInTables = event => {
|
|
|
463
493
|
// selection isn't reported; if not in `onMouseDown`, a click outside the selection will
|
|
464
494
|
// return an empty selection, which will erroneously fire onUnhandledClick.
|
|
465
495
|
|
|
466
|
-
const elementToSelect = anchorInCell ?
|
|
496
|
+
const elementToSelect = anchorInCell ? // Ignored via go/ees005
|
|
497
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
498
|
+
(_parentElement3 = anchorNode.parentElement) === null || _parentElement3 === void 0 ? void 0 : _parentElement3.closest('div,p') : focusInCell ? // Ignored via go/ees005
|
|
499
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
500
|
+
(_parentElement4 = focusNode.parentElement) === null || _parentElement4 === void 0 ? void 0 : _parentElement4.closest('div,p') : tableCell;
|
|
467
501
|
if (elementToSelect) {
|
|
468
502
|
selection.selectAllChildren(elementToSelect);
|
|
469
503
|
}
|
|
@@ -477,6 +511,8 @@ const handleMouseTripleClickInTables = event => {
|
|
|
477
511
|
*/
|
|
478
512
|
const handleWrapperOnClick = (event, props, mouseDownSelection) => {
|
|
479
513
|
var _props$eventHandlers;
|
|
514
|
+
// Ignored via go/ees005
|
|
515
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
480
516
|
const targetElement = event.target;
|
|
481
517
|
handleMouseTripleClickInTables(event);
|
|
482
518
|
|
|
@@ -490,6 +526,9 @@ const handleWrapperOnClick = (event, props, mouseDownSelection) => {
|
|
|
490
526
|
if (!(targetElement instanceof window.Element)) {
|
|
491
527
|
return;
|
|
492
528
|
}
|
|
529
|
+
|
|
530
|
+
// Ignored via go/ees005
|
|
531
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
493
532
|
const rendererWrapper = event.currentTarget;
|
|
494
533
|
const isInteractiveElementInTree = findInTree(targetElement, rendererWrapper, isInteractiveElement);
|
|
495
534
|
if (isInteractiveElementInTree) {
|
|
@@ -660,6 +699,8 @@ const RendererFunctionalComponent = props => {
|
|
|
660
699
|
attributes: {
|
|
661
700
|
platform: PLATFORM.WEB,
|
|
662
701
|
duration,
|
|
702
|
+
// Ignored via go/ees005
|
|
703
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
663
704
|
distortedDuration: renderedMeasurementDistortedDurationMonitor.distortedDuration,
|
|
664
705
|
ttfb: getResponseEndTime(),
|
|
665
706
|
nodes: countNodes(props.document),
|
|
@@ -668,6 +709,9 @@ const RendererFunctionalComponent = props => {
|
|
|
668
709
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
669
710
|
});
|
|
670
711
|
}
|
|
712
|
+
|
|
713
|
+
// Ignored via go/ees005
|
|
714
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
671
715
|
renderedMeasurementDistortedDurationMonitor.cleanup();
|
|
672
716
|
});
|
|
673
717
|
anchorLinkAnalytics();
|
|
@@ -761,12 +805,18 @@ export function Renderer(props) {
|
|
|
761
805
|
const {
|
|
762
806
|
isTopLevelRenderer
|
|
763
807
|
} = useRendererContext();
|
|
764
|
-
return fg('platform_editor_react18_renderer') ? jsx(RendererFunctionalComponent
|
|
808
|
+
return fg('platform_editor_react18_renderer') ? jsx(RendererFunctionalComponent
|
|
809
|
+
// Ignored via go/ees005
|
|
810
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
811
|
+
, _extends({}, props, {
|
|
765
812
|
startPos: startPos,
|
|
766
813
|
isTopLevelRenderer: isTopLevelRenderer
|
|
767
814
|
})) :
|
|
768
815
|
// eslint-disable-next-line react/jsx-pascal-case
|
|
769
|
-
jsx(__RendererClassComponent
|
|
816
|
+
jsx(__RendererClassComponent
|
|
817
|
+
// Ignored via go/ees005
|
|
818
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
819
|
+
, _extends({}, props, {
|
|
770
820
|
startPos: startPos,
|
|
771
821
|
isTopLevelRenderer: isTopLevelRenderer
|
|
772
822
|
}));
|
|
@@ -791,7 +841,10 @@ export const RendererWithAnalytics = /*#__PURE__*/React.memo(props => jsx(Fabric
|
|
|
791
841
|
rethrowError: true,
|
|
792
842
|
fallbackComponent: null,
|
|
793
843
|
createAnalyticsEvent: createAnalyticsEvent
|
|
794
|
-
}, jsx(IntlErrorBoundary, null, jsx(Renderer
|
|
844
|
+
}, jsx(IntlErrorBoundary, null, jsx(Renderer
|
|
845
|
+
// Ignored via go/ees005
|
|
846
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
847
|
+
, _extends({}, props, {
|
|
795
848
|
createAnalyticsEvent: createAnalyticsEvent
|
|
796
849
|
}))));
|
|
797
850
|
}
|
|
@@ -823,6 +876,8 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
|
|
|
823
876
|
// We must check if window is defined, if it isn't we are in a SSR environment
|
|
824
877
|
// and we don't want to add the telepointer
|
|
825
878
|
if (typeof window !== 'undefined' && addTelepointer && innerRef !== null && innerRef !== void 0 && innerRef.current) {
|
|
879
|
+
// Ignored via go/ees005
|
|
880
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
826
881
|
const renderer = innerRef.current.querySelector('.ak-renderer-document');
|
|
827
882
|
if (initialUpdate.current) {
|
|
828
883
|
const lastChild = renderer.lastChild;
|
|
@@ -846,6 +901,8 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
|
|
|
846
901
|
if (oldTelepointer) {
|
|
847
902
|
oldTelepointer.remove();
|
|
848
903
|
}
|
|
904
|
+
// Ignored via go/ees005
|
|
905
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
849
906
|
parentNode.appendChild(createTelepointer());
|
|
850
907
|
}
|
|
851
908
|
}
|
|
@@ -956,6 +1013,8 @@ const RendererWithAnnotationSelection = props => {
|
|
|
956
1013
|
const localRef = React.useRef(null);
|
|
957
1014
|
const innerRef = props.innerRef || localRef;
|
|
958
1015
|
if (!allowAnnotations) {
|
|
1016
|
+
// Ignored via go/ees005
|
|
1017
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
959
1018
|
return jsx(RendererWithAnalytics, _extends({
|
|
960
1019
|
innerRef: innerRef
|
|
961
1020
|
}, props));
|
|
@@ -967,6 +1026,8 @@ const RendererWithAnnotationSelection = props => {
|
|
|
967
1026
|
isNestedRender: true
|
|
968
1027
|
}, jsx(RendererWithAnalytics, _extends({
|
|
969
1028
|
innerRef: innerRef
|
|
1029
|
+
// Ignored via go/ees005
|
|
1030
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
970
1031
|
}, props, {
|
|
971
1032
|
featureFlags: props.featureFlags
|
|
972
1033
|
}))));
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
8
|
+
// Ignored via go/ees005
|
|
9
|
+
// eslint-disable-next-line import/no-namespace
|
|
8
10
|
import * as colors from '@atlaskit/theme/colors';
|
|
9
11
|
import { N60A, Y300, Y75, N40A } from '@atlaskit/theme/colors';
|
|
10
12
|
import { headingSizes as headingSizesImport } from '@atlaskit/theme/typography';
|
|
@@ -254,62 +256,67 @@ const tableSortableColumnStyle = ({
|
|
|
254
256
|
${headingsCss}
|
|
255
257
|
}
|
|
256
258
|
|
|
257
|
-
${fg('platform_editor_nested_tables_renderer_styles') ? `
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
263
|
-
opacity: 1;
|
|
264
|
-
transition: opacity 0.2s ease-in-out;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
259
|
+
${fg('platform_editor_nested_tables_renderer_styles') ? css`
|
|
260
|
+
// New styles
|
|
261
|
+
> .${RendererCssClassName.SORTABLE_COLUMN}
|
|
262
|
+
> .${RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER} {
|
|
263
|
+
margin: 0;
|
|
267
264
|
|
|
268
|
-
|
|
269
|
-
> .${RendererCssClassName.SORTABLE_COLUMN_NO_ORDER} {
|
|
270
|
-
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
271
|
-
opacity: 0;
|
|
272
|
-
&:focus {
|
|
265
|
+
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
273
266
|
opacity: 1;
|
|
267
|
+
transition: opacity 0.2s ease-in-out;
|
|
274
268
|
}
|
|
275
269
|
}
|
|
276
|
-
}
|
|
277
270
|
|
|
278
|
-
&:hover:not(:has(.${RendererCssClassName.SORTABLE_COLUMN_WRAPPER} .${RendererCssClassName.SORTABLE_COLUMN}:hover))
|
|
279
271
|
> .${RendererCssClassName.SORTABLE_COLUMN}
|
|
280
272
|
> .${RendererCssClassName.SORTABLE_COLUMN_NO_ORDER} {
|
|
281
273
|
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
282
|
-
opacity:
|
|
274
|
+
opacity: 0;
|
|
275
|
+
&:focus {
|
|
276
|
+
opacity: 1;
|
|
277
|
+
}
|
|
283
278
|
}
|
|
284
279
|
}
|
|
285
|
-
}
|
|
286
|
-
` : `
|
|
287
|
-
// old styles
|
|
288
|
-
.${RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER} {
|
|
289
|
-
margin: 0;
|
|
290
|
-
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
291
|
-
opacity: 1;
|
|
292
|
-
transition: opacity 0.2s ease-in-out;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
280
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
281
|
+
&:hover:not(
|
|
282
|
+
:has(
|
|
283
|
+
.${RendererCssClassName.SORTABLE_COLUMN_WRAPPER}
|
|
284
|
+
.${RendererCssClassName.SORTABLE_COLUMN}:hover
|
|
285
|
+
)
|
|
286
|
+
)
|
|
287
|
+
> .${RendererCssClassName.SORTABLE_COLUMN}
|
|
288
|
+
> .${RendererCssClassName.SORTABLE_COLUMN_NO_ORDER} {
|
|
289
|
+
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
300
290
|
opacity: 1;
|
|
301
291
|
}
|
|
302
292
|
}
|
|
303
|
-
|
|
293
|
+
` : css`
|
|
294
|
+
// old styles
|
|
295
|
+
.${RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER} {
|
|
296
|
+
margin: 0;
|
|
297
|
+
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
298
|
+
opacity: 1;
|
|
299
|
+
transition: opacity 0.2s ease-in-out;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
304
302
|
|
|
305
|
-
&:hover {
|
|
306
303
|
.${RendererCssClassName.SORTABLE_COLUMN_NO_ORDER} {
|
|
307
304
|
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
308
|
-
opacity:
|
|
305
|
+
opacity: 0;
|
|
306
|
+
&:focus {
|
|
307
|
+
opacity: 1;
|
|
308
|
+
}
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
|
|
312
|
+
&:hover {
|
|
313
|
+
.${RendererCssClassName.SORTABLE_COLUMN_NO_ORDER} {
|
|
314
|
+
.${SORTABLE_COLUMN_ICON_CLASSNAME} {
|
|
315
|
+
opacity: 1;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
`}
|
|
313
320
|
}
|
|
314
321
|
`;
|
|
315
322
|
};
|
|
@@ -467,6 +474,9 @@ const stickyScrollbarStyles = `
|
|
|
467
474
|
bottom: ${"var(--ds-space-250, 20px)"}; // MAX_BROWSER_SCROLLBAR_HEIGHT = 20;
|
|
468
475
|
}
|
|
469
476
|
`;
|
|
477
|
+
|
|
478
|
+
// Ignored via go/ees005
|
|
479
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
470
480
|
export const rendererStyles = wrapperProps => theme => {
|
|
471
481
|
const {
|
|
472
482
|
colorMode,
|
|
@@ -35,6 +35,9 @@ const FadeOut = props => {
|
|
|
35
35
|
css: styles
|
|
36
36
|
}, children);
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
// Ignored via go/ees005
|
|
40
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components, react/prefer-stateless-function
|
|
38
41
|
export class TruncatedWrapper extends Component {
|
|
39
42
|
constructor(props) {
|
|
40
43
|
super(props);
|
|
@@ -9,9 +9,14 @@ export const Provider = function ({
|
|
|
9
9
|
}, children);
|
|
10
10
|
};
|
|
11
11
|
export const withSmartCardStorage = WrappedComponent => {
|
|
12
|
+
// Ignored via go/ees005
|
|
13
|
+
// eslint-disable-next-line react/prefer-stateless-function
|
|
12
14
|
return class extends React.Component {
|
|
13
15
|
render() {
|
|
14
|
-
return /*#__PURE__*/React.createElement(Context.Consumer, null, storage => /*#__PURE__*/React.createElement(WrappedComponent
|
|
16
|
+
return /*#__PURE__*/React.createElement(Context.Consumer, null, storage => /*#__PURE__*/React.createElement(WrappedComponent
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
19
|
+
, _extends({}, this.props, {
|
|
15
20
|
smartCardStorage: storage
|
|
16
21
|
})));
|
|
17
22
|
}
|
|
@@ -3,6 +3,9 @@ import React, { createContext } from 'react';
|
|
|
3
3
|
export const AnnotationsDraftContext = /*#__PURE__*/createContext(null);
|
|
4
4
|
export const ProvidersContext = /*#__PURE__*/createContext(null);
|
|
5
5
|
export const InlineCommentsStateContext = /*#__PURE__*/createContext({});
|
|
6
|
+
|
|
7
|
+
// Ignored via go/ees005
|
|
8
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
6
9
|
export class AnnotationsDraftContextWrapper extends React.Component {
|
|
7
10
|
constructor(...args) {
|
|
8
11
|
super(...args);
|
|
@@ -29,11 +29,15 @@ export const AnnotationDraft = ({
|
|
|
29
29
|
draftPosition,
|
|
30
30
|
children
|
|
31
31
|
}) => {
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
return (
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
35
|
+
jsx("mark", _extends({
|
|
36
|
+
"data-renderer-mark": true
|
|
37
|
+
}, dataAttributes(draftPosition), {
|
|
38
|
+
css: markStyles
|
|
39
|
+
}), children)
|
|
40
|
+
);
|
|
37
41
|
};
|
|
38
42
|
export const getAnnotationIndex = (annotationPosition, fragmentCount) => {
|
|
39
43
|
if (annotationPosition === InsertDraftPosition.START) {
|
|
@@ -58,14 +62,22 @@ export const applyAnnotationOnText = ({
|
|
|
58
62
|
return texts.map((value, index) => {
|
|
59
63
|
const segments = segmentText(value, textHighlighter);
|
|
60
64
|
if (annotateIndex === index) {
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
return (
|
|
66
|
+
// Ignored via go/ees005
|
|
67
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
68
|
+
jsx(AnnotationDraft, {
|
|
69
|
+
key: index,
|
|
70
|
+
draftPosition: draftPosition
|
|
71
|
+
}, renderTextSegments(segments, textHighlighter, marks || [], draftPosition.from))
|
|
72
|
+
);
|
|
65
73
|
}
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
return (
|
|
75
|
+
// Ignored via go/ees005
|
|
76
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
77
|
+
jsx(React.Fragment, {
|
|
78
|
+
key: index
|
|
79
|
+
}, renderTextSegments(segments, textHighlighter, marks || [], draftPosition.from))
|
|
80
|
+
);
|
|
69
81
|
});
|
|
70
82
|
};
|
|
71
83
|
export const TextWithAnnotationDraft = ({
|
|
@@ -32,6 +32,8 @@ const markStyles = () => css`
|
|
|
32
32
|
}
|
|
33
33
|
`;
|
|
34
34
|
const isMobile = () => {
|
|
35
|
+
// Ignored via go/ees005
|
|
36
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
35
37
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
36
38
|
};
|
|
37
39
|
const accessibilityStyles = (startMarker, endMarker) => css({
|
|
@@ -93,6 +95,9 @@ export const MarkComponent = ({
|
|
|
93
95
|
// prevents from opening link URL inside webView in Safari
|
|
94
96
|
event.preventDefault();
|
|
95
97
|
}
|
|
98
|
+
|
|
99
|
+
// Ignored via go/ees005
|
|
100
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
96
101
|
onClick({
|
|
97
102
|
eventTarget: event.target,
|
|
98
103
|
annotationIds
|
|
@@ -12,7 +12,13 @@ export function useInlineAnnotationProps(props) {
|
|
|
12
12
|
return {};
|
|
13
13
|
}
|
|
14
14
|
const inlineCardPosition = props.dataAttributes['data-renderer-start-pos'] - 1;
|
|
15
|
-
const hasDraft = draftPosition &&
|
|
15
|
+
const hasDraft = draftPosition &&
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
18
|
+
(draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) <= inlineCardPosition &&
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
21
|
+
(draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.to) >= inlineCardPosition + 1;
|
|
16
22
|
if (hasDraft) {
|
|
17
23
|
return {
|
|
18
24
|
'data-renderer-mark': true,
|
|
@@ -54,7 +54,10 @@ export const useUserSelectionRange = props => {
|
|
|
54
54
|
// platform/packages/editor/renderer/src/steps/index.ts Line 180
|
|
55
55
|
|
|
56
56
|
// This workaround ensures the endContainer is set to a text node when endContainer is non-text and the parent container is the root element
|
|
57
|
-
if (isTripleClick &&
|
|
57
|
+
if (isTripleClick &&
|
|
58
|
+
// Ignored via go/ees005
|
|
59
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
60
|
+
isRoot(commonAncestorContainer) && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeName) === 'P' // ignore if the parent node is strong, em, etc.
|
|
58
61
|
) {
|
|
59
62
|
var _parentNode$lastChild, _parentNode$lastChild2;
|
|
60
63
|
const lastChild = parentNode !== null && parentNode !== void 0 && parentNode.lastChild && (parentNode === null || parentNode === void 0 ? void 0 : (_parentNode$lastChild = parentNode.lastChild) === null || _parentNode$lastChild === void 0 ? void 0 : _parentNode$lastChild.nodeType) === Node.TEXT_NODE ? parentNode === null || parentNode === void 0 ? void 0 : parentNode.lastChild : parentNode === null || parentNode === void 0 ? void 0 : (_parentNode$lastChild2 = parentNode.lastChild) === null || _parentNode$lastChild2 === void 0 ? void 0 : _parentNode$lastChild2.childNodes[0];
|
|
@@ -65,8 +68,13 @@ export const useUserSelectionRange = props => {
|
|
|
65
68
|
}
|
|
66
69
|
}, 250);
|
|
67
70
|
};
|
|
71
|
+
|
|
72
|
+
// Ignored via go/ees005
|
|
73
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
68
74
|
document.addEventListener('selectionchange', onSelectionChange);
|
|
69
75
|
return () => {
|
|
76
|
+
// Ignored via go/ees005
|
|
77
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
70
78
|
document.removeEventListener('selectionchange', onSelectionChange);
|
|
71
79
|
clearRange();
|
|
72
80
|
};
|
|
@@ -120,7 +120,10 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
|
|
|
120
120
|
}, [onCloseProps, removeDraftModeCallback, createAnalyticsEvent]);
|
|
121
121
|
return /*#__PURE__*/React.createElement(Component, {
|
|
122
122
|
range: range,
|
|
123
|
-
isWithinRange: isWithinRange
|
|
123
|
+
isWithinRange: isWithinRange
|
|
124
|
+
// Ignored via go/ees005
|
|
125
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
126
|
+
,
|
|
124
127
|
wrapperDOM: wrapperDOM.current,
|
|
125
128
|
isAnnotationAllowed: isAnnotationAllowed,
|
|
126
129
|
onClose: onCloseCallback,
|
|
@@ -161,7 +161,10 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
161
161
|
}, [onCloseProps, removeDraftModeCallback, createAnalyticsEvent, inlineNodeTypes]);
|
|
162
162
|
return /*#__PURE__*/React.createElement(Component, {
|
|
163
163
|
range: range,
|
|
164
|
-
draftRange: draftRange
|
|
164
|
+
draftRange: draftRange
|
|
165
|
+
// Ignored via go/ees005
|
|
166
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
167
|
+
,
|
|
165
168
|
wrapperDOM: wrapperDOM.current,
|
|
166
169
|
isAnnotationAllowed: isAnnotationAllowed,
|
|
167
170
|
onClose: onCloseCallback,
|
|
@@ -35,13 +35,19 @@ export const AnnotationsContextWrapper = props => {
|
|
|
35
35
|
}) => {
|
|
36
36
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children, !!hoverComponent && /*#__PURE__*/React.createElement(HoverRangeValidator, {
|
|
37
37
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
38
|
-
rendererRef: rendererRef
|
|
38
|
+
rendererRef: rendererRef
|
|
39
|
+
// Ignored via go/ees005
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
41
|
+
,
|
|
39
42
|
component: hoverComponent,
|
|
40
43
|
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
41
44
|
clearAnnotationDraft: clearAnnotationDraft
|
|
42
45
|
}), !!selectionComponent && /*#__PURE__*/React.createElement(SelectionRangeValidator, {
|
|
43
46
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
44
|
-
rendererRef: rendererRef
|
|
47
|
+
rendererRef: rendererRef
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
50
|
+
,
|
|
45
51
|
selectionComponent: selectionComponent,
|
|
46
52
|
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
47
53
|
clearAnnotationDraft: clearAnnotationDraft
|