@atlaskit/renderer 128.5.0 → 128.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cjs/ui/Renderer/index.js +2 -2
- package/dist/cjs/ui/hooks/useScrollToBlock.js +17 -3
- package/dist/es2019/ui/Renderer/index.js +2 -2
- package/dist/es2019/ui/hooks/useScrollToBlock.js +17 -3
- package/dist/esm/ui/Renderer/index.js +2 -2
- package/dist/esm/ui/hooks/useScrollToBlock.js +17 -3
- package/dist/types/ui/hooks/useScrollToBlock.d.ts +1 -1
- package/dist/types/ui/renderer-props.d.ts +6 -0
- package/dist/types-ts4.5/ui/hooks/useScrollToBlock.d.ts +1 -1
- package/dist/types-ts4.5/ui/renderer-props.d.ts +6 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 128.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`13ec7df78a017`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/13ec7df78a017) -
|
|
8
|
+
Editor-5664: Fix scroll position for block links
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 128.5.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -71,7 +71,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
71
71
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
72
72
|
var RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
73
73
|
var packageName = "@atlaskit/renderer";
|
|
74
|
-
var packageVersion = "128.
|
|
74
|
+
var packageVersion = "128.5.0";
|
|
75
75
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
76
76
|
containerName: 'ak-renderer-wrapper',
|
|
77
77
|
containerType: 'inline-size'
|
|
@@ -440,7 +440,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
440
440
|
timeZone: props.timeZone
|
|
441
441
|
});
|
|
442
442
|
}, [props.featureFlags, props.isTopLevelRenderer, createRendererContext, props.timeZone]);
|
|
443
|
-
(0, _useScrollToBlock.useScrollToBlock)(editorRef, props.document);
|
|
443
|
+
(0, _useScrollToBlock.useScrollToBlock)(editorRef, props.document, props.scrollToBlock);
|
|
444
444
|
try {
|
|
445
445
|
var _rendererContext$feat, _props$media;
|
|
446
446
|
var schema = getSchema(props.schema, props.adfStage);
|
|
@@ -7,6 +7,7 @@ exports.useScrollToBlock = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _browserApis = require("@atlaskit/browser-apis");
|
|
9
9
|
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _useStableScroll2 = require("./useStableScroll");
|
|
11
12
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
12
13
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -25,7 +26,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
25
26
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
26
27
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
27
28
|
*/
|
|
28
|
-
var useScrollToBlock = exports.useScrollToBlock = function useScrollToBlock(containerRef, adfDoc) {
|
|
29
|
+
var useScrollToBlock = exports.useScrollToBlock = function useScrollToBlock(containerRef, adfDoc, scrollToBlock) {
|
|
29
30
|
var _useStableScroll = (0, _useStableScroll2.useStableScroll)({
|
|
30
31
|
stabilityWaitTime: 750,
|
|
31
32
|
maxStabilityWaitTime: 10000
|
|
@@ -120,7 +121,20 @@ var useScrollToBlock = exports.useScrollToBlock = function useScrollToBlock(cont
|
|
|
120
121
|
// Element found and all parent expands are open! Use the utility to scroll.
|
|
121
122
|
// (This will handle any final edge cases and do the actual scrolling).
|
|
122
123
|
// Capture cleanup function to cancel pending timeouts.
|
|
123
|
-
|
|
124
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_block_menu_v2_patch_4')) {
|
|
125
|
+
cancelExpandAndScroll = (0, _blockMenu.expandAllParentsThenScroll)(element, 0, function (el) {
|
|
126
|
+
if (scrollToBlock) {
|
|
127
|
+
scrollToBlock(el);
|
|
128
|
+
} else {
|
|
129
|
+
el.scrollIntoView({
|
|
130
|
+
behavior: 'smooth',
|
|
131
|
+
block: 'start'
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
cancelExpandAndScroll = (0, _blockMenu.expandAllParentsThenScroll)(element);
|
|
137
|
+
}
|
|
124
138
|
return true;
|
|
125
139
|
};
|
|
126
140
|
var performScroll = function performScroll() {
|
|
@@ -235,5 +249,5 @@ var useScrollToBlock = exports.useScrollToBlock = function useScrollToBlock(cont
|
|
|
235
249
|
return cleanup;
|
|
236
250
|
// Intentionally not including adfDoc in the dependency array to avoid unnecessary re-renders.
|
|
237
251
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
238
|
-
}, [containerRef, waitForStability, cleanupStability]);
|
|
252
|
+
}, [containerRef, waitForStability, cleanupStability, scrollToBlock]);
|
|
239
253
|
};
|
|
@@ -57,7 +57,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
57
57
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
58
58
|
const RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
59
59
|
const packageName = "@atlaskit/renderer";
|
|
60
|
-
const packageVersion = "128.
|
|
60
|
+
const packageVersion = "128.5.0";
|
|
61
61
|
const setAsQueryContainerStyles = css({
|
|
62
62
|
containerName: 'ak-renderer-wrapper',
|
|
63
63
|
containerType: 'inline-size'
|
|
@@ -430,7 +430,7 @@ export const RendererFunctionalComponent = props => {
|
|
|
430
430
|
...createRendererContext(props.featureFlags, props.isTopLevelRenderer),
|
|
431
431
|
timeZone: props.timeZone
|
|
432
432
|
}), [props.featureFlags, props.isTopLevelRenderer, createRendererContext, props.timeZone]);
|
|
433
|
-
useScrollToBlock(editorRef, props.document);
|
|
433
|
+
useScrollToBlock(editorRef, props.document, props.scrollToBlock);
|
|
434
434
|
try {
|
|
435
435
|
var _rendererContext$feat, _props$media;
|
|
436
436
|
const schema = getSchema(props.schema, props.adfStage);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { getDocument } from '@atlaskit/browser-apis';
|
|
3
3
|
import { DEFAULT_BLOCK_LINK_HASH_PREFIX, expandAllParentsThenScroll, expandElement, isExpandCollapsed, findNodeWithExpandParents, getLocalIdSelector } from '@atlaskit/editor-common/block-menu';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { useStableScroll } from './useStableScroll';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -17,7 +18,7 @@ import { useStableScroll } from './useStableScroll';
|
|
|
17
18
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
18
19
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
19
20
|
*/
|
|
20
|
-
export const useScrollToBlock = (containerRef, adfDoc) => {
|
|
21
|
+
export const useScrollToBlock = (containerRef, adfDoc, scrollToBlock) => {
|
|
21
22
|
const {
|
|
22
23
|
waitForStability,
|
|
23
24
|
cleanup: cleanupStability
|
|
@@ -106,7 +107,20 @@ export const useScrollToBlock = (containerRef, adfDoc) => {
|
|
|
106
107
|
// Element found and all parent expands are open! Use the utility to scroll.
|
|
107
108
|
// (This will handle any final edge cases and do the actual scrolling).
|
|
108
109
|
// Capture cleanup function to cancel pending timeouts.
|
|
109
|
-
|
|
110
|
+
if (fg('platform_editor_block_menu_v2_patch_4')) {
|
|
111
|
+
cancelExpandAndScroll = expandAllParentsThenScroll(element, 0, el => {
|
|
112
|
+
if (scrollToBlock) {
|
|
113
|
+
scrollToBlock(el);
|
|
114
|
+
} else {
|
|
115
|
+
el.scrollIntoView({
|
|
116
|
+
behavior: 'smooth',
|
|
117
|
+
block: 'start'
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
} else {
|
|
122
|
+
cancelExpandAndScroll = expandAllParentsThenScroll(element);
|
|
123
|
+
}
|
|
110
124
|
return true;
|
|
111
125
|
};
|
|
112
126
|
const performScroll = () => {
|
|
@@ -214,5 +228,5 @@ export const useScrollToBlock = (containerRef, adfDoc) => {
|
|
|
214
228
|
return cleanup;
|
|
215
229
|
// Intentionally not including adfDoc in the dependency array to avoid unnecessary re-renders.
|
|
216
230
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
217
|
-
}, [containerRef, waitForStability, cleanupStability]);
|
|
231
|
+
}, [containerRef, waitForStability, cleanupStability, scrollToBlock]);
|
|
218
232
|
};
|
|
@@ -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.2;
|
|
64
64
|
var packageName = "@atlaskit/renderer";
|
|
65
|
-
var packageVersion = "128.
|
|
65
|
+
var packageVersion = "128.5.0";
|
|
66
66
|
var setAsQueryContainerStyles = css({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
|
@@ -431,7 +431,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
431
431
|
timeZone: props.timeZone
|
|
432
432
|
});
|
|
433
433
|
}, [props.featureFlags, props.isTopLevelRenderer, createRendererContext, props.timeZone]);
|
|
434
|
-
useScrollToBlock(editorRef, props.document);
|
|
434
|
+
useScrollToBlock(editorRef, props.document, props.scrollToBlock);
|
|
435
435
|
try {
|
|
436
436
|
var _rendererContext$feat, _props$media;
|
|
437
437
|
var schema = getSchema(props.schema, props.adfStage);
|
|
@@ -4,6 +4,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
5
|
import { getDocument } from '@atlaskit/browser-apis';
|
|
6
6
|
import { DEFAULT_BLOCK_LINK_HASH_PREFIX, expandAllParentsThenScroll, expandElement, isExpandCollapsed, findNodeWithExpandParents, getLocalIdSelector } from '@atlaskit/editor-common/block-menu';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { useStableScroll } from './useStableScroll';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -20,7 +21,7 @@ import { useStableScroll } from './useStableScroll';
|
|
|
20
21
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
21
22
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
22
23
|
*/
|
|
23
|
-
export var useScrollToBlock = function useScrollToBlock(containerRef, adfDoc) {
|
|
24
|
+
export var useScrollToBlock = function useScrollToBlock(containerRef, adfDoc, scrollToBlock) {
|
|
24
25
|
var _useStableScroll = useStableScroll({
|
|
25
26
|
stabilityWaitTime: 750,
|
|
26
27
|
maxStabilityWaitTime: 10000
|
|
@@ -115,7 +116,20 @@ export var useScrollToBlock = function useScrollToBlock(containerRef, adfDoc) {
|
|
|
115
116
|
// Element found and all parent expands are open! Use the utility to scroll.
|
|
116
117
|
// (This will handle any final edge cases and do the actual scrolling).
|
|
117
118
|
// Capture cleanup function to cancel pending timeouts.
|
|
118
|
-
|
|
119
|
+
if (fg('platform_editor_block_menu_v2_patch_4')) {
|
|
120
|
+
cancelExpandAndScroll = expandAllParentsThenScroll(element, 0, function (el) {
|
|
121
|
+
if (scrollToBlock) {
|
|
122
|
+
scrollToBlock(el);
|
|
123
|
+
} else {
|
|
124
|
+
el.scrollIntoView({
|
|
125
|
+
behavior: 'smooth',
|
|
126
|
+
block: 'start'
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
cancelExpandAndScroll = expandAllParentsThenScroll(element);
|
|
132
|
+
}
|
|
119
133
|
return true;
|
|
120
134
|
};
|
|
121
135
|
var performScroll = function performScroll() {
|
|
@@ -230,5 +244,5 @@ export var useScrollToBlock = function useScrollToBlock(containerRef, adfDoc) {
|
|
|
230
244
|
return cleanup;
|
|
231
245
|
// Intentionally not including adfDoc in the dependency array to avoid unnecessary re-renders.
|
|
232
246
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
233
|
-
}, [containerRef, waitForStability, cleanupStability]);
|
|
247
|
+
}, [containerRef, waitForStability, cleanupStability, scrollToBlock]);
|
|
234
248
|
};
|
|
@@ -13,4 +13,4 @@ import type { DocNode } from '@atlaskit/adf-schema';
|
|
|
13
13
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
14
14
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
15
15
|
*/
|
|
16
|
-
export declare const useScrollToBlock: (containerRef?: React.RefObject<HTMLDivElement>, adfDoc?: DocNode) => void;
|
|
16
|
+
export declare const useScrollToBlock: (containerRef?: React.RefObject<HTMLDivElement>, adfDoc?: DocNode, scrollToBlock?: (element: HTMLElement) => void) => void;
|
|
@@ -136,6 +136,12 @@ export interface RendererProps {
|
|
|
136
136
|
portal?: HTMLElement;
|
|
137
137
|
rendererContext?: RendererContext;
|
|
138
138
|
schema?: Schema;
|
|
139
|
+
/**
|
|
140
|
+
* Optional callback to scroll an element into view when using block links (#block-xxx).
|
|
141
|
+
* When provided, this is used instead of the default scrollIntoView for accurate positioning
|
|
142
|
+
* in product-specific scroll containers (e.g. Confluence view page).
|
|
143
|
+
*/
|
|
144
|
+
scrollToBlock?: (element: HTMLElement) => void;
|
|
139
145
|
/**
|
|
140
146
|
* Determines if the extension should be displayed as inline based on the extension parameters.
|
|
141
147
|
* @param extensionParams - The extension parameters.
|
|
@@ -13,4 +13,4 @@ import type { DocNode } from '@atlaskit/adf-schema';
|
|
|
13
13
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
14
14
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
15
15
|
*/
|
|
16
|
-
export declare const useScrollToBlock: (containerRef?: React.RefObject<HTMLDivElement>, adfDoc?: DocNode) => void;
|
|
16
|
+
export declare const useScrollToBlock: (containerRef?: React.RefObject<HTMLDivElement>, adfDoc?: DocNode, scrollToBlock?: (element: HTMLElement) => void) => void;
|
|
@@ -136,6 +136,12 @@ export interface RendererProps {
|
|
|
136
136
|
portal?: HTMLElement;
|
|
137
137
|
rendererContext?: RendererContext;
|
|
138
138
|
schema?: Schema;
|
|
139
|
+
/**
|
|
140
|
+
* Optional callback to scroll an element into view when using block links (#block-xxx).
|
|
141
|
+
* When provided, this is used instead of the default scrollIntoView for accurate positioning
|
|
142
|
+
* in product-specific scroll containers (e.g. Confluence view page).
|
|
143
|
+
*/
|
|
144
|
+
scrollToBlock?: (element: HTMLElement) => void;
|
|
139
145
|
/**
|
|
140
146
|
* Determines if the extension should be displayed as inline based on the extension parameters.
|
|
141
147
|
* @param extensionParams - The extension parameters.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "128.
|
|
3
|
+
"version": "128.6.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -245,6 +245,9 @@
|
|
|
245
245
|
"platform_editor_media_border_radius_fix": {
|
|
246
246
|
"type": "boolean"
|
|
247
247
|
},
|
|
248
|
+
"platform_editor_block_menu_v2_patch_4": {
|
|
249
|
+
"type": "boolean"
|
|
250
|
+
},
|
|
248
251
|
"platform-dst-lozenge-tag-badge-visual-uplifts": {
|
|
249
252
|
"type": "boolean"
|
|
250
253
|
}
|