@atlaskit/editor-plugin-block-menu 3.1.6 → 3.2.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 +19 -0
- package/dist/cjs/blockMenuPlugin.js +19 -2
- package/dist/cjs/editor-commands/formatNode.js +48 -1
- package/dist/cjs/editor-commands/transforms/layout-transforms.js +26 -19
- package/dist/cjs/ui/block-menu-components.js +3 -2
- package/dist/cjs/ui/block-menu-provider.js +40 -0
- package/dist/cjs/ui/block-menu.js +13 -3
- package/dist/cjs/ui/copy-block.js +11 -3
- package/dist/cjs/ui/copy-section.js +7 -0
- package/dist/cjs/ui/delete-section.js +23 -0
- package/dist/cjs/ui/utils/checkIsFormatMenuHidden.js +35 -1
- package/dist/es2019/blockMenuPlugin.js +19 -2
- package/dist/es2019/editor-commands/formatNode.js +53 -2
- package/dist/es2019/editor-commands/transforms/layout-transforms.js +19 -12
- package/dist/es2019/ui/block-menu-components.js +3 -2
- package/dist/es2019/ui/block-menu-provider.js +31 -0
- package/dist/es2019/ui/block-menu.js +14 -3
- package/dist/es2019/ui/copy-block.js +9 -3
- package/dist/es2019/ui/copy-section.js +7 -0
- package/dist/es2019/ui/delete-section.js +17 -0
- package/dist/es2019/ui/utils/checkIsFormatMenuHidden.js +35 -1
- package/dist/esm/blockMenuPlugin.js +19 -2
- package/dist/esm/editor-commands/formatNode.js +49 -2
- package/dist/esm/editor-commands/transforms/layout-transforms.js +25 -18
- package/dist/esm/ui/block-menu-components.js +3 -2
- package/dist/esm/ui/block-menu-provider.js +32 -0
- package/dist/esm/ui/block-menu.js +13 -3
- package/dist/esm/ui/copy-block.js +11 -3
- package/dist/esm/ui/copy-section.js +7 -0
- package/dist/esm/ui/delete-section.js +16 -0
- package/dist/esm/ui/utils/checkIsFormatMenuHidden.js +35 -1
- package/dist/types/blockMenuPluginType.d.ts +8 -0
- package/dist/types/editor-commands/transforms/layout-transforms.d.ts +3 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ui/block-menu-provider.d.ts +18 -0
- package/dist/types/ui/block-menu.d.ts +1 -1
- package/dist/types/ui/copy-section.d.ts +1 -1
- package/dist/types/ui/delete-section.d.ts +7 -0
- package/dist/types-ts4.5/blockMenuPluginType.d.ts +8 -0
- package/dist/types-ts4.5/editor-commands/transforms/layout-transforms.d.ts +3 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/block-menu-provider.d.ts +18 -0
- package/dist/types-ts4.5/ui/block-menu.d.ts +1 -1
- package/dist/types-ts4.5/ui/copy-section.d.ts +1 -1
- package/dist/types-ts4.5/ui/delete-section.d.ts +7 -0
- package/package.json +4 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
4
|
+
type BlockMenuProviderProps = {
|
|
5
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type BlockMenuContextType = {
|
|
9
|
+
/**
|
|
10
|
+
* Callback for when the dropdown is open/closed. Receives an object with `isOpen` state.
|
|
11
|
+
*
|
|
12
|
+
* If the dropdown was closed programmatically, the `event` parameter will be `null`.
|
|
13
|
+
*/
|
|
14
|
+
onDropdownOpenChanged: (isOpen: boolean) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const useBlockMenu: () => BlockMenuContextType;
|
|
17
|
+
export declare const BlockMenuProvider: ({ children, api }: BlockMenuProviderProps) => React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { WrappedComponentProps } from 'react-intl-next';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
6
|
-
type BlockMenuProps = {
|
|
6
|
+
export type BlockMenuProps = {
|
|
7
7
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
8
8
|
boundariesElement?: HTMLElement;
|
|
9
9
|
editorView: EditorView | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
4
|
+
export declare const DeleteSection: ({ api, children, }: {
|
|
5
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}) => React.JSX.Element | null;
|
|
@@ -19,6 +19,7 @@ export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
|
|
|
19
19
|
OptionalPlugin<DecorationsPlugin>
|
|
20
20
|
];
|
|
21
21
|
pluginConfiguration?: BlockMenuPluginOptions;
|
|
22
|
+
sharedState: BlockMenuSharedState;
|
|
22
23
|
}>;
|
|
23
24
|
export type BlockMenuPluginOptions = {
|
|
24
25
|
/**
|
|
@@ -31,6 +32,13 @@ export type BlockMenuPluginOptions = {
|
|
|
31
32
|
*/
|
|
32
33
|
getLinkPath?: () => string | null;
|
|
33
34
|
};
|
|
35
|
+
export type BlockMenuSharedState = {
|
|
36
|
+
/**
|
|
37
|
+
* The name of the currently selected node type that triggered the block menu
|
|
38
|
+
* This exposes the menuTriggerBy value from blockControls plugin
|
|
39
|
+
*/
|
|
40
|
+
currentSelectedNodeName: string | undefined;
|
|
41
|
+
} | undefined;
|
|
34
42
|
type WithRank<T> = T & {
|
|
35
43
|
rank: number;
|
|
36
44
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { TransformContext } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import { type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
export declare const createDefaultLayoutSection: (schema: Schema, content: PMNode) => PMNode;
|
|
2
5
|
export declare const convertToLayout: (context: TransformContext) => import("prosemirror-state").Transaction;
|
|
3
6
|
export declare const transformLayoutNode: (context: TransformContext) => import("prosemirror-state").Transaction;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { blockMenuPlugin } from './blockMenuPlugin';
|
|
2
|
-
export type { BlockMenuPlugin, RegisterBlockMenuComponent, Parent, BlockMenuPluginOptions, } from './blockMenuPluginType';
|
|
2
|
+
export type { BlockMenuPlugin, RegisterBlockMenuComponent, Parent, BlockMenuPluginOptions, BlockMenuSharedState, } from './blockMenuPluginType';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
4
|
+
type BlockMenuProviderProps = {
|
|
5
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type BlockMenuContextType = {
|
|
9
|
+
/**
|
|
10
|
+
* Callback for when the dropdown is open/closed. Receives an object with `isOpen` state.
|
|
11
|
+
*
|
|
12
|
+
* If the dropdown was closed programmatically, the `event` parameter will be `null`.
|
|
13
|
+
*/
|
|
14
|
+
onDropdownOpenChanged: (isOpen: boolean) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const useBlockMenu: () => BlockMenuContextType;
|
|
17
|
+
export declare const BlockMenuProvider: ({ children, api }: BlockMenuProviderProps) => React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { WrappedComponentProps } from 'react-intl-next';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
6
|
-
type BlockMenuProps = {
|
|
6
|
+
export type BlockMenuProps = {
|
|
7
7
|
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
8
8
|
boundariesElement?: HTMLElement;
|
|
9
9
|
editorView: EditorView | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockMenuPlugin } from '../blockMenuPluginType';
|
|
4
|
+
export declare const DeleteSection: ({ api, children, }: {
|
|
5
|
+
api: ExtractInjectionAPI<BlockMenuPlugin> | undefined;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}) => React.JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@atlaskit/icon": "^28.2.0",
|
|
42
42
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
|
-
"@atlaskit/primitives": "^14.
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
44
|
+
"@atlaskit/primitives": "^14.15.0",
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^12.26.0",
|
|
46
46
|
"@atlaskit/tokens": "^6.3.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^109.
|
|
50
|
+
"@atlaskit/editor-common": "^109.11.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
53
53
|
},
|