@atlaskit/editor-common 134.20.0 → 135.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/cjs/element-browser/components/ElementBrowserLoader.js +25 -21
- package/dist/cjs/extensibility/ExtensionComponent.js +2 -1
- package/dist/cjs/extensions/extension-handlers.js +10 -44
- package/dist/cjs/link/LinkPicker/HyperlinkAddToolbar/index.js +4 -4
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/numbered-headings/create-heading-numberer.js +37 -0
- package/dist/cjs/numbered-headings/index.js +5 -19
- package/dist/cjs/toolbar/EditorToolbarUIProvider.js +18 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/ErrorBoundary/index.js +6 -9
- package/dist/cjs/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +16 -3
- package/dist/es2019/element-browser/components/ElementBrowserLoader.js +20 -14
- package/dist/es2019/extensibility/ExtensionComponent.js +2 -1
- package/dist/es2019/extensions/extension-handlers.js +6 -23
- package/dist/es2019/link/LinkPicker/HyperlinkAddToolbar/index.js +6 -5
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/numbered-headings/create-heading-numberer.js +31 -0
- package/dist/es2019/numbered-headings/index.js +4 -19
- package/dist/es2019/toolbar/EditorToolbarUIProvider.js +16 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/ErrorBoundary/index.js +10 -7
- package/dist/es2019/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +16 -3
- package/dist/esm/element-browser/components/ElementBrowserLoader.js +25 -19
- package/dist/esm/extensibility/ExtensionComponent.js +2 -1
- package/dist/esm/extensions/extension-handlers.js +8 -44
- package/dist/esm/link/LinkPicker/HyperlinkAddToolbar/index.js +4 -4
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/numbered-headings/create-heading-numberer.js +31 -0
- package/dist/esm/numbered-headings/index.js +5 -18
- package/dist/esm/toolbar/EditorToolbarUIProvider.js +18 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/ErrorBoundary/index.js +6 -9
- package/dist/esm/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +16 -3
- package/dist/types/analytics/types/events.d.ts +1 -1
- package/dist/types/extensions/extension-handlers.d.ts +2 -1
- package/dist/types/link/LinkPicker/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types/numbered-headings/create-heading-numberer.d.ts +14 -0
- package/dist/types/numbered-headings/index.d.ts +1 -4
- package/dist/types/ui/ErrorBoundary/index.d.ts +3 -6
- package/numbered-headings/create-heading-numberer/package.json +10 -0
- package/package.json +3 -3
|
@@ -7,6 +7,7 @@ import React, { useCallback, useLayoutEffect, useMemo, useRef } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
11
|
import { ELEMENT_BROWSER_ID } from '../../element-browser';
|
|
11
12
|
import { fullPageMessages } from '../../messages';
|
|
12
13
|
import { mediaInsertMessages } from '../../messages/media-insert';
|
|
@@ -122,12 +123,24 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
|
|
|
122
123
|
* @param event
|
|
123
124
|
*/
|
|
124
125
|
var handleKeyDown = function handleKeyDown(event) {
|
|
125
|
-
var _document$querySelect, _document$querySelect2, _wrapperRef$
|
|
126
|
+
var _document$querySelect, _document$querySelect2, _wrapperRef$current2, _wrapperRef$current3;
|
|
126
127
|
// To trap the focus inside the horizontal toolbar for left and right arrow keys
|
|
127
128
|
var targetElement = event.target;
|
|
128
129
|
if (targetElement instanceof HTMLElement && !targetElement.closest("".concat(childComponentSelector))) {
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
132
|
+
|
|
133
|
+
// On the top layer, a menu or popup opened from the toolbar renders inside the toolbar, and
|
|
134
|
+
// it owns its keys: the arrow keys, Tab, and Escape (which closes it and returns focus to its
|
|
135
|
+
// opener). So the toolbar ignores keys from a layer inside it. A layer around the toolbar
|
|
136
|
+
// (for example a floating toolbar's popup) does not count.
|
|
137
|
+
if (fg('platform-dst-top-layer') && targetElement instanceof Element) {
|
|
138
|
+
var _wrapperRef$current;
|
|
139
|
+
var layer = targetElement.closest('[popover], dialog');
|
|
140
|
+
if (layer && (_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(layer)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
131
144
|
if (targetElement instanceof HTMLElement && (_document$querySelect = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect !== void 0 && _document$querySelect.contains(targetElement) || targetElement instanceof HTMLElement && (_document$querySelect2 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect2 !== void 0 && _document$querySelect2.contains(targetElement) || targetElement instanceof HTMLElement && targetElement.closest('[data-keyboard-navigation-independent]') || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
|
|
132
145
|
return;
|
|
133
146
|
}
|
|
@@ -136,7 +149,7 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
|
|
|
136
149
|
// if menu wrapper exists, then a menu is open and arrow keys will be handled by MenuArrowKeyNavigationProvider
|
|
137
150
|
return;
|
|
138
151
|
}
|
|
139
|
-
var elementBrowser = wrapperRef === null || wrapperRef === void 0 || (_wrapperRef$
|
|
152
|
+
var elementBrowser = wrapperRef === null || wrapperRef === void 0 || (_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.querySelector("#".concat(ELEMENT_BROWSER_ID));
|
|
140
153
|
if (elementBrowser) {
|
|
141
154
|
// if element browser is open, then arrow keys will be handled by MenuArrowKeyNavigationProvider
|
|
142
155
|
return;
|
|
@@ -150,7 +163,7 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
|
|
|
150
163
|
if (targetElement instanceof HTMLElement && targetElement.closest("[aria-label=\"".concat(intl.formatMessage(mediaInsertMessages.mediaPickerPopupAriaLabel), "\"]"))) {
|
|
151
164
|
return;
|
|
152
165
|
}
|
|
153
|
-
if (targetElement instanceof HTMLElement && !((_wrapperRef$
|
|
166
|
+
if (targetElement instanceof HTMLElement && !((_wrapperRef$current3 = wrapperRef.current) !== null && _wrapperRef$current3 !== void 0 && _wrapperRef$current3.contains(targetElement))) {
|
|
154
167
|
selectedItemIndex.current = -1;
|
|
155
168
|
} else {
|
|
156
169
|
selectedItemIndex.current = targetElement instanceof HTMLElement && filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
|
|
@@ -167,7 +167,7 @@ export type ErrorEventAttributes = {
|
|
|
167
167
|
outdatedBrowser?: boolean;
|
|
168
168
|
product?: string;
|
|
169
169
|
};
|
|
170
|
-
type ComponentCrashErrorAEP = OperationalAEP<ACTION.EDITOR_CRASHED, ACTION_SUBJECT.FLOATING_CONTEXTUAL_BUTTON | ACTION_SUBJECT.PLUGIN_SLOT | ACTION_SUBJECT.REACT_NODE_VIEW | ACTION_SUBJECT.TABLES_PLUGIN | ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN | ACTION_SUBJECT.EDITOR | ACTION_SUBJECT.BLOCK_MENU | ACTION_SUBJECT.SYNCED_BLOCK | ACTION_SUBJECT.TOOLBAR, ACTION_SUBJECT_ID | FLOATING_CONTROLS_TITLE, ErrorEventAttributes>;
|
|
170
|
+
type ComponentCrashErrorAEP = OperationalAEP<ACTION.EDITOR_CRASHED, ACTION_SUBJECT.FLOATING_CONTEXTUAL_BUTTON | ACTION_SUBJECT.PLUGIN_SLOT | ACTION_SUBJECT.REACT_NODE_VIEW | ACTION_SUBJECT.TABLES_PLUGIN | ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN | ACTION_SUBJECT.EDITOR | ACTION_SUBJECT.RENDERER | ACTION_SUBJECT.BLOCK_MENU | ACTION_SUBJECT.SYNCED_BLOCK | ACTION_SUBJECT.TOOLBAR, ACTION_SUBJECT_ID | FLOATING_CONTROLS_TITLE, ErrorEventAttributes>;
|
|
171
171
|
type ComponentCrashAdditionalInfoErrorAEP = OperationalAEP<ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION, ACTION_SUBJECT.EDITOR, undefined, {
|
|
172
172
|
errorId: string;
|
|
173
173
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Loadable from 'react-loadable';
|
|
3
|
+
import type { ACTION_SUBJECT } from '../analytics/types/enums';
|
|
3
4
|
import type { ExtensionParams, MultiBodiedExtensionActions, ReferenceEntity } from './types/extension-handler';
|
|
4
5
|
import type { ExtensionKey, ExtensionModuleNode, ExtensionType } from './types/extension-manifest';
|
|
5
6
|
import type { Parameters } from './types/extension-parameters';
|
|
@@ -12,7 +13,7 @@ export declare function getExtensionModuleNodeMaybePreloaded(extensionProvider:
|
|
|
12
13
|
export declare function getExtensionModuleNodePrivateProps(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey): Promise<{
|
|
13
14
|
[prop: string]: any;
|
|
14
15
|
}>;
|
|
15
|
-
export declare function getNodeRenderer<T extends Parameters>(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey): React.ComponentType<{
|
|
16
|
+
export declare function getNodeRenderer<T extends Parameters>(extensionProvider: ExtensionProvider, extensionType: ExtensionType, extensionKey: ExtensionKey, errorActionSubject: ACTION_SUBJECT.EDITOR | ACTION_SUBJECT.RENDERER): React.ComponentType<{
|
|
16
17
|
actions?: MultiBodiedExtensionActions;
|
|
17
18
|
isSelected?: boolean;
|
|
18
19
|
node: ExtensionParams<T>;
|
|
@@ -22,4 +22,4 @@ export interface HyperlinkAddToolbarProps extends Pick<EditorLinkPickerProps, 'o
|
|
|
22
22
|
timesViewed?: number;
|
|
23
23
|
view: EditorView;
|
|
24
24
|
}
|
|
25
|
-
export declare function HyperlinkAddToolbar({ linkPickerOptions:
|
|
25
|
+
export declare function HyperlinkAddToolbar({ linkPickerOptions: linkPickerOptionsProp, onSubmit, displayText, displayUrl, providerFactory, view, onCancel, invokeMethod, lpLinkPicker, onClose, onEscapeCallback, onClickAwayCallback, editorAppearance, inputMethod, searchSessionId, timesViewed, isOffline, }: HyperlinkAddToolbarProps): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that returns the decimal outline number (`1`, `1.1`, `1.1.1`) of each heading,
|
|
3
|
+
* called once per heading in document order. Use it when headings are visited one at a time.
|
|
4
|
+
*
|
|
5
|
+
* Each number has exactly `level` segments. Skipped levels are backfilled with `1` and count as
|
|
6
|
+
* real siblings, and a higher-level heading resets all deeper counters.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const getNextHeadingNumber = createHeadingNumberer();
|
|
10
|
+
* getNextHeadingNumber(1); // '1'
|
|
11
|
+
* getNextHeadingNumber(3); // '1.1.1'
|
|
12
|
+
* getNextHeadingNumber(2); // '1.2'
|
|
13
|
+
*/
|
|
14
|
+
export declare const createHeadingNumberer: () => ((level: number) => string);
|
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const HEADING_NUMBER_ATTRIBUTE = "data-heading-number";
|
|
6
6
|
/**
|
|
7
|
-
* Computes decimal outline numbers
|
|
8
|
-
*
|
|
9
|
-
* Each number has exactly `level` segments. Skipped levels are backfilled with `1` and count as
|
|
10
|
-
* real siblings, and a higher-level heading resets all deeper counters.
|
|
7
|
+
* Computes decimal outline numbers for headings in document order. See `createHeadingNumberer`.
|
|
11
8
|
*
|
|
12
9
|
* @example getHeadingNumbers([1, 3, 2]) // ['1', '1.1.1', '1.2']
|
|
13
10
|
*/
|
|
@@ -9,17 +9,14 @@ interface ErrorBoundaryProps {
|
|
|
9
9
|
component: ErrorCrashPayload['actionSubject'];
|
|
10
10
|
componentId?: ErrorCrashPayload['actionSubjectId'];
|
|
11
11
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
12
|
-
fallbackComponent?: React.ReactNode;
|
|
12
|
+
fallbackComponent?: React.ReactNode | ((error: Error) => React.ReactNode);
|
|
13
13
|
}
|
|
14
14
|
interface ErrorBoundaryState {
|
|
15
|
-
|
|
15
|
+
error: Error | null;
|
|
16
16
|
}
|
|
17
17
|
export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
18
|
-
state:
|
|
19
|
-
errorCaptured: boolean;
|
|
20
|
-
};
|
|
18
|
+
state: ErrorBoundaryState;
|
|
21
19
|
hasFallback(): boolean;
|
|
22
|
-
shouldRecover(): boolean;
|
|
23
20
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
24
21
|
render(): React.ReactNode;
|
|
25
22
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/numbered-headings/create-heading-numberer",
|
|
3
|
+
"main": "../../dist/cjs/numbered-headings/create-heading-numberer.js",
|
|
4
|
+
"module": "../../dist/esm/numbered-headings/create-heading-numberer.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/numbered-headings/create-heading-numberer.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/numbered-headings/create-heading-numberer.d.ts"
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "135.0.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -80,13 +80,13 @@
|
|
|
80
80
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
81
81
|
"@atlaskit/react-ufo": "^8.5.0",
|
|
82
82
|
"@atlaskit/section-message": "^10.3.0",
|
|
83
|
-
"@atlaskit/smart-card": "^46.
|
|
83
|
+
"@atlaskit/smart-card": "^46.15.0",
|
|
84
84
|
"@atlaskit/smart-user-picker": "^12.12.0",
|
|
85
85
|
"@atlaskit/spinner": "^20.4.0",
|
|
86
86
|
"@atlaskit/task-decision": "^21.16.0",
|
|
87
87
|
"@atlaskit/teams-app-config": "^3.1.0",
|
|
88
88
|
"@atlaskit/textfield": "^10.3.0",
|
|
89
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
89
|
+
"@atlaskit/tmp-editor-statsig": "^264.0.0",
|
|
90
90
|
"@atlaskit/tokens": "^20.12.0",
|
|
91
91
|
"@atlaskit/tooltip": "^24.4.0",
|
|
92
92
|
"@atlaskit/width-detector": "^7.2.0",
|