@atlaskit/editor-common 102.0.0 → 102.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 +16 -0
- package/dist/cjs/ai-messages/ai.js +5 -0
- package/dist/cjs/analytics/types/general-events.js +1 -1
- package/dist/cjs/collab/index.js +2 -0
- package/dist/cjs/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +26 -52
- package/dist/cjs/extensibility/MultiBodiedExtension/action-api.js +2 -0
- package/dist/cjs/insert/index.js +2 -0
- package/dist/cjs/keymaps/keymap.js +4 -2
- package/dist/cjs/lazy-node-view/index.js +1 -1
- package/dist/cjs/media-inline/inline-image-card.js +2 -0
- package/dist/cjs/messages/annotation.js +2 -0
- package/dist/cjs/messages/help-dialog.js +2 -0
- package/dist/cjs/monitoring/environment.js +2 -0
- package/dist/cjs/monitoring/error.js +3 -1
- package/dist/cjs/node-width/index.js +0 -1
- package/dist/cjs/quick-insert/assets/datasource-assets-objects.js +1 -1
- package/dist/cjs/quick-insert/assets/datasource-jira-issue.js +1 -1
- package/dist/cjs/quick-insert/assets/feedback.js +1 -1
- package/dist/cjs/quick-insert/assets/quote.js +1 -1
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +1 -1
- package/dist/cjs/react-node-view/index.js +1 -1
- package/dist/cjs/selection/gap-cursor/selection.js +1 -1
- package/dist/cjs/styles/shared/annotation.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Layer/index.js +0 -1
- package/dist/cjs/ui-menu/ColorPickerButton/index.js +1 -1
- package/dist/cjs/ui-menu/ToolbarButton/styles.js +2 -0
- package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +13 -4
- package/dist/cjs/utils/calculate-toolbar-position.js +4 -0
- package/dist/cjs/utils/compareNodes.js +0 -1
- package/dist/cjs/utils/get-performance-options.js +0 -1
- package/dist/cjs/utils/is-text-input.js +0 -2
- package/dist/cjs/utils/table.js +2 -0
- package/dist/cjs/utils/validate-using-spec.js +2 -0
- package/dist/cjs/with-plugin-state/index.js +0 -1
- package/dist/es2019/ai-messages/ai.js +5 -0
- package/dist/es2019/analytics/types/general-events.js +1 -3
- package/dist/es2019/collab/index.js +2 -0
- package/dist/es2019/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +28 -54
- package/dist/es2019/extensibility/MultiBodiedExtension/action-api.js +2 -0
- package/dist/es2019/insert/index.js +2 -0
- package/dist/es2019/keymaps/keymap.js +4 -2
- package/dist/es2019/lazy-node-view/index.js +1 -1
- package/dist/es2019/media-inline/inline-image-card.js +2 -0
- package/dist/es2019/messages/annotation.js +2 -0
- package/dist/es2019/messages/help-dialog.js +2 -0
- package/dist/es2019/monitoring/environment.js +2 -0
- package/dist/es2019/monitoring/error.js +3 -1
- package/dist/es2019/node-width/index.js +0 -1
- package/dist/es2019/quick-insert/assets/datasource-assets-objects.js +1 -1
- package/dist/es2019/quick-insert/assets/datasource-jira-issue.js +1 -1
- package/dist/es2019/quick-insert/assets/feedback.js +1 -1
- package/dist/es2019/quick-insert/assets/quote.js +1 -1
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +1 -1
- package/dist/es2019/react-node-view/index.js +1 -1
- package/dist/es2019/selection/gap-cursor/selection.js +1 -1
- package/dist/es2019/styles/shared/annotation.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Layer/index.js +0 -1
- package/dist/es2019/ui-menu/ColorPickerButton/index.js +1 -1
- package/dist/es2019/ui-menu/ToolbarButton/styles.js +2 -0
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +12 -3
- package/dist/es2019/utils/calculate-toolbar-position.js +4 -0
- package/dist/es2019/utils/compareNodes.js +0 -1
- package/dist/es2019/utils/get-performance-options.js +0 -1
- package/dist/es2019/utils/is-text-input.js +0 -2
- package/dist/es2019/utils/table.js +2 -0
- package/dist/es2019/utils/validate-using-spec.js +2 -0
- package/dist/es2019/with-plugin-state/index.js +0 -1
- package/dist/esm/ai-messages/ai.js +5 -0
- package/dist/esm/analytics/types/general-events.js +1 -3
- package/dist/esm/collab/index.js +2 -0
- package/dist/esm/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +27 -52
- package/dist/esm/extensibility/MultiBodiedExtension/action-api.js +2 -0
- package/dist/esm/insert/index.js +2 -0
- package/dist/esm/keymaps/keymap.js +4 -2
- package/dist/esm/lazy-node-view/index.js +1 -1
- package/dist/esm/media-inline/inline-image-card.js +2 -0
- package/dist/esm/messages/annotation.js +2 -0
- package/dist/esm/messages/help-dialog.js +2 -0
- package/dist/esm/monitoring/environment.js +2 -0
- package/dist/esm/monitoring/error.js +3 -1
- package/dist/esm/node-width/index.js +0 -1
- package/dist/esm/quick-insert/assets/datasource-assets-objects.js +1 -1
- package/dist/esm/quick-insert/assets/datasource-jira-issue.js +1 -1
- package/dist/esm/quick-insert/assets/feedback.js +1 -1
- package/dist/esm/quick-insert/assets/quote.js +1 -1
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +1 -1
- package/dist/esm/react-node-view/index.js +1 -1
- package/dist/esm/selection/gap-cursor/selection.js +1 -1
- package/dist/esm/styles/shared/annotation.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Layer/index.js +0 -1
- package/dist/esm/ui-menu/ColorPickerButton/index.js +1 -1
- package/dist/esm/ui-menu/ToolbarButton/styles.js +2 -0
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +13 -4
- package/dist/esm/utils/calculate-toolbar-position.js +4 -0
- package/dist/esm/utils/compareNodes.js +0 -1
- package/dist/esm/utils/get-performance-options.js +0 -1
- package/dist/esm/utils/is-text-input.js +0 -2
- package/dist/esm/utils/table.js +2 -0
- package/dist/esm/utils/validate-using-spec.js +2 -0
- package/dist/esm/with-plugin-state/index.js +0 -1
- package/dist/types/ai-messages/ai.d.ts +5 -0
- package/dist/types/types/annotation/index.d.ts +0 -3
- package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +6 -0
- package/dist/types-ts4.5/ai-messages/ai.d.ts +5 -0
- package/dist/types-ts4.5/types/annotation/index.d.ts +0 -3
- package/dist/types-ts4.5/ui-react/with-react-editor-view-outer-listeners.d.ts +6 -0
- package/package.json +1 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useReducer, useRef } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
/**
|
|
4
4
|
* a custom hook that handles keyboard navigation for Arrow keys based on a
|
|
5
5
|
* given listSize, and a step (for up and down arrows).
|
|
@@ -81,29 +81,19 @@ const moveReducer = (state, action) => {
|
|
|
81
81
|
selectedItemIndex: canFocusViewMore ? undefined : listSize
|
|
82
82
|
};
|
|
83
83
|
} else {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
} else {
|
|
99
|
-
return {
|
|
100
|
-
...state,
|
|
101
|
-
focusOnSearch: false,
|
|
102
|
-
focusOnViewMore: false,
|
|
103
|
-
focusedItemIndex: 0,
|
|
104
|
-
selectedItemIndex: 0
|
|
105
|
-
};
|
|
106
|
-
}
|
|
84
|
+
var _action$payload$step;
|
|
85
|
+
const newIndex = action.payload.positions ? action.payload.positions - ((_action$payload$step = action.payload.step) !== null && _action$payload$step !== void 0 ? _action$payload$step : 1) : 0;
|
|
86
|
+
const safeIndex = ensureSafeIndex(newIndex, state.listSize);
|
|
87
|
+
const isLastItemFocused = newIndex > listSize;
|
|
88
|
+
const focusOnSearch = isLastItemFocused && !canFocusViewMore;
|
|
89
|
+
const focusOnViewMore = isLastItemFocused && !!canFocusViewMore;
|
|
90
|
+
return {
|
|
91
|
+
...state,
|
|
92
|
+
focusOnSearch: focusOnSearch,
|
|
93
|
+
focusOnViewMore: focusOnViewMore,
|
|
94
|
+
focusedItemIndex: safeIndex,
|
|
95
|
+
selectedItemIndex: safeIndex
|
|
96
|
+
};
|
|
107
97
|
}
|
|
108
98
|
}
|
|
109
99
|
if (state.focusOnViewMore) {
|
|
@@ -328,45 +318,29 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, it
|
|
|
328
318
|
return setFocusOnSearch();
|
|
329
319
|
case 'ArrowRight':
|
|
330
320
|
{
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
return move(e, nextItem);
|
|
336
|
-
} else {
|
|
337
|
-
return move(e, +1);
|
|
338
|
-
}
|
|
321
|
+
var _skipForwardOffsetToS;
|
|
322
|
+
const itemIndex = focusOnSearch ? -1 : selectedItemIndex;
|
|
323
|
+
const nextItem = (_skipForwardOffsetToS = skipForwardOffsetToSafeItem(itemIndex, listSize, 1, itemIsDisabled)) !== null && _skipForwardOffsetToS !== void 0 ? _skipForwardOffsetToS : 1;
|
|
324
|
+
return move(e, nextItem);
|
|
339
325
|
}
|
|
340
326
|
case 'ArrowLeft':
|
|
341
327
|
{
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return move(e, -nextItem);
|
|
346
|
-
} else {
|
|
347
|
-
return move(e, -1);
|
|
348
|
-
}
|
|
328
|
+
var _skipBackwardOffsetTo;
|
|
329
|
+
const nextItem = (_skipBackwardOffsetTo = skipBackwardOffsetToSafeItem(selectedItemIndex, 1, itemIsDisabled)) !== null && _skipBackwardOffsetTo !== void 0 ? _skipBackwardOffsetTo : 1;
|
|
330
|
+
return move(e, -nextItem);
|
|
349
331
|
}
|
|
350
332
|
case 'ArrowDown':
|
|
351
333
|
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return move(e, +nextItem, step);
|
|
357
|
-
} else {
|
|
358
|
-
return move(e, +step);
|
|
359
|
-
}
|
|
334
|
+
var _skipForwardOffsetToS2;
|
|
335
|
+
const itemIndex = focusOnSearch ? -step : selectedItemIndex;
|
|
336
|
+
const nextItem = (_skipForwardOffsetToS2 = skipForwardOffsetToSafeItem(itemIndex, listSize, step, itemIsDisabled)) !== null && _skipForwardOffsetToS2 !== void 0 ? _skipForwardOffsetToS2 : step;
|
|
337
|
+
return move(e, +nextItem, step);
|
|
360
338
|
}
|
|
361
339
|
case 'ArrowUp':
|
|
362
340
|
{
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
return move(e, Math.min(-nextItem, -step), step);
|
|
367
|
-
} else {
|
|
368
|
-
return move(e, -step, step);
|
|
369
|
-
}
|
|
341
|
+
var _skipBackwardOffsetTo2;
|
|
342
|
+
const nextItem = (_skipBackwardOffsetTo2 = skipBackwardOffsetToSafeItem(selectedItemIndex, step, itemIsDisabled)) !== null && _skipBackwardOffsetTo2 !== void 0 ? _skipBackwardOffsetTo2 : step;
|
|
343
|
+
return move(e, Math.min(-nextItem, -step), step);
|
|
370
344
|
}
|
|
371
345
|
}
|
|
372
346
|
}, [focusOnSearch, setFocusOnSearch, move, selectedItemIndex, itemIsDisabled, listSize, step]);
|
|
@@ -73,6 +73,8 @@ export const useMultiBodiedExtensionActions = ({
|
|
|
73
73
|
},
|
|
74
74
|
removeChild(index) {
|
|
75
75
|
const pos = getPos();
|
|
76
|
+
// Ignored via go/ees007
|
|
77
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
76
78
|
// TODO: Add child index validation here, don't trust this data
|
|
77
79
|
if (typeof pos !== 'number' || typeof index !== 'number') {
|
|
78
80
|
throw new Error('Position or index not valid');
|
|
@@ -73,6 +73,8 @@ const insertBeforeOrAfter = (tr, lookDirection, $parentPos, $proposedPosition, c
|
|
|
73
73
|
return tr.insert($proposedPosition[lookDirection](), content);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
// Ignored via go/ees007
|
|
77
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
76
78
|
// FIXME: A more sustainable and configurable way to choose when to split
|
|
77
79
|
// Ignored via go/ees005
|
|
78
80
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -34,9 +34,11 @@ export function keymap(bindings) {
|
|
|
34
34
|
const isDeadKey = name === 'Dead';
|
|
35
35
|
if (isModKeyPressed && (isNonLatinKey || isDeadKey)) {
|
|
36
36
|
keyboardEvent = new KeyboardEvent(event.type, {
|
|
37
|
+
// Ignored via go/ees007
|
|
38
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
37
39
|
// FIXME: The event.keyCode is deprecated (see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode),
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
+
// and could be removed in any time, but the w3c-keyname library doesn't provide a way to get
|
|
41
|
+
// a key by event.code.
|
|
40
42
|
key: base[event.keyCode],
|
|
41
43
|
code: event.code,
|
|
42
44
|
ctrlKey: event.ctrlKey,
|
|
@@ -174,7 +174,7 @@ export const withLazyLoading = ({
|
|
|
174
174
|
});
|
|
175
175
|
requestedNodes.set(nodeName, loaderPromise);
|
|
176
176
|
if (typeof ((_node$type = node.type) === null || _node$type === void 0 ? void 0 : (_node$type$spec = _node$type.spec) === null || _node$type$spec === void 0 ? void 0 : _node$type$spec.toDOM) !== 'function') {
|
|
177
|
-
// TODO:
|
|
177
|
+
// TODO: ED-23982 - Analytics
|
|
178
178
|
// dispatchAnalyticsEvent({
|
|
179
179
|
// action: ACTION.LAZY_NODE_VIEW_ERROR,
|
|
180
180
|
// actionSubject: ACTION_SUBJECT.LAZY_NODE_VIEW,
|
|
@@ -5,6 +5,8 @@ export const annotationMessages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Comment',
|
|
6
6
|
description: 'Create/add an inline comment based on the users selection'
|
|
7
7
|
},
|
|
8
|
+
// Ignored via go/ees007
|
|
9
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
8
10
|
// TODO: Remove this message when the editor_inline_comments_on_inline_nodes FF is removed
|
|
9
11
|
createCommentInvalid: {
|
|
10
12
|
id: 'fabric.editor.createCommentInvalid',
|
|
@@ -85,6 +85,8 @@ export const helpDialogMessages = defineMessages({
|
|
|
85
85
|
defaultMessage: 'Close help dialog',
|
|
86
86
|
description: ''
|
|
87
87
|
},
|
|
88
|
+
// Ignored via go/ees007
|
|
89
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
88
90
|
// TODO: Move it inside quick insert plugin
|
|
89
91
|
quickInsert: {
|
|
90
92
|
id: 'fabric.editor.quickInsert',
|
|
@@ -3,6 +3,8 @@ const FEDRAMP_MODERATE = 'fedramp-moderate';
|
|
|
3
3
|
// To determine whether an instance is a FedRAMP instance
|
|
4
4
|
// Copied from platform/packages/uip/atl-context/src/services/is-fedramp/index.tsx
|
|
5
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
|
+
// Ignored via go/ees007
|
|
7
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
6
8
|
// TODO: Seek alternatives
|
|
7
9
|
export function isFedRamp() {
|
|
8
10
|
var _global$location, _global$location$host;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "102.
|
|
4
|
+
const packageVersion = "102.1.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
|
+
// Ignored via go/ees007
|
|
8
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
7
9
|
// TODO: Sanitise the URL instead of just removing it
|
|
8
10
|
if (data.request) {
|
|
9
11
|
delete data.request.url;
|
|
@@ -37,7 +37,6 @@ export const getParentNodeWidth = (pos, state, containerWidth, isFullWidthModeEn
|
|
|
37
37
|
}
|
|
38
38
|
let parentWidth = calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled);
|
|
39
39
|
|
|
40
|
-
// TODO: ED-15663
|
|
41
40
|
// Please, do not copy or use this kind of code below
|
|
42
41
|
// @ts-ignore
|
|
43
42
|
const contextPanelPluginKey = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// TODO:
|
|
1
|
+
// TODO: DSP-4138 - migrate to @atlaskit/design-system
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export default function IconDatasourceAssetsObjects() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// TODO:
|
|
1
|
+
// TODO: DSP-4138 - Migrate to @atlaskit/design-system
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export default function IconDatasourceJiraIssue() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// TODO:
|
|
1
|
+
// TODO: DSP-4138 - Migrate to @atlaskit/design-system
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useIconThemed } from '../use-icon-themed';
|
|
@@ -270,7 +270,7 @@ function getPortalChildren({
|
|
|
270
270
|
className: `${inlineNodeViewClassname}AddZeroWidthSpace`
|
|
271
271
|
}), ZERO_WIDTH_SPACE), jsx(Component, _extends({
|
|
272
272
|
view: nodeViewParams.view
|
|
273
|
-
// TODO:
|
|
273
|
+
// TODO: ED-13910 - Remove the boolean to fix the prosemirror view type
|
|
274
274
|
// Ignored via go/ees005
|
|
275
275
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
276
276
|
,
|
|
@@ -194,7 +194,7 @@ export default class ReactNodeView {
|
|
|
194
194
|
|
|
195
195
|
// View should not process a re-render if this is false.
|
|
196
196
|
// We dont want to destroy the view, so we return true.
|
|
197
|
-
// TODO: ED-13910 Fix viewShouldUpdate readonly decoration array
|
|
197
|
+
// TODO: ED-13910 - Fix viewShouldUpdate readonly decoration array
|
|
198
198
|
if (!this.viewShouldUpdate(node, decorations)) {
|
|
199
199
|
this.node = node;
|
|
200
200
|
return true;
|
|
@@ -42,7 +42,7 @@ export class GapCursorSelection extends Selection {
|
|
|
42
42
|
}
|
|
43
43
|
let pos = $pos.pos;
|
|
44
44
|
|
|
45
|
-
// TODO: Fix any, potential issue.
|
|
45
|
+
// TODO: ED-5048 - Fix any, potential issue.
|
|
46
46
|
// Ignored via go/ees005
|
|
47
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
48
|
let next = null;
|
|
@@ -59,7 +59,7 @@ export const AnnotationSharedCSSByState = () => {
|
|
|
59
59
|
// emotion and token look up
|
|
60
60
|
background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
61
61
|
borderBottom: `2px solid ${"var(--ds-border-accent-yellow, #B38600)"}`,
|
|
62
|
-
// TODO:
|
|
62
|
+
// TODO: DSP-4147 - Annotation shadow
|
|
63
63
|
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)",
|
|
64
64
|
cursor: 'pointer'
|
|
65
65
|
}),
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "102.
|
|
16
|
+
const packageVersion = "102.1.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -50,7 +50,7 @@ const colorPickerButtonStyle = css({
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
// Control the size of color picker buttons and preview
|
|
53
|
-
// TODO:
|
|
53
|
+
// TODO: DSP-4134 - Color picking UI
|
|
54
54
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
55
55
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
56
56
|
const colorPickerWrapper = () => css({
|
|
@@ -9,6 +9,8 @@ export default /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
9
9
|
// Ignored via go/ees005
|
|
10
10
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
11
11
|
}, props, {
|
|
12
|
+
// Ignored via go/ees007
|
|
13
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
12
14
|
// TODO: (from codemod) Buttons with "component", "css" or "style" prop can't be automatically migrated with codemods. Please migrate it manually.
|
|
13
15
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
14
16
|
style: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React, { PureComponent, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
4
|
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
4
5
|
// Use this context to pass in the reference of the element that should be considered as the outside click target
|
|
5
6
|
// The outside click target is the element that should be clicked outside of to trigger the `handleClickOutside` event
|
|
@@ -48,9 +49,12 @@ class WithOutsideClick extends PureComponent {
|
|
|
48
49
|
}
|
|
49
50
|
componentDidMount() {
|
|
50
51
|
if (this.props.handleClickOutside) {
|
|
52
|
+
const options = this.props.captureClick && editorExperiment('platform_editor_controls', 'variant1') ? {
|
|
53
|
+
capture: true
|
|
54
|
+
} : false;
|
|
51
55
|
// Ignored via go/ees005
|
|
52
56
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
53
|
-
document.addEventListener('click', this.handleClick,
|
|
57
|
+
document.addEventListener('click', this.handleClick, options);
|
|
54
58
|
}
|
|
55
59
|
if (this.props.handleEscapeKeydown) {
|
|
56
60
|
var _this$props$editorRef;
|
|
@@ -66,9 +70,12 @@ class WithOutsideClick extends PureComponent {
|
|
|
66
70
|
}
|
|
67
71
|
componentWillUnmount() {
|
|
68
72
|
if (this.props.handleClickOutside) {
|
|
73
|
+
const options = this.props.captureClick && editorExperiment('platform_editor_controls', 'variant1') ? {
|
|
74
|
+
capture: true
|
|
75
|
+
} : false;
|
|
69
76
|
// Ignored via go/ees005
|
|
70
77
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
71
|
-
document.removeEventListener('click', this.handleClick,
|
|
78
|
+
document.removeEventListener('click', this.handleClick, options);
|
|
72
79
|
}
|
|
73
80
|
if (this.props.handleEscapeKeydown) {
|
|
74
81
|
var _this$props$editorRef2;
|
|
@@ -96,6 +103,7 @@ export default function withReactEditorViewOuterListeners(Component) {
|
|
|
96
103
|
handleEnterKeydown,
|
|
97
104
|
handleEscapeKeydown,
|
|
98
105
|
closeOnTab,
|
|
106
|
+
captureClick,
|
|
99
107
|
...props
|
|
100
108
|
}) => {
|
|
101
109
|
const isActiveProp = hasIsOpen(props) ? props.isOpen : true;
|
|
@@ -125,7 +133,8 @@ export default function withReactEditorViewOuterListeners(Component) {
|
|
|
125
133
|
handleClickOutside: handleClickOutside,
|
|
126
134
|
handleEnterKeydown: handleEnterKeydown,
|
|
127
135
|
handleEscapeKeydown: handleEscapeKeydown,
|
|
128
|
-
closeOnTab: closeOnTab
|
|
136
|
+
closeOnTab: closeOnTab,
|
|
137
|
+
captureClick: captureClick
|
|
129
138
|
}, /*#__PURE__*/React.createElement(Component
|
|
130
139
|
// Ignored via go/ees005
|
|
131
140
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -17,6 +17,8 @@ export const calculateToolbarPositionAboveSelection = toolbarTitle => (editorVie
|
|
|
17
17
|
return nextPos;
|
|
18
18
|
}
|
|
19
19
|
// scroll wrapper for full page, fall back to document body
|
|
20
|
+
// Ignored via go/ees007
|
|
21
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
20
22
|
// TODO: look into using getScrollGutterOptions()
|
|
21
23
|
const scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
22
24
|
const wrapperBounds = scrollWrapper.getBoundingClientRect();
|
|
@@ -91,6 +93,8 @@ export const calculateToolbarPositionTrackHead = toolbarTitle => (editorView, ne
|
|
|
91
93
|
return nextPos;
|
|
92
94
|
}
|
|
93
95
|
// scroll wrapper for full page, fall back to document body
|
|
96
|
+
// Ignored via go/ees007
|
|
97
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
94
98
|
// TODO: look into using getScrollGutterOptions()
|
|
95
99
|
const scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
96
100
|
const wrapperBounds = scrollWrapper.getBoundingClientRect();
|
|
@@ -152,7 +152,6 @@ function getMetaFromNode(node, options, normalizeTextParser) {
|
|
|
152
152
|
}
|
|
153
153
|
case 'mention':
|
|
154
154
|
{
|
|
155
|
-
// TODO: Check what should be the fallback when mention does not have a text
|
|
156
155
|
const text = firstChild.attrs.text || '';
|
|
157
156
|
return {
|
|
158
157
|
type: ContentType.MENTION,
|
|
@@ -8,7 +8,6 @@ const DEFAULT_SAMPLING_RATE = 100;
|
|
|
8
8
|
const DEFAULT_SLOW_THRESHOLD = 7;
|
|
9
9
|
export function getPerformanceOptions(view) {
|
|
10
10
|
var _nodeViewTracking$sam, _nodeViewTracking$slo;
|
|
11
|
-
// TODO: ED-15663
|
|
12
11
|
// Please, do not copy or use this kind of code below
|
|
13
12
|
// @ts-ignore
|
|
14
13
|
const fakePluginKey = {
|
|
@@ -33,6 +33,8 @@ export function getColumnWidths(node) {
|
|
|
33
33
|
return tableColumnWidths;
|
|
34
34
|
}
|
|
35
35
|
export function calcTableColumnWidths(node) {
|
|
36
|
+
// Ignored via go/ees007
|
|
37
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
36
38
|
// TODO: replaced with getColumnWidths, which correctly scans entire table for column widths
|
|
37
39
|
if (fg('platform_editor_table_row_span_fix')) {
|
|
38
40
|
const firstRow = node.firstChild;
|
|
@@ -42,6 +42,8 @@ export const validationErrorHandler = (entity, error, options, marks, validate,
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// Ignored via go/ees007
|
|
46
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
45
47
|
// TODO: We can repair missing content like `panel` without a `paragraph`.
|
|
46
48
|
if (error.code === 'INVALID_CONTENT_LENGTH') {
|
|
47
49
|
if (error.meta && options.allowUnsupportedBlock && entity.content) {
|
|
@@ -6,6 +6,11 @@ export var aiMessages = defineMessages({
|
|
|
6
6
|
defaultMessage: 'Page title',
|
|
7
7
|
description: 'A fallback suggested title for the suggest title prompt'
|
|
8
8
|
},
|
|
9
|
+
eventHubfallbackSuggestedTitlePrefix: {
|
|
10
|
+
id: 'fabric.editor.ai.eventHub.fallbackSuggestedTitlePrefix',
|
|
11
|
+
defaultMessage: 'Page',
|
|
12
|
+
description: 'A fallback suggested title prefix for the suggest title prompt'
|
|
13
|
+
},
|
|
9
14
|
// Toolbar messages
|
|
10
15
|
aiToolbarTitle: {
|
|
11
16
|
id: 'fabric.editor.ai.toolbar.titleText',
|
|
@@ -20,6 +20,4 @@ export var BROWSER_FREEZE_INTERACTION_TYPE = /*#__PURE__*/function (BROWSER_FREE
|
|
|
20
20
|
BROWSER_FREEZE_INTERACTION_TYPE["CLICKING"] = "clicking";
|
|
21
21
|
BROWSER_FREEZE_INTERACTION_TYPE["PASTING"] = "pasting";
|
|
22
22
|
return BROWSER_FREEZE_INTERACTION_TYPE;
|
|
23
|
-
}({});
|
|
24
|
-
|
|
25
|
-
// TODO: https://product-fabric.atlassian.net/browse/AFP-1418
|
|
23
|
+
}({});
|
package/dist/esm/collab/index.js
CHANGED
|
@@ -119,6 +119,8 @@ export var PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
|
|
|
119
119
|
|
|
120
120
|
// Collab Provider interface
|
|
121
121
|
|
|
122
|
+
// Ignored via go/ees007
|
|
123
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
122
124
|
// TODO: Deprecate redundant payload types
|
|
123
125
|
|
|
124
126
|
export var DisconnectReason = /*#__PURE__*/function (DisconnectReason) {
|
|
@@ -3,7 +3,7 @@ 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
|
-
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* a custom hook that handles keyboard navigation for Arrow keys based on a
|
|
9
9
|
* given listSize, and a step (for up and down arrows).
|
|
@@ -78,27 +78,18 @@ var moveReducer = function moveReducer(state, action) {
|
|
|
78
78
|
selectedItemIndex: canFocusViewMore ? undefined : listSize
|
|
79
79
|
});
|
|
80
80
|
} else {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
96
|
-
focusOnSearch: false,
|
|
97
|
-
focusOnViewMore: false,
|
|
98
|
-
focusedItemIndex: 0,
|
|
99
|
-
selectedItemIndex: 0
|
|
100
|
-
});
|
|
101
|
-
}
|
|
81
|
+
var _action$payload$step;
|
|
82
|
+
var _newIndex = action.payload.positions ? action.payload.positions - ((_action$payload$step = action.payload.step) !== null && _action$payload$step !== void 0 ? _action$payload$step : 1) : 0;
|
|
83
|
+
var _safeIndex = ensureSafeIndex(_newIndex, state.listSize);
|
|
84
|
+
var isLastItemFocused = _newIndex > listSize;
|
|
85
|
+
var focusOnSearch = isLastItemFocused && !canFocusViewMore;
|
|
86
|
+
var focusOnViewMore = isLastItemFocused && !!canFocusViewMore;
|
|
87
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
88
|
+
focusOnSearch: focusOnSearch,
|
|
89
|
+
focusOnViewMore: focusOnViewMore,
|
|
90
|
+
focusedItemIndex: _safeIndex,
|
|
91
|
+
selectedItemIndex: _safeIndex
|
|
92
|
+
});
|
|
102
93
|
}
|
|
103
94
|
}
|
|
104
95
|
if (state.focusOnViewMore) {
|
|
@@ -321,45 +312,29 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, it
|
|
|
321
312
|
return setFocusOnSearch();
|
|
322
313
|
case 'ArrowRight':
|
|
323
314
|
{
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
return move(e, nextItem);
|
|
329
|
-
} else {
|
|
330
|
-
return move(e, +1);
|
|
331
|
-
}
|
|
315
|
+
var _skipForwardOffsetToS;
|
|
316
|
+
var itemIndex = focusOnSearch ? -1 : selectedItemIndex;
|
|
317
|
+
var nextItem = (_skipForwardOffsetToS = skipForwardOffsetToSafeItem(itemIndex, listSize, 1, itemIsDisabled)) !== null && _skipForwardOffsetToS !== void 0 ? _skipForwardOffsetToS : 1;
|
|
318
|
+
return move(e, nextItem);
|
|
332
319
|
}
|
|
333
320
|
case 'ArrowLeft':
|
|
334
321
|
{
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
return move(e, -_nextItem);
|
|
339
|
-
} else {
|
|
340
|
-
return move(e, -1);
|
|
341
|
-
}
|
|
322
|
+
var _skipBackwardOffsetTo;
|
|
323
|
+
var _nextItem = (_skipBackwardOffsetTo = skipBackwardOffsetToSafeItem(selectedItemIndex, 1, itemIsDisabled)) !== null && _skipBackwardOffsetTo !== void 0 ? _skipBackwardOffsetTo : 1;
|
|
324
|
+
return move(e, -_nextItem);
|
|
342
325
|
}
|
|
343
326
|
case 'ArrowDown':
|
|
344
327
|
{
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
return move(e, +_nextItem2, step);
|
|
350
|
-
} else {
|
|
351
|
-
return move(e, +step);
|
|
352
|
-
}
|
|
328
|
+
var _skipForwardOffsetToS2;
|
|
329
|
+
var _itemIndex = focusOnSearch ? -step : selectedItemIndex;
|
|
330
|
+
var _nextItem2 = (_skipForwardOffsetToS2 = skipForwardOffsetToSafeItem(_itemIndex, listSize, step, itemIsDisabled)) !== null && _skipForwardOffsetToS2 !== void 0 ? _skipForwardOffsetToS2 : step;
|
|
331
|
+
return move(e, +_nextItem2, step);
|
|
353
332
|
}
|
|
354
333
|
case 'ArrowUp':
|
|
355
334
|
{
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return move(e, Math.min(-_nextItem3, -step), step);
|
|
360
|
-
} else {
|
|
361
|
-
return move(e, -step, step);
|
|
362
|
-
}
|
|
335
|
+
var _skipBackwardOffsetTo2;
|
|
336
|
+
var _nextItem3 = (_skipBackwardOffsetTo2 = skipBackwardOffsetToSafeItem(selectedItemIndex, step, itemIsDisabled)) !== null && _skipBackwardOffsetTo2 !== void 0 ? _skipBackwardOffsetTo2 : step;
|
|
337
|
+
return move(e, Math.min(-_nextItem3, -step), step);
|
|
363
338
|
}
|
|
364
339
|
}
|
|
365
340
|
}, [focusOnSearch, setFocusOnSearch, move, selectedItemIndex, itemIsDisabled, listSize, step]);
|
|
@@ -71,6 +71,8 @@ export var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActi
|
|
|
71
71
|
},
|
|
72
72
|
removeChild: function removeChild(index) {
|
|
73
73
|
var pos = getPos();
|
|
74
|
+
// Ignored via go/ees007
|
|
75
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
74
76
|
// TODO: Add child index validation here, don't trust this data
|
|
75
77
|
if (typeof pos !== 'number' || typeof index !== 'number') {
|
|
76
78
|
throw new Error('Position or index not valid');
|
package/dist/esm/insert/index.js
CHANGED
|
@@ -72,6 +72,8 @@ var insertBeforeOrAfter = function insertBeforeOrAfter(tr, lookDirection, $paren
|
|
|
72
72
|
return tr.insert($proposedPosition[lookDirection](), content);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
// Ignored via go/ees007
|
|
76
|
+
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
|
|
75
77
|
// FIXME: A more sustainable and configurable way to choose when to split
|
|
76
78
|
// Ignored via go/ees005
|
|
77
79
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|