@atlaskit/editor-plugin-block-type 7.1.4 → 7.1.5
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 +13 -0
- package/dist/cjs/blockTypePlugin.js +1 -1
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/TextStylesMenuButton.js +24 -2
- package/dist/es2019/blockTypePlugin.js +1 -1
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/TextStylesMenuButton.js +23 -2
- package/dist/esm/blockTypePlugin.js +1 -1
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/TextStylesMenuButton.js +24 -2
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
|
2
2
|
|
|
3
|
+
## 7.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0eac5a71c3834`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0eac5a71c3834) -
|
|
8
|
+
[ED-29037] Fix dynamic buttons (e.g. text style) in full page primary toolbar flickers during the
|
|
9
|
+
initial load
|
|
10
|
+
- [`c0113eeccb2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0113eeccb2df) -
|
|
11
|
+
[ux] ED-29120 add a new config option for default editor preset
|
|
12
|
+
(`toolbar.enableNewToolbarExperience`) which allows the new toolbar to be disabled. This is needed
|
|
13
|
+
for editors that can't be excluded at the experiment level.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 7.1.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -105,7 +105,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
|
|
|
105
105
|
var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
106
106
|
var options = _ref3.config,
|
|
107
107
|
api = _ref3.api;
|
|
108
|
-
var isToolbarAIFCEnabled = (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true, {
|
|
108
|
+
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true, {
|
|
109
109
|
exposure: true
|
|
110
110
|
});
|
|
111
111
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref4) {
|
|
@@ -7,23 +7,45 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.TextStylesMenuButton = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
12
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
12
13
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
13
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
17
|
var _blockTypes = require("../../block-types");
|
|
15
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
var usePluginState = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
20
|
+
return (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
21
|
+
}, function (api) {
|
|
22
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockType'], function (state) {
|
|
23
|
+
var _state$blockTypeState, _state$blockTypeState2;
|
|
24
|
+
return {
|
|
25
|
+
blockTypesDisabled: (_state$blockTypeState = state.blockTypeState) === null || _state$blockTypeState === void 0 ? void 0 : _state$blockTypeState.blockTypesDisabled,
|
|
26
|
+
currentBlockType: (_state$blockTypeState2 = state.blockTypeState) === null || _state$blockTypeState2 === void 0 ? void 0 : _state$blockTypeState2.currentBlockType
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}, function (api) {
|
|
30
|
+
var blockTypesDisabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockType.blockTypesDisabled');
|
|
31
|
+
var currentBlockType = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockType.currentBlockType');
|
|
32
|
+
return {
|
|
33
|
+
blockTypesDisabled: blockTypesDisabled,
|
|
34
|
+
currentBlockType: currentBlockType
|
|
35
|
+
};
|
|
36
|
+
});
|
|
16
37
|
var TextStylesMenuButton = exports.TextStylesMenuButton = function TextStylesMenuButton(_ref) {
|
|
17
38
|
var _Object$values$find;
|
|
18
39
|
var api = _ref.api,
|
|
19
40
|
children = _ref.children;
|
|
20
41
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
42
|
formatMessage = _useIntl.formatMessage;
|
|
22
|
-
var
|
|
43
|
+
var _usePluginState = usePluginState(api),
|
|
44
|
+
blockTypesDisabled = _usePluginState.blockTypesDisabled,
|
|
45
|
+
currentBlockType = _usePluginState.currentBlockType;
|
|
23
46
|
var blockTypes = (0, _blockTypes.toolbarBlockTypesWithRank)();
|
|
24
47
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
25
48
|
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
26
|
-
var currentBlockType = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockType.currentBlockType');
|
|
27
49
|
var CurrentIcon = (_Object$values$find = Object.values(blockTypes).find(function (blockType) {
|
|
28
50
|
return blockType.name === (currentBlockType === null || currentBlockType === void 0 ? void 0 : currentBlockType.name);
|
|
29
51
|
})) === null || _Object$values$find === void 0 || (_Object$values$find = _Object$values$find.icon) === null || _Object$values$find === void 0 ? void 0 : _Object$values$find.type;
|
|
@@ -93,7 +93,7 @@ const blockTypePlugin = ({
|
|
|
93
93
|
config: options,
|
|
94
94
|
api
|
|
95
95
|
}) => {
|
|
96
|
-
const isToolbarAIFCEnabled = editorExperiment('platform_editor_toolbar_aifc', true, {
|
|
96
|
+
const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true, {
|
|
97
97
|
exposure: true
|
|
98
98
|
});
|
|
99
99
|
const primaryToolbarComponent = ({
|
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
4
|
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
6
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
7
|
import { ToolbarDropdownMenu, ToolbarTooltip, TextIcon } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
10
|
import { toolbarBlockTypesWithRank } from '../../block-types';
|
|
11
|
+
const usePluginState = conditionalHooksFactory(() => expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true), api => {
|
|
12
|
+
return useSharedPluginStateWithSelector(api, ['blockType'], state => {
|
|
13
|
+
var _state$blockTypeState, _state$blockTypeState2;
|
|
14
|
+
return {
|
|
15
|
+
blockTypesDisabled: (_state$blockTypeState = state.blockTypeState) === null || _state$blockTypeState === void 0 ? void 0 : _state$blockTypeState.blockTypesDisabled,
|
|
16
|
+
currentBlockType: (_state$blockTypeState2 = state.blockTypeState) === null || _state$blockTypeState2 === void 0 ? void 0 : _state$blockTypeState2.currentBlockType
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
}, api => {
|
|
20
|
+
const blockTypesDisabled = useSharedPluginStateSelector(api, 'blockType.blockTypesDisabled');
|
|
21
|
+
const currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
|
|
22
|
+
return {
|
|
23
|
+
blockTypesDisabled,
|
|
24
|
+
currentBlockType
|
|
25
|
+
};
|
|
26
|
+
});
|
|
8
27
|
export const TextStylesMenuButton = ({
|
|
9
28
|
api,
|
|
10
29
|
children
|
|
@@ -13,12 +32,14 @@ export const TextStylesMenuButton = ({
|
|
|
13
32
|
const {
|
|
14
33
|
formatMessage
|
|
15
34
|
} = useIntl();
|
|
16
|
-
const
|
|
35
|
+
const {
|
|
36
|
+
blockTypesDisabled,
|
|
37
|
+
currentBlockType
|
|
38
|
+
} = usePluginState(api);
|
|
17
39
|
const blockTypes = toolbarBlockTypesWithRank();
|
|
18
40
|
const {
|
|
19
41
|
editorAppearance
|
|
20
42
|
} = useEditorToolbar();
|
|
21
|
-
const currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
|
|
22
43
|
const CurrentIcon = (_Object$values$find = Object.values(blockTypes).find(blockType => blockType.name === (currentBlockType === null || currentBlockType === void 0 ? void 0 : currentBlockType.name))) === null || _Object$values$find === void 0 ? void 0 : (_Object$values$find$i = _Object$values$find.icon) === null || _Object$values$find$i === void 0 ? void 0 : _Object$values$find$i.type;
|
|
23
44
|
const normalText = blockTypes.normal;
|
|
24
45
|
const TriggerIcon = useMemo(() => {
|
|
@@ -98,7 +98,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
|
|
|
98
98
|
var blockTypePlugin = function blockTypePlugin(_ref3) {
|
|
99
99
|
var options = _ref3.config,
|
|
100
100
|
api = _ref3.api;
|
|
101
|
-
var isToolbarAIFCEnabled = editorExperiment('platform_editor_toolbar_aifc', true, {
|
|
101
|
+
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true, {
|
|
102
102
|
exposure: true
|
|
103
103
|
});
|
|
104
104
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref4) {
|
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
4
|
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
6
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
7
|
import { ToolbarDropdownMenu, ToolbarTooltip, TextIcon } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
10
|
import { toolbarBlockTypesWithRank } from '../../block-types';
|
|
11
|
+
var usePluginState = conditionalHooksFactory(function () {
|
|
12
|
+
return expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
13
|
+
}, function (api) {
|
|
14
|
+
return useSharedPluginStateWithSelector(api, ['blockType'], function (state) {
|
|
15
|
+
var _state$blockTypeState, _state$blockTypeState2;
|
|
16
|
+
return {
|
|
17
|
+
blockTypesDisabled: (_state$blockTypeState = state.blockTypeState) === null || _state$blockTypeState === void 0 ? void 0 : _state$blockTypeState.blockTypesDisabled,
|
|
18
|
+
currentBlockType: (_state$blockTypeState2 = state.blockTypeState) === null || _state$blockTypeState2 === void 0 ? void 0 : _state$blockTypeState2.currentBlockType
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}, function (api) {
|
|
22
|
+
var blockTypesDisabled = useSharedPluginStateSelector(api, 'blockType.blockTypesDisabled');
|
|
23
|
+
var currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
|
|
24
|
+
return {
|
|
25
|
+
blockTypesDisabled: blockTypesDisabled,
|
|
26
|
+
currentBlockType: currentBlockType
|
|
27
|
+
};
|
|
28
|
+
});
|
|
8
29
|
export var TextStylesMenuButton = function TextStylesMenuButton(_ref) {
|
|
9
30
|
var _Object$values$find;
|
|
10
31
|
var api = _ref.api,
|
|
11
32
|
children = _ref.children;
|
|
12
33
|
var _useIntl = useIntl(),
|
|
13
34
|
formatMessage = _useIntl.formatMessage;
|
|
14
|
-
var
|
|
35
|
+
var _usePluginState = usePluginState(api),
|
|
36
|
+
blockTypesDisabled = _usePluginState.blockTypesDisabled,
|
|
37
|
+
currentBlockType = _usePluginState.currentBlockType;
|
|
15
38
|
var blockTypes = toolbarBlockTypesWithRank();
|
|
16
39
|
var _useEditorToolbar = useEditorToolbar(),
|
|
17
40
|
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
18
|
-
var currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
|
|
19
41
|
var CurrentIcon = (_Object$values$find = Object.values(blockTypes).find(function (blockType) {
|
|
20
42
|
return blockType.name === (currentBlockType === null || currentBlockType === void 0 ? void 0 : currentBlockType.name);
|
|
21
43
|
})) === null || _Object$values$find === void 0 || (_Object$values$find = _Object$values$find.icon) === null || _Object$values$find === void 0 ? void 0 : _Object$values$find.type;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.5",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-primary-toolbar": "^5.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-selection": "^4.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-selection-toolbar": "^5.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-toolbar": "^1.
|
|
40
|
+
"@atlaskit/editor-plugin-toolbar": "^1.2.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
42
42
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
@@ -46,16 +46,17 @@
|
|
|
46
46
|
"@atlaskit/icon": "^28.1.0",
|
|
47
47
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
|
+
"@atlaskit/platform-feature-flags-react": "^0.3.0",
|
|
49
50
|
"@atlaskit/primitives": "^14.14.0",
|
|
50
51
|
"@atlaskit/prosemirror-input-rules": "^3.4.0",
|
|
51
52
|
"@atlaskit/theme": "^20.0.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
53
|
+
"@atlaskit/tmp-editor-statsig": "^12.8.0",
|
|
53
54
|
"@atlaskit/tokens": "^6.3.0",
|
|
54
55
|
"@babel/runtime": "^7.0.0",
|
|
55
56
|
"@emotion/react": "^11.7.1"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
|
-
"@atlaskit/editor-common": "^108.
|
|
59
|
+
"@atlaskit/editor-common": "^108.6.0",
|
|
59
60
|
"react": "^18.2.0",
|
|
60
61
|
"react-dom": "^18.2.0",
|
|
61
62
|
"react-intl-next": "npm:react-intl@^5.18.1"
|