@atlaskit/editor-plugin-block-type 6.2.15 → 6.2.17
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 +2 -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/es2019/blockTypePlugin.js +1 -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/esm/blockTypePlugin.js +1 -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/package.json +6 -6
- /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,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
|
2
2
|
|
|
3
|
+
## 6.2.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 6.2.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`51f3f2db61f6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51f3f2db61f6e) -
|
|
14
|
+
Update toolbar config across plugins
|
|
15
|
+
- [`13f464399d1cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/13f464399d1cc) -
|
|
16
|
+
PR to cleanup platform_editor_usesharedpluginstatewithselector for block-type
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 6.2.15
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -24,7 +24,7 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
|
24
24
|
var _main = require("./pm-plugins/main");
|
|
25
25
|
var _FloatingToolbarComponent = require("./pm-plugins/ui/FloatingToolbarComponent");
|
|
26
26
|
var _PrimaryToolbarComponent = require("./pm-plugins/ui/PrimaryToolbarComponent");
|
|
27
|
-
var
|
|
27
|
+
var _toolbarComponents = require("./pm-plugins/ui/toolbar-components");
|
|
28
28
|
var _ui = require("./ui");
|
|
29
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; }
|
|
30
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; }
|
|
@@ -130,7 +130,7 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
|
|
|
130
130
|
};
|
|
131
131
|
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true)) {
|
|
132
132
|
var _api$toolbar;
|
|
133
|
-
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));
|
|
134
134
|
} else {
|
|
135
135
|
var _api$primaryToolbar;
|
|
136
136
|
api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
|
|
@@ -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) {
|
|
@@ -15,7 +15,7 @@ import keymapPlugin from './pm-plugins/keymap';
|
|
|
15
15
|
import { createPlugin, pluginKey } from './pm-plugins/main';
|
|
16
16
|
import { FloatingToolbarComponent } from './pm-plugins/ui/FloatingToolbarComponent';
|
|
17
17
|
import { PrimaryToolbarComponent } from './pm-plugins/ui/PrimaryToolbarComponent';
|
|
18
|
-
import { getToolbarComponents } from './pm-plugins/ui/
|
|
18
|
+
import { getToolbarComponents } from './pm-plugins/ui/toolbar-components';
|
|
19
19
|
import { getBlockTypeComponents } from './ui';
|
|
20
20
|
const headingPluginOptions = ({
|
|
21
21
|
formatMessage
|
|
@@ -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) {
|
|
@@ -19,7 +19,7 @@ import keymapPlugin from './pm-plugins/keymap';
|
|
|
19
19
|
import { createPlugin, pluginKey } from './pm-plugins/main';
|
|
20
20
|
import { FloatingToolbarComponent } from './pm-plugins/ui/FloatingToolbarComponent';
|
|
21
21
|
import { PrimaryToolbarComponent } from './pm-plugins/ui/PrimaryToolbarComponent';
|
|
22
|
-
import { getToolbarComponents } from './pm-plugins/ui/
|
|
22
|
+
import { getToolbarComponents } from './pm-plugins/ui/toolbar-components';
|
|
23
23
|
import { getBlockTypeComponents } from './ui';
|
|
24
24
|
var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
|
|
25
25
|
var formatMessage = _ref.formatMessage;
|
|
@@ -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) {
|
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.17",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,28 +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.
|
|
35
|
+
"@atlaskit/editor-plugin-block-menu": "^0.0.18",
|
|
36
36
|
"@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-selection-toolbar": "^4.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-toolbar": "^0.4.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
41
41
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
42
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
43
|
-
"@atlaskit/editor-toolbar-model": "^0.
|
|
42
|
+
"@atlaskit/editor-toolbar": "^0.6.0",
|
|
43
|
+
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
44
44
|
"@atlaskit/icon": "^28.1.0",
|
|
45
45
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/primitives": "^14.12.0",
|
|
48
48
|
"@atlaskit/prosemirror-input-rules": "^3.4.0",
|
|
49
49
|
"@atlaskit/theme": "^20.0.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^11.11.0",
|
|
51
51
|
"@atlaskit/tokens": "^6.1.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@atlaskit/editor-common": "^107.
|
|
56
|
+
"@atlaskit/editor-common": "^107.34.0",
|
|
57
57
|
"react": "^18.2.0",
|
|
58
58
|
"react-dom": "^18.2.0",
|
|
59
59
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
File without changes
|
|
File without changes
|