@atlaskit/editor-common 72.1.1 → 72.2.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 +21 -0
- package/dist/cjs/analytics/types/enums.js +1 -1
- package/dist/cjs/styles/shared/code-block.js +1 -3
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-menu/Dropdown/index.js +1 -1
- package/dist/cjs/ui-menu/DropdownMenu/index.js +23 -7
- package/dist/cjs/ui-menu/MenuArrowKeyNavigationProvider/index.js +68 -51
- package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +4 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/types/enums.js +1 -1
- package/dist/es2019/styles/shared/code-block.js +3 -6
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-menu/Dropdown/index.js +1 -1
- package/dist/es2019/ui-menu/DropdownMenu/index.js +23 -7
- package/dist/es2019/ui-menu/MenuArrowKeyNavigationProvider/index.js +60 -51
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/types/enums.js +1 -1
- package/dist/esm/styles/shared/code-block.js +1 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-menu/Dropdown/index.js +1 -1
- package/dist/esm/ui-menu/DropdownMenu/index.js +23 -7
- package/dist/esm/ui-menu/MenuArrowKeyNavigationProvider/index.js +66 -52
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +4 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types/enums.d.ts +1 -1
- package/dist/types/analytics/types/events.d.ts +3 -2
- package/dist/types/analytics/types/general-events.d.ts +8 -3
- package/dist/types/types/editor-plugin.d.ts +24 -2
- package/dist/types/types/floating-toolbar.d.ts +10 -0
- package/dist/types/types/type-ahead.d.ts +8 -0
- package/dist/types/ui-menu/DropdownMenu/index.d.ts +1 -1
- package/dist/types/ui-menu/DropdownMenu/types.d.ts +1 -0
- package/dist/types/ui-menu/MenuArrowKeyNavigationProvider/index.d.ts +3 -2
- package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +1 -1
- package/package.json +8 -8
|
@@ -9,9 +9,20 @@ import type { TypeAheadHandler } from './type-ahead';
|
|
|
9
9
|
import type { UIComponentFactory } from './ui-components';
|
|
10
10
|
export declare type PluginsOptions = {
|
|
11
11
|
[pluginName: string]: any;
|
|
12
|
+
/**
|
|
13
|
+
* Handler returns an array of QuickInsertItem that are added to the Element Browser, Insert Menu and Quick Insert
|
|
14
|
+
*/
|
|
12
15
|
quickInsert?: QuickInsertHandler;
|
|
13
16
|
typeAhead?: TypeAheadHandler;
|
|
17
|
+
/**
|
|
18
|
+
* See: `FloatingToolbarConfig`
|
|
19
|
+
*/
|
|
14
20
|
floatingToolbar?: FloatingToolbarHandler;
|
|
21
|
+
/**
|
|
22
|
+
* Handler returning a React component that is added to the context panel.
|
|
23
|
+
*
|
|
24
|
+
* See https://product-fabric.atlassian.net/wiki/spaces/E/pages/1406016239/Context+Panel
|
|
25
|
+
*/
|
|
15
26
|
contextPanel?: ContextPanelHandler;
|
|
16
27
|
};
|
|
17
28
|
declare type EditorViewStateUpdatedCallbackProps = {
|
|
@@ -34,19 +45,27 @@ export interface EditorPlugin {
|
|
|
34
45
|
*/
|
|
35
46
|
pmPlugins?: (pluginOptions?: any) => Array<PMPlugin>;
|
|
36
47
|
/**
|
|
37
|
-
*
|
|
48
|
+
* A list of `NodeConfig`s with a name and a `NodeSpec`. (`NodeSpec` is imported from @atlaskit/adf-schema)
|
|
49
|
+
*
|
|
38
50
|
*/
|
|
39
51
|
nodes?: () => NodeConfig[];
|
|
40
52
|
/**
|
|
41
|
-
*
|
|
53
|
+
* A list of `MarkConfig`s with a name and a `MarkSpec` (`MarkSpec` is imported from @atlaskit/adf-schema)
|
|
42
54
|
*/
|
|
43
55
|
marks?: () => MarkConfig[];
|
|
44
56
|
/**
|
|
45
57
|
* Optional UI-component that lives inside the actual content-area (like mention-picker, floating toolbar for links, etc.)
|
|
58
|
+
*
|
|
59
|
+
* Handler returns a React component that is added to the top of the editor content area (PluginSlot).
|
|
60
|
+
* Although it’s common to specify a custom mount point (eg. date picker)
|
|
46
61
|
*/
|
|
47
62
|
contentComponent?: UIComponentFactory;
|
|
48
63
|
/**
|
|
49
64
|
* Optional UI-component that will be added to the toolbar at the top of the editor (doesn't exist in the compact-editor).
|
|
65
|
+
*
|
|
66
|
+
* Handler returns a React component that is added to the toolbar at the top of the editor
|
|
67
|
+
*
|
|
68
|
+
* Plugins use <ToolbarButton> component to maintain design consistency.
|
|
50
69
|
*/
|
|
51
70
|
primaryToolbarComponent?: ToolbarUIComponentFactory;
|
|
52
71
|
/**
|
|
@@ -54,6 +73,9 @@ export interface EditorPlugin {
|
|
|
54
73
|
* In compact mode this toolbar lives on the right-hand side of the editor.
|
|
55
74
|
*/
|
|
56
75
|
secondaryToolbarComponent?: UIComponentFactory;
|
|
76
|
+
/**
|
|
77
|
+
* Called after EditorView state is updated.
|
|
78
|
+
*/
|
|
57
79
|
onEditorViewStateUpdated?: (props: EditorViewStateUpdatedCallbackProps) => void;
|
|
58
80
|
}
|
|
59
81
|
export declare type getPosHandler = getPosHandlerNode | boolean;
|
|
@@ -204,6 +204,7 @@ declare type FloatingToolbarExtensionsPlaceholder = {
|
|
|
204
204
|
export declare type FloatingToolbarFallbackItem<T> = FloatingToolbarButton<T> | FloatingToolbarCopyButton | FloatingToolbarDropdown<T> | FloatingToolbarSelect<T> | FloatingToolbarInput<T> | FloatingToolbarSeparator;
|
|
205
205
|
export declare type FloatingToolbarItem<T> = FloatingToolbarButton<T> | FloatingToolbarCopyButton | FloatingToolbarDropdown<T> | FloatingToolbarSelect<T> | FloatingToolbarInput<T> | FloatingToolbarCustom<T> | FloatingToolbarSeparator | FloatingToolbarExtensionsPlaceholder;
|
|
206
206
|
export interface FloatingToolbarConfig {
|
|
207
|
+
/** Used for the ariaLabel on the <Popup /> component */
|
|
207
208
|
title: string;
|
|
208
209
|
/**
|
|
209
210
|
* Override the DOM reference used to apply as the target for the
|
|
@@ -213,17 +214,26 @@ export interface FloatingToolbarConfig {
|
|
|
213
214
|
* head of the current selection.
|
|
214
215
|
*/
|
|
215
216
|
getDomRef?: (view: EditorView) => HTMLElement | undefined;
|
|
217
|
+
/** Can prevent the Toolbar from rendering */
|
|
216
218
|
visible?: boolean;
|
|
217
219
|
/**
|
|
218
220
|
* nodeType or list of `nodeType`s this floating toolbar should be shown for.
|
|
219
221
|
**/
|
|
220
222
|
nodeType: NodeType | NodeType[];
|
|
223
|
+
/** Items that will populate the Toolbar.
|
|
224
|
+
*
|
|
225
|
+
* See: `FloatingToolbarItem`
|
|
226
|
+
*/
|
|
221
227
|
items: Array<FloatingToolbarItem<Command>> | ((node: Node) => Array<FloatingToolbarItem<Command>>);
|
|
222
228
|
align?: AlignType;
|
|
229
|
+
/** Class added to Toolbar wrapper */
|
|
223
230
|
className?: string;
|
|
231
|
+
/** Toolbar height */
|
|
224
232
|
height?: number;
|
|
233
|
+
/** Toolbar width */
|
|
225
234
|
width?: number;
|
|
226
235
|
zIndex?: number;
|
|
236
|
+
/** Offset the position of the toolbar. */
|
|
227
237
|
offset?: [number, number];
|
|
228
238
|
forcePlacement?: boolean;
|
|
229
239
|
onPositionCalculated?: (editorView: EditorView, nextPos: Position) => Position;
|
|
@@ -42,17 +42,25 @@ export declare type TypeAheadItem = {
|
|
|
42
42
|
export declare type TypeAheadForceSelect = (props: TypeAheadForceSelectProps) => TypeAheadItem | undefined;
|
|
43
43
|
export declare type TypeAheadHandler = {
|
|
44
44
|
id: TypeAheadAvailableNodes;
|
|
45
|
+
/** Pattern that will trigger the TypeAhead */
|
|
45
46
|
trigger: string;
|
|
47
|
+
/** Custom regex must have a capture group around trigger so it's possible to
|
|
48
|
+
* use it without needing to scan through all triggers again */
|
|
46
49
|
customRegex?: string;
|
|
47
50
|
headless?: boolean;
|
|
51
|
+
/** Handler returns typeahead item based on query. Used to find which item to insert. */
|
|
48
52
|
forceSelect?: TypeAheadForceSelect;
|
|
49
53
|
onInvokeAnalytics?: TypeAheadPayload;
|
|
54
|
+
/** Handler executes logic when TypeAhead opens */
|
|
50
55
|
onOpen?: (editorState: EditorState) => void;
|
|
56
|
+
/** Handler returns an array of TypeAheadItem based on query to be displayed in the TypeAhead */
|
|
51
57
|
getItems: (props: {
|
|
52
58
|
query: string;
|
|
53
59
|
editorState: EditorState;
|
|
54
60
|
}) => Promise<Array<TypeAheadItem>>;
|
|
61
|
+
/** Handler returns a transaction which inserts the TypeAheadItem into the doc */
|
|
55
62
|
selectItem: TypeAheadSelectItem;
|
|
63
|
+
/** Handler executes logic when TypeAhead is dismissed */
|
|
56
64
|
dismiss?: (props: {
|
|
57
65
|
editorState: EditorState;
|
|
58
66
|
query: string;
|
|
@@ -13,7 +13,7 @@ export default class DropdownMenuWrapper extends PureComponent<Props, State> {
|
|
|
13
13
|
state: State;
|
|
14
14
|
private handleRef;
|
|
15
15
|
private updatePopupPlacement;
|
|
16
|
-
private
|
|
16
|
+
private handleCloseAndFocus;
|
|
17
17
|
private handleClose;
|
|
18
18
|
private renderDropdownMenu;
|
|
19
19
|
render(): jsx.JSX.Element;
|
|
@@ -5,11 +5,12 @@ declare type SimpleEventHandler<T> = (event: T) => void;
|
|
|
5
5
|
* This component is a wrapper of vertical menus which listens to keydown events of children
|
|
6
6
|
* and handles up/down arrow key navigation
|
|
7
7
|
*/
|
|
8
|
-
export declare const MenuArrowKeyNavigationProvider: ({ children, handleClose, disableArrowKeyNavigation, keyDownHandlerContext,
|
|
8
|
+
export declare const MenuArrowKeyNavigationProvider: ({ children, handleClose, disableArrowKeyNavigation, keyDownHandlerContext, closeOnTab, onSelection, }: {
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
handleClose?: SimpleEventHandler<KeyboardEvent> | undefined;
|
|
11
11
|
disableArrowKeyNavigation?: boolean | undefined;
|
|
12
12
|
keyDownHandlerContext?: KeyDownHandlerContext | undefined;
|
|
13
|
-
|
|
13
|
+
onSelection?: ((index: number) => void) | undefined;
|
|
14
|
+
closeOnTab?: boolean | undefined;
|
|
14
15
|
}) => JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -5,7 +5,7 @@ export interface WithOutsideClickProps {
|
|
|
5
5
|
handleEscapeKeydown?: SimpleEventHandler<KeyboardEvent>;
|
|
6
6
|
handleEnterKeydown?: SimpleEventHandler<KeyboardEvent>;
|
|
7
7
|
targetRef?: any;
|
|
8
|
-
|
|
8
|
+
closeOnTab?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export default function withReactEditorViewOuterListeners<P>(Component: ComponentClass<P> | StatelessComponent<P>): React.FC<P & WithOutsideClickProps>;
|
|
11
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "72.
|
|
3
|
+
"version": "72.2.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/"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@atlaskit/activity-provider": "^2.3.0",
|
|
60
60
|
"@atlaskit/adf-schema": "^25.1.0",
|
|
61
61
|
"@atlaskit/adf-utils": "^18.0.0",
|
|
62
|
-
"@atlaskit/analytics-listeners": "^8.
|
|
62
|
+
"@atlaskit/analytics-listeners": "^8.5.0",
|
|
63
63
|
"@atlaskit/analytics-namespaced-context": "^6.6.0",
|
|
64
64
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
65
65
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
@@ -67,18 +67,18 @@
|
|
|
67
67
|
"@atlaskit/code": "^14.4.0",
|
|
68
68
|
"@atlaskit/codemod-utils": "^4.1.0",
|
|
69
69
|
"@atlaskit/editor-json-transformer": "^8.8.0",
|
|
70
|
-
"@atlaskit/editor-palette": "
|
|
70
|
+
"@atlaskit/editor-palette": "1.0.0",
|
|
71
71
|
"@atlaskit/editor-shared-styles": "^2.3.0",
|
|
72
72
|
"@atlaskit/emoji": "^67.0.0",
|
|
73
73
|
"@atlaskit/icon": "^21.11.0",
|
|
74
74
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
75
|
-
"@atlaskit/media-card": "^74.
|
|
75
|
+
"@atlaskit/media-card": "^74.5.0",
|
|
76
76
|
"@atlaskit/media-client": "^20.0.0",
|
|
77
|
-
"@atlaskit/media-picker": "^64.
|
|
77
|
+
"@atlaskit/media-picker": "^64.2.0",
|
|
78
78
|
"@atlaskit/mention": "^21.0.0",
|
|
79
79
|
"@atlaskit/menu": "^1.4.0",
|
|
80
80
|
"@atlaskit/profilecard": "^18.2.0",
|
|
81
|
-
"@atlaskit/smart-card": "^23.
|
|
81
|
+
"@atlaskit/smart-card": "^23.14.0",
|
|
82
82
|
"@atlaskit/smart-user-picker": "^6.0.0",
|
|
83
83
|
"@atlaskit/task-decision": "^17.5.0",
|
|
84
84
|
"@atlaskit/theme": "^12.2.0",
|
|
@@ -114,9 +114,9 @@
|
|
|
114
114
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
|
-
"@atlaskit/editor-core": "^178.
|
|
117
|
+
"@atlaskit/editor-core": "^178.1.0",
|
|
118
118
|
"@atlaskit/editor-json-transformer": "^8.8.0",
|
|
119
|
-
"@atlaskit/editor-plugin-table": "^1.
|
|
119
|
+
"@atlaskit/editor-plugin-table": "^1.1.0",
|
|
120
120
|
"@atlaskit/editor-test-helpers": "^18.0.0",
|
|
121
121
|
"@atlaskit/media-core": "^34.0.0",
|
|
122
122
|
"@atlaskit/util-data-test": "^17.6.0",
|