@atlaskit/renderer 126.12.4 → 126.13.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 +7 -0
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +0 -5
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/hooks/useScrollToBlock.js +1 -12
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +0 -5
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/hooks/useScrollToBlock.js +1 -12
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +0 -5
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/hooks/useScrollToBlock.js +1 -12
- package/dist/types/ui/hooks/useScrollToBlock.d.ts +0 -7
- package/dist/types-ts4.5/ui/hooks/useScrollToBlock.d.ts +0 -7
- package/package.json +1 -1
- package/dist/cjs/ui/hooks/useScrollToLocalId.js +0 -146
- package/dist/es2019/ui/hooks/useScrollToLocalId.js +0 -141
- package/dist/esm/ui/hooks/useScrollToLocalId.js +0 -141
- package/dist/types/ui/hooks/useScrollToLocalId.d.ts +0 -10
- package/dist/types-ts4.5/ui/hooks/useScrollToLocalId.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 126.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c67bc7d9fda55`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c67bc7d9fda55) -
|
|
8
|
+
[ux] Cleanup fg: platform_editor_expand_on_scroll_to_block
|
|
9
|
+
|
|
3
10
|
## 126.12.4
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -7,11 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.textHighlightPaddingStyles = exports.RendererStyleContainer = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
-
var _useScrollToLocalId = require("../hooks/useScrollToLocalId");
|
|
11
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
11
|
var _style = require("./style");
|
|
13
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
15
13
|
var _consts = require("../../consts");
|
|
16
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
15
|
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
@@ -1976,9 +1974,6 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
|
|
|
1976
1974
|
children = props.children,
|
|
1977
1975
|
innerRef = props.innerRef,
|
|
1978
1976
|
testId = props.testId;
|
|
1979
|
-
|
|
1980
|
-
// Scroll to localId functionality
|
|
1981
|
-
(0, _useScrollToLocalId.useScrollToLocalId)(innerRef, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true));
|
|
1982
1977
|
var isAdvancedLayoutsOn = (0, _experiments.editorExperiment)('advanced_layouts', true);
|
|
1983
1978
|
var isPreviewPanelResponsivenessOn = (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
1984
1979
|
exposure: true
|
|
@@ -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 = "126.12.
|
|
74
|
+
var packageVersion = "126.12.4";
|
|
75
75
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
76
76
|
containerName: 'ak-renderer-wrapper',
|
|
77
77
|
containerType: 'inline-size'
|
|
@@ -7,7 +7,6 @@ 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 _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
10
|
var _useStableScroll2 = require("./useStableScroll");
|
|
12
11
|
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; } } }; }
|
|
13
12
|
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; } }
|
|
@@ -23,13 +22,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
23
22
|
* which prevents issues with images loading, dynamic content, or other async operations that
|
|
24
23
|
* cause layout changes.
|
|
25
24
|
*
|
|
26
|
-
* This hook replaces useScrollToLocalId when the platform_editor_expand_on_scroll_to_block experiment is enabled.
|
|
27
|
-
*
|
|
28
|
-
* When platform_editor_expand_on_scroll_to_block experiment is cleaned up:
|
|
29
|
-
* - Remove the experiment check
|
|
30
|
-
* - Delete the deprecated useScrollToLocalId hook
|
|
31
|
-
* - Make this the default scroll-to-block behavior
|
|
32
|
-
*
|
|
33
25
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
34
26
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
35
27
|
*/
|
|
@@ -46,14 +38,11 @@ var useScrollToBlock = exports.useScrollToBlock = function useScrollToBlock(cont
|
|
|
46
38
|
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current)) {
|
|
47
39
|
return;
|
|
48
40
|
}
|
|
49
|
-
if (!(0, _expValEquals.expValEquals)('platform_editor_expand_on_scroll_to_block', 'isEnabled', true)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
41
|
|
|
53
42
|
// Parse hash fragment for block ID (format: #block-{localId}).
|
|
54
43
|
var hash = window.location.hash;
|
|
55
44
|
var defaultPrefixWithHash = "#".concat(_blockMenu.DEFAULT_BLOCK_LINK_HASH_PREFIX);
|
|
56
|
-
var blockId = hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
45
|
+
var blockId = hash && hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
57
46
|
if (!blockId) {
|
|
58
47
|
return;
|
|
59
48
|
}
|
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
-
import { useScrollToLocalId } from '../hooks/useScrollToLocalId';
|
|
11
10
|
import { B300, B400, B500, N20, N200, N30A, N40A, N60A, N800, R50, R500, Y300, Y75 } from '@atlaskit/theme/colors';
|
|
12
11
|
import { FullPagePadding } from './style';
|
|
13
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
15
13
|
import { RendererCssClassName } from '../../consts';
|
|
16
14
|
import { akEditorBlockquoteBorderColor, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorFullPageNarrowBreakout, akEditorGutterPaddingReduced, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth, akEditorGutterPadding, akEditorLineHeight, akEditorSelectedNodeClassName, akEditorShadowZIndex, akEditorStickyHeaderZIndex, akEditorTableBorder, akEditorTableCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, blockNodesVerticalMargin, scaledBlockNodesVerticalMargin, gridMediumMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullPageDenseFontSize } from '@atlaskit/editor-shared-styles';
|
|
17
15
|
import { INLINE_IMAGE_WRAPPER_CLASS_NAME } from '@atlaskit/editor-common/media-inline';
|
|
@@ -2539,9 +2537,6 @@ export const RendererStyleContainer = props => {
|
|
|
2539
2537
|
innerRef,
|
|
2540
2538
|
testId
|
|
2541
2539
|
} = props;
|
|
2542
|
-
|
|
2543
|
-
// Scroll to localId functionality
|
|
2544
|
-
useScrollToLocalId(innerRef, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true));
|
|
2545
2540
|
const isAdvancedLayoutsOn = editorExperiment('advanced_layouts', true);
|
|
2546
2541
|
const isPreviewPanelResponsivenessOn = editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
2547
2542
|
exposure: true
|
|
@@ -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 = "126.12.
|
|
60
|
+
const packageVersion = "126.12.4";
|
|
61
61
|
const setAsQueryContainerStyles = css({
|
|
62
62
|
containerName: 'ak-renderer-wrapper',
|
|
63
63
|
containerType: 'inline-size'
|
|
@@ -1,7 +1,6 @@
|
|
|
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 { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { useStableScroll } from './useStableScroll';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -15,13 +14,6 @@ import { useStableScroll } from './useStableScroll';
|
|
|
15
14
|
* which prevents issues with images loading, dynamic content, or other async operations that
|
|
16
15
|
* cause layout changes.
|
|
17
16
|
*
|
|
18
|
-
* This hook replaces useScrollToLocalId when the platform_editor_expand_on_scroll_to_block experiment is enabled.
|
|
19
|
-
*
|
|
20
|
-
* When platform_editor_expand_on_scroll_to_block experiment is cleaned up:
|
|
21
|
-
* - Remove the experiment check
|
|
22
|
-
* - Delete the deprecated useScrollToLocalId hook
|
|
23
|
-
* - Make this the default scroll-to-block behavior
|
|
24
|
-
*
|
|
25
17
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
26
18
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
27
19
|
*/
|
|
@@ -39,14 +31,11 @@ export const useScrollToBlock = (containerRef, adfDoc) => {
|
|
|
39
31
|
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current)) {
|
|
40
32
|
return;
|
|
41
33
|
}
|
|
42
|
-
if (!expValEquals('platform_editor_expand_on_scroll_to_block', 'isEnabled', true)) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
34
|
|
|
46
35
|
// Parse hash fragment for block ID (format: #block-{localId}).
|
|
47
36
|
const hash = window.location.hash;
|
|
48
37
|
const defaultPrefixWithHash = `#${DEFAULT_BLOCK_LINK_HASH_PREFIX}`;
|
|
49
|
-
const blockId = hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
38
|
+
const blockId = hash && hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
50
39
|
if (!blockId) {
|
|
51
40
|
return;
|
|
52
41
|
}
|
|
@@ -9,11 +9,9 @@ var _css8, _$concat3, _$concat6;
|
|
|
9
9
|
*/
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
|
-
import { useScrollToLocalId } from '../hooks/useScrollToLocalId';
|
|
13
12
|
import { B300, B400, B500, N20, N200, N30A, N40A, N60A, N800, R50, R500, Y300, Y75 } from '@atlaskit/theme/colors';
|
|
14
13
|
import { FullPagePadding } from './style';
|
|
15
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
17
15
|
import { RendererCssClassName } from '../../consts';
|
|
18
16
|
import { akEditorBlockquoteBorderColor, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorFullPageNarrowBreakout, akEditorGutterPaddingReduced, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth, akEditorGutterPadding, akEditorLineHeight, akEditorSelectedNodeClassName, akEditorShadowZIndex, akEditorStickyHeaderZIndex, akEditorTableBorder, akEditorTableCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, blockNodesVerticalMargin, scaledBlockNodesVerticalMargin, gridMediumMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullPageDenseFontSize } from '@atlaskit/editor-shared-styles';
|
|
19
17
|
import { INLINE_IMAGE_WRAPPER_CLASS_NAME } from '@atlaskit/editor-common/media-inline';
|
|
@@ -1969,9 +1967,6 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
|
|
|
1969
1967
|
children = props.children,
|
|
1970
1968
|
innerRef = props.innerRef,
|
|
1971
1969
|
testId = props.testId;
|
|
1972
|
-
|
|
1973
|
-
// Scroll to localId functionality
|
|
1974
|
-
useScrollToLocalId(innerRef, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true));
|
|
1975
1970
|
var isAdvancedLayoutsOn = editorExperiment('advanced_layouts', true);
|
|
1976
1971
|
var isPreviewPanelResponsivenessOn = editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
1977
1972
|
exposure: true
|
|
@@ -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 = "126.12.
|
|
65
|
+
var packageVersion = "126.12.4";
|
|
66
66
|
var setAsQueryContainerStyles = css({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
|
@@ -4,7 +4,6 @@ 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 { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
7
|
import { useStableScroll } from './useStableScroll';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -18,13 +17,6 @@ import { useStableScroll } from './useStableScroll';
|
|
|
18
17
|
* which prevents issues with images loading, dynamic content, or other async operations that
|
|
19
18
|
* cause layout changes.
|
|
20
19
|
*
|
|
21
|
-
* This hook replaces useScrollToLocalId when the platform_editor_expand_on_scroll_to_block experiment is enabled.
|
|
22
|
-
*
|
|
23
|
-
* When platform_editor_expand_on_scroll_to_block experiment is cleaned up:
|
|
24
|
-
* - Remove the experiment check
|
|
25
|
-
* - Delete the deprecated useScrollToLocalId hook
|
|
26
|
-
* - Make this the default scroll-to-block behavior
|
|
27
|
-
*
|
|
28
20
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
29
21
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
30
22
|
*/
|
|
@@ -41,14 +33,11 @@ export var useScrollToBlock = function useScrollToBlock(containerRef, adfDoc) {
|
|
|
41
33
|
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current)) {
|
|
42
34
|
return;
|
|
43
35
|
}
|
|
44
|
-
if (!expValEquals('platform_editor_expand_on_scroll_to_block', 'isEnabled', true)) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
36
|
|
|
48
37
|
// Parse hash fragment for block ID (format: #block-{localId}).
|
|
49
38
|
var hash = window.location.hash;
|
|
50
39
|
var defaultPrefixWithHash = "#".concat(DEFAULT_BLOCK_LINK_HASH_PREFIX);
|
|
51
|
-
var blockId = hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
40
|
+
var blockId = hash && hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
52
41
|
if (!blockId) {
|
|
53
42
|
return;
|
|
54
43
|
}
|
|
@@ -10,13 +10,6 @@ import type { DocNode } from '@atlaskit/adf-schema';
|
|
|
10
10
|
* which prevents issues with images loading, dynamic content, or other async operations that
|
|
11
11
|
* cause layout changes.
|
|
12
12
|
*
|
|
13
|
-
* This hook replaces useScrollToLocalId when the platform_editor_expand_on_scroll_to_block experiment is enabled.
|
|
14
|
-
*
|
|
15
|
-
* When platform_editor_expand_on_scroll_to_block experiment is cleaned up:
|
|
16
|
-
* - Remove the experiment check
|
|
17
|
-
* - Delete the deprecated useScrollToLocalId hook
|
|
18
|
-
* - Make this the default scroll-to-block behavior
|
|
19
|
-
*
|
|
20
13
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
21
14
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
22
15
|
*/
|
|
@@ -10,13 +10,6 @@ import type { DocNode } from '@atlaskit/adf-schema';
|
|
|
10
10
|
* which prevents issues with images loading, dynamic content, or other async operations that
|
|
11
11
|
* cause layout changes.
|
|
12
12
|
*
|
|
13
|
-
* This hook replaces useScrollToLocalId when the platform_editor_expand_on_scroll_to_block experiment is enabled.
|
|
14
|
-
*
|
|
15
|
-
* When platform_editor_expand_on_scroll_to_block experiment is cleaned up:
|
|
16
|
-
* - Remove the experiment check
|
|
17
|
-
* - Delete the deprecated useScrollToLocalId hook
|
|
18
|
-
* - Make this the default scroll-to-block behavior
|
|
19
|
-
*
|
|
20
13
|
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
|
|
21
14
|
* @param adfDoc - The ADF document to search for nodes and expand parents
|
|
22
15
|
*/
|
package/package.json
CHANGED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useScrollToLocalId = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _browserApis = require("@atlaskit/browser-apis");
|
|
9
|
-
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
10
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
|
-
// Find editor node dom with localId - similar to confluence useScrollOnUrlChange.ts
|
|
12
|
-
var getLocalIdSelector = function getLocalIdSelector(localId, container) {
|
|
13
|
-
// Check if the element with data-local-id exists
|
|
14
|
-
var element = container.querySelector("[data-local-id=\"".concat(localId, "\"]"));
|
|
15
|
-
if (element) {
|
|
16
|
-
return element;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Special case for decision lists and task lists which already have localId
|
|
20
|
-
element = container.querySelector("[data-decision-list-local-id=\"".concat(localId, "\"]"));
|
|
21
|
-
if (element) {
|
|
22
|
-
return element;
|
|
23
|
-
}
|
|
24
|
-
element = container.querySelector("[data-task-list-local-id=\"".concat(localId, "\"]"));
|
|
25
|
-
if (element) {
|
|
26
|
-
return element;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Special case for tables which use data-table-local-id
|
|
30
|
-
element = container.querySelector("[data-table-local-id=\"".concat(localId, "\"]"));
|
|
31
|
-
if (element) {
|
|
32
|
-
return element;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Special case for extension, smart cards and media which use lowercase localid
|
|
36
|
-
element = container.querySelector("[localid=\"".concat(localId, "\"]"));
|
|
37
|
-
if (element) {
|
|
38
|
-
return element;
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* useScrollToLocalId - Handler for block link scrolling in the renderer (traditional pages)
|
|
45
|
-
*
|
|
46
|
-
* This hook is deprecated in favor of useScrollToBlock which supports expanding parent nodes.
|
|
47
|
-
* This hook will be removed when the platform_editor_expand_on_scroll_to_block experiment is cleaned up.
|
|
48
|
-
*
|
|
49
|
-
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer).
|
|
50
|
-
* @param shouldScrollToLocalId - Whether scroll-to-block functionality should be enabled
|
|
51
|
-
*/
|
|
52
|
-
var useScrollToLocalId = exports.useScrollToLocalId = function useScrollToLocalId(containerRef, shouldScrollToLocalId) {
|
|
53
|
-
(0, _react.useEffect)(function () {
|
|
54
|
-
var _getDocument;
|
|
55
|
-
// Only run in browser environment
|
|
56
|
-
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current) || !shouldScrollToLocalId) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_expand_on_scroll_to_block', 'isEnabled', true)) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Parse hash fragment for block ID (format: #block-{localId})
|
|
64
|
-
var hash = window.location.hash;
|
|
65
|
-
var defaultPrefixWithHash = "#".concat(_blockMenu.DEFAULT_BLOCK_LINK_HASH_PREFIX);
|
|
66
|
-
var blockId = hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
67
|
-
if (!blockId) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
var retryCount = 0;
|
|
71
|
-
// 5 second timeout based on dashboard showing ~4.96s TTI load time
|
|
72
|
-
var maxRetries = 20; // Maximum 20 retries (5 seconds at 250ms intervals)
|
|
73
|
-
var retryInterval = 250; // Check every 250ms
|
|
74
|
-
var intervalId = null;
|
|
75
|
-
var scrollToElement = function scrollToElement() {
|
|
76
|
-
if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
77
|
-
var element = getLocalIdSelector(blockId, containerRef.current);
|
|
78
|
-
if (element) {
|
|
79
|
-
element.scrollIntoView({
|
|
80
|
-
behavior: 'smooth'
|
|
81
|
-
});
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
};
|
|
87
|
-
var attemptScroll = function attemptScroll() {
|
|
88
|
-
retryCount++;
|
|
89
|
-
|
|
90
|
-
// Try to scroll to element
|
|
91
|
-
if (scrollToElement()) {
|
|
92
|
-
if (intervalId) {
|
|
93
|
-
clearInterval(intervalId);
|
|
94
|
-
intervalId = null;
|
|
95
|
-
}
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Stop retrying if we've exceeded max retries
|
|
100
|
-
if (retryCount >= maxRetries) {
|
|
101
|
-
if (intervalId) {
|
|
102
|
-
clearInterval(intervalId);
|
|
103
|
-
intervalId = null;
|
|
104
|
-
}
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// Try to scroll immediately
|
|
111
|
-
if (attemptScroll()) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (((_getDocument = (0, _browserApis.getDocument)()) === null || _getDocument === void 0 ? void 0 : _getDocument.readyState) === 'complete') {
|
|
115
|
-
// Document is already ready, try a few more times with delays
|
|
116
|
-
// This handles cases where elements are added after document ready
|
|
117
|
-
intervalId = setInterval(function () {
|
|
118
|
-
attemptScroll();
|
|
119
|
-
}, retryInterval);
|
|
120
|
-
} else {
|
|
121
|
-
// Document not ready yet, wait for it and then retry
|
|
122
|
-
intervalId = setInterval(function () {
|
|
123
|
-
var _getDocument2;
|
|
124
|
-
if (((_getDocument2 = (0, _browserApis.getDocument)()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.readyState) === 'complete') {
|
|
125
|
-
attemptScroll();
|
|
126
|
-
} else if (retryCount >= maxRetries) {
|
|
127
|
-
// Stop retrying even if document isn't ready
|
|
128
|
-
if (intervalId) {
|
|
129
|
-
clearInterval(intervalId);
|
|
130
|
-
intervalId = null;
|
|
131
|
-
}
|
|
132
|
-
} else {
|
|
133
|
-
retryCount++;
|
|
134
|
-
}
|
|
135
|
-
}, retryInterval);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Cleanup function
|
|
139
|
-
return function () {
|
|
140
|
-
if (intervalId) {
|
|
141
|
-
clearInterval(intervalId);
|
|
142
|
-
intervalId = null;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}, [containerRef, shouldScrollToLocalId]);
|
|
146
|
-
};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { getDocument } from '@atlaskit/browser-apis';
|
|
3
|
-
import { DEFAULT_BLOCK_LINK_HASH_PREFIX } from '@atlaskit/editor-common/block-menu';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
-
|
|
6
|
-
// Find editor node dom with localId - similar to confluence useScrollOnUrlChange.ts
|
|
7
|
-
const getLocalIdSelector = (localId, container) => {
|
|
8
|
-
// Check if the element with data-local-id exists
|
|
9
|
-
let element = container.querySelector(`[data-local-id="${localId}"]`);
|
|
10
|
-
if (element) {
|
|
11
|
-
return element;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Special case for decision lists and task lists which already have localId
|
|
15
|
-
element = container.querySelector(`[data-decision-list-local-id="${localId}"]`);
|
|
16
|
-
if (element) {
|
|
17
|
-
return element;
|
|
18
|
-
}
|
|
19
|
-
element = container.querySelector(`[data-task-list-local-id="${localId}"]`);
|
|
20
|
-
if (element) {
|
|
21
|
-
return element;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Special case for tables which use data-table-local-id
|
|
25
|
-
element = container.querySelector(`[data-table-local-id="${localId}"]`);
|
|
26
|
-
if (element) {
|
|
27
|
-
return element;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Special case for extension, smart cards and media which use lowercase localid
|
|
31
|
-
element = container.querySelector(`[localid="${localId}"]`);
|
|
32
|
-
if (element) {
|
|
33
|
-
return element;
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* useScrollToLocalId - Handler for block link scrolling in the renderer (traditional pages)
|
|
40
|
-
*
|
|
41
|
-
* This hook is deprecated in favor of useScrollToBlock which supports expanding parent nodes.
|
|
42
|
-
* This hook will be removed when the platform_editor_expand_on_scroll_to_block experiment is cleaned up.
|
|
43
|
-
*
|
|
44
|
-
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer).
|
|
45
|
-
* @param shouldScrollToLocalId - Whether scroll-to-block functionality should be enabled
|
|
46
|
-
*/
|
|
47
|
-
export const useScrollToLocalId = (containerRef, shouldScrollToLocalId) => {
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
var _getDocument;
|
|
50
|
-
// Only run in browser environment
|
|
51
|
-
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current) || !shouldScrollToLocalId) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (expValEquals('platform_editor_expand_on_scroll_to_block', 'isEnabled', true)) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Parse hash fragment for block ID (format: #block-{localId})
|
|
59
|
-
const hash = window.location.hash;
|
|
60
|
-
const defaultPrefixWithHash = `#${DEFAULT_BLOCK_LINK_HASH_PREFIX}`;
|
|
61
|
-
const blockId = hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
62
|
-
if (!blockId) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
let retryCount = 0;
|
|
66
|
-
// 5 second timeout based on dashboard showing ~4.96s TTI load time
|
|
67
|
-
const maxRetries = 20; // Maximum 20 retries (5 seconds at 250ms intervals)
|
|
68
|
-
const retryInterval = 250; // Check every 250ms
|
|
69
|
-
let intervalId = null;
|
|
70
|
-
const scrollToElement = () => {
|
|
71
|
-
if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
72
|
-
const element = getLocalIdSelector(blockId, containerRef.current);
|
|
73
|
-
if (element) {
|
|
74
|
-
element.scrollIntoView({
|
|
75
|
-
behavior: 'smooth'
|
|
76
|
-
});
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return false;
|
|
81
|
-
};
|
|
82
|
-
const attemptScroll = () => {
|
|
83
|
-
retryCount++;
|
|
84
|
-
|
|
85
|
-
// Try to scroll to element
|
|
86
|
-
if (scrollToElement()) {
|
|
87
|
-
if (intervalId) {
|
|
88
|
-
clearInterval(intervalId);
|
|
89
|
-
intervalId = null;
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Stop retrying if we've exceeded max retries
|
|
95
|
-
if (retryCount >= maxRetries) {
|
|
96
|
-
if (intervalId) {
|
|
97
|
-
clearInterval(intervalId);
|
|
98
|
-
intervalId = null;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
return false;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// Try to scroll immediately
|
|
106
|
-
if (attemptScroll()) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (((_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.readyState) === 'complete') {
|
|
110
|
-
// Document is already ready, try a few more times with delays
|
|
111
|
-
// This handles cases where elements are added after document ready
|
|
112
|
-
intervalId = setInterval(() => {
|
|
113
|
-
attemptScroll();
|
|
114
|
-
}, retryInterval);
|
|
115
|
-
} else {
|
|
116
|
-
// Document not ready yet, wait for it and then retry
|
|
117
|
-
intervalId = setInterval(() => {
|
|
118
|
-
var _getDocument2;
|
|
119
|
-
if (((_getDocument2 = getDocument()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.readyState) === 'complete') {
|
|
120
|
-
attemptScroll();
|
|
121
|
-
} else if (retryCount >= maxRetries) {
|
|
122
|
-
// Stop retrying even if document isn't ready
|
|
123
|
-
if (intervalId) {
|
|
124
|
-
clearInterval(intervalId);
|
|
125
|
-
intervalId = null;
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
retryCount++;
|
|
129
|
-
}
|
|
130
|
-
}, retryInterval);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Cleanup function
|
|
134
|
-
return () => {
|
|
135
|
-
if (intervalId) {
|
|
136
|
-
clearInterval(intervalId);
|
|
137
|
-
intervalId = null;
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}, [containerRef, shouldScrollToLocalId]);
|
|
141
|
-
};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { getDocument } from '@atlaskit/browser-apis';
|
|
3
|
-
import { DEFAULT_BLOCK_LINK_HASH_PREFIX } from '@atlaskit/editor-common/block-menu';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
-
|
|
6
|
-
// Find editor node dom with localId - similar to confluence useScrollOnUrlChange.ts
|
|
7
|
-
var getLocalIdSelector = function getLocalIdSelector(localId, container) {
|
|
8
|
-
// Check if the element with data-local-id exists
|
|
9
|
-
var element = container.querySelector("[data-local-id=\"".concat(localId, "\"]"));
|
|
10
|
-
if (element) {
|
|
11
|
-
return element;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Special case for decision lists and task lists which already have localId
|
|
15
|
-
element = container.querySelector("[data-decision-list-local-id=\"".concat(localId, "\"]"));
|
|
16
|
-
if (element) {
|
|
17
|
-
return element;
|
|
18
|
-
}
|
|
19
|
-
element = container.querySelector("[data-task-list-local-id=\"".concat(localId, "\"]"));
|
|
20
|
-
if (element) {
|
|
21
|
-
return element;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Special case for tables which use data-table-local-id
|
|
25
|
-
element = container.querySelector("[data-table-local-id=\"".concat(localId, "\"]"));
|
|
26
|
-
if (element) {
|
|
27
|
-
return element;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Special case for extension, smart cards and media which use lowercase localid
|
|
31
|
-
element = container.querySelector("[localid=\"".concat(localId, "\"]"));
|
|
32
|
-
if (element) {
|
|
33
|
-
return element;
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* useScrollToLocalId - Handler for block link scrolling in the renderer (traditional pages)
|
|
40
|
-
*
|
|
41
|
-
* This hook is deprecated in favor of useScrollToBlock which supports expanding parent nodes.
|
|
42
|
-
* This hook will be removed when the platform_editor_expand_on_scroll_to_block experiment is cleaned up.
|
|
43
|
-
*
|
|
44
|
-
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer).
|
|
45
|
-
* @param shouldScrollToLocalId - Whether scroll-to-block functionality should be enabled
|
|
46
|
-
*/
|
|
47
|
-
export var useScrollToLocalId = function useScrollToLocalId(containerRef, shouldScrollToLocalId) {
|
|
48
|
-
useEffect(function () {
|
|
49
|
-
var _getDocument;
|
|
50
|
-
// Only run in browser environment
|
|
51
|
-
if (typeof window === 'undefined' || !(containerRef !== null && containerRef !== void 0 && containerRef.current) || !shouldScrollToLocalId) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (expValEquals('platform_editor_expand_on_scroll_to_block', 'isEnabled', true)) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Parse hash fragment for block ID (format: #block-{localId})
|
|
59
|
-
var hash = window.location.hash;
|
|
60
|
-
var defaultPrefixWithHash = "#".concat(DEFAULT_BLOCK_LINK_HASH_PREFIX);
|
|
61
|
-
var blockId = hash.startsWith(defaultPrefixWithHash) ? hash.slice(defaultPrefixWithHash.length) : null;
|
|
62
|
-
if (!blockId) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
var retryCount = 0;
|
|
66
|
-
// 5 second timeout based on dashboard showing ~4.96s TTI load time
|
|
67
|
-
var maxRetries = 20; // Maximum 20 retries (5 seconds at 250ms intervals)
|
|
68
|
-
var retryInterval = 250; // Check every 250ms
|
|
69
|
-
var intervalId = null;
|
|
70
|
-
var scrollToElement = function scrollToElement() {
|
|
71
|
-
if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
72
|
-
var element = getLocalIdSelector(blockId, containerRef.current);
|
|
73
|
-
if (element) {
|
|
74
|
-
element.scrollIntoView({
|
|
75
|
-
behavior: 'smooth'
|
|
76
|
-
});
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return false;
|
|
81
|
-
};
|
|
82
|
-
var attemptScroll = function attemptScroll() {
|
|
83
|
-
retryCount++;
|
|
84
|
-
|
|
85
|
-
// Try to scroll to element
|
|
86
|
-
if (scrollToElement()) {
|
|
87
|
-
if (intervalId) {
|
|
88
|
-
clearInterval(intervalId);
|
|
89
|
-
intervalId = null;
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Stop retrying if we've exceeded max retries
|
|
95
|
-
if (retryCount >= maxRetries) {
|
|
96
|
-
if (intervalId) {
|
|
97
|
-
clearInterval(intervalId);
|
|
98
|
-
intervalId = null;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
return false;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// Try to scroll immediately
|
|
106
|
-
if (attemptScroll()) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (((_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.readyState) === 'complete') {
|
|
110
|
-
// Document is already ready, try a few more times with delays
|
|
111
|
-
// This handles cases where elements are added after document ready
|
|
112
|
-
intervalId = setInterval(function () {
|
|
113
|
-
attemptScroll();
|
|
114
|
-
}, retryInterval);
|
|
115
|
-
} else {
|
|
116
|
-
// Document not ready yet, wait for it and then retry
|
|
117
|
-
intervalId = setInterval(function () {
|
|
118
|
-
var _getDocument2;
|
|
119
|
-
if (((_getDocument2 = getDocument()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.readyState) === 'complete') {
|
|
120
|
-
attemptScroll();
|
|
121
|
-
} else if (retryCount >= maxRetries) {
|
|
122
|
-
// Stop retrying even if document isn't ready
|
|
123
|
-
if (intervalId) {
|
|
124
|
-
clearInterval(intervalId);
|
|
125
|
-
intervalId = null;
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
retryCount++;
|
|
129
|
-
}
|
|
130
|
-
}, retryInterval);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Cleanup function
|
|
134
|
-
return function () {
|
|
135
|
-
if (intervalId) {
|
|
136
|
-
clearInterval(intervalId);
|
|
137
|
-
intervalId = null;
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}, [containerRef, shouldScrollToLocalId]);
|
|
141
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useScrollToLocalId - Handler for block link scrolling in the renderer (traditional pages)
|
|
3
|
-
*
|
|
4
|
-
* This hook is deprecated in favor of useScrollToBlock which supports expanding parent nodes.
|
|
5
|
-
* This hook will be removed when the platform_editor_expand_on_scroll_to_block experiment is cleaned up.
|
|
6
|
-
*
|
|
7
|
-
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer).
|
|
8
|
-
* @param shouldScrollToLocalId - Whether scroll-to-block functionality should be enabled
|
|
9
|
-
*/
|
|
10
|
-
export declare const useScrollToLocalId: (containerRef?: React.RefObject<HTMLDivElement>, shouldScrollToLocalId?: boolean) => void;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useScrollToLocalId - Handler for block link scrolling in the renderer (traditional pages)
|
|
3
|
-
*
|
|
4
|
-
* This hook is deprecated in favor of useScrollToBlock which supports expanding parent nodes.
|
|
5
|
-
* This hook will be removed when the platform_editor_expand_on_scroll_to_block experiment is cleaned up.
|
|
6
|
-
*
|
|
7
|
-
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer).
|
|
8
|
-
* @param shouldScrollToLocalId - Whether scroll-to-block functionality should be enabled
|
|
9
|
-
*/
|
|
10
|
-
export declare const useScrollToLocalId: (containerRef?: React.RefObject<HTMLDivElement>, shouldScrollToLocalId?: boolean) => void;
|