@atlaskit/editor-common 102.10.4 → 102.11.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.
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ import { jsx } from '@emotion/react';
3
+ import type { IntlShape } from 'react-intl-next';
4
+ import type { Node } from '@atlaskit/editor-prosemirror/model';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
+ import type { ButtonItemProps } from '@atlaskit/menu';
7
+ import type { ExtensionAPI, ExtensionProvider } from '../extensions';
8
+ import type { DropdownOptionT, FloatingToolbarOverflowDropdownOptions } from '../types';
9
+ export declare const menuItemDimensions: {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ export interface Props {
14
+ hide: Function;
15
+ dispatchCommand: Function;
16
+ items: Array<DropdownOptionT<Function>> | FloatingToolbarOverflowDropdownOptions<Function>;
17
+ showSelected?: boolean;
18
+ editorView?: EditorView;
19
+ extensions?: ExtensionProps;
20
+ }
21
+ export type ExtensionProps = {
22
+ node: Node;
23
+ extensionApi?: ExtensionAPI;
24
+ extensionsProvider?: Promise<ExtensionProvider>;
25
+ };
26
+ export interface DropdownButtonItemProps extends ButtonItemProps {
27
+ onMouseEnter?: (event: React.MouseEvent | React.KeyboardEvent) => void;
28
+ onMouseOver?: (event: React.MouseEvent | React.KeyboardEvent) => void;
29
+ onMouseLeave?: (event: React.MouseEvent | React.KeyboardEvent) => void;
30
+ onMouseOut?: (event: React.MouseEvent | React.KeyboardEvent) => void;
31
+ onFocus?: (event: React.MouseEvent | React.KeyboardEvent) => void;
32
+ onBlur?: (event: React.MouseEvent | React.KeyboardEvent) => void;
33
+ }
34
+ export type DropdownMenuItemProps = {
35
+ item: DropdownOptionT<Function>;
36
+ hide: Function;
37
+ dispatchCommand: Function;
38
+ editorView?: EditorView;
39
+ intl: IntlShape;
40
+ showSelected: boolean;
41
+ itemSelected?: boolean;
42
+ };
43
+ export declare const DropdownMenuItem: (props: DropdownMenuItemProps) => jsx.JSX.Element;
@@ -4,4 +4,7 @@ export declare const shallowEqual: (objA?: Object, objB?: Object) => boolean;
4
4
  export declare const compareArrays: <T extends any[]>(left: Array<T>, right: Array<T>, compareFn?: (left: T, right: T) => boolean) => boolean;
5
5
  export declare const isSameItem: (leftItem: Item, rightItem: Item) => boolean;
6
6
  export declare const areSameItems: (leftArr?: Array<Item>, rightArr?: Array<Item>) => boolean;
7
+ export { DropdownMenuExtensionItems } from './DropdownMenuExtensionItems';
8
+ export { DropdownMenuItem } from './DropdownMenuItem';
9
+ export type { DropdownMenuItemProps } from './DropdownMenuItem';
7
10
  export { default as messages } from './messages';
@@ -8,6 +8,7 @@ import type { SpotlightCard } from '@atlaskit/onboarding';
8
8
  import type { Placement } from '@atlaskit/popper';
9
9
  import type { TooltipProps } from '@atlaskit/tooltip';
10
10
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
11
+ import type { DropdownMenuItemProps } from '../floating-toolbar';
11
12
  import type { ProviderFactory } from '../provider-factory';
12
13
  import type { PaletteColor } from '../ui-color/ColorPalette/Palettes/type';
13
14
  import type { Command, CommandDispatch } from './command';
@@ -19,7 +20,13 @@ type OverflowDropdownHeading = {
19
20
  type: 'overflow-dropdown-heading';
20
21
  title: string;
21
22
  };
22
- export type FloatingToolbarOverflowDropdownOptions<T extends Object> = Array<DropdownOptionT<T> | FloatingToolbarSeparator | OverflowDropdownHeading>;
23
+ type OverflowDropdownCustom<T extends Object> = {
24
+ type: 'custom';
25
+ fallback: Array<FloatingToolbarFallbackItem<T>>;
26
+ render: (view?: EditorView, dropdownOption?: Omit<DropdownMenuItemProps, 'item'>) => React.ReactNode;
27
+ hidden?: boolean;
28
+ };
29
+ export type FloatingToolbarOverflowDropdownOptions<T extends Object> = Array<DropdownOptionT<T> | FloatingToolbarSeparator | OverflowDropdownHeading | OverflowDropdownCustom<T>>;
23
30
  type FloatingToolbarOverflowDropdown<T extends Object> = {
24
31
  type: 'overflow-dropdown';
25
32
  options: FloatingToolbarOverflowDropdownOptions<T>;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import type { IntlShape } from 'react-intl-next';
3
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { ExtensionAPI, ExtensionProvider } from '../extensions';
6
+ export interface DropdownMenuOptions {
7
+ hide: Function;
8
+ dispatchCommand: Function;
9
+ intl: IntlShape;
10
+ showSelected: boolean;
11
+ }
12
+ type OverflowExtensionPlaceholderProps = {
13
+ node: PMNode;
14
+ editorView: EditorView;
15
+ extension: ExtensionProps;
16
+ disabled?: (key: string) => boolean;
17
+ dropdownOptions?: DropdownMenuOptions;
18
+ };
19
+ export type ExtensionProps = {
20
+ extensionApi?: ExtensionAPI;
21
+ extensionProvider?: Promise<ExtensionProvider>;
22
+ };
23
+ export declare const DropdownMenuExtensionItems: (props: OverflowExtensionPlaceholderProps) => React.JSX.Element | null;
24
+ export {};
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ import { jsx } from '@emotion/react';
3
+ import type { IntlShape } from 'react-intl-next';
4
+ import type { Node } from '@atlaskit/editor-prosemirror/model';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
+ import type { ButtonItemProps } from '@atlaskit/menu';
7
+ import type { ExtensionAPI, ExtensionProvider } from '../extensions';
8
+ import type { DropdownOptionT, FloatingToolbarOverflowDropdownOptions } from '../types';
9
+ export declare const menuItemDimensions: {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ export interface Props {
14
+ hide: Function;
15
+ dispatchCommand: Function;
16
+ items: Array<DropdownOptionT<Function>> | FloatingToolbarOverflowDropdownOptions<Function>;
17
+ showSelected?: boolean;
18
+ editorView?: EditorView;
19
+ extensions?: ExtensionProps;
20
+ }
21
+ export type ExtensionProps = {
22
+ node: Node;
23
+ extensionApi?: ExtensionAPI;
24
+ extensionsProvider?: Promise<ExtensionProvider>;
25
+ };
26
+ export interface DropdownButtonItemProps extends ButtonItemProps {
27
+ onMouseEnter?: (event: React.MouseEvent | React.KeyboardEvent) => void;
28
+ onMouseOver?: (event: React.MouseEvent | React.KeyboardEvent) => void;
29
+ onMouseLeave?: (event: React.MouseEvent | React.KeyboardEvent) => void;
30
+ onMouseOut?: (event: React.MouseEvent | React.KeyboardEvent) => void;
31
+ onFocus?: (event: React.MouseEvent | React.KeyboardEvent) => void;
32
+ onBlur?: (event: React.MouseEvent | React.KeyboardEvent) => void;
33
+ }
34
+ export type DropdownMenuItemProps = {
35
+ item: DropdownOptionT<Function>;
36
+ hide: Function;
37
+ dispatchCommand: Function;
38
+ editorView?: EditorView;
39
+ intl: IntlShape;
40
+ showSelected: boolean;
41
+ itemSelected?: boolean;
42
+ };
43
+ export declare const DropdownMenuItem: (props: DropdownMenuItemProps) => jsx.JSX.Element;
@@ -4,4 +4,7 @@ export declare const shallowEqual: (objA?: Object, objB?: Object) => boolean;
4
4
  export declare const compareArrays: <T extends any[]>(left: Array<T>, right: Array<T>, compareFn?: (left: T, right: T) => boolean) => boolean;
5
5
  export declare const isSameItem: (leftItem: Item, rightItem: Item) => boolean;
6
6
  export declare const areSameItems: (leftArr?: Array<Item>, rightArr?: Array<Item>) => boolean;
7
+ export { DropdownMenuExtensionItems } from './DropdownMenuExtensionItems';
8
+ export { DropdownMenuItem } from './DropdownMenuItem';
9
+ export type { DropdownMenuItemProps } from './DropdownMenuItem';
7
10
  export { default as messages } from './messages';
@@ -8,6 +8,7 @@ import type { SpotlightCard } from '@atlaskit/onboarding';
8
8
  import type { Placement } from '@atlaskit/popper';
9
9
  import type { TooltipProps } from '@atlaskit/tooltip';
10
10
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
11
+ import type { DropdownMenuItemProps } from '../floating-toolbar';
11
12
  import type { ProviderFactory } from '../provider-factory';
12
13
  import type { PaletteColor } from '../ui-color/ColorPalette/Palettes/type';
13
14
  import type { Command, CommandDispatch } from './command';
@@ -19,7 +20,13 @@ type OverflowDropdownHeading = {
19
20
  type: 'overflow-dropdown-heading';
20
21
  title: string;
21
22
  };
22
- export type FloatingToolbarOverflowDropdownOptions<T extends Object> = Array<DropdownOptionT<T> | FloatingToolbarSeparator | OverflowDropdownHeading>;
23
+ type OverflowDropdownCustom<T extends Object> = {
24
+ type: 'custom';
25
+ fallback: Array<FloatingToolbarFallbackItem<T>>;
26
+ render: (view?: EditorView, dropdownOption?: Omit<DropdownMenuItemProps, 'item'>) => React.ReactNode;
27
+ hidden?: boolean;
28
+ };
29
+ export type FloatingToolbarOverflowDropdownOptions<T extends Object> = Array<DropdownOptionT<T> | FloatingToolbarSeparator | OverflowDropdownHeading | OverflowDropdownCustom<T>>;
23
30
  type FloatingToolbarOverflowDropdown<T extends Object> = {
24
31
  type: 'overflow-dropdown';
25
32
  options: FloatingToolbarOverflowDropdownOptions<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "102.10.4",
3
+ "version": "102.11.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/"