@atlaskit/editor-plugin-block-type 6.2.14 → 6.2.16
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 +18 -0
- package/dist/cjs/blockTypePlugin.js +8 -2
- package/dist/cjs/pm-plugins/ui/FloatingToolbarComponent.js +2 -27
- package/dist/cjs/pm-plugins/ui/PrimaryToolbarComponent.js +9 -34
- package/dist/cjs/pm-plugins/ui/{ToolbarComponents.js → toolbar-components.js} +7 -1
- package/dist/cjs/ui/HeadingMenuItem.js +31 -0
- package/dist/cjs/ui/ParagraphMenuItem.js +21 -0
- package/dist/cjs/ui/QuoteMenuItem.js +21 -0
- package/dist/cjs/ui/index.js +115 -0
- package/dist/es2019/blockTypePlugin.js +7 -1
- package/dist/es2019/pm-plugins/ui/FloatingToolbarComponent.js +4 -31
- package/dist/es2019/pm-plugins/ui/PrimaryToolbarComponent.js +11 -38
- package/dist/es2019/pm-plugins/ui/{ToolbarComponents.js → toolbar-components.js} +7 -2
- package/dist/es2019/ui/HeadingMenuItem.js +26 -0
- package/dist/es2019/ui/ParagraphMenuItem.js +15 -0
- package/dist/es2019/ui/QuoteMenuItem.js +15 -0
- package/dist/es2019/ui/index.js +92 -0
- package/dist/esm/blockTypePlugin.js +7 -1
- package/dist/esm/pm-plugins/ui/FloatingToolbarComponent.js +3 -28
- package/dist/esm/pm-plugins/ui/PrimaryToolbarComponent.js +10 -35
- package/dist/esm/pm-plugins/ui/{ToolbarComponents.js → toolbar-components.js} +8 -2
- package/dist/esm/ui/HeadingMenuItem.js +24 -0
- package/dist/esm/ui/ParagraphMenuItem.js +14 -0
- package/dist/esm/ui/QuoteMenuItem.js +14 -0
- package/dist/esm/ui/index.js +108 -0
- package/dist/types/blockTypePluginType.d.ts +3 -1
- package/dist/types/ui/HeadingMenuItem.d.ts +6 -0
- package/dist/types/ui/ParagraphMenuItem.d.ts +2 -0
- package/dist/types/ui/QuoteMenuItem.d.ts +2 -0
- package/dist/types/ui/index.d.ts +2 -0
- package/dist/types-ts4.5/blockTypePluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/HeadingMenuItem.d.ts +6 -0
- package/dist/types-ts4.5/ui/ParagraphMenuItem.d.ts +2 -0
- package/dist/types-ts4.5/ui/QuoteMenuItem.d.ts +2 -0
- package/dist/types-ts4.5/ui/index.d.ts +2 -0
- package/package.json +6 -5
- /package/dist/types/pm-plugins/ui/{ToolbarComponents.d.ts → toolbar-components.d.ts} +0 -0
- /package/dist/types-ts4.5/pm-plugins/ui/{ToolbarComponents.d.ts → toolbar-components.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
|
2
2
|
|
|
3
|
+
## 6.2.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`51f3f2db61f6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51f3f2db61f6e) -
|
|
8
|
+
Update toolbar config across plugins
|
|
9
|
+
- [`13f464399d1cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/13f464399d1cc) -
|
|
10
|
+
PR to cleanup platform_editor_usesharedpluginstatewithselector for block-type
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 6.2.15
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`1ab3eb4c56ebb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1ab3eb4c56ebb) -
|
|
18
|
+
[ux] ED-28581: Registered components for block type and list plugins
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 6.2.14
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -16,6 +16,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
|
16
16
|
var _types = require("@atlaskit/editor-common/types");
|
|
17
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
18
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
19
20
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
20
21
|
var _blockType = require("./pm-plugins/commands/block-type");
|
|
21
22
|
var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
|
|
@@ -23,7 +24,8 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
|
23
24
|
var _main = require("./pm-plugins/main");
|
|
24
25
|
var _FloatingToolbarComponent = require("./pm-plugins/ui/FloatingToolbarComponent");
|
|
25
26
|
var _PrimaryToolbarComponent = require("./pm-plugins/ui/PrimaryToolbarComponent");
|
|
26
|
-
var
|
|
27
|
+
var _toolbarComponents = require("./pm-plugins/ui/toolbar-components");
|
|
28
|
+
var _ui = require("./ui");
|
|
27
29
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
30
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
31
|
var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
|
|
@@ -128,7 +130,7 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
|
128
130
|
};
|
|
129
131
|
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true)) {
|
|
130
132
|
var _api$toolbar;
|
|
131
|
-
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0,
|
|
133
|
+
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api));
|
|
132
134
|
} else {
|
|
133
135
|
var _api$primaryToolbar;
|
|
134
136
|
api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
|
|
@@ -136,6 +138,10 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
|
136
138
|
component: primaryToolbarComponent
|
|
137
139
|
});
|
|
138
140
|
}
|
|
141
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
142
|
+
var _api$blockMenu;
|
|
143
|
+
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents((0, _ui.getBlockTypeComponents)());
|
|
144
|
+
}
|
|
139
145
|
return {
|
|
140
146
|
name: 'blockType',
|
|
141
147
|
nodes: function nodes() {
|
|
@@ -18,7 +18,8 @@ var FloatingToolbarSettings = {
|
|
|
18
18
|
isToolbarReducedSpacing: true,
|
|
19
19
|
shouldUseDefaultRole: false
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
function FloatingToolbarComponent(_ref) {
|
|
22
|
+
var api = _ref.api;
|
|
22
23
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockType'], function (states) {
|
|
23
24
|
var _states$blockTypeStat, _states$blockTypeStat2, _states$blockTypeStat3, _states$blockTypeStat4, _states$blockTypeStat5;
|
|
24
25
|
return {
|
|
@@ -34,32 +35,6 @@ var useFloatingToolbarComponentPluginState = (0, _hooks.sharedPluginStateHookMig
|
|
|
34
35
|
availableBlockTypes = _useSharedPluginState.availableBlockTypes,
|
|
35
36
|
availableBlockTypesInDropdown = _useSharedPluginState.availableBlockTypesInDropdown,
|
|
36
37
|
formattingIsPresent = _useSharedPluginState.formattingIsPresent;
|
|
37
|
-
return {
|
|
38
|
-
currentBlockType: currentBlockType,
|
|
39
|
-
blockTypesDisabled: blockTypesDisabled,
|
|
40
|
-
availableBlockTypes: availableBlockTypes,
|
|
41
|
-
availableBlockTypesInDropdown: availableBlockTypesInDropdown,
|
|
42
|
-
formattingIsPresent: formattingIsPresent
|
|
43
|
-
};
|
|
44
|
-
}, function (api) {
|
|
45
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['blockType']),
|
|
46
|
-
blockTypeState = _useSharedPluginState2.blockTypeState;
|
|
47
|
-
return {
|
|
48
|
-
currentBlockType: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.currentBlockType,
|
|
49
|
-
blockTypesDisabled: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.blockTypesDisabled,
|
|
50
|
-
availableBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypes,
|
|
51
|
-
availableBlockTypesInDropdown: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypesInDropdown,
|
|
52
|
-
formattingIsPresent: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.formattingIsPresent
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
function FloatingToolbarComponent(_ref) {
|
|
56
|
-
var api = _ref.api;
|
|
57
|
-
var _useFloatingToolbarCo = useFloatingToolbarComponentPluginState(api),
|
|
58
|
-
currentBlockType = _useFloatingToolbarCo.currentBlockType,
|
|
59
|
-
blockTypesDisabled = _useFloatingToolbarCo.blockTypesDisabled,
|
|
60
|
-
availableBlockTypes = _useFloatingToolbarCo.availableBlockTypes,
|
|
61
|
-
availableBlockTypesInDropdown = _useFloatingToolbarCo.availableBlockTypesInDropdown,
|
|
62
|
-
formattingIsPresent = _useFloatingToolbarCo.formattingIsPresent;
|
|
63
38
|
var boundSetBlockType = (0, _react.useCallback)(function (name, fromBlockQuote) {
|
|
64
39
|
var _api$core, _api$blockType;
|
|
65
40
|
return api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 || (_api$blockType = _api$blockType.commands) === null || _api$blockType === void 0 ? void 0 : _api$blockType.setTextLevel(name, _analytics.INPUT_METHOD.FLOATING_TB, fromBlockQuote));
|
|
@@ -9,7 +9,15 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
11
|
var _ToolbarBlockType = _interopRequireDefault(require("./ToolbarBlockType"));
|
|
12
|
-
|
|
12
|
+
function PrimaryToolbarComponent(_ref) {
|
|
13
|
+
var api = _ref.api,
|
|
14
|
+
isSmall = _ref.isSmall,
|
|
15
|
+
disabled = _ref.disabled,
|
|
16
|
+
isToolbarReducedSpacing = _ref.isToolbarReducedSpacing,
|
|
17
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
18
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
19
|
+
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
20
|
+
shouldUseDefaultRole = _ref.shouldUseDefaultRole;
|
|
13
21
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockType'], function (states) {
|
|
14
22
|
var _states$blockTypeStat, _states$blockTypeStat2, _states$blockTypeStat3, _states$blockTypeStat4, _states$blockTypeStat5;
|
|
15
23
|
return {
|
|
@@ -25,39 +33,6 @@ var usePrimaryToolbarComponentPluginState = (0, _hooks.sharedPluginStateHookMigr
|
|
|
25
33
|
availableBlockTypes = _useSharedPluginState.availableBlockTypes,
|
|
26
34
|
availableBlockTypesInDropdown = _useSharedPluginState.availableBlockTypesInDropdown,
|
|
27
35
|
formattingIsPresent = _useSharedPluginState.formattingIsPresent;
|
|
28
|
-
return {
|
|
29
|
-
currentBlockType: currentBlockType,
|
|
30
|
-
blockTypesDisabled: blockTypesDisabled,
|
|
31
|
-
availableBlockTypes: availableBlockTypes,
|
|
32
|
-
availableBlockTypesInDropdown: availableBlockTypesInDropdown,
|
|
33
|
-
formattingIsPresent: formattingIsPresent
|
|
34
|
-
};
|
|
35
|
-
}, function (api) {
|
|
36
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['blockType']),
|
|
37
|
-
blockTypeState = _useSharedPluginState2.blockTypeState;
|
|
38
|
-
return {
|
|
39
|
-
currentBlockType: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.currentBlockType,
|
|
40
|
-
blockTypesDisabled: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.blockTypesDisabled,
|
|
41
|
-
availableBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypes,
|
|
42
|
-
availableBlockTypesInDropdown: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypesInDropdown,
|
|
43
|
-
formattingIsPresent: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.formattingIsPresent
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
function PrimaryToolbarComponent(_ref) {
|
|
47
|
-
var api = _ref.api,
|
|
48
|
-
isSmall = _ref.isSmall,
|
|
49
|
-
disabled = _ref.disabled,
|
|
50
|
-
isToolbarReducedSpacing = _ref.isToolbarReducedSpacing,
|
|
51
|
-
popupsMountPoint = _ref.popupsMountPoint,
|
|
52
|
-
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
53
|
-
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
54
|
-
shouldUseDefaultRole = _ref.shouldUseDefaultRole;
|
|
55
|
-
var _usePrimaryToolbarCom = usePrimaryToolbarComponentPluginState(api),
|
|
56
|
-
currentBlockType = _usePrimaryToolbarCom.currentBlockType,
|
|
57
|
-
blockTypesDisabled = _usePrimaryToolbarCom.blockTypesDisabled,
|
|
58
|
-
availableBlockTypes = _usePrimaryToolbarCom.availableBlockTypes,
|
|
59
|
-
availableBlockTypesInDropdown = _usePrimaryToolbarCom.availableBlockTypesInDropdown,
|
|
60
|
-
formattingIsPresent = _usePrimaryToolbarCom.formattingIsPresent;
|
|
61
36
|
var boundSetBlockType = function boundSetBlockType(name, fromBlockQuote) {
|
|
62
37
|
var _api$core, _api$blockType;
|
|
63
38
|
return api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 || (_api$blockType = _api$blockType.commands) === null || _api$blockType === void 0 ? void 0 : _api$blockType.setTextLevel(name, _analytics.INPUT_METHOD.TOOLBAR, fromBlockQuote));
|
|
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.getToolbarComponents = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
12
|
var _blockTypes = require("../block-types");
|
|
11
13
|
var _HeadingButton = require("./ToolbarBlockType/HeadingButton");
|
|
12
14
|
var _QuoteButton = require("./ToolbarBlockType/QuoteButton");
|
|
@@ -41,7 +43,11 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
41
43
|
type: _toolbar.TEXT_STYLES_MENU.type,
|
|
42
44
|
key: _toolbar.TEXT_STYLES_MENU.key,
|
|
43
45
|
rank: _toolbar.TEXT_STYLES_MENU_RANK[_toolbar.TEXT_STYLES_MENU_SECTION.key]
|
|
44
|
-
}]
|
|
46
|
+
}].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
|
|
47
|
+
type: _toolbar.TEXT_COLLAPSED_MENU.type,
|
|
48
|
+
key: _toolbar.TEXT_COLLAPSED_MENU.key,
|
|
49
|
+
rank: _toolbar.TEXT_COLLAPSED_MENU_RANK[_toolbar.TEXT_STYLES_MENU_SECTION.key]
|
|
50
|
+
}] : []))
|
|
45
51
|
}];
|
|
46
52
|
Object.values((0, _blockTypes.toolbarBlockTypesWithRank)()).forEach(function (blockType) {
|
|
47
53
|
if (blockType.toolbarKey) {
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getBlockTypeComponents = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
10
|
+
var _HeadingMenuItem = require("./HeadingMenuItem");
|
|
11
|
+
var _ParagraphMenuItem = require("./ParagraphMenuItem");
|
|
12
|
+
var _QuoteMenuItem = require("./QuoteMenuItem");
|
|
13
|
+
var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockTypeComponents() {
|
|
14
|
+
return [{
|
|
15
|
+
type: 'block-menu-item',
|
|
16
|
+
key: _blockMenu.FORMAT_HEADING_1_MENU_ITEM.key,
|
|
17
|
+
parent: {
|
|
18
|
+
type: 'block-menu-section',
|
|
19
|
+
key: 'nested-menu-format-section-primary',
|
|
20
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_HEADING_1_MENU_ITEM.key]
|
|
21
|
+
},
|
|
22
|
+
component: function component() {
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_HeadingMenuItem.HeadingMenuItem, {
|
|
24
|
+
level: 1
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
type: 'block-menu-item',
|
|
29
|
+
key: _blockMenu.FORMAT_HEADING_2_MENU_ITEM.key,
|
|
30
|
+
parent: {
|
|
31
|
+
type: 'block-menu-section',
|
|
32
|
+
key: 'nested-menu-format-section-primary',
|
|
33
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_HEADING_2_MENU_ITEM.key]
|
|
34
|
+
},
|
|
35
|
+
component: function component() {
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_HeadingMenuItem.HeadingMenuItem, {
|
|
37
|
+
level: 2
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
type: 'block-menu-item',
|
|
42
|
+
key: _blockMenu.FORMAT_HEADING_3_MENU_ITEM.key,
|
|
43
|
+
parent: {
|
|
44
|
+
type: 'block-menu-section',
|
|
45
|
+
key: 'nested-menu-format-section-primary',
|
|
46
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_HEADING_3_MENU_ITEM.key]
|
|
47
|
+
},
|
|
48
|
+
component: function component() {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_HeadingMenuItem.HeadingMenuItem, {
|
|
50
|
+
level: 3
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
type: 'block-menu-item',
|
|
55
|
+
key: _blockMenu.FORMAT_HEADING_4_MENU_ITEM.key,
|
|
56
|
+
parent: {
|
|
57
|
+
type: 'block-menu-section',
|
|
58
|
+
key: 'nested-menu-format-section-primary',
|
|
59
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_HEADING_4_MENU_ITEM.key]
|
|
60
|
+
},
|
|
61
|
+
component: function component() {
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_HeadingMenuItem.HeadingMenuItem, {
|
|
63
|
+
level: 4
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
type: 'block-menu-item',
|
|
68
|
+
key: _blockMenu.FORMAT_HEADING_5_MENU_ITEM.key,
|
|
69
|
+
parent: {
|
|
70
|
+
type: 'block-menu-section',
|
|
71
|
+
key: 'nested-menu-format-section-primary',
|
|
72
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_HEADING_5_MENU_ITEM.key]
|
|
73
|
+
},
|
|
74
|
+
component: function component() {
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement(_HeadingMenuItem.HeadingMenuItem, {
|
|
76
|
+
level: 5
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
type: 'block-menu-item',
|
|
81
|
+
key: _blockMenu.FORMAT_HEADING_6_MENU_ITEM.key,
|
|
82
|
+
parent: {
|
|
83
|
+
type: 'block-menu-section',
|
|
84
|
+
key: 'nested-menu-format-section-primary',
|
|
85
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_HEADING_6_MENU_ITEM.key]
|
|
86
|
+
},
|
|
87
|
+
component: function component() {
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_HeadingMenuItem.HeadingMenuItem, {
|
|
89
|
+
level: 6
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
type: 'block-menu-item',
|
|
94
|
+
key: _blockMenu.FORMAT_PARAGRAPH_MENU_ITEM.key,
|
|
95
|
+
parent: {
|
|
96
|
+
type: 'block-menu-section',
|
|
97
|
+
key: 'nested-menu-format-section-primary',
|
|
98
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_PARAGRAPH_MENU_ITEM.key]
|
|
99
|
+
},
|
|
100
|
+
component: function component() {
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement(_ParagraphMenuItem.ParagraphMenuItem, null);
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
type: 'block-menu-item',
|
|
105
|
+
key: _blockMenu.FORMAT_QUOTE_MENU_ITEM.key,
|
|
106
|
+
parent: {
|
|
107
|
+
type: 'block-menu-section',
|
|
108
|
+
key: 'nested-menu-format-section-primary',
|
|
109
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_QUOTE_MENU_ITEM.key]
|
|
110
|
+
},
|
|
111
|
+
component: function component() {
|
|
112
|
+
return /*#__PURE__*/_react.default.createElement(_QuoteMenuItem.QuoteMenuItem, null);
|
|
113
|
+
}
|
|
114
|
+
}];
|
|
115
|
+
};
|
|
@@ -7,6 +7,7 @@ import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
|
|
|
7
7
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
10
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
12
|
import { clearFormatting, insertBlockQuoteWithAnalytics, insertBlockQuoteWithAnalyticsCommand, setBlockTypeWithAnalytics } from './pm-plugins/commands/block-type';
|
|
12
13
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
@@ -14,7 +15,8 @@ import keymapPlugin from './pm-plugins/keymap';
|
|
|
14
15
|
import { createPlugin, pluginKey } from './pm-plugins/main';
|
|
15
16
|
import { FloatingToolbarComponent } from './pm-plugins/ui/FloatingToolbarComponent';
|
|
16
17
|
import { PrimaryToolbarComponent } from './pm-plugins/ui/PrimaryToolbarComponent';
|
|
17
|
-
import { getToolbarComponents } from './pm-plugins/ui/
|
|
18
|
+
import { getToolbarComponents } from './pm-plugins/ui/toolbar-components';
|
|
19
|
+
import { getBlockTypeComponents } from './ui';
|
|
18
20
|
const headingPluginOptions = ({
|
|
19
21
|
formatMessage
|
|
20
22
|
}, isAllowed, editorAnalyticsApi) => {
|
|
@@ -125,6 +127,10 @@ const blockTypePlugin = ({
|
|
|
125
127
|
component: primaryToolbarComponent
|
|
126
128
|
});
|
|
127
129
|
}
|
|
130
|
+
if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
131
|
+
var _api$blockMenu;
|
|
132
|
+
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents(getBlockTypeComponents());
|
|
133
|
+
}
|
|
128
134
|
return {
|
|
129
135
|
name: 'blockType',
|
|
130
136
|
nodes() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import {
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
5
|
import ToolbarBlockType from './ToolbarBlockType';
|
|
6
6
|
const FloatingToolbarSettings = {
|
|
@@ -9,7 +9,9 @@ const FloatingToolbarSettings = {
|
|
|
9
9
|
isToolbarReducedSpacing: true,
|
|
10
10
|
shouldUseDefaultRole: false
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
export function FloatingToolbarComponent({
|
|
13
|
+
api
|
|
14
|
+
}) {
|
|
13
15
|
const {
|
|
14
16
|
currentBlockType,
|
|
15
17
|
blockTypesDisabled,
|
|
@@ -26,35 +28,6 @@ const useFloatingToolbarComponentPluginState = sharedPluginStateHookMigratorFact
|
|
|
26
28
|
formattingIsPresent: (_states$blockTypeStat5 = states.blockTypeState) === null || _states$blockTypeStat5 === void 0 ? void 0 : _states$blockTypeStat5.formattingIsPresent
|
|
27
29
|
};
|
|
28
30
|
});
|
|
29
|
-
return {
|
|
30
|
-
currentBlockType,
|
|
31
|
-
blockTypesDisabled,
|
|
32
|
-
availableBlockTypes,
|
|
33
|
-
availableBlockTypesInDropdown,
|
|
34
|
-
formattingIsPresent
|
|
35
|
-
};
|
|
36
|
-
}, api => {
|
|
37
|
-
const {
|
|
38
|
-
blockTypeState
|
|
39
|
-
} = useSharedPluginState(api, ['blockType']);
|
|
40
|
-
return {
|
|
41
|
-
currentBlockType: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.currentBlockType,
|
|
42
|
-
blockTypesDisabled: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.blockTypesDisabled,
|
|
43
|
-
availableBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypes,
|
|
44
|
-
availableBlockTypesInDropdown: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypesInDropdown,
|
|
45
|
-
formattingIsPresent: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.formattingIsPresent
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
export function FloatingToolbarComponent({
|
|
49
|
-
api
|
|
50
|
-
}) {
|
|
51
|
-
const {
|
|
52
|
-
currentBlockType,
|
|
53
|
-
blockTypesDisabled,
|
|
54
|
-
availableBlockTypes,
|
|
55
|
-
availableBlockTypesInDropdown,
|
|
56
|
-
formattingIsPresent
|
|
57
|
-
} = useFloatingToolbarComponentPluginState(api);
|
|
58
31
|
const boundSetBlockType = useCallback((name, fromBlockQuote) => {
|
|
59
32
|
var _api$core, _api$blockType, _api$blockType$comman;
|
|
60
33
|
return api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : (_api$blockType$comman = _api$blockType.commands) === null || _api$blockType$comman === void 0 ? void 0 : _api$blockType$comman.setTextLevel(name, INPUT_METHOD.FLOATING_TB, fromBlockQuote));
|
|
@@ -1,43 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import {
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import ToolbarBlockType from './ToolbarBlockType';
|
|
5
|
-
const usePrimaryToolbarComponentPluginState = sharedPluginStateHookMigratorFactory(api => {
|
|
6
|
-
const {
|
|
7
|
-
currentBlockType,
|
|
8
|
-
blockTypesDisabled,
|
|
9
|
-
availableBlockTypes,
|
|
10
|
-
availableBlockTypesInDropdown,
|
|
11
|
-
formattingIsPresent
|
|
12
|
-
} = useSharedPluginStateWithSelector(api, ['blockType'], states => {
|
|
13
|
-
var _states$blockTypeStat, _states$blockTypeStat2, _states$blockTypeStat3, _states$blockTypeStat4, _states$blockTypeStat5;
|
|
14
|
-
return {
|
|
15
|
-
currentBlockType: (_states$blockTypeStat = states.blockTypeState) === null || _states$blockTypeStat === void 0 ? void 0 : _states$blockTypeStat.currentBlockType,
|
|
16
|
-
blockTypesDisabled: (_states$blockTypeStat2 = states.blockTypeState) === null || _states$blockTypeStat2 === void 0 ? void 0 : _states$blockTypeStat2.blockTypesDisabled,
|
|
17
|
-
availableBlockTypes: (_states$blockTypeStat3 = states.blockTypeState) === null || _states$blockTypeStat3 === void 0 ? void 0 : _states$blockTypeStat3.availableBlockTypes,
|
|
18
|
-
availableBlockTypesInDropdown: (_states$blockTypeStat4 = states.blockTypeState) === null || _states$blockTypeStat4 === void 0 ? void 0 : _states$blockTypeStat4.availableBlockTypesInDropdown,
|
|
19
|
-
formattingIsPresent: (_states$blockTypeStat5 = states.blockTypeState) === null || _states$blockTypeStat5 === void 0 ? void 0 : _states$blockTypeStat5.formattingIsPresent
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
return {
|
|
23
|
-
currentBlockType,
|
|
24
|
-
blockTypesDisabled,
|
|
25
|
-
availableBlockTypes,
|
|
26
|
-
availableBlockTypesInDropdown,
|
|
27
|
-
formattingIsPresent
|
|
28
|
-
};
|
|
29
|
-
}, api => {
|
|
30
|
-
const {
|
|
31
|
-
blockTypeState
|
|
32
|
-
} = useSharedPluginState(api, ['blockType']);
|
|
33
|
-
return {
|
|
34
|
-
currentBlockType: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.currentBlockType,
|
|
35
|
-
blockTypesDisabled: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.blockTypesDisabled,
|
|
36
|
-
availableBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypes,
|
|
37
|
-
availableBlockTypesInDropdown: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypesInDropdown,
|
|
38
|
-
formattingIsPresent: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.formattingIsPresent
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
5
|
export function PrimaryToolbarComponent({
|
|
42
6
|
api,
|
|
43
7
|
isSmall,
|
|
@@ -54,7 +18,16 @@ export function PrimaryToolbarComponent({
|
|
|
54
18
|
availableBlockTypes,
|
|
55
19
|
availableBlockTypesInDropdown,
|
|
56
20
|
formattingIsPresent
|
|
57
|
-
} =
|
|
21
|
+
} = useSharedPluginStateWithSelector(api, ['blockType'], states => {
|
|
22
|
+
var _states$blockTypeStat, _states$blockTypeStat2, _states$blockTypeStat3, _states$blockTypeStat4, _states$blockTypeStat5;
|
|
23
|
+
return {
|
|
24
|
+
currentBlockType: (_states$blockTypeStat = states.blockTypeState) === null || _states$blockTypeStat === void 0 ? void 0 : _states$blockTypeStat.currentBlockType,
|
|
25
|
+
blockTypesDisabled: (_states$blockTypeStat2 = states.blockTypeState) === null || _states$blockTypeStat2 === void 0 ? void 0 : _states$blockTypeStat2.blockTypesDisabled,
|
|
26
|
+
availableBlockTypes: (_states$blockTypeStat3 = states.blockTypeState) === null || _states$blockTypeStat3 === void 0 ? void 0 : _states$blockTypeStat3.availableBlockTypes,
|
|
27
|
+
availableBlockTypesInDropdown: (_states$blockTypeStat4 = states.blockTypeState) === null || _states$blockTypeStat4 === void 0 ? void 0 : _states$blockTypeStat4.availableBlockTypesInDropdown,
|
|
28
|
+
formattingIsPresent: (_states$blockTypeStat5 = states.blockTypeState) === null || _states$blockTypeStat5 === void 0 ? void 0 : _states$blockTypeStat5.formattingIsPresent
|
|
29
|
+
};
|
|
30
|
+
});
|
|
58
31
|
const boundSetBlockType = (name, fromBlockQuote) => {
|
|
59
32
|
var _api$core, _api$blockType, _api$blockType$comman;
|
|
60
33
|
return api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : (_api$blockType$comman = _api$blockType.commands) === null || _api$blockType$comman === void 0 ? void 0 : _api$blockType$comman.setTextLevel(name, INPUT_METHOD.TOOLBAR, fromBlockQuote));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TEXT_STYLES_GROUP, TEXT_SECTION_RANK, TEXT_SECTION, TEXT_STYLES_MENU, TEXT_STYLES_GROUP_RANK, TEXT_STYLES_MENU_SECTION, TEXT_STYLES_MENU_RANK } from '@atlaskit/editor-common/toolbar';
|
|
2
|
+
import { TEXT_STYLES_GROUP, TEXT_SECTION_RANK, TEXT_SECTION, TEXT_STYLES_MENU, TEXT_STYLES_GROUP_RANK, TEXT_STYLES_MENU_SECTION, TEXT_STYLES_MENU_RANK, TEXT_COLLAPSED_MENU_RANK, TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
import { toolbarBlockTypesWithRank } from '../block-types';
|
|
4
5
|
import { HeadingButton } from './ToolbarBlockType/HeadingButton';
|
|
5
6
|
import { QuoteButton } from './ToolbarBlockType/QuoteButton';
|
|
@@ -33,7 +34,11 @@ export const getToolbarComponents = api => {
|
|
|
33
34
|
type: TEXT_STYLES_MENU.type,
|
|
34
35
|
key: TEXT_STYLES_MENU.key,
|
|
35
36
|
rank: TEXT_STYLES_MENU_RANK[TEXT_STYLES_MENU_SECTION.key]
|
|
36
|
-
}
|
|
37
|
+
}, ...(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
|
|
38
|
+
type: TEXT_COLLAPSED_MENU.type,
|
|
39
|
+
key: TEXT_COLLAPSED_MENU.key,
|
|
40
|
+
rank: TEXT_COLLAPSED_MENU_RANK[TEXT_STYLES_MENU_SECTION.key]
|
|
41
|
+
}] : [])]
|
|
37
42
|
}];
|
|
38
43
|
Object.values(toolbarBlockTypesWithRank()).forEach(blockType => {
|
|
39
44
|
if (blockType.toolbarKey) {
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
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 { HeadingMenuItem } from './HeadingMenuItem';
|
|
4
|
+
import { ParagraphMenuItem } from './ParagraphMenuItem';
|
|
5
|
+
import { QuoteMenuItem } from './QuoteMenuItem';
|
|
6
|
+
export const getBlockTypeComponents = () => {
|
|
7
|
+
return [{
|
|
8
|
+
type: 'block-menu-item',
|
|
9
|
+
key: FORMAT_HEADING_1_MENU_ITEM.key,
|
|
10
|
+
parent: {
|
|
11
|
+
type: 'block-menu-section',
|
|
12
|
+
key: 'nested-menu-format-section-primary',
|
|
13
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_1_MENU_ITEM.key]
|
|
14
|
+
},
|
|
15
|
+
component: () => /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
16
|
+
level: 1
|
|
17
|
+
})
|
|
18
|
+
}, {
|
|
19
|
+
type: 'block-menu-item',
|
|
20
|
+
key: FORMAT_HEADING_2_MENU_ITEM.key,
|
|
21
|
+
parent: {
|
|
22
|
+
type: 'block-menu-section',
|
|
23
|
+
key: 'nested-menu-format-section-primary',
|
|
24
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_2_MENU_ITEM.key]
|
|
25
|
+
},
|
|
26
|
+
component: () => /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
27
|
+
level: 2
|
|
28
|
+
})
|
|
29
|
+
}, {
|
|
30
|
+
type: 'block-menu-item',
|
|
31
|
+
key: FORMAT_HEADING_3_MENU_ITEM.key,
|
|
32
|
+
parent: {
|
|
33
|
+
type: 'block-menu-section',
|
|
34
|
+
key: 'nested-menu-format-section-primary',
|
|
35
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_3_MENU_ITEM.key]
|
|
36
|
+
},
|
|
37
|
+
component: () => /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
38
|
+
level: 3
|
|
39
|
+
})
|
|
40
|
+
}, {
|
|
41
|
+
type: 'block-menu-item',
|
|
42
|
+
key: FORMAT_HEADING_4_MENU_ITEM.key,
|
|
43
|
+
parent: {
|
|
44
|
+
type: 'block-menu-section',
|
|
45
|
+
key: 'nested-menu-format-section-primary',
|
|
46
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_4_MENU_ITEM.key]
|
|
47
|
+
},
|
|
48
|
+
component: () => /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
49
|
+
level: 4
|
|
50
|
+
})
|
|
51
|
+
}, {
|
|
52
|
+
type: 'block-menu-item',
|
|
53
|
+
key: FORMAT_HEADING_5_MENU_ITEM.key,
|
|
54
|
+
parent: {
|
|
55
|
+
type: 'block-menu-section',
|
|
56
|
+
key: 'nested-menu-format-section-primary',
|
|
57
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_5_MENU_ITEM.key]
|
|
58
|
+
},
|
|
59
|
+
component: () => /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
60
|
+
level: 5
|
|
61
|
+
})
|
|
62
|
+
}, {
|
|
63
|
+
type: 'block-menu-item',
|
|
64
|
+
key: FORMAT_HEADING_6_MENU_ITEM.key,
|
|
65
|
+
parent: {
|
|
66
|
+
type: 'block-menu-section',
|
|
67
|
+
key: 'nested-menu-format-section-primary',
|
|
68
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_6_MENU_ITEM.key]
|
|
69
|
+
},
|
|
70
|
+
component: () => /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
71
|
+
level: 6
|
|
72
|
+
})
|
|
73
|
+
}, {
|
|
74
|
+
type: 'block-menu-item',
|
|
75
|
+
key: FORMAT_PARAGRAPH_MENU_ITEM.key,
|
|
76
|
+
parent: {
|
|
77
|
+
type: 'block-menu-section',
|
|
78
|
+
key: 'nested-menu-format-section-primary',
|
|
79
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_PARAGRAPH_MENU_ITEM.key]
|
|
80
|
+
},
|
|
81
|
+
component: () => /*#__PURE__*/React.createElement(ParagraphMenuItem, null)
|
|
82
|
+
}, {
|
|
83
|
+
type: 'block-menu-item',
|
|
84
|
+
key: FORMAT_QUOTE_MENU_ITEM.key,
|
|
85
|
+
parent: {
|
|
86
|
+
type: 'block-menu-section',
|
|
87
|
+
key: 'nested-menu-format-section-primary',
|
|
88
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_QUOTE_MENU_ITEM.key]
|
|
89
|
+
},
|
|
90
|
+
component: () => /*#__PURE__*/React.createElement(QuoteMenuItem, null)
|
|
91
|
+
}];
|
|
92
|
+
};
|
|
@@ -11,6 +11,7 @@ import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
|
|
|
11
11
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
16
|
import { clearFormatting as _clearFormatting, insertBlockQuoteWithAnalytics, insertBlockQuoteWithAnalyticsCommand, setBlockTypeWithAnalytics } from './pm-plugins/commands/block-type';
|
|
16
17
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
@@ -18,7 +19,8 @@ import keymapPlugin from './pm-plugins/keymap';
|
|
|
18
19
|
import { createPlugin, pluginKey } from './pm-plugins/main';
|
|
19
20
|
import { FloatingToolbarComponent } from './pm-plugins/ui/FloatingToolbarComponent';
|
|
20
21
|
import { PrimaryToolbarComponent } from './pm-plugins/ui/PrimaryToolbarComponent';
|
|
21
|
-
import { getToolbarComponents } from './pm-plugins/ui/
|
|
22
|
+
import { getToolbarComponents } from './pm-plugins/ui/toolbar-components';
|
|
23
|
+
import { getBlockTypeComponents } from './ui';
|
|
22
24
|
var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
|
|
23
25
|
var formatMessage = _ref.formatMessage;
|
|
24
26
|
if (!isAllowed) {
|
|
@@ -129,6 +131,10 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
|
129
131
|
component: primaryToolbarComponent
|
|
130
132
|
});
|
|
131
133
|
}
|
|
134
|
+
if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
135
|
+
var _api$blockMenu;
|
|
136
|
+
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(getBlockTypeComponents());
|
|
137
|
+
}
|
|
132
138
|
return {
|
|
133
139
|
name: 'blockType',
|
|
134
140
|
nodes: function nodes() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import {
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
5
|
import ToolbarBlockType from './ToolbarBlockType';
|
|
6
6
|
var FloatingToolbarSettings = {
|
|
@@ -9,7 +9,8 @@ var FloatingToolbarSettings = {
|
|
|
9
9
|
isToolbarReducedSpacing: true,
|
|
10
10
|
shouldUseDefaultRole: false
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
export function FloatingToolbarComponent(_ref) {
|
|
13
|
+
var api = _ref.api;
|
|
13
14
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['blockType'], function (states) {
|
|
14
15
|
var _states$blockTypeStat, _states$blockTypeStat2, _states$blockTypeStat3, _states$blockTypeStat4, _states$blockTypeStat5;
|
|
15
16
|
return {
|
|
@@ -25,32 +26,6 @@ var useFloatingToolbarComponentPluginState = sharedPluginStateHookMigratorFactor
|
|
|
25
26
|
availableBlockTypes = _useSharedPluginState.availableBlockTypes,
|
|
26
27
|
availableBlockTypesInDropdown = _useSharedPluginState.availableBlockTypesInDropdown,
|
|
27
28
|
formattingIsPresent = _useSharedPluginState.formattingIsPresent;
|
|
28
|
-
return {
|
|
29
|
-
currentBlockType: currentBlockType,
|
|
30
|
-
blockTypesDisabled: blockTypesDisabled,
|
|
31
|
-
availableBlockTypes: availableBlockTypes,
|
|
32
|
-
availableBlockTypesInDropdown: availableBlockTypesInDropdown,
|
|
33
|
-
formattingIsPresent: formattingIsPresent
|
|
34
|
-
};
|
|
35
|
-
}, function (api) {
|
|
36
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['blockType']),
|
|
37
|
-
blockTypeState = _useSharedPluginState2.blockTypeState;
|
|
38
|
-
return {
|
|
39
|
-
currentBlockType: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.currentBlockType,
|
|
40
|
-
blockTypesDisabled: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.blockTypesDisabled,
|
|
41
|
-
availableBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypes,
|
|
42
|
-
availableBlockTypesInDropdown: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypesInDropdown,
|
|
43
|
-
formattingIsPresent: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.formattingIsPresent
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
export function FloatingToolbarComponent(_ref) {
|
|
47
|
-
var api = _ref.api;
|
|
48
|
-
var _useFloatingToolbarCo = useFloatingToolbarComponentPluginState(api),
|
|
49
|
-
currentBlockType = _useFloatingToolbarCo.currentBlockType,
|
|
50
|
-
blockTypesDisabled = _useFloatingToolbarCo.blockTypesDisabled,
|
|
51
|
-
availableBlockTypes = _useFloatingToolbarCo.availableBlockTypes,
|
|
52
|
-
availableBlockTypesInDropdown = _useFloatingToolbarCo.availableBlockTypesInDropdown,
|
|
53
|
-
formattingIsPresent = _useFloatingToolbarCo.formattingIsPresent;
|
|
54
29
|
var boundSetBlockType = useCallback(function (name, fromBlockQuote) {
|
|
55
30
|
var _api$core, _api$blockType;
|
|
56
31
|
return api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 || (_api$blockType = _api$blockType.commands) === null || _api$blockType === void 0 ? void 0 : _api$blockType.setTextLevel(name, INPUT_METHOD.FLOATING_TB, fromBlockQuote));
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import {
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import ToolbarBlockType from './ToolbarBlockType';
|
|
5
|
-
|
|
5
|
+
export function PrimaryToolbarComponent(_ref) {
|
|
6
|
+
var api = _ref.api,
|
|
7
|
+
isSmall = _ref.isSmall,
|
|
8
|
+
disabled = _ref.disabled,
|
|
9
|
+
isToolbarReducedSpacing = _ref.isToolbarReducedSpacing,
|
|
10
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
11
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
12
|
+
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
13
|
+
shouldUseDefaultRole = _ref.shouldUseDefaultRole;
|
|
6
14
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['blockType'], function (states) {
|
|
7
15
|
var _states$blockTypeStat, _states$blockTypeStat2, _states$blockTypeStat3, _states$blockTypeStat4, _states$blockTypeStat5;
|
|
8
16
|
return {
|
|
@@ -18,39 +26,6 @@ var usePrimaryToolbarComponentPluginState = sharedPluginStateHookMigratorFactory
|
|
|
18
26
|
availableBlockTypes = _useSharedPluginState.availableBlockTypes,
|
|
19
27
|
availableBlockTypesInDropdown = _useSharedPluginState.availableBlockTypesInDropdown,
|
|
20
28
|
formattingIsPresent = _useSharedPluginState.formattingIsPresent;
|
|
21
|
-
return {
|
|
22
|
-
currentBlockType: currentBlockType,
|
|
23
|
-
blockTypesDisabled: blockTypesDisabled,
|
|
24
|
-
availableBlockTypes: availableBlockTypes,
|
|
25
|
-
availableBlockTypesInDropdown: availableBlockTypesInDropdown,
|
|
26
|
-
formattingIsPresent: formattingIsPresent
|
|
27
|
-
};
|
|
28
|
-
}, function (api) {
|
|
29
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['blockType']),
|
|
30
|
-
blockTypeState = _useSharedPluginState2.blockTypeState;
|
|
31
|
-
return {
|
|
32
|
-
currentBlockType: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.currentBlockType,
|
|
33
|
-
blockTypesDisabled: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.blockTypesDisabled,
|
|
34
|
-
availableBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypes,
|
|
35
|
-
availableBlockTypesInDropdown: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableBlockTypesInDropdown,
|
|
36
|
-
formattingIsPresent: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.formattingIsPresent
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
export function PrimaryToolbarComponent(_ref) {
|
|
40
|
-
var api = _ref.api,
|
|
41
|
-
isSmall = _ref.isSmall,
|
|
42
|
-
disabled = _ref.disabled,
|
|
43
|
-
isToolbarReducedSpacing = _ref.isToolbarReducedSpacing,
|
|
44
|
-
popupsMountPoint = _ref.popupsMountPoint,
|
|
45
|
-
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
46
|
-
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
47
|
-
shouldUseDefaultRole = _ref.shouldUseDefaultRole;
|
|
48
|
-
var _usePrimaryToolbarCom = usePrimaryToolbarComponentPluginState(api),
|
|
49
|
-
currentBlockType = _usePrimaryToolbarCom.currentBlockType,
|
|
50
|
-
blockTypesDisabled = _usePrimaryToolbarCom.blockTypesDisabled,
|
|
51
|
-
availableBlockTypes = _usePrimaryToolbarCom.availableBlockTypes,
|
|
52
|
-
availableBlockTypesInDropdown = _usePrimaryToolbarCom.availableBlockTypesInDropdown,
|
|
53
|
-
formattingIsPresent = _usePrimaryToolbarCom.formattingIsPresent;
|
|
54
29
|
var boundSetBlockType = function boundSetBlockType(name, fromBlockQuote) {
|
|
55
30
|
var _api$core, _api$blockType;
|
|
56
31
|
return api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 || (_api$blockType = api.blockType) === null || _api$blockType === void 0 || (_api$blockType = _api$blockType.commands) === null || _api$blockType === void 0 ? void 0 : _api$blockType.setTextLevel(name, INPUT_METHOD.TOOLBAR, fromBlockQuote));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { TEXT_STYLES_GROUP, TEXT_SECTION_RANK, TEXT_SECTION, TEXT_STYLES_MENU, TEXT_STYLES_GROUP_RANK, TEXT_STYLES_MENU_SECTION, TEXT_STYLES_MENU_RANK } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { TEXT_STYLES_GROUP, TEXT_SECTION_RANK, TEXT_SECTION, TEXT_STYLES_MENU, TEXT_STYLES_GROUP_RANK, TEXT_STYLES_MENU_SECTION, TEXT_STYLES_MENU_RANK, TEXT_COLLAPSED_MENU_RANK, TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
5
|
import { toolbarBlockTypesWithRank } from '../block-types';
|
|
4
6
|
import { HeadingButton } from './ToolbarBlockType/HeadingButton';
|
|
5
7
|
import { QuoteButton } from './ToolbarBlockType/QuoteButton';
|
|
@@ -34,7 +36,11 @@ export var getToolbarComponents = function getToolbarComponents(api) {
|
|
|
34
36
|
type: TEXT_STYLES_MENU.type,
|
|
35
37
|
key: TEXT_STYLES_MENU.key,
|
|
36
38
|
rank: TEXT_STYLES_MENU_RANK[TEXT_STYLES_MENU_SECTION.key]
|
|
37
|
-
}]
|
|
39
|
+
}].concat(_toConsumableArray(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
|
|
40
|
+
type: TEXT_COLLAPSED_MENU.type,
|
|
41
|
+
key: TEXT_COLLAPSED_MENU.key,
|
|
42
|
+
rank: TEXT_COLLAPSED_MENU_RANK[TEXT_STYLES_MENU_SECTION.key]
|
|
43
|
+
}] : []))
|
|
38
44
|
}];
|
|
39
45
|
Object.values(toolbarBlockTypesWithRank()).forEach(function (blockType) {
|
|
40
46
|
if (blockType.toolbarKey) {
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
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 { HeadingMenuItem } from './HeadingMenuItem';
|
|
4
|
+
import { ParagraphMenuItem } from './ParagraphMenuItem';
|
|
5
|
+
import { QuoteMenuItem } from './QuoteMenuItem';
|
|
6
|
+
export var getBlockTypeComponents = function getBlockTypeComponents() {
|
|
7
|
+
return [{
|
|
8
|
+
type: 'block-menu-item',
|
|
9
|
+
key: FORMAT_HEADING_1_MENU_ITEM.key,
|
|
10
|
+
parent: {
|
|
11
|
+
type: 'block-menu-section',
|
|
12
|
+
key: 'nested-menu-format-section-primary',
|
|
13
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_1_MENU_ITEM.key]
|
|
14
|
+
},
|
|
15
|
+
component: function component() {
|
|
16
|
+
return /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
17
|
+
level: 1
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}, {
|
|
21
|
+
type: 'block-menu-item',
|
|
22
|
+
key: FORMAT_HEADING_2_MENU_ITEM.key,
|
|
23
|
+
parent: {
|
|
24
|
+
type: 'block-menu-section',
|
|
25
|
+
key: 'nested-menu-format-section-primary',
|
|
26
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_2_MENU_ITEM.key]
|
|
27
|
+
},
|
|
28
|
+
component: function component() {
|
|
29
|
+
return /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
30
|
+
level: 2
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
type: 'block-menu-item',
|
|
35
|
+
key: FORMAT_HEADING_3_MENU_ITEM.key,
|
|
36
|
+
parent: {
|
|
37
|
+
type: 'block-menu-section',
|
|
38
|
+
key: 'nested-menu-format-section-primary',
|
|
39
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_3_MENU_ITEM.key]
|
|
40
|
+
},
|
|
41
|
+
component: function component() {
|
|
42
|
+
return /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
43
|
+
level: 3
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
type: 'block-menu-item',
|
|
48
|
+
key: FORMAT_HEADING_4_MENU_ITEM.key,
|
|
49
|
+
parent: {
|
|
50
|
+
type: 'block-menu-section',
|
|
51
|
+
key: 'nested-menu-format-section-primary',
|
|
52
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_4_MENU_ITEM.key]
|
|
53
|
+
},
|
|
54
|
+
component: function component() {
|
|
55
|
+
return /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
56
|
+
level: 4
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
type: 'block-menu-item',
|
|
61
|
+
key: FORMAT_HEADING_5_MENU_ITEM.key,
|
|
62
|
+
parent: {
|
|
63
|
+
type: 'block-menu-section',
|
|
64
|
+
key: 'nested-menu-format-section-primary',
|
|
65
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_5_MENU_ITEM.key]
|
|
66
|
+
},
|
|
67
|
+
component: function component() {
|
|
68
|
+
return /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
69
|
+
level: 5
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
type: 'block-menu-item',
|
|
74
|
+
key: FORMAT_HEADING_6_MENU_ITEM.key,
|
|
75
|
+
parent: {
|
|
76
|
+
type: 'block-menu-section',
|
|
77
|
+
key: 'nested-menu-format-section-primary',
|
|
78
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_HEADING_6_MENU_ITEM.key]
|
|
79
|
+
},
|
|
80
|
+
component: function component() {
|
|
81
|
+
return /*#__PURE__*/React.createElement(HeadingMenuItem, {
|
|
82
|
+
level: 6
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
type: 'block-menu-item',
|
|
87
|
+
key: FORMAT_PARAGRAPH_MENU_ITEM.key,
|
|
88
|
+
parent: {
|
|
89
|
+
type: 'block-menu-section',
|
|
90
|
+
key: 'nested-menu-format-section-primary',
|
|
91
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_PARAGRAPH_MENU_ITEM.key]
|
|
92
|
+
},
|
|
93
|
+
component: function component() {
|
|
94
|
+
return /*#__PURE__*/React.createElement(ParagraphMenuItem, null);
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
type: 'block-menu-item',
|
|
98
|
+
key: FORMAT_QUOTE_MENU_ITEM.key,
|
|
99
|
+
parent: {
|
|
100
|
+
type: 'block-menu-section',
|
|
101
|
+
key: 'nested-menu-format-section-primary',
|
|
102
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_QUOTE_MENU_ITEM.key]
|
|
103
|
+
},
|
|
104
|
+
component: function component() {
|
|
105
|
+
return /*#__PURE__*/React.createElement(QuoteMenuItem, null);
|
|
106
|
+
}
|
|
107
|
+
}];
|
|
108
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
3
4
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
4
5
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
5
6
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
@@ -22,7 +23,8 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
|
22
23
|
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
23
24
|
OptionalPlugin<SelectionToolbarPlugin>,
|
|
24
25
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
25
|
-
OptionalPlugin<ToolbarPlugin
|
|
26
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
27
|
+
OptionalPlugin<BlockMenuPlugin>
|
|
26
28
|
];
|
|
27
29
|
pluginConfiguration: BlockTypePluginOptions | undefined;
|
|
28
30
|
sharedState: BlockTypeState | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
3
4
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
4
5
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
5
6
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
@@ -22,7 +23,8 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
|
|
|
22
23
|
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
23
24
|
OptionalPlugin<SelectionToolbarPlugin>,
|
|
24
25
|
OptionalPlugin<UserPreferencesPlugin>,
|
|
25
|
-
OptionalPlugin<ToolbarPlugin
|
|
26
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
27
|
+
OptionalPlugin<BlockMenuPlugin>
|
|
26
28
|
];
|
|
27
29
|
pluginConfiguration: BlockTypePluginOptions | undefined;
|
|
28
30
|
sharedState: BlockTypeState | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.16",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,27 +32,28 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^50.2.3",
|
|
33
33
|
"@atlaskit/css": "^0.12.0",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-block-menu": "^0.0.17",
|
|
35
36
|
"@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
|
|
36
37
|
"@atlaskit/editor-plugin-selection-toolbar": "^4.3.0",
|
|
37
38
|
"@atlaskit/editor-plugin-toolbar": "^0.4.0",
|
|
38
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
40
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
40
41
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
41
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
42
|
-
"@atlaskit/editor-toolbar-model": "^0.
|
|
42
|
+
"@atlaskit/editor-toolbar": "^0.6.0",
|
|
43
|
+
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
43
44
|
"@atlaskit/icon": "^28.1.0",
|
|
44
45
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
45
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
47
|
"@atlaskit/primitives": "^14.12.0",
|
|
47
48
|
"@atlaskit/prosemirror-input-rules": "^3.4.0",
|
|
48
49
|
"@atlaskit/theme": "^20.0.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^11.11.0",
|
|
50
51
|
"@atlaskit/tokens": "^6.1.0",
|
|
51
52
|
"@babel/runtime": "^7.0.0",
|
|
52
53
|
"@emotion/react": "^11.7.1"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^107.
|
|
56
|
+
"@atlaskit/editor-common": "^107.34.0",
|
|
56
57
|
"react": "^18.2.0",
|
|
57
58
|
"react-dom": "^18.2.0",
|
|
58
59
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
File without changes
|
|
File without changes
|