@atlaskit/editor-plugin-block-type 16.2.2 → 17.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +80 -20
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +69 -5
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +70 -8
- package/dist/types/pm-plugins/ui/ToolbarBlockType/HeadingButton.d.ts +5 -0
- package/package.json +12 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
|
2
2
|
|
|
3
|
+
## 17.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ae5ca1873aef4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ae5ca1873aef4) -
|
|
8
|
+
Clean up feature gate `platform_editor_nested_dnd_styles_changes`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 17.0.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`e13803b85f2da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e13803b85f2da) -
|
|
16
|
+
[ux] Fix heading typography in block type dropdown items.
|
|
17
|
+
|
|
18
|
+
Applies editor UGC font tokens directly to block type dropdown previews when
|
|
19
|
+
`platform_editor_fix_block_type_dropdown_no_style` is enabled.
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 16.2.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/* HeadingButton.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
-
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
|
|
3
|
-
/* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
|
|
4
2
|
"use strict";
|
|
5
3
|
|
|
6
|
-
var
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.HeadingButton = void 0;
|
|
11
9
|
require("./HeadingButton.compiled.css");
|
|
12
|
-
var React = _interopRequireWildcard(require("react"));
|
|
13
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
14
12
|
var _reactIntl = require("react-intl");
|
|
15
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
14
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
@@ -19,11 +17,14 @@ var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
|
19
17
|
var _ugcTokens = require("@atlaskit/editor-common/ugc-tokens");
|
|
20
18
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
21
19
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
20
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
22
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
22
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
24
23
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
25
24
|
var _utils = require("../../utils");
|
|
26
|
-
|
|
25
|
+
var _editorUGCToken;
|
|
26
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
|
|
27
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
|
|
27
28
|
var smallTextStyle = null;
|
|
28
29
|
var normalStyle = null;
|
|
29
30
|
var heading1Style = null;
|
|
@@ -32,45 +33,104 @@ var heading3Style = null;
|
|
|
32
33
|
var heading4Style = null;
|
|
33
34
|
var heading5Style = null;
|
|
34
35
|
var heading6Style = null;
|
|
35
|
-
var
|
|
36
|
+
var LegacyHeadingText = function LegacyHeadingText(_ref) {
|
|
36
37
|
var children = _ref.children,
|
|
37
38
|
headingType = _ref.headingType;
|
|
38
39
|
switch (headingType) {
|
|
39
40
|
case 'heading1':
|
|
40
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
41
42
|
className: (0, _runtime.ax)(["_djwm111w _5vbmmnnt _1k511xgx _2qeye8o0 _1xjn1kpd _1db31m24 _1c77t7zq _1tkzeeh4 _1obv1fw0 _coj31fw0 _1sxz1fw0 _sumi1fw0 _1osd1fw0 _yb941fw0"])
|
|
42
43
|
}, children);
|
|
43
44
|
case 'heading2':
|
|
44
|
-
return /*#__PURE__*/
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
45
46
|
className: (0, _runtime.ax)(["_djwm111w _5vbmmnnt _1k511xgx _2qeye8o0 _1xjn1kpd _1db31m24 _1c77t7zq _1tkzeeh4 _1obv1fw0 _coj31fw0 _1sxz1fw0 _sumi1fw0 _1osd1fw0 _yb941fw0"])
|
|
46
47
|
}, children);
|
|
47
48
|
case 'heading3':
|
|
48
|
-
return /*#__PURE__*/
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
50
|
className: (0, _runtime.ax)(["_djwm111w _5vbmmnnt _1k511xgx _2qeye8o0 _1xjn1kpd _1db31m24 _1c77t7zq _1tkzeeh4 _1obv1fw0 _coj31fw0 _1sxz1fw0 _sumi1fw0 _1osd1fw0 _yb941fw0"])
|
|
50
51
|
}, children);
|
|
51
52
|
case 'heading4':
|
|
52
|
-
return /*#__PURE__*/
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
53
54
|
className: (0, _runtime.ax)(["_djwm111w _5vbmmnnt _1k511xgx _2qeye8o0 _1xjn1kpd _1db31m24 _1c77t7zq _1tkzeeh4 _1obv1fw0 _coj31fw0 _1sxz1fw0 _sumi1fw0 _1osd1fw0 _yb941fw0"])
|
|
54
55
|
}, children);
|
|
55
56
|
case 'heading5':
|
|
56
|
-
return /*#__PURE__*/
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
57
58
|
className: (0, _runtime.ax)(["_djwm111w _5vbmmnnt _1k511xgx _2qeye8o0 _1xjn1kpd _1db31m24 _1c77t7zq _1tkzeeh4 _1obv1fw0 _coj31fw0 _1sxz1fw0 _sumi1fw0 _1osd1fw0 _yb941fw0"])
|
|
58
59
|
}, children);
|
|
59
60
|
case 'heading6':
|
|
60
|
-
return /*#__PURE__*/
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
61
62
|
className: (0, _runtime.ax)(["_djwm111w _5vbmmnnt _1k511xgx _2qeye8o0 _1xjn1kpd _1db31m24 _1c77t7zq _1tkzeeh4 _1obv1fw0 _coj31fw0 _1sxz1fw0 _sumi1fw0 _1osd1fw0 _yb941fw0"])
|
|
62
63
|
}, children);
|
|
63
64
|
case 'smallText':
|
|
64
|
-
return /*#__PURE__*/
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
65
66
|
className: (0, _runtime.ax)(["_djwm111w _5vbmmnnt _1k511xgx _2qeye8o0 _1xjn1kpd _1db31m24 _1c77t7zq _1tkzeeh4 _1obv1fw0 _coj31fw0 _1sxz1fw0 _sumi1fw0 _1osd1fw0 _yb941fw0"])
|
|
66
67
|
}, children);
|
|
67
68
|
case 'normal':
|
|
68
69
|
default:
|
|
69
|
-
return /*#__PURE__*/
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
70
71
|
className: (0, _runtime.ax)(["_djwm111w _5vbmmnnt _1k511xgx _2qeye8o0 _1xjn1kpd _1db31m24 _1c77t7zq _1tkzeeh4 _1obv1fw0 _coj31fw0 _1sxz1fw0 _sumi1fw0 _1osd1fw0 _yb941fw0"])
|
|
71
72
|
}, children);
|
|
72
73
|
}
|
|
73
74
|
};
|
|
75
|
+
var headingTextProps = {
|
|
76
|
+
normal: {
|
|
77
|
+
style: {
|
|
78
|
+
font: (0, _ugcTokens.editorUGCToken)('editor.font.body')
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
smallText: {
|
|
82
|
+
style: {
|
|
83
|
+
font: (_editorUGCToken = (0, _ugcTokens.editorUGCToken)('editor.font.body.small')) !== null && _editorUGCToken !== void 0 ? _editorUGCToken : (0, _ugcTokens.editorUGCToken)('editor.font.body')
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
heading1: {
|
|
87
|
+
style: {
|
|
88
|
+
font: (0, _ugcTokens.editorUGCToken)('editor.font.heading.h1')
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
heading2: {
|
|
92
|
+
style: {
|
|
93
|
+
font: (0, _ugcTokens.editorUGCToken)('editor.font.heading.h2')
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
heading3: {
|
|
97
|
+
style: {
|
|
98
|
+
font: (0, _ugcTokens.editorUGCToken)('editor.font.heading.h3')
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
heading4: {
|
|
102
|
+
style: {
|
|
103
|
+
font: (0, _ugcTokens.editorUGCToken)('editor.font.heading.h4')
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
heading5: {
|
|
107
|
+
style: {
|
|
108
|
+
font: (0, _ugcTokens.editorUGCToken)('editor.font.heading.h5')
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
heading6: {
|
|
112
|
+
style: {
|
|
113
|
+
font: (0, _ugcTokens.editorUGCToken)('editor.font.heading.h6')
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var HeadingText = function HeadingText(_ref2) {
|
|
118
|
+
var children = _ref2.children,
|
|
119
|
+
headingType = _ref2.headingType;
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement('div', headingTextProps[headingType], children);
|
|
121
|
+
};
|
|
122
|
+
var HeadingPreview = function HeadingPreview(_ref3) {
|
|
123
|
+
var children = _ref3.children,
|
|
124
|
+
headingType = _ref3.headingType;
|
|
125
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_fix_block_type_dropdown_no_style')) {
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement(HeadingText, {
|
|
127
|
+
headingType: headingType
|
|
128
|
+
}, children);
|
|
129
|
+
}
|
|
130
|
+
return /*#__PURE__*/_react.default.createElement(LegacyHeadingText, {
|
|
131
|
+
headingType: headingType
|
|
132
|
+
}, children);
|
|
133
|
+
};
|
|
74
134
|
var shortcuts = {
|
|
75
135
|
normal: _keymaps.setNormalText,
|
|
76
136
|
smallText: _keymaps.toggleSmallText,
|
|
@@ -87,9 +147,9 @@ var shouldDisableHeadingButton = function shouldDisableHeadingButton(state, bloc
|
|
|
87
147
|
}
|
|
88
148
|
return (0, _utils.isSelectionInsideListNode)(state) && blockType.name !== 'normal' && blockType.name !== 'smallText';
|
|
89
149
|
};
|
|
90
|
-
var HeadingButton = exports.HeadingButton = function HeadingButton(
|
|
91
|
-
var blockType =
|
|
92
|
-
api =
|
|
150
|
+
var HeadingButton = exports.HeadingButton = function HeadingButton(_ref4) {
|
|
151
|
+
var blockType = _ref4.blockType,
|
|
152
|
+
api = _ref4.api;
|
|
93
153
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
94
154
|
formatMessage = _useIntl.formatMessage;
|
|
95
155
|
var currentBlockType = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockType.currentBlockType');
|
|
@@ -164,16 +224,16 @@ var HeadingButton = exports.HeadingButton = function HeadingButton(_ref2) {
|
|
|
164
224
|
// fields directly — clearer than nested optional chains and not fragile to
|
|
165
225
|
// future reordering of the conditions.
|
|
166
226
|
var isSelected = isMarkdownBridgeActive ? sourceFormatState != null ? headingLevel !== null ? sourceFormatState.headingLevel === headingLevel : blockType.name === 'normal' ? sourceFormatState.headingLevel === null && !sourceFormatState.inBlockquote : false : false : (currentBlockType === null || currentBlockType === void 0 ? void 0 : currentBlockType.name) === blockType.name;
|
|
167
|
-
return /*#__PURE__*/
|
|
227
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
168
228
|
elemBefore: blockType.icon,
|
|
169
|
-
elemAfter: shortcut ? /*#__PURE__*/
|
|
229
|
+
elemAfter: shortcut ? /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarKeyboardShortcutHint, {
|
|
170
230
|
shortcut: shortcut
|
|
171
231
|
}) : undefined,
|
|
172
232
|
onClick: onClick,
|
|
173
233
|
isSelected: isSelected,
|
|
174
234
|
isDisabled: isDisabled,
|
|
175
235
|
ariaKeyshortcuts: shortcut
|
|
176
|
-
}, /*#__PURE__*/
|
|
236
|
+
}, /*#__PURE__*/_react.default.createElement(HeadingPreview, {
|
|
177
237
|
headingType: blockType.name
|
|
178
238
|
}, formatMessage(blockType.title)));
|
|
179
239
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/* HeadingButton.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
|
|
2
|
+
var _editorUGCToken;
|
|
4
3
|
import "./HeadingButton.compiled.css";
|
|
5
|
-
import * as React from 'react';
|
|
6
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
|
|
6
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
7
9
|
import { useIntl } from 'react-intl';
|
|
8
10
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
11
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
@@ -12,6 +14,7 @@ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
|
12
14
|
import { editorUGCToken } from '@atlaskit/editor-common/ugc-tokens';
|
|
13
15
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
14
16
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
17
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
15
18
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
19
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
20
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
@@ -24,7 +27,7 @@ const heading3Style = null;
|
|
|
24
27
|
const heading4Style = null;
|
|
25
28
|
const heading5Style = null;
|
|
26
29
|
const heading6Style = null;
|
|
27
|
-
const
|
|
30
|
+
const LegacyHeadingText = ({
|
|
28
31
|
children,
|
|
29
32
|
headingType
|
|
30
33
|
}) => {
|
|
@@ -64,6 +67,67 @@ const HeadingText = ({
|
|
|
64
67
|
}, children);
|
|
65
68
|
}
|
|
66
69
|
};
|
|
70
|
+
const headingTextProps = {
|
|
71
|
+
normal: {
|
|
72
|
+
style: {
|
|
73
|
+
font: editorUGCToken('editor.font.body')
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
smallText: {
|
|
77
|
+
style: {
|
|
78
|
+
font: (_editorUGCToken = editorUGCToken('editor.font.body.small')) !== null && _editorUGCToken !== void 0 ? _editorUGCToken : editorUGCToken('editor.font.body')
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
heading1: {
|
|
82
|
+
style: {
|
|
83
|
+
font: editorUGCToken('editor.font.heading.h1')
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
heading2: {
|
|
87
|
+
style: {
|
|
88
|
+
font: editorUGCToken('editor.font.heading.h2')
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
heading3: {
|
|
92
|
+
style: {
|
|
93
|
+
font: editorUGCToken('editor.font.heading.h3')
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
heading4: {
|
|
97
|
+
style: {
|
|
98
|
+
font: editorUGCToken('editor.font.heading.h4')
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
heading5: {
|
|
102
|
+
style: {
|
|
103
|
+
font: editorUGCToken('editor.font.heading.h5')
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
heading6: {
|
|
107
|
+
style: {
|
|
108
|
+
font: editorUGCToken('editor.font.heading.h6')
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const HeadingText = ({
|
|
113
|
+
children,
|
|
114
|
+
headingType
|
|
115
|
+
}) => {
|
|
116
|
+
return /*#__PURE__*/React.createElement('div', headingTextProps[headingType], children);
|
|
117
|
+
};
|
|
118
|
+
const HeadingPreview = ({
|
|
119
|
+
children,
|
|
120
|
+
headingType
|
|
121
|
+
}) => {
|
|
122
|
+
if (isExperimentEnabled('platform_editor_fix_block_type_dropdown_no_style')) {
|
|
123
|
+
return /*#__PURE__*/React.createElement(HeadingText, {
|
|
124
|
+
headingType: headingType
|
|
125
|
+
}, children);
|
|
126
|
+
}
|
|
127
|
+
return /*#__PURE__*/React.createElement(LegacyHeadingText, {
|
|
128
|
+
headingType: headingType
|
|
129
|
+
}, children);
|
|
130
|
+
};
|
|
67
131
|
const shortcuts = {
|
|
68
132
|
normal: setNormalText,
|
|
69
133
|
smallText: toggleSmallText,
|
|
@@ -168,7 +232,7 @@ export const HeadingButton = ({
|
|
|
168
232
|
isSelected: isSelected,
|
|
169
233
|
isDisabled: isDisabled,
|
|
170
234
|
ariaKeyshortcuts: shortcut
|
|
171
|
-
}, /*#__PURE__*/React.createElement(
|
|
235
|
+
}, /*#__PURE__*/React.createElement(HeadingPreview, {
|
|
172
236
|
headingType: blockType.name
|
|
173
237
|
}, formatMessage(blockType.title)));
|
|
174
238
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/* HeadingButton.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
|
|
2
|
+
var _editorUGCToken;
|
|
4
3
|
import "./HeadingButton.compiled.css";
|
|
5
|
-
import * as React from 'react';
|
|
6
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
|
|
6
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
7
9
|
import { useIntl } from 'react-intl';
|
|
8
10
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
11
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
@@ -12,6 +14,7 @@ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
|
12
14
|
import { editorUGCToken } from '@atlaskit/editor-common/ugc-tokens';
|
|
13
15
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
14
16
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
17
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
15
18
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
19
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
20
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
@@ -24,7 +27,7 @@ var heading3Style = null;
|
|
|
24
27
|
var heading4Style = null;
|
|
25
28
|
var heading5Style = null;
|
|
26
29
|
var heading6Style = null;
|
|
27
|
-
var
|
|
30
|
+
var LegacyHeadingText = function LegacyHeadingText(_ref) {
|
|
28
31
|
var children = _ref.children,
|
|
29
32
|
headingType = _ref.headingType;
|
|
30
33
|
switch (headingType) {
|
|
@@ -63,6 +66,65 @@ var HeadingText = function HeadingText(_ref) {
|
|
|
63
66
|
}, children);
|
|
64
67
|
}
|
|
65
68
|
};
|
|
69
|
+
var headingTextProps = {
|
|
70
|
+
normal: {
|
|
71
|
+
style: {
|
|
72
|
+
font: editorUGCToken('editor.font.body')
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
smallText: {
|
|
76
|
+
style: {
|
|
77
|
+
font: (_editorUGCToken = editorUGCToken('editor.font.body.small')) !== null && _editorUGCToken !== void 0 ? _editorUGCToken : editorUGCToken('editor.font.body')
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
heading1: {
|
|
81
|
+
style: {
|
|
82
|
+
font: editorUGCToken('editor.font.heading.h1')
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
heading2: {
|
|
86
|
+
style: {
|
|
87
|
+
font: editorUGCToken('editor.font.heading.h2')
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
heading3: {
|
|
91
|
+
style: {
|
|
92
|
+
font: editorUGCToken('editor.font.heading.h3')
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
heading4: {
|
|
96
|
+
style: {
|
|
97
|
+
font: editorUGCToken('editor.font.heading.h4')
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
heading5: {
|
|
101
|
+
style: {
|
|
102
|
+
font: editorUGCToken('editor.font.heading.h5')
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
heading6: {
|
|
106
|
+
style: {
|
|
107
|
+
font: editorUGCToken('editor.font.heading.h6')
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var HeadingText = function HeadingText(_ref2) {
|
|
112
|
+
var children = _ref2.children,
|
|
113
|
+
headingType = _ref2.headingType;
|
|
114
|
+
return /*#__PURE__*/React.createElement('div', headingTextProps[headingType], children);
|
|
115
|
+
};
|
|
116
|
+
var HeadingPreview = function HeadingPreview(_ref3) {
|
|
117
|
+
var children = _ref3.children,
|
|
118
|
+
headingType = _ref3.headingType;
|
|
119
|
+
if (isExperimentEnabled('platform_editor_fix_block_type_dropdown_no_style')) {
|
|
120
|
+
return /*#__PURE__*/React.createElement(HeadingText, {
|
|
121
|
+
headingType: headingType
|
|
122
|
+
}, children);
|
|
123
|
+
}
|
|
124
|
+
return /*#__PURE__*/React.createElement(LegacyHeadingText, {
|
|
125
|
+
headingType: headingType
|
|
126
|
+
}, children);
|
|
127
|
+
};
|
|
66
128
|
var shortcuts = {
|
|
67
129
|
normal: setNormalText,
|
|
68
130
|
smallText: toggleSmallText,
|
|
@@ -79,9 +141,9 @@ var shouldDisableHeadingButton = function shouldDisableHeadingButton(state, bloc
|
|
|
79
141
|
}
|
|
80
142
|
return isSelectionInsideListNode(state) && blockType.name !== 'normal' && blockType.name !== 'smallText';
|
|
81
143
|
};
|
|
82
|
-
export var HeadingButton = function HeadingButton(
|
|
83
|
-
var blockType =
|
|
84
|
-
api =
|
|
144
|
+
export var HeadingButton = function HeadingButton(_ref4) {
|
|
145
|
+
var blockType = _ref4.blockType,
|
|
146
|
+
api = _ref4.api;
|
|
85
147
|
var _useIntl = useIntl(),
|
|
86
148
|
formatMessage = _useIntl.formatMessage;
|
|
87
149
|
var currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
|
|
@@ -165,7 +227,7 @@ export var HeadingButton = function HeadingButton(_ref2) {
|
|
|
165
227
|
isSelected: isSelected,
|
|
166
228
|
isDisabled: isDisabled,
|
|
167
229
|
ariaKeyshortcuts: shortcut
|
|
168
|
-
}, /*#__PURE__*/React.createElement(
|
|
230
|
+
}, /*#__PURE__*/React.createElement(HeadingPreview, {
|
|
169
231
|
headingType: blockType.name
|
|
170
232
|
}, formatMessage(blockType.title)));
|
|
171
233
|
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
1
6
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
7
|
import type { BlockTypePlugin } from '../../../blockTypePluginType';
|
|
3
8
|
import type { BlockTypeWithRank } from '../../types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.1",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@atlaskit/adf-schema": "^56.5.0",
|
|
25
25
|
"@atlaskit/css": "^1.0.0",
|
|
26
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
27
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
28
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
29
|
-
"@atlaskit/editor-plugin-list": "^
|
|
30
|
-
"@atlaskit/editor-plugin-primary-toolbar": "^
|
|
31
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
32
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^
|
|
33
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
26
|
+
"@atlaskit/editor-plugin-analytics": "^13.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-block-menu": "^12.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-interaction": "^24.0.0",
|
|
29
|
+
"@atlaskit/editor-plugin-list": "^15.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^14.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-selection": "^13.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^14.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-toolbar": "^10.0.0",
|
|
34
34
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
35
35
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
36
36
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
@@ -38,18 +38,19 @@
|
|
|
38
38
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
39
39
|
"@atlaskit/icon": "^37.2.0",
|
|
40
40
|
"@atlaskit/icon-lab": "^7.4.0",
|
|
41
|
+
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
41
42
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
42
43
|
"@atlaskit/primitives": "^22.2.0",
|
|
43
44
|
"@atlaskit/prosemirror-history": "^1.1.0",
|
|
44
45
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^138.0.0",
|
|
46
47
|
"@atlaskit/tokens": "^16.3.0",
|
|
47
48
|
"@babel/runtime": "^7.0.0",
|
|
48
49
|
"@compiled/react": "^1.0.0",
|
|
49
50
|
"@emotion/react": "^11.7.1"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^
|
|
53
|
+
"@atlaskit/editor-common": "^117.0.0",
|
|
53
54
|
"react": "^18.2.0 || ^19.2.0",
|
|
54
55
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
55
56
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -104,9 +105,6 @@
|
|
|
104
105
|
"platform_editor_toolbar_responsive_fixes": {
|
|
105
106
|
"type": "boolean"
|
|
106
107
|
},
|
|
107
|
-
"platform_editor_nested_dnd_styles_changes": {
|
|
108
|
-
"type": "boolean"
|
|
109
|
-
},
|
|
110
108
|
"platform_editor_use_preferences_plugin": {
|
|
111
109
|
"type": "boolean"
|
|
112
110
|
},
|