@atlaskit/editor-common 84.2.0 → 84.3.1
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 +23 -0
- package/afm-jira/tsconfig.json +3 -0
- package/dist/cjs/element-browser/components/CategoryList.js +5 -18
- package/dist/cjs/element-browser/components/ElementList/ElementList.js +5 -5
- package/dist/cjs/element-browser/components/StatelessElementBrowser.js +20 -31
- package/dist/cjs/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +8 -17
- package/dist/cjs/extensibility/ExtensionNodeWrapper.js +2 -2
- package/dist/cjs/mark/commands.js +2 -7
- package/dist/cjs/messages/annotation.js +1 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +3 -2
- package/dist/cjs/styles/shared/annotation.js +2 -34
- package/dist/cjs/styles/shared/smartCard.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/annotation/index.js +10 -18
- package/dist/cjs/utils/index.js +5 -1
- package/dist/cjs/utils/scroll-gutter.js +3 -0
- package/dist/cjs/utils/validator.js +5 -5
- package/dist/cjs/whitespace/index.js +18 -0
- package/dist/es2019/element-browser/components/CategoryList.js +5 -14
- package/dist/es2019/element-browser/components/ElementList/ElementList.js +6 -6
- package/dist/es2019/element-browser/components/StatelessElementBrowser.js +20 -31
- package/dist/es2019/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +8 -17
- package/dist/es2019/extensibility/ExtensionNodeWrapper.js +1 -1
- package/dist/es2019/mark/commands.js +3 -10
- package/dist/es2019/messages/annotation.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +2 -1
- package/dist/es2019/styles/shared/annotation.js +3 -35
- package/dist/es2019/styles/shared/smartCard.js +2 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/annotation/index.js +11 -21
- package/dist/es2019/utils/index.js +4 -1
- package/dist/es2019/utils/scroll-gutter.js +3 -0
- package/dist/es2019/utils/validator.js +6 -6
- package/dist/es2019/whitespace/index.js +1 -0
- package/dist/esm/element-browser/components/CategoryList.js +5 -18
- package/dist/esm/element-browser/components/ElementList/ElementList.js +6 -6
- package/dist/esm/element-browser/components/StatelessElementBrowser.js +20 -31
- package/dist/esm/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +8 -17
- package/dist/esm/extensibility/ExtensionNodeWrapper.js +1 -1
- package/dist/esm/mark/commands.js +3 -8
- package/dist/esm/messages/annotation.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +2 -1
- package/dist/esm/styles/shared/annotation.js +3 -35
- package/dist/esm/styles/shared/smartCard.js +2 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/annotation/index.js +11 -19
- package/dist/esm/utils/index.js +4 -1
- package/dist/esm/utils/scroll-gutter.js +3 -0
- package/dist/esm/utils/validator.js +6 -6
- package/dist/esm/whitespace/index.js +1 -0
- package/dist/types/types/annotation/index.d.ts +2 -2
- package/dist/types/utils/annotation/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +4 -1
- package/dist/types/utils/scroll-gutter.d.ts +3 -0
- package/dist/types/whitespace/index.d.ts +1 -0
- package/dist/types-ts4.5/types/annotation/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/annotation/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/index.d.ts +4 -1
- package/dist/types-ts4.5/utils/scroll-gutter.d.ts +3 -0
- package/dist/types-ts4.5/whitespace/index.d.ts +1 -0
- package/package.json +3 -8
- package/whitespace/package.json +15 -0
- /package/dist/cjs/{utils → whitespace}/whitespace.js +0 -0
- /package/dist/es2019/{utils → whitespace}/whitespace.js +0 -0
- /package/dist/esm/{utils → whitespace}/whitespace.js +0 -0
- /package/dist/types/{utils → whitespace}/whitespace.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → whitespace}/whitespace.d.ts +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
4
|
var _excluded = ["categories"],
|
|
6
5
|
_excluded2 = ["buttonStyles"];
|
|
@@ -13,7 +12,6 @@ import React, { Fragment, memo, useCallback } from 'react';
|
|
|
13
12
|
import { css, jsx } from '@emotion/react';
|
|
14
13
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
15
14
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
16
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
17
15
|
import { B400, B50, N800 } from '@atlaskit/theme/colors';
|
|
18
16
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
|
|
19
17
|
import { DEVICE_BREAKPOINT_NUMBERS, GRID_SIZE } from '../constants';
|
|
@@ -23,20 +21,14 @@ function CategoryList(_ref) {
|
|
|
23
21
|
var _ref$categories = _ref.categories,
|
|
24
22
|
categories = _ref$categories === void 0 ? [] : _ref$categories,
|
|
25
23
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
focusedCategoryIndexState = _React$useState2[0],
|
|
29
|
-
setFocusedCategoryIndexState = _React$useState2[1];
|
|
30
|
-
var focusedCategoryIndexProp = props.focusedCategoryIndex,
|
|
31
|
-
setFocusedCategoryIndexProp = props.setFocusedCategoryIndex,
|
|
24
|
+
var focusedCategoryIndex = props.focusedCategoryIndex,
|
|
25
|
+
setFocusedCategoryIndex = props.setFocusedCategoryIndex,
|
|
32
26
|
onSelectCategory = props.onSelectCategory;
|
|
33
|
-
var focusedCategoryIndex = getBooleanFF('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? focusedCategoryIndexProp : focusedCategoryIndexState;
|
|
34
|
-
var setFocusedCategoryIndex = getBooleanFF('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1') ? setFocusedCategoryIndexProp : setFocusedCategoryIndexState;
|
|
35
27
|
return jsx(Fragment, null, categories.map(function (category, index) {
|
|
36
28
|
var categoriesLength = categories === null || categories === void 0 ? void 0 : categories.length;
|
|
37
29
|
var selectNextCategory;
|
|
38
30
|
var selectPreviousCategory;
|
|
39
|
-
if (
|
|
31
|
+
if (categoriesLength > 1) {
|
|
40
32
|
selectNextCategory = function selectNextCategory() {
|
|
41
33
|
if (index !== categoriesLength - 1) {
|
|
42
34
|
setFocusedCategoryIndex(index + 1);
|
|
@@ -84,9 +76,6 @@ function CategoryListItem(_ref2) {
|
|
|
84
76
|
selectNextCategory = _ref2.selectNextCategory;
|
|
85
77
|
var ref = useFocus(focus);
|
|
86
78
|
var onClick = useCallback(function () {
|
|
87
|
-
if (!getBooleanFF('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
|
|
88
|
-
onSelectCategory(category);
|
|
89
|
-
}
|
|
90
79
|
/**
|
|
91
80
|
* When user double clicks on same category, focus on first item.
|
|
92
81
|
*/
|
|
@@ -95,9 +84,7 @@ function CategoryListItem(_ref2) {
|
|
|
95
84
|
} else {
|
|
96
85
|
setFocusedCategoryIndex(index);
|
|
97
86
|
}
|
|
98
|
-
|
|
99
|
-
onSelectCategory(category);
|
|
100
|
-
}
|
|
87
|
+
onSelectCategory(category);
|
|
101
88
|
fireAnalyticsEvent(createAnalyticsEvent)({
|
|
102
89
|
payload: {
|
|
103
90
|
action: ACTION.CLICKED,
|
|
@@ -171,7 +158,7 @@ function CategoryListItem(_ref2) {
|
|
|
171
158
|
isSelected: selectedCategory === category.name,
|
|
172
159
|
onClick: onClick,
|
|
173
160
|
onFocus: onFocus,
|
|
174
|
-
onKeyDown:
|
|
161
|
+
onKeyDown: onKeyDown,
|
|
175
162
|
theme: getTheme,
|
|
176
163
|
role: "tab",
|
|
177
164
|
"aria-selected": selectedCategory === category.name ? 'true' : 'false',
|
|
@@ -15,7 +15,7 @@ import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
|
15
15
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
16
16
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
17
17
|
import { ButtonItem } from '@atlaskit/menu';
|
|
18
|
-
import {
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
19
|
import { B100, N200 } from '@atlaskit/theme/colors';
|
|
20
20
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
21
21
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -127,7 +127,7 @@ function ElementList(_ref) {
|
|
|
127
127
|
,
|
|
128
128
|
className: "element-item-wrapper",
|
|
129
129
|
css: elementItemWrapper,
|
|
130
|
-
onKeyDown:
|
|
130
|
+
onKeyDown: function onKeyDown(e) {
|
|
131
131
|
if (e.key === 'Tab') {
|
|
132
132
|
if (e.shiftKey && index === 0) {
|
|
133
133
|
if (setFocusedCategoryIndex) {
|
|
@@ -147,7 +147,7 @@ function ElementList(_ref) {
|
|
|
147
147
|
setFocusedItemIndex(items.length - 1);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
}
|
|
150
|
+
}
|
|
151
151
|
}, jsx(MemoizedElementItem, _extends({
|
|
152
152
|
inlineMode: !fullMode,
|
|
153
153
|
index: index,
|
|
@@ -183,7 +183,7 @@ function ElementList(_ref) {
|
|
|
183
183
|
,
|
|
184
184
|
className: "element-item-wrapper",
|
|
185
185
|
css: elementItemWrapper,
|
|
186
|
-
onKeyDown:
|
|
186
|
+
onKeyDown: function onKeyDown(e) {
|
|
187
187
|
if (e.key === 'Tab') {
|
|
188
188
|
if (e.shiftKey && index === 0) {
|
|
189
189
|
if (setFocusedCategoryIndex) {
|
|
@@ -203,7 +203,7 @@ function ElementList(_ref) {
|
|
|
203
203
|
setFocusedItemIndex(items.length - 1);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
}
|
|
206
|
+
}
|
|
207
207
|
}, jsx(MemoizedElementItem, _extends({
|
|
208
208
|
inlineMode: !fullMode,
|
|
209
209
|
index: index,
|
|
@@ -233,7 +233,7 @@ function ElementList(_ref) {
|
|
|
233
233
|
disableWidth: true
|
|
234
234
|
}, function (_ref5) {
|
|
235
235
|
var height = _ref5.height;
|
|
236
|
-
return
|
|
236
|
+
return fg('platform.editor.a11y-element-browser') ? jsx(Grid, _extends({
|
|
237
237
|
cellRenderer: gridCellRenderer,
|
|
238
238
|
height: height,
|
|
239
239
|
width: containerWidth - ELEMENT_LIST_PADDING * 2 // containerWidth - padding on Left/Right (for focus outline)
|
|
@@ -7,7 +7,6 @@ import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import { FormattedMessage } from 'react-intl-next';
|
|
9
9
|
import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
|
|
12
11
|
import { DEVICE_BREAKPOINT_NUMBERS, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
|
|
13
12
|
import useContainerWidth from '../hooks/use-container-width';
|
|
@@ -108,6 +107,7 @@ var categoryListWrapper = css(mobileCategoryListWrapper, {
|
|
|
108
107
|
flexDirection: 'column'
|
|
109
108
|
});
|
|
110
109
|
function StatelessElementBrowser(props) {
|
|
110
|
+
var _props$categories;
|
|
111
111
|
var items = props.items,
|
|
112
112
|
onSelectItem = props.onSelectItem,
|
|
113
113
|
onInsertItem = props.onInsertItem,
|
|
@@ -126,21 +126,18 @@ function StatelessElementBrowser(props) {
|
|
|
126
126
|
setColumnCount = _useState2[1];
|
|
127
127
|
var selectedCategoryIndex;
|
|
128
128
|
var isFocusSearch;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
// clear the flag if the search happens after a user has chosen the category
|
|
138
|
-
categoryBeenChosen.current = false;
|
|
139
|
-
}
|
|
140
|
-
// A11Y: if categories exists, on the initial render search element should receive focus.
|
|
141
|
-
// After user pick some category the category should stay focused.
|
|
142
|
-
isFocusSearch = !categoryBeenChosen.current || !isEmptySearchTerm;
|
|
129
|
+
selectedCategoryIndex = (_props$categories = props.categories) === null || _props$categories === void 0 ? void 0 : _props$categories.findIndex(function (category) {
|
|
130
|
+
return category.name === selectedCategory;
|
|
131
|
+
});
|
|
132
|
+
if (showCategories) {
|
|
133
|
+
var isEmptySearchTerm = !searchTerm || (searchTerm === null || searchTerm === void 0 ? void 0 : searchTerm.length) === 0;
|
|
134
|
+
if (!isEmptySearchTerm) {
|
|
135
|
+
// clear the flag if the search happens after a user has chosen the category
|
|
136
|
+
categoryBeenChosen.current = false;
|
|
143
137
|
}
|
|
138
|
+
// A11Y: if categories exists, on the initial render search element should receive focus.
|
|
139
|
+
// After user pick some category the category should stay focused.
|
|
140
|
+
isFocusSearch = !categoryBeenChosen.current || !isEmptySearchTerm;
|
|
144
141
|
}
|
|
145
142
|
var _useSelectAndFocusOnA = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, !!viewMoreItem, isFocusSearch),
|
|
146
143
|
selectedItemIndex = _useSelectAndFocusOnA.selectedItemIndex,
|
|
@@ -182,22 +179,14 @@ function StatelessElementBrowser(props) {
|
|
|
182
179
|
*/
|
|
183
180
|
var selectedItem = selectedItemIndex !== undefined ? items[selectedItemIndex] : null;
|
|
184
181
|
var onItemsEnterTabKeyPress = useCallback(function (e) {
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
} else {
|
|
190
|
-
if (e.key !== 'Enter') {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
182
|
+
if (e.key !== 'Enter' && (e.key !== 'Tab' || !showCategories)) {
|
|
183
|
+
return;
|
|
193
184
|
}
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
185
|
+
if (showCategories && e.key === 'Tab' && selectedCategoryIndex !== undefined) {
|
|
186
|
+
// A11Y: Set focus on first category if tab pressed on search
|
|
187
|
+
setFocusedCategoryIndex(selectedCategoryIndex);
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
return;
|
|
201
190
|
}
|
|
202
191
|
if (onInsertItem && selectedItem != null) {
|
|
203
192
|
onInsertItem(selectedItem);
|
|
@@ -248,7 +237,7 @@ function StatelessElementBrowser(props) {
|
|
|
248
237
|
focusedCategoryIndex: focusedCategoryIndex,
|
|
249
238
|
setFocusedCategoryIndex: setFocusedCategoryIndex,
|
|
250
239
|
selectedCategoryIndex: selectedCategoryIndex,
|
|
251
|
-
onSelectCategory:
|
|
240
|
+
onSelectCategory: onSelectCategoryCB
|
|
252
241
|
})));
|
|
253
242
|
}
|
|
254
243
|
function MobileBrowser(_ref) {
|
|
@@ -3,7 +3,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
import { useCallback, useEffect, useReducer, useRef } from 'react';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* a custom hook that handles keyboard navigation for Arrow keys based on a
|
|
@@ -65,7 +64,6 @@ var reducer = function reducer(state, action) {
|
|
|
65
64
|
case ACTIONS.MOVE:
|
|
66
65
|
return moveReducer(state, action);
|
|
67
66
|
}
|
|
68
|
-
return state;
|
|
69
67
|
};
|
|
70
68
|
var moveReducer = function moveReducer(state, action) {
|
|
71
69
|
var listSize = state.listSize,
|
|
@@ -192,13 +190,11 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, is
|
|
|
192
190
|
var payload = _objectSpread(_objectSpread({}, initialState), {}, {
|
|
193
191
|
listSize: listSize
|
|
194
192
|
});
|
|
195
|
-
if
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
201
|
-
}
|
|
193
|
+
// A11Y: if categories exist ,on the initial render search element should receive focus.
|
|
194
|
+
// After user pick some category the category should stay focused.
|
|
195
|
+
payload = Object.assign(payload, {
|
|
196
|
+
focusOnSearch: isFocusSearch !== null && isFocusSearch !== void 0 ? isFocusSearch : initialState.focusOnSearch
|
|
197
|
+
});
|
|
202
198
|
dispatch({
|
|
203
199
|
type: ACTIONS.UPDATE_STATE,
|
|
204
200
|
payload: payload
|
|
@@ -211,20 +207,15 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, is
|
|
|
211
207
|
focusOnSearch: false,
|
|
212
208
|
focusOnViewMore: false
|
|
213
209
|
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
});
|
|
218
|
-
}
|
|
210
|
+
payload = Object.assign(payload, {
|
|
211
|
+
focusedCategoryIndex: undefined
|
|
212
|
+
});
|
|
219
213
|
dispatch({
|
|
220
214
|
type: ACTIONS.UPDATE_STATE,
|
|
221
215
|
payload: payload
|
|
222
216
|
});
|
|
223
217
|
}, [dispatch]);
|
|
224
218
|
var setFocusedCategoryIndex = useCallback(function (index) {
|
|
225
|
-
if (!getBooleanFF('platform.editor.a11y-focus-order-for-element-browser-categories_ztiw1')) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
219
|
var payload = {
|
|
229
220
|
focusOnSearch: false,
|
|
230
221
|
focusOnViewMore: false,
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
|
-
import { ZERO_WIDTH_SPACE } from '../
|
|
7
|
+
import { ZERO_WIDTH_SPACE } from '../whitespace';
|
|
8
8
|
var styles = css({
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
10
10
|
'&.inline-extension': {
|
|
@@ -2,7 +2,7 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
// eslint-disable-next-line no-duplicate-imports
|
|
3
3
|
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
-
import {
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
var SMART_TO_ASCII = {
|
|
7
7
|
'…': '...',
|
|
8
8
|
'→': '->',
|
|
@@ -130,22 +130,17 @@ export var transformSmartCharsMentionsAndEmojis = function transformSmartCharsMe
|
|
|
130
130
|
export var applyMarkOnRange = function applyMarkOnRange(from, to, removeMark, mark, tr) {
|
|
131
131
|
var schema = tr.doc.type.schema;
|
|
132
132
|
var code = schema.marks.code;
|
|
133
|
-
var inlineCard = schema.nodes.inlineCard;
|
|
134
133
|
if (mark.type === code) {
|
|
135
|
-
|
|
134
|
+
fg('platform.editor.simplify-inline-cards-in-code-blocks_jw6t1') ? transformNonTextNodesToText(from, to, tr) : transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
136
135
|
}
|
|
137
136
|
tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), function (node, pos) {
|
|
138
|
-
if (
|
|
137
|
+
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
139
138
|
if (!node.isText) {
|
|
140
139
|
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
141
140
|
if (!isAllowedInlineNode) {
|
|
142
141
|
return true;
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
|
-
} else if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
146
|
-
if (!node.isText && node.type !== inlineCard) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
144
|
} else {
|
|
150
145
|
if (!node.isText) {
|
|
151
146
|
return true;
|
|
@@ -5,7 +5,7 @@ export var annotationMessages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Comment',
|
|
6
6
|
description: 'Create/add an inline comment based on the users selection'
|
|
7
7
|
},
|
|
8
|
-
// TODO: Remove this message when the
|
|
8
|
+
// TODO: Remove this message when the editor_inline_comments_on_inline_nodes FF is removed
|
|
9
9
|
createCommentInvalid: {
|
|
10
10
|
id: 'fabric.editor.createCommentInvalid',
|
|
11
11
|
defaultMessage: 'You can only comment on text and headings',
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "84.
|
|
10
|
+
var packageVersion = "84.3.1";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -9,7 +9,8 @@ import React from 'react';
|
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
10
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
11
11
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
12
|
-
import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered
|
|
12
|
+
import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
13
|
+
import { ZERO_WIDTH_SPACE } from '../whitespace';
|
|
13
14
|
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
14
15
|
export var inlineNodeViewClassname = 'inlineNodeView';
|
|
15
16
|
function createNodeView(_ref) {
|
|
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject, _templateObject2;
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
|
-
import {
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { N60A, Y300, Y75 } from '@atlaskit/theme/colors';
|
|
7
7
|
export var annotationPrefix = 'ak-editor-annotation';
|
|
8
8
|
export var AnnotationSharedClassNames = {
|
|
@@ -19,7 +19,7 @@ export var BlockAnnotationSharedClassNames = {
|
|
|
19
19
|
var Yellow100 = 'rgb(255, 247, 214)';
|
|
20
20
|
var Y200a = 'rgba(255, 196, 0, 0.82)';
|
|
21
21
|
export var AnnotationSharedCSSByState = function AnnotationSharedCSSByState() {
|
|
22
|
-
if (
|
|
22
|
+
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
23
23
|
// NOTE: These styles are shared between renderer and editor. Sometimes they
|
|
24
24
|
// need different selectors and other times they apply the same attributes
|
|
25
25
|
// in a different way. For example in renderer the focus styles are an
|
|
@@ -49,38 +49,6 @@ export var AnnotationSharedCSSByState = function AnnotationSharedCSSByState() {
|
|
|
49
49
|
borderBottomColor: "var(--ds-border-accent-yellow, ".concat(Y200a, ")")
|
|
50
50
|
})
|
|
51
51
|
};
|
|
52
|
-
} else if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
53
|
-
return {
|
|
54
|
-
focus: css({
|
|
55
|
-
background: "var(--ds-background-accent-yellow-subtler, ".concat(Y75, ")"),
|
|
56
|
-
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(Y300, ")")),
|
|
57
|
-
boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(N60A, ", -1px 2px 3px ").concat(N60A), ")"),
|
|
58
|
-
cursor: 'pointer',
|
|
59
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
60
|
-
'&:has(.card)': {
|
|
61
|
-
fontSize: '1.5rem',
|
|
62
|
-
lineHeight: '1.2rem',
|
|
63
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
64
|
-
'& > *': {
|
|
65
|
-
fontSize: '16px'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}),
|
|
69
|
-
blur: css({
|
|
70
|
-
background: "var(--ds-background-accent-yellow-subtlest, ".concat(Yellow100, ")"),
|
|
71
|
-
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(Y200a, ")")),
|
|
72
|
-
cursor: 'pointer',
|
|
73
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
74
|
-
'&:has(.card)': {
|
|
75
|
-
fontSize: '1.5rem',
|
|
76
|
-
lineHeight: '1.2rem',
|
|
77
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
78
|
-
'& > *': {
|
|
79
|
-
fontSize: '16px'
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
};
|
|
84
52
|
} else {
|
|
85
53
|
return {
|
|
86
54
|
focus: css({
|
|
@@ -101,7 +69,7 @@ export var AnnotationSharedCSSByState = function AnnotationSharedCSSByState() {
|
|
|
101
69
|
}
|
|
102
70
|
};
|
|
103
71
|
export var annotationSharedStyles = function annotationSharedStyles() {
|
|
104
|
-
return
|
|
72
|
+
return fg('editor_inline_comments_on_inline_nodes') ? // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState()` is not safe in object syntax
|
|
105
73
|
css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror {\n\t\t\t\t\t.", ",\n\t\t\t\t\t\t.", ",\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t", ";\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t", ";\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t", ";\n\t\t\t\t\t\tcursor: initial;\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t", ";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), AnnotationSharedClassNames.blur, AnnotationSharedClassNames.focus, AnnotationSharedClassNames.draft, AnnotationSharedCSSByState().common, AnnotationSharedClassNames.focus, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.draft, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.blur, AnnotationSharedCSSByState().blur) : // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState()` is not safe in object syntax
|
|
106
74
|
css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t", ";\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t", ";\n\t\t\t\t\t\tcursor: initial;\n\t\t\t\t\t}\n\n\t\t\t\t\t.", " {\n\t\t\t\t\t\t", ";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t"])), AnnotationSharedClassNames.focus, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.draft, AnnotationSharedCSSByState().focus, AnnotationSharedClassNames.blur, AnnotationSharedCSSByState().blur);
|
|
107
75
|
};
|
|
@@ -3,7 +3,7 @@ var _templateObject;
|
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedNodeClassName, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import {
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { N0, N40 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { N60A, Y300, Y75 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { SmartCardSharedCssClassName } from './smart-card';
|
|
@@ -11,4 +11,4 @@ export var DATASOURCE_INNER_CONTAINER_CLASSNAME = 'datasourceView-content-inner-
|
|
|
11
11
|
export var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
|
|
12
12
|
|
|
13
13
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
14
|
-
export var smartCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER,
|
|
14
|
+
export var smartCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, fg('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, ".concat(Y75, ")"), ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, ".concat(Y300, ")"), ";\n box-shadow: ", "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(N60A, ", -1px 2px 3px ").concat(N60A), ")"), ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), "var(--ds-border-radius-200, 8px)", SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.DATASOURCE_CONTAINER, SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-background-neutral-subtle, ".concat(N0, ")"), "var(--ds-border-radius-200, 8px)", "var(--ds-border, ".concat(N40, ")"), akEditorSelectedNodeClassName, DATASOURCE_INNER_CONTAINER_CLASSNAME, getSelectionStyles([SelectionStyle.BoxShadow]), DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
|
|
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
17
17
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
18
18
|
import Layer from '../Layer';
|
|
19
19
|
var packageName = "@atlaskit/editor-common";
|
|
20
|
-
var packageVersion = "84.
|
|
20
|
+
var packageVersion = "84.3.1";
|
|
21
21
|
var halfFocusRing = 1;
|
|
22
22
|
var dropOffset = '0, 8';
|
|
23
23
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,35 +1,27 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
|
-
import {
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
export var canApplyAnnotationOnRange = function canApplyAnnotationOnRange(rangeSelection, doc, schema) {
|
|
5
5
|
var from = rangeSelection.from,
|
|
6
6
|
to = rangeSelection.to;
|
|
7
7
|
if (isNaN(from + to) || to - from <= 0 || to < 0 || from < 0) {
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
|
-
var inlineCard = schema.nodes.inlineCard;
|
|
11
10
|
var foundInvalid = false;
|
|
12
11
|
doc.nodesBetween(rangeSelection.from, rangeSelection.to, function (node, _pos, parent) {
|
|
13
12
|
// Special exception for hardBreak nodes
|
|
14
13
|
if (schema.nodes.hardBreak === node.type) {
|
|
15
14
|
return false;
|
|
16
15
|
}
|
|
16
|
+
|
|
17
17
|
// For block elements or text nodes, we want to check
|
|
18
18
|
// if annotations are allowed inside this tree
|
|
19
19
|
// or if we're leaf and not text
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
foundInvalid = true;
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
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))) {
|
|
30
|
-
foundInvalid = true;
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
20
|
+
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
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;
|
|
33
25
|
}
|
|
34
26
|
} else {
|
|
35
27
|
if (node.isInline && !node.isText || node.isLeaf && !node.isText || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
@@ -99,7 +91,7 @@ export function containsAnyAnnotations(slice, state) {
|
|
|
99
91
|
export function getRangeInlineNodeNames(_ref) {
|
|
100
92
|
var doc = _ref.doc,
|
|
101
93
|
pos = _ref.pos;
|
|
102
|
-
if (!
|
|
94
|
+
if (!fg('editor_inline_comments_on_inline_nodes')) {
|
|
103
95
|
return undefined;
|
|
104
96
|
}
|
|
105
97
|
var nodeNames = new Set();
|
|
@@ -117,13 +109,13 @@ export function getRangeInlineNodeNames(_ref) {
|
|
|
117
109
|
/**
|
|
118
110
|
* This function returns a list of node types that are wrapped by an annotation mark.
|
|
119
111
|
*
|
|
120
|
-
* The `undefined` will be returned if `
|
|
112
|
+
* The `undefined` will be returned if `editor_inline_comments_on_inline_nodes` is off.
|
|
121
113
|
*
|
|
122
114
|
* @todo: Do not forget to remove `undefined` when the
|
|
123
|
-
* `
|
|
115
|
+
* `editor_inline_comments_on_inline_nodes` is removed.
|
|
124
116
|
*/
|
|
125
117
|
export function getAnnotationInlineNodeTypes(state, annotationId) {
|
|
126
|
-
if (!
|
|
118
|
+
if (!fg('editor_inline_comments_on_inline_nodes')) {
|
|
127
119
|
return undefined;
|
|
128
120
|
}
|
|
129
121
|
var mark = state.schema.marks.annotation.create({
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -27,7 +27,10 @@ export { hasMergedCell, calcTableColumnWidths, convertProsemirrorTableNodeToArra
|
|
|
27
27
|
export { createCompareNodes } from './compareNodes';
|
|
28
28
|
export { compose } from './compose';
|
|
29
29
|
export { isTextInput } from './is-text-input';
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated - [ED-23844] moving to own entry point @atlaskit/editor-common/whitespace
|
|
32
|
+
*/
|
|
33
|
+
export { ZERO_WIDTH_SPACE, ZERO_WIDTH_JOINER } from '../whitespace';
|
|
31
34
|
export { shouldForceTracking } from './should-force-tracking';
|
|
32
35
|
export { getModeFromTheme } from './getModeFromTheme';
|
|
33
36
|
export { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from './get-performance-options';
|
|
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
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; }
|
|
5
5
|
import { inlineNodes, isSafeUrl, PanelType, generateUuid as uuid } from '@atlaskit/adf-schema';
|
|
6
6
|
import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
|
|
7
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
export var ADFStages = {
|
|
9
9
|
FINAL: 'final',
|
|
10
10
|
STAGE_0: 'stage0'
|
|
@@ -248,7 +248,7 @@ export var getValidNode = function getValidNode(originalNode) {
|
|
|
248
248
|
return _objectSpread({
|
|
249
249
|
type: type,
|
|
250
250
|
attrs: attrs
|
|
251
|
-
},
|
|
251
|
+
}, fg('editor_inline_comments_on_inline_nodes') ? {
|
|
252
252
|
marks: marks
|
|
253
253
|
} : {});
|
|
254
254
|
}
|
|
@@ -260,7 +260,7 @@ export var getValidNode = function getValidNode(originalNode) {
|
|
|
260
260
|
return _objectSpread({
|
|
261
261
|
type: type,
|
|
262
262
|
attrs: attrs
|
|
263
|
-
},
|
|
263
|
+
}, fg('editor_inline_comments_on_inline_nodes') ? {
|
|
264
264
|
marks: marks
|
|
265
265
|
} : {});
|
|
266
266
|
}
|
|
@@ -272,7 +272,7 @@ export var getValidNode = function getValidNode(originalNode) {
|
|
|
272
272
|
return _objectSpread({
|
|
273
273
|
type: type,
|
|
274
274
|
attrs: attrs
|
|
275
|
-
},
|
|
275
|
+
}, fg('editor_inline_comments_on_inline_nodes') ? {
|
|
276
276
|
marks: marks
|
|
277
277
|
} : {});
|
|
278
278
|
}
|
|
@@ -295,7 +295,7 @@ export var getValidNode = function getValidNode(originalNode) {
|
|
|
295
295
|
return _objectSpread({
|
|
296
296
|
type: type,
|
|
297
297
|
attrs: attrs
|
|
298
|
-
},
|
|
298
|
+
}, fg('editor_inline_comments_on_inline_nodes') ? {
|
|
299
299
|
marks: marks
|
|
300
300
|
} : {});
|
|
301
301
|
}
|
|
@@ -502,7 +502,7 @@ export var getValidNode = function getValidNode(originalNode) {
|
|
|
502
502
|
text: mentionText,
|
|
503
503
|
accessLevel: ''
|
|
504
504
|
}
|
|
505
|
-
},
|
|
505
|
+
}, fg('editor_inline_comments_on_inline_nodes') ? {
|
|
506
506
|
marks: marks
|
|
507
507
|
} : {});
|
|
508
508
|
if (mentionAccess) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ZERO_WIDTH_SPACE, ZERO_WIDTH_JOINER } from './whitespace';
|
|
@@ -85,10 +85,10 @@ export type InlineCommentViewComponentProps = {
|
|
|
85
85
|
* Return a list of inline node types, which are wrapped by the annotation,
|
|
86
86
|
* for annotation with given ID.
|
|
87
87
|
*
|
|
88
|
-
* The `undefined` will be returned if `
|
|
88
|
+
* The `undefined` will be returned if `editor_inline_comments_on_inline_nodes` is off.
|
|
89
89
|
*
|
|
90
90
|
* @todo: Do not forget to remove `undefined` when the
|
|
91
|
-
* `
|
|
91
|
+
* `editor_inline_comments_on_inline_nodes` is removed.
|
|
92
92
|
*/
|
|
93
93
|
getInlineNodeTypes: (annotationId: string) => string[] | undefined;
|
|
94
94
|
};
|