@atlaskit/editor-plugin-block-type 6.2.18 → 7.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 +16 -0
- package/dist/cjs/blockTypePlugin.js +1 -1
- package/dist/cjs/ui/HeadingBlockMenuItem.js +63 -0
- package/dist/cjs/ui/ParagraphBlockMenuItem.js +50 -0
- package/dist/cjs/ui/QuoteBlockMenuItem.js +42 -0
- package/dist/cjs/ui/index.js +34 -42
- package/dist/es2019/blockTypePlugin.js +1 -1
- package/dist/es2019/ui/HeadingBlockMenuItem.js +57 -0
- package/dist/es2019/ui/ParagraphBlockMenuItem.js +44 -0
- package/dist/es2019/ui/QuoteBlockMenuItem.js +36 -0
- package/dist/es2019/ui/index.js +28 -19
- package/dist/esm/blockTypePlugin.js +1 -1
- package/dist/esm/ui/HeadingBlockMenuItem.js +56 -0
- package/dist/esm/ui/ParagraphBlockMenuItem.js +43 -0
- package/dist/esm/ui/QuoteBlockMenuItem.js +35 -0
- package/dist/esm/ui/index.js +34 -41
- package/dist/types/blockTypePluginType.d.ts +5 -1
- package/dist/types/ui/HeadingBlockMenuItem.d.ts +9 -0
- package/dist/types/ui/ParagraphBlockMenuItem.d.ts +8 -0
- package/dist/types/ui/QuoteBlockMenuItem.d.ts +8 -0
- package/dist/types/ui/index.d.ts +3 -1
- package/dist/types-ts4.5/blockTypePluginType.d.ts +5 -1
- package/dist/types-ts4.5/ui/HeadingBlockMenuItem.d.ts +9 -0
- package/dist/types-ts4.5/ui/ParagraphBlockMenuItem.d.ts +8 -0
- package/dist/types-ts4.5/ui/QuoteBlockMenuItem.d.ts +8 -0
- package/dist/types-ts4.5/ui/index.d.ts +3 -1
- package/package.json +12 -10
- package/dist/cjs/ui/HeadingMenuItem.js +0 -31
- package/dist/cjs/ui/ParagraphMenuItem.js +0 -21
- package/dist/cjs/ui/QuoteMenuItem.js +0 -21
- package/dist/es2019/ui/HeadingMenuItem.js +0 -26
- package/dist/es2019/ui/ParagraphMenuItem.js +0 -15
- package/dist/es2019/ui/QuoteMenuItem.js +0 -15
- package/dist/esm/ui/HeadingMenuItem.js +0 -24
- package/dist/esm/ui/ParagraphMenuItem.js +0 -14
- package/dist/esm/ui/QuoteMenuItem.js +0 -14
- package/dist/types/ui/HeadingMenuItem.d.ts +0 -6
- package/dist/types/ui/ParagraphMenuItem.d.ts +0 -2
- package/dist/types/ui/QuoteMenuItem.d.ts +0 -2
- package/dist/types-ts4.5/ui/HeadingMenuItem.d.ts +0 -6
- package/dist/types-ts4.5/ui/ParagraphMenuItem.d.ts +0 -2
- package/dist/types-ts4.5/ui/QuoteMenuItem.d.ts +0 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
|
|
8
|
+
import { NORMAL_TEXT } from './consts';
|
|
9
|
+
var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
|
|
10
|
+
var api = _ref.api;
|
|
11
|
+
var _useIntl = useIntl(),
|
|
12
|
+
formatMessage = _useIntl.formatMessage;
|
|
13
|
+
var currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
|
|
14
|
+
var bulletListActive = useSharedPluginStateSelector(api, 'list.bulletListActive');
|
|
15
|
+
var orderedListActive = useSharedPluginStateSelector(api, 'list.orderedListActive');
|
|
16
|
+
var selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
17
|
+
var isTextSelection = selection instanceof TextSelection;
|
|
18
|
+
var isParagraph = isTextSelection && currentBlockType && currentBlockType === NORMAL_TEXT && !bulletListActive && !orderedListActive;
|
|
19
|
+
var handleClick = function handleClick() {
|
|
20
|
+
if (!selection) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!isParagraph) {
|
|
24
|
+
var _api$blockMenu;
|
|
25
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode("paragraph"));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
29
|
+
onClick: handleClick,
|
|
30
|
+
isSelected: isParagraph,
|
|
31
|
+
elemBefore: /*#__PURE__*/React.createElement(TextParagraphIcon, {
|
|
32
|
+
label: ""
|
|
33
|
+
})
|
|
34
|
+
}, formatMessage(blockMenuMessages.paragraph));
|
|
35
|
+
};
|
|
36
|
+
export var createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref2) {
|
|
37
|
+
var api = _ref2.api;
|
|
38
|
+
return function () {
|
|
39
|
+
return /*#__PURE__*/React.createElement(ParagraphBlockMenuItem, {
|
|
40
|
+
api: api
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import QuotationMarkIcon from '@atlaskit/icon/core/quotation-mark';
|
|
7
|
+
import { BLOCK_QUOTE } from './consts';
|
|
8
|
+
var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
|
|
9
|
+
var api = _ref.api;
|
|
10
|
+
var _useIntl = useIntl(),
|
|
11
|
+
formatMessage = _useIntl.formatMessage;
|
|
12
|
+
var currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
|
|
13
|
+
var isBlockQuote = currentBlockType && currentBlockType === BLOCK_QUOTE;
|
|
14
|
+
var handleClick = function handleClick() {
|
|
15
|
+
if (!isBlockQuote) {
|
|
16
|
+
var _api$blockMenu;
|
|
17
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode("blockquote"));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
21
|
+
onClick: handleClick,
|
|
22
|
+
isSelected: isBlockQuote,
|
|
23
|
+
elemBefore: /*#__PURE__*/React.createElement(QuotationMarkIcon, {
|
|
24
|
+
label: ""
|
|
25
|
+
})
|
|
26
|
+
}, formatMessage(blockTypeMessages.blockquote));
|
|
27
|
+
};
|
|
28
|
+
export var createQuoteBlockMenuItem = function createQuoteBlockMenuItem(_ref2) {
|
|
29
|
+
var api = _ref2.api;
|
|
30
|
+
return function () {
|
|
31
|
+
return /*#__PURE__*/React.createElement(QuoteBlockMenuItem, {
|
|
32
|
+
api: api
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
};
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { FORMAT_HEADING_1_MENU_ITEM, FORMAT_HEADING_2_MENU_ITEM, FORMAT_HEADING_3_MENU_ITEM, FORMAT_HEADING_4_MENU_ITEM, FORMAT_HEADING_5_MENU_ITEM, FORMAT_HEADING_6_MENU_ITEM, FORMAT_NESTED_MENU_RANK, FORMAT_PARAGRAPH_MENU_ITEM, FORMAT_QUOTE_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
2
|
+
import { createHeadingBlockMenuItem } from './HeadingBlockMenuItem';
|
|
3
|
+
import { createParagraphBlockMenuItem } from './ParagraphBlockMenuItem';
|
|
4
|
+
import { createQuoteBlockMenuItem } from './QuoteBlockMenuItem';
|
|
5
|
+
export var getBlockTypeComponents = function getBlockTypeComponents(api) {
|
|
7
6
|
return [{
|
|
8
7
|
type: 'block-menu-item',
|
|
9
8
|
key: FORMAT_HEADING_1_MENU_ITEM.key,
|
|
@@ -12,11 +11,10 @@ export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
|
12
11
|
key: 'nested-menu-format-section-primary',
|
|
13
12
|
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_1_MENU_ITEM.key]
|
|
14
13
|
},
|
|
15
|
-
component:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
14
|
+
component: createHeadingBlockMenuItem({
|
|
15
|
+
level: 1,
|
|
16
|
+
api: api
|
|
17
|
+
})
|
|
20
18
|
}, {
|
|
21
19
|
type: 'block-menu-item',
|
|
22
20
|
key: FORMAT_HEADING_2_MENU_ITEM.key,
|
|
@@ -25,11 +23,10 @@ export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
|
25
23
|
key: 'nested-menu-format-section-primary',
|
|
26
24
|
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_2_MENU_ITEM.key]
|
|
27
25
|
},
|
|
28
|
-
component:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
26
|
+
component: createHeadingBlockMenuItem({
|
|
27
|
+
level: 2,
|
|
28
|
+
api: api
|
|
29
|
+
})
|
|
33
30
|
}, {
|
|
34
31
|
type: 'block-menu-item',
|
|
35
32
|
key: FORMAT_HEADING_3_MENU_ITEM.key,
|
|
@@ -38,11 +35,10 @@ export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
|
38
35
|
key: 'nested-menu-format-section-primary',
|
|
39
36
|
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_3_MENU_ITEM.key]
|
|
40
37
|
},
|
|
41
|
-
component:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
38
|
+
component: createHeadingBlockMenuItem({
|
|
39
|
+
level: 3,
|
|
40
|
+
api: api
|
|
41
|
+
})
|
|
46
42
|
}, {
|
|
47
43
|
type: 'block-menu-item',
|
|
48
44
|
key: FORMAT_HEADING_4_MENU_ITEM.key,
|
|
@@ -51,11 +47,10 @@ export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
|
51
47
|
key: 'nested-menu-format-section-primary',
|
|
52
48
|
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_4_MENU_ITEM.key]
|
|
53
49
|
},
|
|
54
|
-
component:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
50
|
+
component: createHeadingBlockMenuItem({
|
|
51
|
+
level: 4,
|
|
52
|
+
api: api
|
|
53
|
+
})
|
|
59
54
|
}, {
|
|
60
55
|
type: 'block-menu-item',
|
|
61
56
|
key: FORMAT_HEADING_5_MENU_ITEM.key,
|
|
@@ -64,11 +59,10 @@ export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
|
64
59
|
key: 'nested-menu-format-section-primary',
|
|
65
60
|
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_5_MENU_ITEM.key]
|
|
66
61
|
},
|
|
67
|
-
component:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
62
|
+
component: createHeadingBlockMenuItem({
|
|
63
|
+
level: 5,
|
|
64
|
+
api: api
|
|
65
|
+
})
|
|
72
66
|
}, {
|
|
73
67
|
type: 'block-menu-item',
|
|
74
68
|
key: FORMAT_HEADING_6_MENU_ITEM.key,
|
|
@@ -77,11 +71,10 @@ export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
|
77
71
|
key: 'nested-menu-format-section-primary',
|
|
78
72
|
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_6_MENU_ITEM.key]
|
|
79
73
|
},
|
|
80
|
-
component:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
74
|
+
component: createHeadingBlockMenuItem({
|
|
75
|
+
level: 6,
|
|
76
|
+
api: api
|
|
77
|
+
})
|
|
85
78
|
}, {
|
|
86
79
|
type: 'block-menu-item',
|
|
87
80
|
key: FORMAT_PARAGRAPH_MENU_ITEM.key,
|
|
@@ -90,9 +83,9 @@ export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
|
90
83
|
key: 'nested-menu-format-section-primary',
|
|
91
84
|
rank: FORMAT_NESTED_MENU_RANK[FORMAT_PARAGRAPH_MENU_ITEM.key]
|
|
92
85
|
},
|
|
93
|
-
component:
|
|
94
|
-
|
|
95
|
-
}
|
|
86
|
+
component: createParagraphBlockMenuItem({
|
|
87
|
+
api: api
|
|
88
|
+
})
|
|
96
89
|
}, {
|
|
97
90
|
type: 'block-menu-item',
|
|
98
91
|
key: FORMAT_QUOTE_MENU_ITEM.key,
|
|
@@ -101,8 +94,8 @@ export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
|
101
94
|
key: 'nested-menu-format-section-primary',
|
|
102
95
|
rank: FORMAT_NESTED_MENU_RANK[FORMAT_QUOTE_MENU_ITEM.key]
|
|
103
96
|
},
|
|
104
|
-
component:
|
|
105
|
-
|
|
106
|
-
}
|
|
97
|
+
component: createQuoteBlockMenuItem({
|
|
98
|
+
api: api
|
|
99
|
+
})
|
|
107
100
|
}];
|
|
108
101
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
4
|
+
import type { ListPlugin } from '@atlaskit/editor-plugin-list';
|
|
4
5
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
6
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
5
7
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
6
8
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
7
9
|
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
|
|
@@ -24,7 +26,9 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
|
24
26
|
OptionalPlugin<SelectionToolbarPlugin>,
|
|
25
27
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
26
28
|
OptionalPlugin<ToolbarPlugin>,
|
|
27
|
-
OptionalPlugin<BlockMenuPlugin
|
|
29
|
+
OptionalPlugin<BlockMenuPlugin>,
|
|
30
|
+
OptionalPlugin<ListPlugin>,
|
|
31
|
+
OptionalPlugin<SelectionPlugin>
|
|
28
32
|
];
|
|
29
33
|
pluginConfiguration: BlockTypePluginOptions | undefined;
|
|
30
34
|
sharedState: BlockTypeState | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
|
4
|
+
type HeadingBlockMenuItemProps = {
|
|
5
|
+
api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
|
|
6
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
7
|
+
};
|
|
8
|
+
export declare const createHeadingBlockMenuItem: ({ level, api }: HeadingBlockMenuItemProps) => () => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
|
4
|
+
type ParagraphBlockMenuItemProps = {
|
|
5
|
+
api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const createParagraphBlockMenuItem: ({ api }: ParagraphBlockMenuItemProps) => () => React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
|
4
|
+
type QuoteBlockMenuItemProps = {
|
|
5
|
+
api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const createQuoteBlockMenuItem: ({ api }: QuoteBlockMenuItemProps) => () => React.JSX.Element;
|
|
8
|
+
export {};
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { RegisterBlockMenuComponent } from '@atlaskit/editor-plugin-block-menu';
|
|
2
|
-
|
|
3
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
|
4
|
+
export declare const getBlockTypeComponents: (api: ExtractInjectionAPI<BlockTypePlugin> | undefined) => RegisterBlockMenuComponent[];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
4
|
+
import type { ListPlugin } from '@atlaskit/editor-plugin-list';
|
|
4
5
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
6
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
5
7
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
6
8
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
7
9
|
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
|
|
@@ -24,7 +26,9 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
|
24
26
|
OptionalPlugin<SelectionToolbarPlugin>,
|
|
25
27
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
26
28
|
OptionalPlugin<ToolbarPlugin>,
|
|
27
|
-
OptionalPlugin<BlockMenuPlugin
|
|
29
|
+
OptionalPlugin<BlockMenuPlugin>,
|
|
30
|
+
OptionalPlugin<ListPlugin>,
|
|
31
|
+
OptionalPlugin<SelectionPlugin>
|
|
28
32
|
];
|
|
29
33
|
pluginConfiguration: BlockTypePluginOptions | undefined;
|
|
30
34
|
sharedState: BlockTypeState | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
|
4
|
+
type HeadingBlockMenuItemProps = {
|
|
5
|
+
api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
|
|
6
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
7
|
+
};
|
|
8
|
+
export declare const createHeadingBlockMenuItem: ({ level, api }: HeadingBlockMenuItemProps) => () => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
|
4
|
+
type ParagraphBlockMenuItemProps = {
|
|
5
|
+
api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const createParagraphBlockMenuItem: ({ api }: ParagraphBlockMenuItemProps) => () => React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
|
4
|
+
type QuoteBlockMenuItemProps = {
|
|
5
|
+
api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const createQuoteBlockMenuItem: ({ api }: QuoteBlockMenuItemProps) => () => React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { RegisterBlockMenuComponent } from '@atlaskit/editor-plugin-block-menu';
|
|
2
|
-
|
|
3
|
+
import type { BlockTypePlugin } from '../blockTypePluginType';
|
|
4
|
+
export declare const getBlockTypeComponents: (api: ExtractInjectionAPI<BlockTypePlugin> | undefined) => RegisterBlockMenuComponent[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,11 +31,13 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/adf-schema": "^50.2.3",
|
|
33
33
|
"@atlaskit/css": "^0.12.0",
|
|
34
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
35
|
-
"@atlaskit/editor-plugin-block-menu": "^0.0
|
|
36
|
-
"@atlaskit/editor-plugin-
|
|
37
|
-
"@atlaskit/editor-plugin-
|
|
38
|
-
"@atlaskit/editor-plugin-
|
|
34
|
+
"@atlaskit/editor-plugin-analytics": "^4.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-block-menu": "^1.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-list": "^6.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^5.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-selection": "^4.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^5.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-toolbar": "^1.0.0",
|
|
39
41
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
42
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
41
43
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
@@ -47,13 +49,13 @@
|
|
|
47
49
|
"@atlaskit/primitives": "^14.12.0",
|
|
48
50
|
"@atlaskit/prosemirror-input-rules": "^3.4.0",
|
|
49
51
|
"@atlaskit/theme": "^20.0.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^12.0.0",
|
|
51
53
|
"@atlaskit/tokens": "^6.1.0",
|
|
52
54
|
"@babel/runtime": "^7.0.0",
|
|
53
55
|
"@emotion/react": "^11.7.1"
|
|
54
56
|
},
|
|
55
57
|
"peerDependencies": {
|
|
56
|
-
"@atlaskit/editor-common": "^
|
|
58
|
+
"@atlaskit/editor-common": "^108.0.0",
|
|
57
59
|
"react": "^18.2.0",
|
|
58
60
|
"react-dom": "^18.2.0",
|
|
59
61
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -61,8 +63,8 @@
|
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@af/visual-regression": "workspace:^",
|
|
63
65
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
64
|
-
"@atlaskit/editor-plugin-quick-insert": "^
|
|
65
|
-
"@atlaskit/editor-plugin-type-ahead": "^
|
|
66
|
+
"@atlaskit/editor-plugin-quick-insert": "^4.0.0",
|
|
67
|
+
"@atlaskit/editor-plugin-type-ahead": "^4.0.0",
|
|
66
68
|
"@atlaskit/ssr": "workspace:^",
|
|
67
69
|
"@testing-library/react": "^13.4.0",
|
|
68
70
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.HeadingMenuItem = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactIntlNext = require("react-intl-next");
|
|
10
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
-
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
-
var _textHeadingFive = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-heading-five"));
|
|
13
|
-
var _textHeadingFour = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-heading-four"));
|
|
14
|
-
var _textHeadingOne = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-heading-one"));
|
|
15
|
-
var _textHeadingSix = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-heading-six"));
|
|
16
|
-
var _textHeadingThree = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-heading-three"));
|
|
17
|
-
var _textHeadingTwo = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-heading-two"));
|
|
18
|
-
var headingIcons = [_textHeadingOne.default, _textHeadingTwo.default, _textHeadingThree.default, _textHeadingFour.default, _textHeadingFive.default, _textHeadingSix.default];
|
|
19
|
-
var headingMessages = [_messages.blockTypeMessages.heading1, _messages.blockTypeMessages.heading2, _messages.blockTypeMessages.heading3, _messages.blockTypeMessages.heading4, _messages.blockTypeMessages.heading5, _messages.blockTypeMessages.heading6];
|
|
20
|
-
var HeadingMenuItem = exports.HeadingMenuItem = function HeadingMenuItem(_ref) {
|
|
21
|
-
var level = _ref.level;
|
|
22
|
-
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
23
|
-
formatMessage = _useIntl.formatMessage;
|
|
24
|
-
var Icon = headingIcons[level - 1];
|
|
25
|
-
var message = headingMessages[level - 1];
|
|
26
|
-
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
27
|
-
elemBefore: /*#__PURE__*/_react.default.createElement(Icon, {
|
|
28
|
-
label: formatMessage(message)
|
|
29
|
-
})
|
|
30
|
-
}, formatMessage(message));
|
|
31
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ParagraphMenuItem = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactIntlNext = require("react-intl-next");
|
|
10
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
-
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
-
var _textParagraph = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-paragraph"));
|
|
13
|
-
var ParagraphMenuItem = exports.ParagraphMenuItem = function ParagraphMenuItem() {
|
|
14
|
-
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
15
|
-
formatMessage = _useIntl.formatMessage;
|
|
16
|
-
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
17
|
-
elemBefore: /*#__PURE__*/_react.default.createElement(_textParagraph.default, {
|
|
18
|
-
label: formatMessage(_messages.blockMenuMessages.paragraph)
|
|
19
|
-
})
|
|
20
|
-
}, formatMessage(_messages.blockMenuMessages.paragraph));
|
|
21
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.QuoteMenuItem = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactIntlNext = require("react-intl-next");
|
|
10
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
-
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
-
var _quotationMark = _interopRequireDefault(require("@atlaskit/icon/core/quotation-mark"));
|
|
13
|
-
var QuoteMenuItem = exports.QuoteMenuItem = function QuoteMenuItem() {
|
|
14
|
-
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
15
|
-
formatMessage = _useIntl.formatMessage;
|
|
16
|
-
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
17
|
-
elemBefore: /*#__PURE__*/_react.default.createElement(_quotationMark.default, {
|
|
18
|
-
label: formatMessage(_messages.blockTypeMessages.blockquote)
|
|
19
|
-
})
|
|
20
|
-
}, formatMessage(_messages.blockTypeMessages.blockquote));
|
|
21
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
-
import TextHeadingFiveIcon from '@atlaskit/icon-lab/core/text-heading-five';
|
|
6
|
-
import TextHeadingFourIcon from '@atlaskit/icon-lab/core/text-heading-four';
|
|
7
|
-
import TextHeadingOneIcon from '@atlaskit/icon-lab/core/text-heading-one';
|
|
8
|
-
import TextHeadingSixIcon from '@atlaskit/icon-lab/core/text-heading-six';
|
|
9
|
-
import TextHeadingThreeIcon from '@atlaskit/icon-lab/core/text-heading-three';
|
|
10
|
-
import TextHeadingTwoIcon from '@atlaskit/icon-lab/core/text-heading-two';
|
|
11
|
-
const headingIcons = [TextHeadingOneIcon, TextHeadingTwoIcon, TextHeadingThreeIcon, TextHeadingFourIcon, TextHeadingFiveIcon, TextHeadingSixIcon];
|
|
12
|
-
const headingMessages = [blockTypeMessages.heading1, blockTypeMessages.heading2, blockTypeMessages.heading3, blockTypeMessages.heading4, blockTypeMessages.heading5, blockTypeMessages.heading6];
|
|
13
|
-
export const HeadingMenuItem = ({
|
|
14
|
-
level
|
|
15
|
-
}) => {
|
|
16
|
-
const {
|
|
17
|
-
formatMessage
|
|
18
|
-
} = useIntl();
|
|
19
|
-
const Icon = headingIcons[level - 1];
|
|
20
|
-
const message = headingMessages[level - 1];
|
|
21
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
22
|
-
elemBefore: /*#__PURE__*/React.createElement(Icon, {
|
|
23
|
-
label: formatMessage(message)
|
|
24
|
-
})
|
|
25
|
-
}, formatMessage(message));
|
|
26
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
-
import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
|
|
6
|
-
export const ParagraphMenuItem = () => {
|
|
7
|
-
const {
|
|
8
|
-
formatMessage
|
|
9
|
-
} = useIntl();
|
|
10
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
11
|
-
elemBefore: /*#__PURE__*/React.createElement(TextParagraphIcon, {
|
|
12
|
-
label: formatMessage(blockMenuMessages.paragraph)
|
|
13
|
-
})
|
|
14
|
-
}, formatMessage(blockMenuMessages.paragraph));
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
-
import QuotationMarkIcon from '@atlaskit/icon/core/quotation-mark';
|
|
6
|
-
export const QuoteMenuItem = () => {
|
|
7
|
-
const {
|
|
8
|
-
formatMessage
|
|
9
|
-
} = useIntl();
|
|
10
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
11
|
-
elemBefore: /*#__PURE__*/React.createElement(QuotationMarkIcon, {
|
|
12
|
-
label: formatMessage(blockTypeMessages.blockquote)
|
|
13
|
-
})
|
|
14
|
-
}, formatMessage(blockTypeMessages.blockquote));
|
|
15
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
-
import TextHeadingFiveIcon from '@atlaskit/icon-lab/core/text-heading-five';
|
|
6
|
-
import TextHeadingFourIcon from '@atlaskit/icon-lab/core/text-heading-four';
|
|
7
|
-
import TextHeadingOneIcon from '@atlaskit/icon-lab/core/text-heading-one';
|
|
8
|
-
import TextHeadingSixIcon from '@atlaskit/icon-lab/core/text-heading-six';
|
|
9
|
-
import TextHeadingThreeIcon from '@atlaskit/icon-lab/core/text-heading-three';
|
|
10
|
-
import TextHeadingTwoIcon from '@atlaskit/icon-lab/core/text-heading-two';
|
|
11
|
-
var headingIcons = [TextHeadingOneIcon, TextHeadingTwoIcon, TextHeadingThreeIcon, TextHeadingFourIcon, TextHeadingFiveIcon, TextHeadingSixIcon];
|
|
12
|
-
var headingMessages = [blockTypeMessages.heading1, blockTypeMessages.heading2, blockTypeMessages.heading3, blockTypeMessages.heading4, blockTypeMessages.heading5, blockTypeMessages.heading6];
|
|
13
|
-
export var HeadingMenuItem = function HeadingMenuItem(_ref) {
|
|
14
|
-
var level = _ref.level;
|
|
15
|
-
var _useIntl = useIntl(),
|
|
16
|
-
formatMessage = _useIntl.formatMessage;
|
|
17
|
-
var Icon = headingIcons[level - 1];
|
|
18
|
-
var message = headingMessages[level - 1];
|
|
19
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
20
|
-
elemBefore: /*#__PURE__*/React.createElement(Icon, {
|
|
21
|
-
label: formatMessage(message)
|
|
22
|
-
})
|
|
23
|
-
}, formatMessage(message));
|
|
24
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
-
import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
|
|
6
|
-
export var ParagraphMenuItem = function ParagraphMenuItem() {
|
|
7
|
-
var _useIntl = useIntl(),
|
|
8
|
-
formatMessage = _useIntl.formatMessage;
|
|
9
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
10
|
-
elemBefore: /*#__PURE__*/React.createElement(TextParagraphIcon, {
|
|
11
|
-
label: formatMessage(blockMenuMessages.paragraph)
|
|
12
|
-
})
|
|
13
|
-
}, formatMessage(blockMenuMessages.paragraph));
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
-
import QuotationMarkIcon from '@atlaskit/icon/core/quotation-mark';
|
|
6
|
-
export var QuoteMenuItem = function QuoteMenuItem() {
|
|
7
|
-
var _useIntl = useIntl(),
|
|
8
|
-
formatMessage = _useIntl.formatMessage;
|
|
9
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
10
|
-
elemBefore: /*#__PURE__*/React.createElement(QuotationMarkIcon, {
|
|
11
|
-
label: formatMessage(blockTypeMessages.blockquote)
|
|
12
|
-
})
|
|
13
|
-
}, formatMessage(blockTypeMessages.blockquote));
|
|
14
|
-
};
|