@atlaskit/editor-common 82.0.1 → 82.1.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 +26 -0
- package/dist/cjs/element-browser/components/ElementList/ElementList.js +123 -27
- package/dist/cjs/element-browser/components/StatelessElementBrowser.js +7 -1
- package/dist/cjs/element-browser/constants.js +3 -2
- package/dist/cjs/mark/commands.js +8 -1
- package/dist/cjs/monitoring/environment.js +22 -0
- package/dist/cjs/monitoring/error.js +3 -2
- package/dist/cjs/styles/shared/annotation.js +67 -42
- package/dist/cjs/styles/shared/background-color.js +11 -13
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/annotation/index.js +11 -3
- package/dist/cjs/utils/validator.js +24 -27
- package/dist/es2019/element-browser/components/ElementList/ElementList.js +100 -6
- package/dist/es2019/element-browser/components/StatelessElementBrowser.js +7 -1
- package/dist/es2019/element-browser/constants.js +2 -1
- package/dist/es2019/mark/commands.js +8 -1
- package/dist/es2019/monitoring/environment.js +16 -0
- package/dist/es2019/monitoring/error.js +3 -2
- package/dist/es2019/styles/shared/annotation.js +70 -43
- package/dist/es2019/styles/shared/background-color.js +3 -3
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/annotation/index.js +11 -3
- package/dist/es2019/utils/validator.js +24 -24
- package/dist/esm/element-browser/components/ElementList/ElementList.js +124 -28
- package/dist/esm/element-browser/components/StatelessElementBrowser.js +7 -1
- package/dist/esm/element-browser/constants.js +2 -1
- package/dist/esm/mark/commands.js +8 -1
- package/dist/esm/monitoring/environment.js +16 -0
- package/dist/esm/monitoring/error.js +3 -2
- package/dist/esm/styles/shared/annotation.js +67 -42
- package/dist/esm/styles/shared/background-color.js +11 -13
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/annotation/index.js +11 -3
- package/dist/esm/utils/validator.js +24 -27
- package/dist/types/element-browser/components/ElementList/ElementList.d.ts +1 -0
- package/dist/types/element-browser/constants.d.ts +1 -0
- package/dist/types/monitoring/environment.d.ts +1 -0
- package/dist/types/styles/shared/background-color.d.ts +1 -1
- package/dist/types-ts4.5/element-browser/components/ElementList/ElementList.d.ts +1 -0
- package/dist/types-ts4.5/element-browser/constants.d.ts +1 -0
- package/dist/types-ts4.5/monitoring/environment.d.ts +1 -0
- package/dist/types-ts4.5/styles/shared/background-color.d.ts +1 -1
- package/package.json +12 -6
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "selectedCategoryIndex", "searchTerm", "setFocusedCategoryIndex", "setFocusedItemIndex"];
|
|
4
|
+
var _excluded = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "columnCount", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "selectedCategoryIndex", "searchTerm", "setFocusedCategoryIndex", "setFocusedItemIndex"];
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import React, { Fragment, memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import { Grid } from 'react-virtualized';
|
|
8
9
|
import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer';
|
|
10
|
+
import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
9
11
|
import { Collection } from 'react-virtualized/dist/commonjs/Collection';
|
|
10
12
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
11
13
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
@@ -17,7 +19,7 @@ import { borderRadius } from '@atlaskit/theme/constants';
|
|
|
17
19
|
import Tooltip from '@atlaskit/tooltip';
|
|
18
20
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../../analytics';
|
|
19
21
|
import { IconFallback } from '../../../quick-insert';
|
|
20
|
-
import { ELEMENT_LIST_PADDING, SCROLLBAR_WIDTH } from '../../constants';
|
|
22
|
+
import { ELEMENT_ITEM_HEIGHT, ELEMENT_ITEM_PADDING, ELEMENT_LIST_PADDING, SCROLLBAR_WIDTH } from '../../constants';
|
|
21
23
|
import useContainerWidth from '../../hooks/use-container-width';
|
|
22
24
|
import useFocus from '../../hooks/use-focus';
|
|
23
25
|
import { Modes } from '../../types';
|
|
@@ -46,6 +48,7 @@ function ElementList(_ref) {
|
|
|
46
48
|
mode = _ref.mode,
|
|
47
49
|
selectedItemIndex = _ref.selectedItemIndex,
|
|
48
50
|
focusedItemIndex = _ref.focusedItemIndex,
|
|
51
|
+
columnCount = _ref.columnCount,
|
|
49
52
|
setColumnCount = _ref.setColumnCount,
|
|
50
53
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
51
54
|
emptyStateHandler = _ref.emptyStateHandler,
|
|
@@ -85,11 +88,28 @@ function ElementList(_ref) {
|
|
|
85
88
|
}
|
|
86
89
|
});
|
|
87
90
|
}, [createAnalyticsEvent]);
|
|
91
|
+
|
|
92
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
93
|
+
var cache = new CellMeasurerCache({
|
|
94
|
+
fixedWidth: true,
|
|
95
|
+
defaultHeight: ELEMENT_ITEM_HEIGHT,
|
|
96
|
+
minHeight: ELEMENT_ITEM_HEIGHT
|
|
97
|
+
});
|
|
98
|
+
var columnWidth = (containerWidth - ELEMENT_ITEM_PADDING * 2) / columnCount;
|
|
99
|
+
var rowCount = Math.ceil(items.length / columnCount);
|
|
100
|
+
var rowHeight = function rowHeight(_ref2) {
|
|
101
|
+
var index = _ref2.index;
|
|
102
|
+
return cache.rowHeight({
|
|
103
|
+
index: index
|
|
104
|
+
}) <= ELEMENT_ITEM_HEIGHT ? ELEMENT_ITEM_HEIGHT : cache.rowHeight({
|
|
105
|
+
index: index
|
|
106
|
+
}) + ELEMENT_ITEM_PADDING * 2;
|
|
107
|
+
};
|
|
88
108
|
var cellRenderer = useMemo(function () {
|
|
89
|
-
return function (
|
|
90
|
-
var index =
|
|
91
|
-
key =
|
|
92
|
-
style =
|
|
109
|
+
return function (_ref3) {
|
|
110
|
+
var index = _ref3.index,
|
|
111
|
+
key = _ref3.key,
|
|
112
|
+
style = _ref3.style;
|
|
93
113
|
if (items[index] == null) {
|
|
94
114
|
return;
|
|
95
115
|
}
|
|
@@ -132,6 +152,61 @@ function ElementList(_ref) {
|
|
|
132
152
|
}, props)));
|
|
133
153
|
};
|
|
134
154
|
}, [items, fullMode, selectedItemIndex, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
|
|
155
|
+
var gridCellRenderer = useMemo(function () {
|
|
156
|
+
return function (_ref4) {
|
|
157
|
+
var columnIndex = _ref4.columnIndex,
|
|
158
|
+
key = _ref4.key,
|
|
159
|
+
parent = _ref4.parent,
|
|
160
|
+
rowIndex = _ref4.rowIndex,
|
|
161
|
+
style = _ref4.style;
|
|
162
|
+
var index = rowIndex * columnCount + columnIndex;
|
|
163
|
+
if (items[index] == null) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
return index > items.length - 1 ? null : jsx(CellMeasurer, {
|
|
167
|
+
cache: cache,
|
|
168
|
+
key: key,
|
|
169
|
+
rowIndex: rowIndex,
|
|
170
|
+
columnIndex: columnIndex,
|
|
171
|
+
parent: parent
|
|
172
|
+
}, jsx("div", {
|
|
173
|
+
style: style,
|
|
174
|
+
key: key,
|
|
175
|
+
className: "element-item-wrapper",
|
|
176
|
+
css: elementItemWrapper,
|
|
177
|
+
onKeyDown: getBooleanFF('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? function (e) {
|
|
178
|
+
if (e.key === 'Tab') {
|
|
179
|
+
if (e.shiftKey && index === 0) {
|
|
180
|
+
if (setFocusedCategoryIndex) {
|
|
181
|
+
if (!!selectedCategoryIndex) {
|
|
182
|
+
setFocusedCategoryIndex(selectedCategoryIndex);
|
|
183
|
+
} else {
|
|
184
|
+
setFocusedCategoryIndex(0);
|
|
185
|
+
}
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// before focus jumps from elements list we need to rerender react-virtualized collection.
|
|
190
|
+
// Otherwise on the next render 'scrollToCell' will have same cached value
|
|
191
|
+
// and collection will not be scrolled to top.
|
|
192
|
+
// So Tab press on category will not work anymore due to invisible 1-t element.
|
|
193
|
+
else if (index === items.length - 2) {
|
|
194
|
+
setFocusedItemIndex(items.length - 1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} : undefined
|
|
198
|
+
}, jsx(MemoizedElementItem, _extends({
|
|
199
|
+
inlineMode: !fullMode,
|
|
200
|
+
index: index,
|
|
201
|
+
item: items[index],
|
|
202
|
+
selected: selectedItemIndex === index,
|
|
203
|
+
focus: focusedItemIndex === index,
|
|
204
|
+
setFocusedItemIndex: setFocusedItemIndex
|
|
205
|
+
}, props))));
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
209
|
+
[cache, items, fullMode, selectedItemIndex, columnCount, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
|
|
135
210
|
return jsx(Fragment, null, jsx(ContainerWidthMonitor, null), jsx("div", {
|
|
136
211
|
css: elementItemsWrapper,
|
|
137
212
|
"data-testid": "element-items",
|
|
@@ -147,9 +222,30 @@ function ElementList(_ref) {
|
|
|
147
222
|
onExternalLinkClick: onExternalLinkClick
|
|
148
223
|
}) : jsx(Fragment, null, containerWidth > 0 && jsx(AutoSizer, {
|
|
149
224
|
disableWidth: true
|
|
150
|
-
}, function (
|
|
151
|
-
var height =
|
|
152
|
-
return jsx(
|
|
225
|
+
}, function (_ref5) {
|
|
226
|
+
var height = _ref5.height;
|
|
227
|
+
return getBooleanFF('platform.editor.a11y-element-browser') ? jsx(Grid, _extends({
|
|
228
|
+
cellRenderer: gridCellRenderer,
|
|
229
|
+
height: height,
|
|
230
|
+
width: containerWidth - ELEMENT_LIST_PADDING * 2 // containerWidth - padding on Left/Right (for focus outline)
|
|
231
|
+
/**
|
|
232
|
+
* Refresh Grid on WidthObserver value change.
|
|
233
|
+
* Length of the items used to force re-render to solve Firefox bug with react-virtualized retaining
|
|
234
|
+
* scroll position after updating the data. If new data has different number of cells, a re-render
|
|
235
|
+
* is forced to prevent the scroll position render bug.
|
|
236
|
+
*/,
|
|
237
|
+
key: containerWidth + items.length,
|
|
238
|
+
rowHeight: rowHeight,
|
|
239
|
+
rowCount: rowCount,
|
|
240
|
+
columnCount: columnCount,
|
|
241
|
+
columnWidth: columnWidth,
|
|
242
|
+
deferredMeasurementCache: cache
|
|
243
|
+
}, selectedItemIndex && {
|
|
244
|
+
scrollToCell: {
|
|
245
|
+
rowIndex: selectedItemIndex / columnCount,
|
|
246
|
+
columnIndex: selectedItemIndex % columnCount
|
|
247
|
+
}
|
|
248
|
+
})) : jsx(Collection, {
|
|
153
249
|
cellCount: items.length,
|
|
154
250
|
cellRenderer: cellRenderer,
|
|
155
251
|
cellSizeAndPositionGetter: cellSizeAndPositionGetter(containerWidth - ELEMENT_LIST_PADDING * 2, scrollbarWidth),
|
|
@@ -168,14 +264,14 @@ function ElementList(_ref) {
|
|
|
168
264
|
}
|
|
169
265
|
var MemoizedElementItem = /*#__PURE__*/memo(ElementItem);
|
|
170
266
|
MemoizedElementItem.displayName = 'MemoizedElementItem';
|
|
171
|
-
export function ElementItem(
|
|
172
|
-
var inlineMode =
|
|
173
|
-
selected =
|
|
174
|
-
item =
|
|
175
|
-
index =
|
|
176
|
-
onInsertItem =
|
|
177
|
-
focus =
|
|
178
|
-
setFocusedItemIndex =
|
|
267
|
+
export function ElementItem(_ref6) {
|
|
268
|
+
var inlineMode = _ref6.inlineMode,
|
|
269
|
+
selected = _ref6.selected,
|
|
270
|
+
item = _ref6.item,
|
|
271
|
+
index = _ref6.index,
|
|
272
|
+
onInsertItem = _ref6.onInsertItem,
|
|
273
|
+
focus = _ref6.focus,
|
|
274
|
+
setFocusedItemIndex = _ref6.setFocusedItemIndex;
|
|
179
275
|
var ref = useFocus(focus);
|
|
180
276
|
|
|
181
277
|
/**
|
|
@@ -240,17 +336,17 @@ export function ElementItem(_ref4) {
|
|
|
240
336
|
var itemStyleOverrides = {
|
|
241
337
|
alignItems: 'flex-start'
|
|
242
338
|
};
|
|
243
|
-
var ElementBefore = /*#__PURE__*/memo(function (
|
|
244
|
-
var icon =
|
|
245
|
-
title =
|
|
339
|
+
var ElementBefore = /*#__PURE__*/memo(function (_ref7) {
|
|
340
|
+
var icon = _ref7.icon,
|
|
341
|
+
title = _ref7.title;
|
|
246
342
|
return jsx("div", {
|
|
247
343
|
css: [itemIcon, itemIconStyle]
|
|
248
344
|
}, icon ? icon() : jsx(IconFallback, null));
|
|
249
345
|
});
|
|
250
|
-
var ItemContent = /*#__PURE__*/memo(function (
|
|
251
|
-
var title =
|
|
252
|
-
description =
|
|
253
|
-
keyshortcut =
|
|
346
|
+
var ItemContent = /*#__PURE__*/memo(function (_ref8) {
|
|
347
|
+
var title = _ref8.title,
|
|
348
|
+
description = _ref8.description,
|
|
349
|
+
keyshortcut = _ref8.keyshortcut;
|
|
254
350
|
return (
|
|
255
351
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
256
352
|
jsx("div", {
|
|
@@ -278,14 +374,14 @@ var elementItemsWrapper = css({
|
|
|
278
374
|
justifyContent: 'flex-start',
|
|
279
375
|
overflow: 'hidden',
|
|
280
376
|
padding: "var(--ds-space-025, 2px)",
|
|
281
|
-
'.ReactVirtualized__Collection': {
|
|
377
|
+
'.ReactVirtualized__Collection, .ReactVirtualized__Grid': {
|
|
282
378
|
borderRadius: '3px',
|
|
283
379
|
outline: 'none',
|
|
284
|
-
'
|
|
380
|
+
'&:focus': {
|
|
285
381
|
boxShadow: "0 0 0 ".concat(ELEMENT_LIST_PADDING, "px ", "var(--ds-border-focused, ".concat(B100, ")"))
|
|
286
382
|
}
|
|
287
383
|
},
|
|
288
|
-
'.ReactVirtualized__Collection__innerScrollContainer': {
|
|
384
|
+
'.ReactVirtualized__Collection__innerScrollContainer, .ReactVirtualized__Grid__innerScrollContainer': {
|
|
289
385
|
"div[class='element-item-wrapper']:last-child": {
|
|
290
386
|
paddingBottom: "var(--ds-space-050, 4px)"
|
|
291
387
|
}
|
|
@@ -294,7 +390,7 @@ var elementItemsWrapper = css({
|
|
|
294
390
|
var elementItemWrapper = css({
|
|
295
391
|
div: {
|
|
296
392
|
button: {
|
|
297
|
-
|
|
393
|
+
minHeight: '75px',
|
|
298
394
|
alignItems: 'flex-start',
|
|
299
395
|
padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-150, 12px)", " 11px")
|
|
300
396
|
}
|
|
@@ -76,7 +76,7 @@ var mobileCategoryListWrapper = css({
|
|
|
76
76
|
padding: "var(--ds-space-200, 8px)".concat(" 0 ", "var(--ds-space-200, 16px)", " 0"),
|
|
77
77
|
minHeight: "".concat(GRID_SIZE * 4, "px"),
|
|
78
78
|
overflow: '-moz-scrollbars-none',
|
|
79
|
-
'
|
|
79
|
+
'&::-webkit-scrollbar': {
|
|
80
80
|
display: 'none'
|
|
81
81
|
},
|
|
82
82
|
scrollbarWidth: 'none',
|
|
@@ -208,6 +208,7 @@ function StatelessElementBrowser(props) {
|
|
|
208
208
|
focusedCategoryIndex: focusedCategoryIndex,
|
|
209
209
|
setFocusedCategoryIndex: setFocusedCategoryIndex,
|
|
210
210
|
focusOnSearch: focusOnSearch,
|
|
211
|
+
columnCount: columnCount,
|
|
211
212
|
setColumnCount: setColumnCount,
|
|
212
213
|
setFocusOnSearch: setFocusOnSearch,
|
|
213
214
|
onKeyPress: onItemsEnterTabKeyPress,
|
|
@@ -220,6 +221,7 @@ function StatelessElementBrowser(props) {
|
|
|
220
221
|
setFocusedItemIndex: setFocusedItemIndex,
|
|
221
222
|
focusOnSearch: focusOnSearch,
|
|
222
223
|
setColumnCount: setColumnCount,
|
|
224
|
+
columnCount: columnCount,
|
|
223
225
|
setFocusOnSearch: setFocusOnSearch,
|
|
224
226
|
onKeyPress: onItemsEnterTabKeyPress,
|
|
225
227
|
onKeyDown: onKeyDown,
|
|
@@ -246,6 +248,7 @@ function MobileBrowser(_ref) {
|
|
|
246
248
|
setFocusedCategoryIndex = _ref.setFocusedCategoryIndex,
|
|
247
249
|
focusOnSearch = _ref.focusOnSearch,
|
|
248
250
|
focusOnViewMore = _ref.focusOnViewMore,
|
|
251
|
+
columnCount = _ref.columnCount,
|
|
249
252
|
setColumnCount = _ref.setColumnCount,
|
|
250
253
|
setFocusOnSearch = _ref.setFocusOnSearch,
|
|
251
254
|
onKeyPress = _ref.onKeyPress,
|
|
@@ -289,6 +292,7 @@ function MobileBrowser(_ref) {
|
|
|
289
292
|
selectedItemIndex: selectedItemIndex,
|
|
290
293
|
focusedItemIndex: focusedItemIndex,
|
|
291
294
|
setFocusedItemIndex: setFocusedItemIndex,
|
|
295
|
+
columnCount: columnCount,
|
|
292
296
|
setColumnCount: setColumnCount,
|
|
293
297
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
294
298
|
emptyStateHandler: emptyStateHandler,
|
|
@@ -316,6 +320,7 @@ function DesktopBrowser(_ref2) {
|
|
|
316
320
|
setFocusedCategoryIndex = _ref2.setFocusedCategoryIndex,
|
|
317
321
|
selectedCategoryIndex = _ref2.selectedCategoryIndex,
|
|
318
322
|
focusOnSearch = _ref2.focusOnSearch,
|
|
323
|
+
columnCount = _ref2.columnCount,
|
|
319
324
|
setColumnCount = _ref2.setColumnCount,
|
|
320
325
|
setFocusOnSearch = _ref2.setFocusOnSearch,
|
|
321
326
|
onKeyPress = _ref2.onKeyPress,
|
|
@@ -373,6 +378,7 @@ function DesktopBrowser(_ref2) {
|
|
|
373
378
|
selectedItemIndex: selectedItemIndex,
|
|
374
379
|
focusedItemIndex: focusedItemIndex,
|
|
375
380
|
setFocusedItemIndex: setFocusedItemIndex,
|
|
381
|
+
columnCount: columnCount,
|
|
376
382
|
setColumnCount: setColumnCount,
|
|
377
383
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
378
384
|
emptyStateHandler: emptyStateHandler,
|
|
@@ -20,4 +20,5 @@ export var INLINE_SIDEBAR_HEIGHT = '54px';
|
|
|
20
20
|
export var SEARCH_ITEM_HEIGHT_WIDTH = '20px';
|
|
21
21
|
export var SCROLLBAR_WIDTH = 15;
|
|
22
22
|
export var ELEMENT_LIST_PADDING = 2;
|
|
23
|
-
export var ELEMENT_ITEM_HEIGHT = 75;
|
|
23
|
+
export var ELEMENT_ITEM_HEIGHT = 75;
|
|
24
|
+
export var ELEMENT_ITEM_PADDING = 10;
|
|
@@ -135,7 +135,14 @@ export var applyMarkOnRange = function applyMarkOnRange(from, to, removeMark, ma
|
|
|
135
135
|
getBooleanFF('platform.editor.simplify-inline-cards-in-code-blocks_jw6t1') ? transformNonTextNodesToText(from, to, tr) : transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
136
136
|
}
|
|
137
137
|
tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), function (node, pos) {
|
|
138
|
-
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
138
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
139
|
+
if (!node.isText) {
|
|
140
|
+
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
141
|
+
if (!isAllowedInlineNode) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
} else if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
139
146
|
if (!node.isText && node.type !== inlineCard) {
|
|
140
147
|
return true;
|
|
141
148
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var FEDRAMP_MODERATE = 'fedramp-moderate';
|
|
2
|
+
|
|
3
|
+
// To determine whether an instance is a FedRAMP instance
|
|
4
|
+
// Copied from platform/packages/uip/atl-context/src/services/is-fedramp/index.tsx
|
|
5
|
+
// We cannot import the same-named function from @atlassian/atl-context due to editor-common being a public package (and atl-context being private)
|
|
6
|
+
// TODO: Seek alternatives
|
|
7
|
+
export function isFedRamp() {
|
|
8
|
+
var _globalThis$location;
|
|
9
|
+
// MICROS_PERIMETER is already used by few products, so we need to keep it for backward compatibility
|
|
10
|
+
var env = globalThis.MICROS_PERIMETER || globalThis.UNSAFE_ATL_CONTEXT_BOUNDARY;
|
|
11
|
+
if (env) {
|
|
12
|
+
return env === FEDRAMP_MODERATE;
|
|
13
|
+
}
|
|
14
|
+
var matches = (_globalThis$location = globalThis.location) === null || _globalThis$location === void 0 || (_globalThis$location = _globalThis$location.hostname) === null || _globalThis$location === void 0 ? void 0 : _globalThis$location.match(/atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net)/);
|
|
15
|
+
return matches ? matches.length > 0 : false;
|
|
16
|
+
}
|
|
@@ -4,9 +4,10 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
import { isFedRamp } from './environment';
|
|
7
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "82.0
|
|
10
|
+
var packageVersion = "82.1.0";
|
|
10
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
12
|
// Remove URL as it has UGC
|
|
12
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -41,7 +42,7 @@ export var logException = /*#__PURE__*/function () {
|
|
|
41
42
|
_yield$import2 = _context.sent;
|
|
42
43
|
ExtraErrorData = _yield$import2.ExtraErrorData;
|
|
43
44
|
sentryOptions = {
|
|
44
|
-
dsn: SENTRY_DSN,
|
|
45
|
+
dsn: isFedRamp() ? undefined : SENTRY_DSN,
|
|
45
46
|
release: "".concat(packageName, "@").concat(packageVersion),
|
|
46
47
|
environment: (_process$env$CLOUD_EN = process.env.CLOUD_ENV) !== null && _process$env$CLOUD_EN !== void 0 ? _process$env$CLOUD_EN : 'unknown',
|
|
47
48
|
ignoreErrors: [
|
|
@@ -15,53 +15,78 @@ export var BlockAnnotationSharedClassNames = {
|
|
|
15
15
|
blur: "".concat(blockAnnotationPrefix, "-blur"),
|
|
16
16
|
draft: "".concat(blockAnnotationPrefix, "-draft")
|
|
17
17
|
};
|
|
18
|
-
var
|
|
18
|
+
var Yellow100 = 'rgb(255, 247, 214)';
|
|
19
19
|
var Y200a = 'rgba(255, 196, 0, 0.82)';
|
|
20
20
|
export var AnnotationSharedCSSByState = function AnnotationSharedCSSByState() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
fontSize: '16px'
|
|
21
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
22
|
+
return {
|
|
23
|
+
focus: css({
|
|
24
|
+
background: "var(--ds-background-accent-yellow-subtler, ".concat(Y75, ")"),
|
|
25
|
+
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(Y300, ")")),
|
|
26
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(N60A, ", -1px 2px 3px ").concat(N60A), ")"),
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
padding: '1.5px 0',
|
|
29
|
+
'&:has(.card)': {
|
|
30
|
+
padding: '4.5px 0 3px 0'
|
|
32
31
|
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
lineHeight: '1.2rem',
|
|
42
|
-
'& > *': {
|
|
43
|
-
fontSize: '16px'
|
|
32
|
+
}),
|
|
33
|
+
blur: css({
|
|
34
|
+
background: "var(--ds-background-accent-yellow-subtlest, ".concat(Yellow100, ")"),
|
|
35
|
+
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(Y200a, ")")),
|
|
36
|
+
cursor: 'pointer',
|
|
37
|
+
padding: '1.5px 0',
|
|
38
|
+
'&:has(.card)': {
|
|
39
|
+
padding: '4.5px 0 3px 0'
|
|
44
40
|
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
} else if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
44
|
+
return {
|
|
45
|
+
focus: css({
|
|
46
|
+
background: "var(--ds-background-accent-yellow-subtler, ".concat(Y75, ")"),
|
|
47
|
+
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(Y300, ")")),
|
|
48
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(N60A, ", -1px 2px 3px ").concat(N60A), ")"),
|
|
49
|
+
cursor: 'pointer',
|
|
50
|
+
'&:has(.card)': {
|
|
51
|
+
fontSize: '1.5rem',
|
|
52
|
+
lineHeight: '1.2rem',
|
|
53
|
+
'& > *': {
|
|
54
|
+
fontSize: '16px'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
blur: css({
|
|
59
|
+
background: "var(--ds-background-accent-yellow-subtlest, ".concat(Yellow100, ")"),
|
|
60
|
+
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(Y200a, ")")),
|
|
61
|
+
cursor: 'pointer',
|
|
62
|
+
'&:has(.card)': {
|
|
63
|
+
fontSize: '1.5rem',
|
|
64
|
+
lineHeight: '1.2rem',
|
|
65
|
+
'& > *': {
|
|
66
|
+
fontSize: '16px'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
} else {
|
|
72
|
+
return {
|
|
73
|
+
focus: css({
|
|
74
|
+
// Background is not coming through in confluence, suspecting to be caused by some specific combination of
|
|
75
|
+
// emotion and token look up
|
|
76
|
+
background: "var(--ds-background-accent-yellow-subtler, ".concat(Y75, ")"),
|
|
77
|
+
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(Y300, ")")),
|
|
78
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4147
|
|
79
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(N60A, ", -1px 2px 3px ").concat(N60A), ")"),
|
|
80
|
+
cursor: 'pointer'
|
|
81
|
+
}),
|
|
82
|
+
blur: css({
|
|
83
|
+
background: "var(--ds-background-accent-yellow-subtlest, ".concat(Yellow100, ")"),
|
|
84
|
+
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(Y200a, ")")),
|
|
85
|
+
cursor: 'pointer'
|
|
86
|
+
})
|
|
87
|
+
};
|
|
88
|
+
}
|
|
63
89
|
};
|
|
64
|
-
|
|
65
90
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState()` is not safe in object syntax
|
|
66
91
|
export var annotationSharedStyles = function annotationSharedStyles() {
|
|
67
92
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t.", " {\n\t\t\t", ";\n\t\t}\n\n\t\t.", " {\n\t\t\t", ";\n\t\t\tcursor: initial;\n\t\t}\n\n\t\t.", " {\n\t\t\t", ";\n\t\t}\n\t}\n"])), AnnotationSharedClassNames.focus, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.draft, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.blur, AnnotationSharedCSSByState().blur);
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
export var backgroundColorStyles =
|
|
3
|
-
|
|
4
|
-
'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
};
|
|
2
|
+
export var backgroundColorStyles = css({
|
|
3
|
+
'.fabric-background-color-mark': {
|
|
4
|
+
backgroundColor: 'var(--custom-palette-color, inherit)'
|
|
5
|
+
},
|
|
6
|
+
'a .fabric-background-color-mark': {
|
|
7
|
+
backgroundColor: 'unset'
|
|
8
|
+
},
|
|
9
|
+
'.fabric-background-color-mark .ak-editor-annotation': {
|
|
10
|
+
backgroundColor: 'unset'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
@@ -15,7 +15,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
15
15
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
16
16
|
import Layer from '../Layer';
|
|
17
17
|
var packageName = "@atlaskit/editor-common";
|
|
18
|
-
var packageVersion = "82.0
|
|
18
|
+
var packageVersion = "82.1.0";
|
|
19
19
|
var halfFocusRing = 1;
|
|
20
20
|
var dropOffset = '0, 8';
|
|
21
21
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -17,9 +17,17 @@ export var canApplyAnnotationOnRange = function canApplyAnnotationOnRange(rangeS
|
|
|
17
17
|
// or if we're leaf and not text
|
|
18
18
|
|
|
19
19
|
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
21
|
+
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
22
|
+
if (node.isInline && !node.isText && !isAllowedInlineNode || node.isLeaf && !node.isText && !isAllowedInlineNode || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
23
|
+
foundInvalid = true;
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
if (node.isInline && !node.isText && node.type !== inlineCard || node.isLeaf && !node.isText && node.type !== inlineCard || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
28
|
+
foundInvalid = true;
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
23
31
|
}
|
|
24
32
|
} else {
|
|
25
33
|
if (node.isInline && !node.isText || node.isLeaf && !node.isText || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
@@ -245,30 +245,36 @@ export var getValidNode = function getValidNode(originalNode) {
|
|
|
245
245
|
case 'date':
|
|
246
246
|
{
|
|
247
247
|
if (attrs && attrs.timestamp) {
|
|
248
|
-
return {
|
|
248
|
+
return _objectSpread({
|
|
249
249
|
type: type,
|
|
250
250
|
attrs: attrs
|
|
251
|
-
}
|
|
251
|
+
}, getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
|
|
252
|
+
marks: marks
|
|
253
|
+
} : {});
|
|
252
254
|
}
|
|
253
255
|
break;
|
|
254
256
|
}
|
|
255
257
|
case 'status':
|
|
256
258
|
{
|
|
257
259
|
if (attrs && attrs.text && attrs.color) {
|
|
258
|
-
return {
|
|
260
|
+
return _objectSpread({
|
|
259
261
|
type: type,
|
|
260
262
|
attrs: attrs
|
|
261
|
-
}
|
|
263
|
+
}, getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
|
|
264
|
+
marks: marks
|
|
265
|
+
} : {});
|
|
262
266
|
}
|
|
263
267
|
break;
|
|
264
268
|
}
|
|
265
269
|
case 'emoji':
|
|
266
270
|
{
|
|
267
271
|
if (attrs && attrs.shortName) {
|
|
268
|
-
return {
|
|
272
|
+
return _objectSpread({
|
|
269
273
|
type: type,
|
|
270
274
|
attrs: attrs
|
|
271
|
-
}
|
|
275
|
+
}, getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
|
|
276
|
+
marks: marks
|
|
277
|
+
} : {});
|
|
272
278
|
}
|
|
273
279
|
break;
|
|
274
280
|
}
|
|
@@ -285,26 +291,15 @@ export var getValidNode = function getValidNode(originalNode) {
|
|
|
285
291
|
}
|
|
286
292
|
case 'inlineCard':
|
|
287
293
|
{
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
type: type
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
if (marks) {
|
|
296
|
-
inlineCardNode.marks = _toConsumableArray(marks);
|
|
297
|
-
}
|
|
298
|
-
return inlineCardNode;
|
|
299
|
-
} else {
|
|
300
|
-
if (attrs && (attrs.datasource && !attrs.url || attrs.url && isSafeUrl(attrs.url) || attrs.data && attrs.data.url && isSafeUrl(attrs.data.url))) {
|
|
301
|
-
return {
|
|
302
|
-
type: type,
|
|
303
|
-
attrs: attrs
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
break;
|
|
294
|
+
if (attrs && (attrs.datasource && !attrs.url || attrs.url && isSafeUrl(attrs.url) || attrs.data && attrs.data.url && isSafeUrl(attrs.data.url))) {
|
|
295
|
+
return _objectSpread({
|
|
296
|
+
type: type,
|
|
297
|
+
attrs: attrs
|
|
298
|
+
}, getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') ? {
|
|
299
|
+
marks: marks
|
|
300
|
+
} : {});
|
|
307
301
|
}
|
|
302
|
+
break;
|
|
308
303
|
}
|
|
309
304
|
case 'blockCard':
|
|
310
305
|
{
|
|
@@ -500,14 +495,16 @@ export var getValidNode = function getValidNode(originalNode) {
|
|
|
500
495
|
mentionText = text || '@unknown';
|
|
501
496
|
}
|
|
502
497
|
if (mentionText && mentionId) {
|
|
503
|
-
var mentionNode = {
|
|
498
|
+
var mentionNode = _objectSpread({
|
|
504
499
|
type: type,
|
|
505
500
|
attrs: {
|
|
506
501
|
id: mentionId,
|
|
507
502
|
text: mentionText,
|
|
508
503
|
accessLevel: ''
|
|
509
504
|
}
|
|
510
|
-
}
|
|
505
|
+
}, getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? {
|
|
506
|
+
marks: marks
|
|
507
|
+
} : {});
|
|
511
508
|
if (mentionAccess) {
|
|
512
509
|
mentionNode.attrs.accessLevel = mentionAccess;
|
|
513
510
|
}
|
|
@@ -13,6 +13,7 @@ export interface Props {
|
|
|
13
13
|
items: QuickInsertItem[];
|
|
14
14
|
mode: keyof typeof Modes;
|
|
15
15
|
onInsertItem: (item: QuickInsertItem) => void;
|
|
16
|
+
columnCount: number;
|
|
16
17
|
setColumnCount: (columnCount: number) => void;
|
|
17
18
|
setFocusedItemIndex: (index: number) => void;
|
|
18
19
|
setFocusedCategoryIndex?: (index: number) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isFedRamp(): boolean;
|