@atlaskit/editor-common 111.7.2 → 111.7.4
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 +22 -0
- package/afm-cc/tsconfig.json +1 -1
- package/dist/cjs/element-browser/ElementBrowser.js +0 -2
- package/dist/cjs/element-browser/components/StatelessElementBrowser.js +2 -10
- package/dist/cjs/messages/placeholder-text.js +4 -4
- package/dist/cjs/messages/text-color.js +1 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/calculate-toolbar-position.js +147 -14
- package/dist/es2019/element-browser/ElementBrowser.js +0 -2
- package/dist/es2019/element-browser/components/StatelessElementBrowser.js +3 -11
- package/dist/es2019/messages/placeholder-text.js +4 -4
- package/dist/es2019/messages/text-color.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/calculate-toolbar-position.js +149 -13
- package/dist/esm/element-browser/ElementBrowser.js +0 -2
- package/dist/esm/element-browser/components/StatelessElementBrowser.js +3 -11
- package/dist/esm/messages/placeholder-text.js +4 -4
- package/dist/esm/messages/text-color.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/calculate-toolbar-position.js +146 -13
- package/dist/types/element-browser/ElementBrowser.d.ts +0 -7
- package/dist/types/element-browser/components/StatelessElementBrowser.d.ts +0 -14
- package/dist/types/messages/placeholder-text.d.ts +1 -1
- package/dist/types/utils/calculate-toolbar-position.d.ts +7 -0
- package/dist/types-ts4.5/element-browser/ElementBrowser.d.ts +0 -7
- package/dist/types-ts4.5/element-browser/components/StatelessElementBrowser.d.ts +0 -14
- package/dist/types-ts4.5/messages/placeholder-text.d.ts +1 -1
- package/dist/types-ts4.5/utils/calculate-toolbar-position.d.ts +7 -0
- package/package.json +6 -9
- package/dist/cjs/element-browser/ViewMore.js +0 -58
- package/dist/es2019/element-browser/ViewMore.js +0 -52
- package/dist/esm/element-browser/ViewMore.js +0 -51
- package/dist/types/element-browser/ViewMore.d.ts +0 -6
- package/dist/types-ts4.5/element-browser/ViewMore.d.ts +0 -6
|
@@ -110,7 +110,6 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
|
|
|
110
110
|
showCategories = _this$props.showCategories,
|
|
111
111
|
mode = _this$props.mode,
|
|
112
112
|
emptyStateHandler = _this$props.emptyStateHandler,
|
|
113
|
-
viewMoreItem = _this$props.viewMoreItem,
|
|
114
113
|
onViewMore = _this$props.onViewMore,
|
|
115
114
|
cache = _this$props.cache,
|
|
116
115
|
autoFocusSearch = _this$props.autoFocusSearch;
|
|
@@ -132,7 +131,6 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
|
|
|
132
131
|
mode: mode,
|
|
133
132
|
searchTerm: searchTerm,
|
|
134
133
|
emptyStateHandler: emptyStateHandler,
|
|
135
|
-
viewMoreItem: viewMoreItem,
|
|
136
134
|
cache: cache,
|
|
137
135
|
onViewMore: onViewMore,
|
|
138
136
|
autoFocusSearch: autoFocusSearch
|
|
@@ -11,15 +11,13 @@ import { css, jsx } from '@emotion/react';
|
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
12
|
import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext';
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
14
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
15
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
|
|
17
16
|
import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
|
|
18
|
-
import { ViewMore
|
|
17
|
+
import { ViewMore } from '../components/ViewMore';
|
|
19
18
|
import { DEVICE_BREAKPOINT_NUMBERS, ELEMENT_BROWSER_ID, ELEMENT_BROWSER_LIST_ID, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
|
|
20
19
|
import useContainerWidth from '../hooks/use-container-width';
|
|
21
20
|
import useSelectAndFocusOnArrowNavigation from '../hooks/use-select-and-focus-on-arrow-navigation';
|
|
22
|
-
import { ViewMore } from '../ViewMore';
|
|
23
21
|
import CategoryList from './CategoryList';
|
|
24
22
|
import ElementList from './ElementList/ElementList';
|
|
25
23
|
import ElementSearch from './ElementSearch';
|
|
@@ -120,7 +118,6 @@ function StatelessElementBrowser(props) {
|
|
|
120
118
|
var items = props.items,
|
|
121
119
|
onSelectItem = props.onSelectItem,
|
|
122
120
|
onInsertItem = props.onInsertItem,
|
|
123
|
-
viewMoreItem = props.viewMoreItem,
|
|
124
121
|
onViewMore = props.onViewMore,
|
|
125
122
|
selectedCategory = props.selectedCategory,
|
|
126
123
|
onSelectCategory = props.onSelectCategory,
|
|
@@ -160,7 +157,7 @@ function StatelessElementBrowser(props) {
|
|
|
160
157
|
var _items$index$isDisabl, _items$index;
|
|
161
158
|
return (_items$index$isDisabl = (_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.isDisabled) !== null && _items$index$isDisabl !== void 0 ? _items$index$isDisabl : false;
|
|
162
159
|
}, [items]);
|
|
163
|
-
var _useSelectAndFocusOnA = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount,
|
|
160
|
+
var _useSelectAndFocusOnA = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, !!onViewMore, itemIsDisabled, isFocusSearch, autoFocusSearch),
|
|
164
161
|
selectedItemIndex = _useSelectAndFocusOnA.selectedItemIndex,
|
|
165
162
|
focusedItemIndex = _useSelectAndFocusOnA.focusedItemIndex,
|
|
166
163
|
setFocusedItemIndex = _useSelectAndFocusOnA.setFocusedItemIndex,
|
|
@@ -262,7 +259,6 @@ function StatelessElementBrowser(props) {
|
|
|
262
259
|
setFocusOnSearch: setFocusOnSearch,
|
|
263
260
|
onKeyPress: onItemsEnterTabKeyPress,
|
|
264
261
|
onKeyDown: onKeyDown,
|
|
265
|
-
viewMoreItem: viewMoreItem,
|
|
266
262
|
onViewMore: onViewMore,
|
|
267
263
|
focusOnViewMore: focusOnViewMore,
|
|
268
264
|
cache: cache
|
|
@@ -313,7 +309,6 @@ function MobileBrowser(_ref) {
|
|
|
313
309
|
searchTerm = _ref.searchTerm,
|
|
314
310
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
315
311
|
emptyStateHandler = _ref.emptyStateHandler,
|
|
316
|
-
viewMoreItem = _ref.viewMoreItem,
|
|
317
312
|
onViewMore = _ref.onViewMore,
|
|
318
313
|
cache = _ref.cache,
|
|
319
314
|
_ref$focusOnEmptyStat = _ref.focusOnEmptyStateButton,
|
|
@@ -365,12 +360,9 @@ function MobileBrowser(_ref) {
|
|
|
365
360
|
selectedCategory: selectedCategory,
|
|
366
361
|
searchTerm: searchTerm,
|
|
367
362
|
cache: cache
|
|
368
|
-
})), onViewMore &&
|
|
363
|
+
})), onViewMore && jsx(ViewMore, {
|
|
369
364
|
onViewMore: onViewMore,
|
|
370
365
|
focus: focusOnViewMore
|
|
371
|
-
}), viewMoreItem && !fg('platform_editor_refactor_view_more') && jsx(ViewMore, {
|
|
372
|
-
item: viewMoreItem,
|
|
373
|
-
focus: focusOnViewMore
|
|
374
366
|
}))
|
|
375
367
|
);
|
|
376
368
|
}
|
|
@@ -40,9 +40,9 @@ export var placeholderTextMessages = defineMessages({
|
|
|
40
40
|
defaultMessage: ' to insert elements',
|
|
41
41
|
description: 'Text after slash in long empty node placeholder'
|
|
42
42
|
},
|
|
43
|
-
|
|
44
|
-
id: 'fabric.editor.
|
|
45
|
-
defaultMessage: 'Add content
|
|
46
|
-
description: 'Placeholder text for sync block'
|
|
43
|
+
sourceSyncBlockPlaceholderText: {
|
|
44
|
+
id: 'fabric.editor.sourceSyncBlockPlaceholderText',
|
|
45
|
+
defaultMessage: 'Add content you want to reuse. Copy and paste this block to sync in other locations.',
|
|
46
|
+
description: 'Placeholder text for source sync block'
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -12,7 +12,7 @@ export var textColorMessages = defineMessages({
|
|
|
12
12
|
},
|
|
13
13
|
textColorHighlightTooltip: {
|
|
14
14
|
id: 'fabric.editor.textColorHighlightTooltip',
|
|
15
|
-
defaultMessage: 'Text and
|
|
15
|
+
defaultMessage: 'Text and highlight color',
|
|
16
16
|
description: 'Tooltip of menu that provides access to various colors of highlight.'
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "111.7.
|
|
13
|
+
var packageVersion = "111.7.3";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "111.7.
|
|
24
|
+
var packageVersion = "111.7.3";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
2
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
var MAXIMUM_BROWSER_SCROLLBAR_WIDTH = 20;
|
|
5
6
|
|
|
6
7
|
/*
|
|
@@ -79,19 +80,36 @@ export var calculateToolbarPositionAboveSelection = function calculateToolbarPos
|
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
var findContainingElement = function findContainingElement(editorView) {
|
|
84
|
+
// First, try to find .fabric-editor-popup-scroll-parent
|
|
85
|
+
var scrollParent = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
86
|
+
if (scrollParent) {
|
|
87
|
+
return {
|
|
88
|
+
container: scrollParent,
|
|
89
|
+
isFixed: false
|
|
90
|
+
};
|
|
91
|
+
} else {
|
|
92
|
+
// If no scroll parent, look for a fixed positioned parent
|
|
93
|
+
var fixedParent = editorView.dom.parentElement;
|
|
94
|
+
while (fixedParent && fixedParent !== document.body) {
|
|
95
|
+
var computedStyle = window.getComputedStyle(fixedParent);
|
|
96
|
+
if (computedStyle.position === 'fixed') {
|
|
97
|
+
return {
|
|
98
|
+
container: fixedParent,
|
|
99
|
+
isFixed: true
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
fixedParent = fixedParent.parentElement;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Fall back to document.body if no fixed parent found
|
|
107
|
+
return {
|
|
108
|
+
container: document.body,
|
|
109
|
+
isFixed: false
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export var calculateToolbarPositionTrackHeadOld = function calculateToolbarPositionTrackHeadOld(toolbarTitle) {
|
|
95
113
|
return function (editorView, nextPos) {
|
|
96
114
|
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
97
115
|
if (!toolbar) {
|
|
@@ -161,6 +179,121 @@ export var calculateToolbarPositionTrackHead = function calculateToolbarPosition
|
|
|
161
179
|
};
|
|
162
180
|
};
|
|
163
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Same logic as calculateToolbarPositionTrackHeadOld, but with the following changes:
|
|
184
|
+
* - Uses a cached container to avoid repeated DOM traversal and getComputedStyle calls
|
|
185
|
+
* - Works when editor is nested within a fixed positioned parent, such as within a modal or sidebar
|
|
186
|
+
*/
|
|
187
|
+
export var calculateToolbarPositionTrackHeadNew = function calculateToolbarPositionTrackHeadNew(toolbarTitle) {
|
|
188
|
+
// Cache the container to avoid repeated DOM traversal and getComputedStyle calls
|
|
189
|
+
var cachedContainer = null;
|
|
190
|
+
var isFixedContainer = false;
|
|
191
|
+
var cachedEditorDom = null;
|
|
192
|
+
return function (editorView, nextPos) {
|
|
193
|
+
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
194
|
+
if (!toolbar) {
|
|
195
|
+
return nextPos;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Find and cache the container (only recalculates if editor DOM changed)
|
|
199
|
+
if (cachedEditorDom !== editorView.dom) {
|
|
200
|
+
cachedEditorDom = editorView.dom;
|
|
201
|
+
var _findContainingElemen = findContainingElement(editorView),
|
|
202
|
+
_container = _findContainingElemen.container,
|
|
203
|
+
isFixed = _findContainingElemen.isFixed;
|
|
204
|
+
cachedContainer = _container;
|
|
205
|
+
isFixedContainer = isFixed;
|
|
206
|
+
}
|
|
207
|
+
if (!cachedContainer) {
|
|
208
|
+
return nextPos;
|
|
209
|
+
}
|
|
210
|
+
var container = cachedContainer;
|
|
211
|
+
var containerBounds = container.getBoundingClientRect();
|
|
212
|
+
var selection = window && window.getSelection();
|
|
213
|
+
var moreRovoOptionsButton = document.querySelector('button[aria-label="More Rovo options"], [aria-label="More Rovo options"]');
|
|
214
|
+
var isMoreRovoOptionsButtonVisible = !!moreRovoOptionsButton && moreRovoOptionsButton instanceof HTMLElement && !!moreRovoOptionsButton.offsetParent;
|
|
215
|
+
var range = null;
|
|
216
|
+
if (isMoreRovoOptionsButtonVisible && fg('platform_editor_ai_generic_prep_for_aifc')) {
|
|
217
|
+
if (selection && selection.getRangeAt && selection.rangeCount > 0) {
|
|
218
|
+
var maybeRange = selection.getRangeAt(0);
|
|
219
|
+
if (maybeRange instanceof Range) {
|
|
220
|
+
range = maybeRange;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
} else {
|
|
224
|
+
if (selection && !selection.isCollapsed && selection.getRangeAt && selection.rangeCount > 0) {
|
|
225
|
+
var _maybeRange2 = selection.getRangeAt(0);
|
|
226
|
+
if (_maybeRange2 instanceof Range) {
|
|
227
|
+
range = _maybeRange2;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (!range) {
|
|
232
|
+
return nextPos;
|
|
233
|
+
}
|
|
234
|
+
var toolbarRect = toolbar.getBoundingClientRect();
|
|
235
|
+
var _editorView$state$sel3 = editorView.state.selection,
|
|
236
|
+
head = _editorView$state$sel3.head,
|
|
237
|
+
anchor = _editorView$state$sel3.anchor;
|
|
238
|
+
var topCoords = editorView.coordsAtPos(Math.min(head, anchor));
|
|
239
|
+
var bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
|
|
240
|
+
var top;
|
|
241
|
+
// If not the same line AND we are selecting downwards, display toolbar below.
|
|
242
|
+
if (head > anchor && topCoords.top !== bottomCoords.top) {
|
|
243
|
+
// We are taking the previous pos to the maxium, so avoid end of line positions
|
|
244
|
+
// returning the next line's rect.
|
|
245
|
+
top = (bottomCoords.top || 0) + toolbarRect.height / 1.15;
|
|
246
|
+
} else {
|
|
247
|
+
top = (topCoords.top || 0) - toolbarRect.height * 1.5;
|
|
248
|
+
}
|
|
249
|
+
var left = (head > anchor ? bottomCoords.right : topCoords.left) - toolbarRect.width / 2;
|
|
250
|
+
|
|
251
|
+
// Place toolbar below selection if not sufficient space above
|
|
252
|
+
if (top < containerBounds.top) {
|
|
253
|
+
var _getCoordsBelowSelect3 = getCoordsBelowSelection(bottomCoords, toolbarRect);
|
|
254
|
+
top = _getCoordsBelowSelect3.top;
|
|
255
|
+
left = _getCoordsBelowSelect3.left;
|
|
256
|
+
}
|
|
257
|
+
var leftCoord = Math.max(0, left - containerBounds.left);
|
|
258
|
+
if (leftCoord + toolbarRect.width > containerBounds.width) {
|
|
259
|
+
var _scrollbarWidth2 = MAXIMUM_BROWSER_SCROLLBAR_WIDTH;
|
|
260
|
+
leftCoord = Math.max(0, containerBounds.width - (toolbarRect.width + _scrollbarWidth2));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Apply scroll offset only for non-fixed containers
|
|
264
|
+
// Fixed positioned elements don't scroll with the page
|
|
265
|
+
var scrollOffset = isFixedContainer ? 0 : container.scrollTop;
|
|
266
|
+
return {
|
|
267
|
+
top: top - containerBounds.top + scrollOffset,
|
|
268
|
+
left: leftCoord
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/*
|
|
274
|
+
Calculates the position of the floating toolbar relative to the selection.
|
|
275
|
+
This implementation works in multiple scenarios:
|
|
276
|
+
- Standard scrollable containers with .fabric-editor-popup-scroll-parent
|
|
277
|
+
- Fixed positioned parent containers
|
|
278
|
+
- Falls back to document.body
|
|
279
|
+
|
|
280
|
+
The function automatically detects the container type and applies the appropriate
|
|
281
|
+
positioning logic and scroll offset handling.
|
|
282
|
+
|
|
283
|
+
Things to consider:
|
|
284
|
+
- stick as close to the head X release coordinates as possible
|
|
285
|
+
- coordinates of head X and getBoundingClientRect() are absolute in client viewport
|
|
286
|
+
- popup may appear in '.fabric-editor-popup-scroll-parent', fixed parent, or body
|
|
287
|
+
- we use the toolbarRect to center align toolbar
|
|
288
|
+
- use container bounds to clamp values
|
|
289
|
+
- for fixed positioning, no scroll offsets are applied
|
|
290
|
+
- for scrollable containers, scroll offsets are included
|
|
291
|
+
*/
|
|
292
|
+
export var calculateToolbarPositionTrackHead = function calculateToolbarPositionTrackHead(toolbarTitle) {
|
|
293
|
+
var isSelToolbarFixEnabled = expValEquals('platform_editor_sel_toolbar_fix', 'isEnabled', true);
|
|
294
|
+
return isSelToolbarFixEnabled ? calculateToolbarPositionTrackHeadNew(toolbarTitle) : calculateToolbarPositionTrackHeadOld(toolbarTitle);
|
|
295
|
+
};
|
|
296
|
+
|
|
164
297
|
/**
|
|
165
298
|
* Returns the coordintes at the bottom the selection.
|
|
166
299
|
*/
|
|
@@ -19,13 +19,6 @@ export interface Props {
|
|
|
19
19
|
onViewMore?: () => void;
|
|
20
20
|
showCategories: boolean;
|
|
21
21
|
showSearch: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @private
|
|
24
|
-
* @deprecated
|
|
25
|
-
* Deprecated in favour of onViewMore
|
|
26
|
-
* Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
27
|
-
*/
|
|
28
|
-
viewMoreItem?: QuickInsertItem;
|
|
29
22
|
}
|
|
30
23
|
export interface State {
|
|
31
24
|
categories: Category[];
|
|
@@ -27,13 +27,6 @@ export type StatelessElementBrowserProps = {
|
|
|
27
27
|
selectedCategory?: string;
|
|
28
28
|
showCategories: boolean;
|
|
29
29
|
showSearch: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @private
|
|
32
|
-
* @deprecated
|
|
33
|
-
* Deprecated in favour of onViewMore
|
|
34
|
-
* Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
35
|
-
*/
|
|
36
|
-
viewMoreItem?: QuickInsertItem;
|
|
37
30
|
} & WithAnalyticsEventsProps;
|
|
38
31
|
declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Omit<{
|
|
39
32
|
/**
|
|
@@ -54,12 +47,5 @@ declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRef
|
|
|
54
47
|
selectedCategory?: string;
|
|
55
48
|
showCategories: boolean;
|
|
56
49
|
showSearch: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* @private
|
|
59
|
-
* @deprecated
|
|
60
|
-
* Deprecated in favour of onViewMore
|
|
61
|
-
* Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
62
|
-
*/
|
|
63
|
-
viewMoreItem?: QuickInsertItem;
|
|
64
50
|
}, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "ref"> & React.RefAttributes<any>>>;
|
|
65
51
|
export default MemoizedElementBrowser;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { PopupPosition as Position } from '../ui';
|
|
3
3
|
export declare const calculateToolbarPositionAboveSelection: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
4
|
+
export declare const calculateToolbarPositionTrackHeadOld: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
5
|
+
/**
|
|
6
|
+
* Same logic as calculateToolbarPositionTrackHeadOld, but with the following changes:
|
|
7
|
+
* - Uses a cached container to avoid repeated DOM traversal and getComputedStyle calls
|
|
8
|
+
* - Works when editor is nested within a fixed positioned parent, such as within a modal or sidebar
|
|
9
|
+
*/
|
|
10
|
+
export declare const calculateToolbarPositionTrackHeadNew: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
4
11
|
export declare const calculateToolbarPositionTrackHead: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
5
12
|
export type CoordsAtPos = {
|
|
6
13
|
bottom: number;
|
|
@@ -19,13 +19,6 @@ export interface Props {
|
|
|
19
19
|
onViewMore?: () => void;
|
|
20
20
|
showCategories: boolean;
|
|
21
21
|
showSearch: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @private
|
|
24
|
-
* @deprecated
|
|
25
|
-
* Deprecated in favour of onViewMore
|
|
26
|
-
* Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
27
|
-
*/
|
|
28
|
-
viewMoreItem?: QuickInsertItem;
|
|
29
22
|
}
|
|
30
23
|
export interface State {
|
|
31
24
|
categories: Category[];
|
|
@@ -27,13 +27,6 @@ export type StatelessElementBrowserProps = {
|
|
|
27
27
|
selectedCategory?: string;
|
|
28
28
|
showCategories: boolean;
|
|
29
29
|
showSearch: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @private
|
|
32
|
-
* @deprecated
|
|
33
|
-
* Deprecated in favour of onViewMore
|
|
34
|
-
* Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
35
|
-
*/
|
|
36
|
-
viewMoreItem?: QuickInsertItem;
|
|
37
30
|
} & WithAnalyticsEventsProps;
|
|
38
31
|
declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Omit<{
|
|
39
32
|
/**
|
|
@@ -54,12 +47,5 @@ declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRef
|
|
|
54
47
|
selectedCategory?: string;
|
|
55
48
|
showCategories: boolean;
|
|
56
49
|
showSearch: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* @private
|
|
59
|
-
* @deprecated
|
|
60
|
-
* Deprecated in favour of onViewMore
|
|
61
|
-
* Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
62
|
-
*/
|
|
63
|
-
viewMoreItem?: QuickInsertItem;
|
|
64
50
|
}, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "ref"> & React.RefAttributes<any>>>;
|
|
65
51
|
export default MemoizedElementBrowser;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { PopupPosition as Position } from '../ui';
|
|
3
3
|
export declare const calculateToolbarPositionAboveSelection: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
4
|
+
export declare const calculateToolbarPositionTrackHeadOld: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
5
|
+
/**
|
|
6
|
+
* Same logic as calculateToolbarPositionTrackHeadOld, but with the following changes:
|
|
7
|
+
* - Uses a cached container to avoid repeated DOM traversal and getComputedStyle calls
|
|
8
|
+
* - Works when editor is nested within a fixed positioned parent, such as within a modal or sidebar
|
|
9
|
+
*/
|
|
10
|
+
export declare const calculateToolbarPositionTrackHeadNew: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
4
11
|
export declare const calculateToolbarPositionTrackHead: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
5
12
|
export type CoordsAtPos = {
|
|
6
13
|
bottom: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "111.7.
|
|
3
|
+
"version": "111.7.4",
|
|
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/"
|
|
@@ -70,20 +70,20 @@
|
|
|
70
70
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
71
71
|
"@atlaskit/popper": "^7.1.0",
|
|
72
72
|
"@atlaskit/primitives": "^17.0.0",
|
|
73
|
-
"@atlaskit/profilecard": "^24.
|
|
73
|
+
"@atlaskit/profilecard": "^24.30.0",
|
|
74
74
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
75
|
-
"@atlaskit/react-ufo": "^4.
|
|
75
|
+
"@atlaskit/react-ufo": "^4.17.0",
|
|
76
76
|
"@atlaskit/section-message": "^8.12.0",
|
|
77
77
|
"@atlaskit/smart-card": "^43.20.0",
|
|
78
78
|
"@atlaskit/smart-user-picker": "^8.9.0",
|
|
79
79
|
"@atlaskit/spinner": "^19.0.0",
|
|
80
|
-
"@atlaskit/status": "^3.
|
|
80
|
+
"@atlaskit/status": "^3.1.0",
|
|
81
81
|
"@atlaskit/task-decision": "^19.2.0",
|
|
82
82
|
"@atlaskit/textfield": "^8.2.0",
|
|
83
83
|
"@atlaskit/theme": "^21.0.0",
|
|
84
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
84
|
+
"@atlaskit/tmp-editor-statsig": "^16.18.0",
|
|
85
85
|
"@atlaskit/tokens": "^9.1.0",
|
|
86
|
-
"@atlaskit/tooltip": "^20.
|
|
86
|
+
"@atlaskit/tooltip": "^20.14.0",
|
|
87
87
|
"@atlaskit/width-detector": "^5.0.0",
|
|
88
88
|
"@babel/runtime": "^7.0.0",
|
|
89
89
|
"@compiled/react": "^0.18.6",
|
|
@@ -204,9 +204,6 @@
|
|
|
204
204
|
"editor_a11y_aria_label_removal_popup": {
|
|
205
205
|
"type": "boolean"
|
|
206
206
|
},
|
|
207
|
-
"platform_editor_refactor_view_more": {
|
|
208
|
-
"type": "boolean"
|
|
209
|
-
},
|
|
210
207
|
"platform_editor_bordered_panel_nested_in_table": {
|
|
211
208
|
"type": "boolean"
|
|
212
209
|
},
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ViewMore = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _react2 = require("@emotion/react");
|
|
9
|
-
var _menu = require("@atlaskit/menu");
|
|
10
|
-
/**
|
|
11
|
-
* @jsxRuntime classic
|
|
12
|
-
* @jsx jsx
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
|
-
|
|
17
|
-
var itemBefore = (0, _react2.css)({
|
|
18
|
-
width: '40px',
|
|
19
|
-
height: '40px',
|
|
20
|
-
boxSizing: 'border-box',
|
|
21
|
-
display: 'flex',
|
|
22
|
-
justifyContent: 'center',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
marginRight: "var(--ds-space-050, 4px)"
|
|
25
|
-
});
|
|
26
|
-
var ViewMore = exports.ViewMore = function ViewMore(_ref) {
|
|
27
|
-
var item = _ref.item,
|
|
28
|
-
focus = _ref.focus;
|
|
29
|
-
var ref = (0, _react.useRef)(null);
|
|
30
|
-
(0, _react.useEffect)(function () {
|
|
31
|
-
if (ref.current && focus) {
|
|
32
|
-
ref.current.focus();
|
|
33
|
-
}
|
|
34
|
-
}, [focus]);
|
|
35
|
-
return (0, _react2.jsx)(_menu.Section, {
|
|
36
|
-
hasSeparator: true
|
|
37
|
-
}, (0, _react2.jsx)(_menu.ButtonItem
|
|
38
|
-
// Ignored via go/ees005
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
-
, {
|
|
41
|
-
onClick: item.action
|
|
42
|
-
// Ignored via go/ees005
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
44
|
-
,
|
|
45
|
-
iconBefore: (0, _react2.jsx)("div", {
|
|
46
|
-
css: itemBefore
|
|
47
|
-
}, item.icon()),
|
|
48
|
-
"aria-describedby": item.title,
|
|
49
|
-
"data-testid": "view-more-elements-item"
|
|
50
|
-
// @ts-ignore Overriding Menu styles is not supported
|
|
51
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
52
|
-
,
|
|
53
|
-
css: (0, _react2.css)({
|
|
54
|
-
padding: "0px ".concat("var(--ds-space-150, 12px)")
|
|
55
|
-
}),
|
|
56
|
-
ref: ref
|
|
57
|
-
}, item.title));
|
|
58
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { useEffect, useRef } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import { ButtonItem, Section } from '@atlaskit/menu';
|
|
10
|
-
const itemBefore = css({
|
|
11
|
-
width: '40px',
|
|
12
|
-
height: '40px',
|
|
13
|
-
boxSizing: 'border-box',
|
|
14
|
-
display: 'flex',
|
|
15
|
-
justifyContent: 'center',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
marginRight: "var(--ds-space-050, 4px)"
|
|
18
|
-
});
|
|
19
|
-
export const ViewMore = ({
|
|
20
|
-
item,
|
|
21
|
-
focus
|
|
22
|
-
}) => {
|
|
23
|
-
const ref = useRef(null);
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (ref.current && focus) {
|
|
26
|
-
ref.current.focus();
|
|
27
|
-
}
|
|
28
|
-
}, [focus]);
|
|
29
|
-
return jsx(Section, {
|
|
30
|
-
hasSeparator: true
|
|
31
|
-
}, jsx(ButtonItem
|
|
32
|
-
// Ignored via go/ees005
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
, {
|
|
35
|
-
onClick: item.action
|
|
36
|
-
// Ignored via go/ees005
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
38
|
-
,
|
|
39
|
-
iconBefore: jsx("div", {
|
|
40
|
-
css: itemBefore
|
|
41
|
-
}, item.icon()),
|
|
42
|
-
"aria-describedby": item.title,
|
|
43
|
-
"data-testid": "view-more-elements-item"
|
|
44
|
-
// @ts-ignore Overriding Menu styles is not supported
|
|
45
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
46
|
-
,
|
|
47
|
-
css: css({
|
|
48
|
-
padding: `0px ${"var(--ds-space-150, 12px)"}`
|
|
49
|
-
}),
|
|
50
|
-
ref: ref
|
|
51
|
-
}, item.title));
|
|
52
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { useEffect, useRef } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import { ButtonItem, Section } from '@atlaskit/menu';
|
|
10
|
-
var itemBefore = css({
|
|
11
|
-
width: '40px',
|
|
12
|
-
height: '40px',
|
|
13
|
-
boxSizing: 'border-box',
|
|
14
|
-
display: 'flex',
|
|
15
|
-
justifyContent: 'center',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
marginRight: "var(--ds-space-050, 4px)"
|
|
18
|
-
});
|
|
19
|
-
export var ViewMore = function ViewMore(_ref) {
|
|
20
|
-
var item = _ref.item,
|
|
21
|
-
focus = _ref.focus;
|
|
22
|
-
var ref = useRef(null);
|
|
23
|
-
useEffect(function () {
|
|
24
|
-
if (ref.current && focus) {
|
|
25
|
-
ref.current.focus();
|
|
26
|
-
}
|
|
27
|
-
}, [focus]);
|
|
28
|
-
return jsx(Section, {
|
|
29
|
-
hasSeparator: true
|
|
30
|
-
}, jsx(ButtonItem
|
|
31
|
-
// Ignored via go/ees005
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
, {
|
|
34
|
-
onClick: item.action
|
|
35
|
-
// Ignored via go/ees005
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
|
-
,
|
|
38
|
-
iconBefore: jsx("div", {
|
|
39
|
-
css: itemBefore
|
|
40
|
-
}, item.icon()),
|
|
41
|
-
"aria-describedby": item.title,
|
|
42
|
-
"data-testid": "view-more-elements-item"
|
|
43
|
-
// @ts-ignore Overriding Menu styles is not supported
|
|
44
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
45
|
-
,
|
|
46
|
-
css: css({
|
|
47
|
-
padding: "0px ".concat("var(--ds-space-150, 12px)")
|
|
48
|
-
}),
|
|
49
|
-
ref: ref
|
|
50
|
-
}, item.title));
|
|
51
|
-
};
|