@atlaskit/editor-common 119.16.4 → 120.0.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 +46 -0
- package/codemods/117.0.0-upgrade-react-peer-dependencies.ts +6 -0
- package/dist/cjs/media-insert/rank.js +11 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/node-anchor/limited-mode-document-thresholds.js +41 -3
- package/dist/cjs/node-anchor/node-anchor-provider.js +5 -46
- package/dist/cjs/node-anchor/should-enable-limited-mode.js +52 -0
- package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +128 -0
- package/dist/cjs/quick-insert/QuickInsertMenuItem.js +24 -45
- package/dist/cjs/quick-insert/TypeAheadQuickInsertMenuItem.js +56 -0
- package/dist/cjs/quick-insert/quickInsertMenuItemUtils.js +22 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/media-insert/rank.js +7 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/node-anchor/limited-mode-document-thresholds.js +39 -2
- package/dist/es2019/node-anchor/node-anchor-provider.js +5 -48
- package/dist/es2019/node-anchor/should-enable-limited-mode.js +47 -0
- package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +123 -0
- package/dist/es2019/quick-insert/QuickInsertMenuItem.js +24 -38
- package/dist/es2019/quick-insert/TypeAheadQuickInsertMenuItem.js +51 -0
- package/dist/es2019/quick-insert/quickInsertMenuItemUtils.js +13 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/media-insert/rank.js +4 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/node-anchor/limited-mode-document-thresholds.js +41 -2
- package/dist/esm/node-anchor/node-anchor-provider.js +5 -46
- package/dist/esm/node-anchor/should-enable-limited-mode.js +46 -0
- package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +121 -0
- package/dist/esm/quick-insert/QuickInsertMenuItem.js +24 -43
- package/dist/esm/quick-insert/TypeAheadQuickInsertMenuItem.js +49 -0
- package/dist/esm/quick-insert/quickInsertMenuItemUtils.js +16 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/media-insert/rank.d.ts +3 -0
- package/dist/types/node-anchor/limited-mode-document-thresholds.d.ts +29 -2
- package/dist/types/node-anchor/should-enable-limited-mode.d.ts +21 -0
- package/dist/types/quick-insert/ElementBrowserQuickInsertMenuItem.d.ts +3 -0
- package/dist/types/quick-insert/QuickInsertContext.d.ts +1 -0
- package/dist/types/quick-insert/QuickInsertMenuItem.d.ts +8 -8
- package/dist/types/quick-insert/TypeAheadQuickInsertMenuItem.d.ts +3 -0
- package/dist/types/quick-insert/quickInsertMenuItemUtils.d.ts +2 -0
- package/media-insert/rank/package.json +10 -0
- package/package.json +2 -2
- package/should-enable-limited-mode/package.json +10 -0
- /package/dist/cjs/quick-insert/{QuickInsertMenuItem.compiled.css → TypeAheadQuickInsertMenuItem.compiled.css} +0 -0
- /package/dist/es2019/quick-insert/{QuickInsertMenuItem.compiled.css → TypeAheadQuickInsertMenuItem.compiled.css} +0 -0
- /package/dist/esm/quick-insert/{QuickInsertMenuItem.compiled.css → TypeAheadQuickInsertMenuItem.compiled.css} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- Compiled primitives do not provide Pressable.
|
|
4
|
+
import { Box, Inline, Pressable, Stack, Text, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import { useQuickInsertMenuItemSelection } from './quickInsertMenuItemUtils';
|
|
6
|
+
import { useQuickInsertContext } from './useQuickInsertContext';
|
|
7
|
+
var itemStyles = xcss({
|
|
8
|
+
alignItems: 'start',
|
|
9
|
+
backgroundColor: 'color.background.neutral.subtle',
|
|
10
|
+
borderColor: 'color.border',
|
|
11
|
+
borderRadius: 'radius.medium',
|
|
12
|
+
borderStyle: 'solid',
|
|
13
|
+
borderWidth: 'border.width',
|
|
14
|
+
color: 'color.text',
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
gap: 'space.150',
|
|
18
|
+
padding: 'space.150',
|
|
19
|
+
textAlign: 'start',
|
|
20
|
+
width: '100%'
|
|
21
|
+
});
|
|
22
|
+
var selectedItemStyles = xcss({
|
|
23
|
+
alignItems: 'start',
|
|
24
|
+
backgroundColor: 'color.background.selected',
|
|
25
|
+
borderColor: 'color.border.selected',
|
|
26
|
+
borderRadius: 'radius.medium',
|
|
27
|
+
borderStyle: 'solid',
|
|
28
|
+
borderWidth: 'border.width',
|
|
29
|
+
color: 'color.text',
|
|
30
|
+
cursor: 'pointer',
|
|
31
|
+
display: 'flex',
|
|
32
|
+
gap: 'space.150',
|
|
33
|
+
padding: 'space.150',
|
|
34
|
+
textAlign: 'start',
|
|
35
|
+
width: '100%'
|
|
36
|
+
});
|
|
37
|
+
var disabledItemStyles = xcss({
|
|
38
|
+
alignItems: 'start',
|
|
39
|
+
backgroundColor: 'color.background.neutral.subtle',
|
|
40
|
+
borderColor: 'color.border',
|
|
41
|
+
borderRadius: 'radius.medium',
|
|
42
|
+
borderStyle: 'solid',
|
|
43
|
+
borderWidth: 'border.width',
|
|
44
|
+
color: 'color.text.disabled',
|
|
45
|
+
cursor: 'not-allowed',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
gap: 'space.150',
|
|
48
|
+
padding: 'space.150',
|
|
49
|
+
textAlign: 'start',
|
|
50
|
+
width: '100%'
|
|
51
|
+
});
|
|
52
|
+
var iconStyles = xcss({
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
backgroundColor: 'elevation.surface.overlay',
|
|
55
|
+
borderColor: 'color.border',
|
|
56
|
+
borderRadius: 'radius.medium',
|
|
57
|
+
borderStyle: 'solid',
|
|
58
|
+
borderWidth: 'border.width',
|
|
59
|
+
display: 'flex',
|
|
60
|
+
flexShrink: 0,
|
|
61
|
+
height: '40px',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
overflow: 'hidden',
|
|
64
|
+
width: '40px'
|
|
65
|
+
});
|
|
66
|
+
var descriptionStyles = xcss({
|
|
67
|
+
color: 'color.text.subtle'
|
|
68
|
+
});
|
|
69
|
+
var shortcutStyles = xcss({
|
|
70
|
+
backgroundColor: 'color.background.neutral',
|
|
71
|
+
borderRadius: 'radius.small',
|
|
72
|
+
color: 'color.text.subtle',
|
|
73
|
+
font: 'font.body.small',
|
|
74
|
+
paddingBlock: 'space.025',
|
|
75
|
+
paddingInline: 'space.050'
|
|
76
|
+
});
|
|
77
|
+
export var ElementBrowserQuickInsertMenuItem = function ElementBrowserQuickInsertMenuItem(_ref) {
|
|
78
|
+
var ariaLabel = _ref.ariaLabel,
|
|
79
|
+
description = _ref.description,
|
|
80
|
+
iconBefore = _ref.iconBefore,
|
|
81
|
+
isDisabled = _ref.isDisabled,
|
|
82
|
+
onSelect = _ref.onSelect,
|
|
83
|
+
shortcut = _ref.shortcut,
|
|
84
|
+
_ref$shouldWrapIcon = _ref.shouldWrapIcon,
|
|
85
|
+
shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
|
|
86
|
+
title = _ref.title;
|
|
87
|
+
var _useQuickInsertContex = useQuickInsertContext(),
|
|
88
|
+
item = _useQuickInsertContex.item;
|
|
89
|
+
var _ref2 = item !== null && item !== void 0 ? item : {
|
|
90
|
+
id: undefined,
|
|
91
|
+
isSelected: false
|
|
92
|
+
},
|
|
93
|
+
id = _ref2.id,
|
|
94
|
+
isSelected = _ref2.isSelected;
|
|
95
|
+
var handleClick = useQuickInsertMenuItemSelection(onSelect);
|
|
96
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
97
|
+
"aria-label": ariaLabel,
|
|
98
|
+
"aria-selected": isSelected,
|
|
99
|
+
id: id,
|
|
100
|
+
isDisabled: isDisabled,
|
|
101
|
+
onClick: handleClick,
|
|
102
|
+
role: "option",
|
|
103
|
+
xcss: isDisabled ? disabledItemStyles : isSelected ? selectedItemStyles : itemStyles
|
|
104
|
+
}, iconBefore && shouldWrapIcon ? /*#__PURE__*/React.createElement(Box, {
|
|
105
|
+
xcss: iconStyles
|
|
106
|
+
}, iconBefore) : iconBefore, /*#__PURE__*/React.createElement(Stack, {
|
|
107
|
+
space: "space.050",
|
|
108
|
+
grow: "fill"
|
|
109
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
110
|
+
alignBlock: "center",
|
|
111
|
+
spread: "space-between",
|
|
112
|
+
space: "space.100"
|
|
113
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
114
|
+
weight: "medium"
|
|
115
|
+
}, title), shortcut && /*#__PURE__*/React.createElement(Box, {
|
|
116
|
+
as: "span",
|
|
117
|
+
xcss: shortcutStyles
|
|
118
|
+
}, shortcut)), description && /*#__PURE__*/React.createElement(Box, {
|
|
119
|
+
xcss: descriptionStyles
|
|
120
|
+
}, /*#__PURE__*/React.createElement(Text, null, description))));
|
|
121
|
+
};
|
|
@@ -1,54 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import React, { useCallback } from 'react';
|
|
5
|
-
import ButtonItem from '@atlaskit/menu/button-item';
|
|
6
|
-
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ElementBrowserQuickInsertMenuItem } from './ElementBrowserQuickInsertMenuItem';
|
|
3
|
+
import { TypeAheadQuickInsertMenuItem } from './TypeAheadQuickInsertMenuItem';
|
|
7
4
|
import { useQuickInsertContext } from './useQuickInsertContext';
|
|
8
|
-
var styles = {
|
|
9
|
-
icon: "_2rko1qi0 _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg",
|
|
10
|
-
shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu"
|
|
11
|
-
};
|
|
12
5
|
export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
|
|
13
|
-
var _item$isSelected;
|
|
14
6
|
var ariaLabel = _ref.ariaLabel,
|
|
7
|
+
description = _ref.description,
|
|
15
8
|
iconBefore = _ref.iconBefore,
|
|
16
9
|
isDisabled = _ref.isDisabled,
|
|
17
10
|
onSelect = _ref.onSelect,
|
|
18
11
|
shortcut = _ref.shortcut,
|
|
19
|
-
|
|
20
|
-
shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
|
|
12
|
+
shouldWrapIcon = _ref.shouldWrapIcon,
|
|
21
13
|
title = _ref.title;
|
|
22
14
|
var _useQuickInsertContex = useQuickInsertContext(),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return select(function (selectionContext) {
|
|
29
|
-
return onSelect({
|
|
30
|
-
editorView: editorView,
|
|
31
|
-
insert: selectionContext.insert,
|
|
32
|
-
source: selectionContext.source
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
}, [editorView, onSelect, select]);
|
|
36
|
-
return /*#__PURE__*/React.createElement(ButtonItem, {
|
|
37
|
-
"aria-label": ariaLabel,
|
|
38
|
-
"aria-selected": isSelected,
|
|
39
|
-
iconBefore: iconBefore && shouldWrapIcon ? /*#__PURE__*/React.createElement(Box, {
|
|
40
|
-
xcss: styles.icon
|
|
41
|
-
}, iconBefore) : iconBefore,
|
|
42
|
-
id: item === null || item === void 0 ? void 0 : item.id,
|
|
15
|
+
surface = _useQuickInsertContex.surface;
|
|
16
|
+
return surface === 'element-browser' ? /*#__PURE__*/React.createElement(ElementBrowserQuickInsertMenuItem, {
|
|
17
|
+
ariaLabel: ariaLabel,
|
|
18
|
+
description: description,
|
|
19
|
+
iconBefore: iconBefore,
|
|
43
20
|
isDisabled: isDisabled,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
21
|
+
onSelect: onSelect,
|
|
22
|
+
shortcut: shortcut,
|
|
23
|
+
shouldWrapIcon: shouldWrapIcon,
|
|
24
|
+
title: title
|
|
25
|
+
}) : /*#__PURE__*/React.createElement(TypeAheadQuickInsertMenuItem, {
|
|
26
|
+
ariaLabel: ariaLabel,
|
|
27
|
+
description: description,
|
|
28
|
+
iconBefore: iconBefore,
|
|
29
|
+
isDisabled: isDisabled,
|
|
30
|
+
onSelect: onSelect,
|
|
31
|
+
shortcut: shortcut,
|
|
32
|
+
shouldWrapIcon: shouldWrapIcon,
|
|
33
|
+
title: title
|
|
34
|
+
});
|
|
54
35
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* TypeAheadQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
+
import "./TypeAheadQuickInsertMenuItem.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import ButtonItem from '@atlaskit/menu/button-item';
|
|
6
|
+
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
7
|
+
import { useQuickInsertMenuItemSelection } from './quickInsertMenuItemUtils';
|
|
8
|
+
import { useQuickInsertContext } from './useQuickInsertContext';
|
|
9
|
+
var styles = {
|
|
10
|
+
icon: "_2rko1qi0 _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg",
|
|
11
|
+
shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu"
|
|
12
|
+
};
|
|
13
|
+
export var TypeAheadQuickInsertMenuItem = function TypeAheadQuickInsertMenuItem(_ref) {
|
|
14
|
+
var ariaLabel = _ref.ariaLabel,
|
|
15
|
+
iconBefore = _ref.iconBefore,
|
|
16
|
+
isDisabled = _ref.isDisabled,
|
|
17
|
+
onSelect = _ref.onSelect,
|
|
18
|
+
shortcut = _ref.shortcut,
|
|
19
|
+
_ref$shouldWrapIcon = _ref.shouldWrapIcon,
|
|
20
|
+
shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
|
|
21
|
+
title = _ref.title;
|
|
22
|
+
var _useQuickInsertContex = useQuickInsertContext(),
|
|
23
|
+
item = _useQuickInsertContex.item;
|
|
24
|
+
var _ref2 = item !== null && item !== void 0 ? item : {
|
|
25
|
+
id: undefined,
|
|
26
|
+
isSelected: false
|
|
27
|
+
},
|
|
28
|
+
id = _ref2.id,
|
|
29
|
+
isSelected = _ref2.isSelected;
|
|
30
|
+
var handleClick = useQuickInsertMenuItemSelection(onSelect);
|
|
31
|
+
return /*#__PURE__*/React.createElement(ButtonItem, {
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
"aria-selected": isSelected,
|
|
34
|
+
iconBefore: iconBefore && shouldWrapIcon ? /*#__PURE__*/React.createElement(Box, {
|
|
35
|
+
xcss: styles.icon
|
|
36
|
+
}, iconBefore) : iconBefore,
|
|
37
|
+
id: id,
|
|
38
|
+
isDisabled: isDisabled,
|
|
39
|
+
isSelected: isSelected,
|
|
40
|
+
onClick: handleClick,
|
|
41
|
+
role: "option"
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
43
|
+
alignBlock: "center",
|
|
44
|
+
spread: "space-between"
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Text, null, title), shortcut && /*#__PURE__*/React.createElement(Box, {
|
|
46
|
+
as: "span",
|
|
47
|
+
xcss: styles.shortcut
|
|
48
|
+
}, shortcut)));
|
|
49
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useQuickInsertContext } from './useQuickInsertContext';
|
|
3
|
+
export var useQuickInsertMenuItemSelection = function useQuickInsertMenuItemSelection(onSelect) {
|
|
4
|
+
var _useQuickInsertContex = useQuickInsertContext(),
|
|
5
|
+
editorView = _useQuickInsertContex.editorView,
|
|
6
|
+
select = _useQuickInsertContex.select;
|
|
7
|
+
return useCallback(function () {
|
|
8
|
+
return select(function (selectionContext) {
|
|
9
|
+
return onSelect({
|
|
10
|
+
editorView: editorView,
|
|
11
|
+
insert: selectionContext.insert,
|
|
12
|
+
source: selectionContext.source
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}, [editorView, onSelect, select]);
|
|
16
|
+
};
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "119.
|
|
24
|
+
var packageVersion = "119.17.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
/** Fixed document thresholds for limited (performance) mode (previously Statsig-driven). */
|
|
2
2
|
export declare const LIMITED_MODE_DEFAULT_NODE_COUNT_THRESHOLD = 5000;
|
|
3
3
|
export declare const LIMITED_MODE_DEFAULT_DOC_SIZE_THRESHOLD = 30000;
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Treatment node-count threshold. Production node-count percentiles across all documents are
|
|
6
|
+
* p90 ≈ 206, p95 ≈ 576, p99 ≈ 2,438 — today's 5,000 sits beyond p99 and fires on only ~0.36% of
|
|
7
|
+
* documents. 2,500 is p99 rounded, i.e. limited mode becomes a guard on the largest ~1% of pages.
|
|
8
|
+
*
|
|
9
|
+
* Deliberately NOT lower: the worst-5%-by-INP cohort has a median document of ~25 nodes, so its
|
|
10
|
+
* slowness is device/extension/collab-bound and structurally invisible. No node-count value catches
|
|
11
|
+
* it without enabling limited mode for nearly everyone (300 nodes ⇒ 8% of all sessions for 34%
|
|
12
|
+
* recall). Chasing that cohort needs a runtime input-latency trigger, not a bigger document guard.
|
|
13
|
+
*/
|
|
14
|
+
export declare const LIMITED_MODE_TWEAKED_NODE_COUNT_THRESHOLD = 2438;
|
|
15
|
+
/**
|
|
16
|
+
* Treatment `nodeSize` threshold — a backstop for pathologically huge documents, not a routine
|
|
17
|
+
* trigger. Input latency really does degrade at extreme document sizes: the 100k+ `nodeSize` bucket
|
|
18
|
+
* sits at p90 113.5ms / p99 899ms, against p90 25.6ms in the 6k–11k bucket. But that curve is smooth
|
|
19
|
+
* and only becomes severe far past the body of the distribution (production `nodeSize` p99 is
|
|
20
|
+
* ~91.8k), so this is set well beyond p99 rather than at the control's 30,000 — which fires around
|
|
21
|
+
* p95 and so degrades a large population of plain long-text pages that type perfectly well.
|
|
22
|
+
*/
|
|
23
|
+
export declare const LIMITED_MODE_TWEAKED_DOC_SIZE_THRESHOLD = 750000;
|
|
24
|
+
export type LimitedModeThresholds = {
|
|
25
|
+
docSizeThreshold: number;
|
|
26
|
+
nodeCountThreshold: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The document thresholds currently in force. This is the only place the cohort is resolved — the
|
|
30
|
+
* limited-mode decision itself is identical either way, only these two numbers change.
|
|
31
|
+
*/
|
|
32
|
+
export declare const getLimitedModeThresholds: () => LimitedModeThresholds;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
/**
|
|
3
|
+
* Single source of truth for the limited (performance) mode decision.
|
|
4
|
+
*
|
|
5
|
+
* Shared by the limited-mode plugin (`editor-plugin-limited-mode/src/pm-plugins/main.ts`) and the
|
|
6
|
+
* node-anchor provider (`node-anchor-provider.ts`) so the logic can no longer drift between two
|
|
7
|
+
* hand-synced copies. It lives in `editor-common` to avoid a circular dependency (the plugin already
|
|
8
|
+
* depends on `editor-common`; `editor-common` must not depend on the plugin).
|
|
9
|
+
*
|
|
10
|
+
* Limited mode is enabled when ANY of the following is true:
|
|
11
|
+
* 1. `doc.nodeSize` exceeds the doc-size threshold (checked first, O(1))
|
|
12
|
+
* 2. the document contains a legacy-content macro (LCM)
|
|
13
|
+
* 3. node count exceeds the node-count threshold
|
|
14
|
+
*
|
|
15
|
+
* The thresholds come from `getLimitedModeThresholds()`, which is where the
|
|
16
|
+
* `platform_editor_limited_threshold_tweaks` cohort is resolved — see
|
|
17
|
+
* `limited-mode-document-thresholds.ts` for the values and the data behind them.
|
|
18
|
+
*
|
|
19
|
+
* Performance: doc size is checked first so an oversized document skips the traversal entirely.
|
|
20
|
+
*/
|
|
21
|
+
export declare const shouldEnableLimitedModeForDocument: (doc: PMNode) => boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QuickInsertMenuItemProps } from './QuickInsertMenuItem';
|
|
3
|
+
export declare const ElementBrowserQuickInsertMenuItem: ({ ariaLabel, description, iconBefore, isDisabled, onSelect, shortcut, shouldWrapIcon, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
|
|
@@ -18,5 +18,6 @@ export type QuickInsertContextValue = {
|
|
|
18
18
|
menuOpenId?: symbol;
|
|
19
19
|
select: (selectionHandler: QuickInsertSelectionHandler) => void;
|
|
20
20
|
surfaceContext?: SurfaceContext;
|
|
21
|
+
surface: 'typeahead' | 'element-browser';
|
|
21
22
|
};
|
|
22
23
|
export declare const QuickInsertContext: Context<QuickInsertContextValue | null>;
|
|
@@ -3,8 +3,14 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import type { INPUT_METHOD } from '../analytics';
|
|
5
5
|
import type { TypeAheadInsert } from '../types';
|
|
6
|
-
type
|
|
6
|
+
export type OnSelectContext = {
|
|
7
|
+
editorView: EditorView;
|
|
8
|
+
insert: TypeAheadInsert;
|
|
9
|
+
source: INPUT_METHOD.ELEMENT_BROWSER | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
|
|
10
|
+
};
|
|
11
|
+
export type QuickInsertMenuItemProps = {
|
|
7
12
|
ariaLabel?: string;
|
|
13
|
+
description?: string;
|
|
8
14
|
iconBefore?: React.ReactNode;
|
|
9
15
|
isDisabled?: boolean;
|
|
10
16
|
onSelect: (context: OnSelectContext) => Transaction | false | void;
|
|
@@ -12,10 +18,4 @@ type Props = {
|
|
|
12
18
|
shouldWrapIcon?: boolean;
|
|
13
19
|
title: string;
|
|
14
20
|
};
|
|
15
|
-
export
|
|
16
|
-
editorView: EditorView;
|
|
17
|
-
insert: TypeAheadInsert;
|
|
18
|
-
source: INPUT_METHOD.ELEMENT_BROWSER | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
|
|
19
|
-
};
|
|
20
|
-
export declare const QuickInsertMenuItem: ({ ariaLabel, iconBefore, isDisabled, onSelect, shortcut, shouldWrapIcon, title, }: Props) => React.JSX.Element;
|
|
21
|
-
export {};
|
|
21
|
+
export declare const QuickInsertMenuItem: ({ ariaLabel, description, iconBefore, isDisabled, onSelect, shortcut, shouldWrapIcon, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QuickInsertMenuItemProps } from './QuickInsertMenuItem';
|
|
3
|
+
export declare const TypeAheadQuickInsertMenuItem: ({ ariaLabel, iconBefore, isDisabled, onSelect, shortcut, shouldWrapIcon, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/media-insert/rank",
|
|
3
|
+
"main": "../../dist/cjs/media-insert/rank.js",
|
|
4
|
+
"module": "../../dist/esm/media-insert/rank.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/media-insert/rank.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/media-insert/rank.d.ts"
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "120.0.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/activity-provider": "^3.0.0",
|
|
32
|
-
"@atlaskit/adf-schema": "^57.
|
|
32
|
+
"@atlaskit/adf-schema": "^57.1.0",
|
|
33
33
|
"@atlaskit/adf-utils": "^20.7.0",
|
|
34
34
|
"@atlaskit/afm-i18n-platform-editor-editor-common": "2.200.0",
|
|
35
35
|
"@atlaskit/analytics-listeners": "^11.1.0",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/should-enable-limited-mode",
|
|
3
|
+
"main": "../dist/cjs/node-anchor/should-enable-limited-mode.js",
|
|
4
|
+
"module": "../dist/esm/node-anchor/should-enable-limited-mode.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/node-anchor/should-enable-limited-mode.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/node-anchor/should-enable-limited-mode.d.ts"
|
|
10
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|