@atlaskit/editor-plugin-block-type 12.1.7 → 12.1.9
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/pm-plugins/block-types.js +2 -2
- package/dist/cjs/pm-plugins/consts.js +2 -1
- package/dist/cjs/pm-plugins/main.js +8 -0
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +1 -5
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +3 -1
- package/dist/cjs/pm-plugins/ui/ToolbarBlockType/index.js +4 -1
- package/dist/es2019/pm-plugins/block-types.js +3 -3
- package/dist/es2019/pm-plugins/consts.js +1 -0
- package/dist/es2019/pm-plugins/main.js +10 -2
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +2 -6
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +3 -1
- package/dist/es2019/pm-plugins/ui/ToolbarBlockType/index.js +4 -1
- package/dist/esm/pm-plugins/block-types.js +3 -3
- package/dist/esm/pm-plugins/consts.js +1 -0
- package/dist/esm/pm-plugins/main.js +10 -2
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/HeadingButton.js +2 -6
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/blocktype-button.js +3 -1
- package/dist/esm/pm-plugins/ui/ToolbarBlockType/index.js +4 -1
- package/dist/types/pm-plugins/consts.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/consts.d.ts +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-type
|
|
2
2
|
|
|
3
|
+
## 12.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ceefea718fc6d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ceefea718fc6d) -
|
|
8
|
+
Add keyboard shortcut (Cmd+Opt+7 on Mac, Ctrl+Alt+7 on Windows) for the small text feature in the
|
|
9
|
+
editor, gated behind the platform_editor_small_font_size experiment. Also adds the shortcut to the
|
|
10
|
+
toolbar tooltip and help dialog.
|
|
11
|
+
- [`d7123d7a16015`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d7123d7a16015) -
|
|
12
|
+
Use TextSmallIcon instead of TextIcon for small text block type
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 12.1.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 12.1.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -36,7 +36,7 @@ var SMALL_TEXT = exports.SMALL_TEXT = {
|
|
|
36
36
|
title: _messages.blockTypeMessages.smallText,
|
|
37
37
|
nodeName: 'paragraph',
|
|
38
38
|
markName: 'fontSize',
|
|
39
|
-
icon: /*#__PURE__*/_react.default.createElement(
|
|
39
|
+
icon: /*#__PURE__*/_react.default.createElement(_editorToolbar.TextSmallIcon, {
|
|
40
40
|
label: ""
|
|
41
41
|
}),
|
|
42
42
|
LEGACY_icon: /*#__PURE__*/_react.default.createElement(_icons.Text, null)
|
|
@@ -153,7 +153,7 @@ var toolbarBlockTypesWithRank = exports.toolbarBlockTypesWithRank = function too
|
|
|
153
153
|
})
|
|
154
154
|
}, allowFontSize && (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true) && {
|
|
155
155
|
smallText: _objectSpread(_objectSpread({}, SMALL_TEXT), {}, {
|
|
156
|
-
icon: /*#__PURE__*/_react.default.createElement(
|
|
156
|
+
icon: /*#__PURE__*/_react.default.createElement(_editorToolbar.TextSmallIcon, {
|
|
157
157
|
size: "small",
|
|
158
158
|
label: ""
|
|
159
159
|
}),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.HEADING_NUMPAD_KEYS = exports.HEADING_KEYS = void 0;
|
|
6
|
+
exports.KEY_7 = exports.HEADING_NUMPAD_KEYS = exports.HEADING_KEYS = void 0;
|
|
7
7
|
var KEY_0 = 48;
|
|
8
8
|
var KEY_1 = 49;
|
|
9
9
|
var KEY_2 = 50;
|
|
@@ -11,6 +11,7 @@ var KEY_3 = 51;
|
|
|
11
11
|
var KEY_4 = 52;
|
|
12
12
|
var KEY_5 = 53;
|
|
13
13
|
var KEY_6 = 54;
|
|
14
|
+
var KEY_7 = exports.KEY_7 = 55;
|
|
14
15
|
var HEADING_KEYS = exports.HEADING_KEYS = [KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6];
|
|
15
16
|
var NUMPAD_KEY_0 = 96;
|
|
16
17
|
var NUMPAD_KEY_1 = 97;
|
|
@@ -164,6 +164,14 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
|
|
|
164
164
|
var _editorAPI$core$actio2, _editorAPI$core2;
|
|
165
165
|
return (_editorAPI$core$actio2 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core2 = editorAPI.core) === null || _editorAPI$core2 === void 0 ? void 0 : _editorAPI$core2.actions.execute(autoformatHeading(headingLevel, editorAnalyticsApi))) !== null && _editorAPI$core$actio2 !== void 0 ? _editorAPI$core$actio2 : false;
|
|
166
166
|
}
|
|
167
|
+
} else if (event.keyCode === _consts.KEY_7 && event.altKey && (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true)) {
|
|
168
|
+
if (browser.mac && event.metaKey) {
|
|
169
|
+
var _editorAPI$core$actio3, _editorAPI$core3;
|
|
170
|
+
return (_editorAPI$core$actio3 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core3 = editorAPI.core) === null || _editorAPI$core3 === void 0 ? void 0 : _editorAPI$core3.actions.execute((0, _blockType.setSmallTextWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio3 !== void 0 ? _editorAPI$core$actio3 : false;
|
|
171
|
+
} else if (!browser.mac && event.ctrlKey && altKeyLocation !== event.DOM_KEY_LOCATION_RIGHT) {
|
|
172
|
+
var _editorAPI$core$actio4, _editorAPI$core4;
|
|
173
|
+
return (_editorAPI$core$actio4 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core4 = editorAPI.core) === null || _editorAPI$core4 === void 0 ? void 0 : _editorAPI$core4.actions.execute((0, _blockType.setSmallTextWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio4 !== void 0 ? _editorAPI$core$actio4 : false;
|
|
174
|
+
}
|
|
167
175
|
} else if (event.key === 'Alt') {
|
|
168
176
|
// event.location is for the current key only; when a user hits Ctrl-Alt-1 the
|
|
169
177
|
// location refers to the location of the '1' key
|
|
@@ -105,11 +105,7 @@ var headingSizeStylesMap = {
|
|
|
105
105
|
};
|
|
106
106
|
var shortcuts = {
|
|
107
107
|
normal: _keymaps.setNormalText,
|
|
108
|
-
smallText:
|
|
109
|
-
description: '',
|
|
110
|
-
mac: '',
|
|
111
|
-
windows: ''
|
|
112
|
-
},
|
|
108
|
+
smallText: _keymaps.toggleSmallText,
|
|
113
109
|
heading1: _keymaps.toggleHeading1,
|
|
114
110
|
heading2: _keymaps.toggleHeading2,
|
|
115
111
|
heading3: _keymaps.toggleHeading3,
|
|
@@ -74,7 +74,9 @@ var BlockTypeButton = exports.BlockTypeButton = function BlockTypeButton(props)
|
|
|
74
74
|
color: "currentColor",
|
|
75
75
|
size: "small"
|
|
76
76
|
}))))
|
|
77
|
-
}, !shouldUseIconAsButton && (0, _react2.jsx)(_primitives.Box
|
|
77
|
+
}, !shouldUseIconAsButton && (0, _react2.jsx)(_primitives.Box
|
|
78
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
79
|
+
, {
|
|
78
80
|
xcss: [buttonContentStyle, props.isReducedSpacing && buttonContentReducedSpacingStyle]
|
|
79
81
|
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage
|
|
80
82
|
// Ignored via go/ees005
|
|
@@ -253,12 +253,15 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
253
253
|
scrollableElement: popupsScrollableElement,
|
|
254
254
|
zIndex: _editorSharedStyles.akEditorMenuZIndex,
|
|
255
255
|
fitHeight: 360,
|
|
256
|
-
fitWidth: 106
|
|
256
|
+
fitWidth: 106
|
|
257
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
258
|
+
,
|
|
257
259
|
section: {
|
|
258
260
|
hasSeparator: true
|
|
259
261
|
},
|
|
260
262
|
shouldUseDefaultRole: shouldUseDefaultRole
|
|
261
263
|
// hasSeparator={true}
|
|
264
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
262
265
|
,
|
|
263
266
|
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
264
267
|
if (isOpenedByKeyboard) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
3
|
import { BLOCK_QUOTE_MENU_ITEM, HEADING_1_MENU_ITEM, HEADING_2_MENU_ITEM, HEADING_3_MENU_ITEM, HEADING_4_MENU_ITEM, HEADING_5_MENU_ITEM, HEADING_6_MENU_ITEM, NORMAL_TEXT_MENU_ITEM, SMALL_TEXT_MENU_ITEM, TEXT_STYLES_MENU_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
|
|
4
|
-
import { TextIcon as EditorToolbarTextIcon, QuoteIcon, HeadingOneIcon, HeadingTwoIcon, HeadingThreeIcon, HeadingFourIcon, HeadingFiveIcon, HeadingSixIcon } from '@atlaskit/editor-toolbar';
|
|
4
|
+
import { TextIcon as EditorToolbarTextIcon, QuoteIcon, HeadingOneIcon, HeadingTwoIcon, HeadingThreeIcon, HeadingFourIcon, HeadingFiveIcon, HeadingSixIcon, TextSmallIcon } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import TextHeadingFiveIcon from '@atlaskit/icon-lab/core/text-heading-five';
|
|
6
6
|
import TextHeadingFourIcon from '@atlaskit/icon-lab/core/text-heading-four';
|
|
7
7
|
import TextHeadingOneIcon from '@atlaskit/icon-lab/core/text-heading-one';
|
|
@@ -26,7 +26,7 @@ export const SMALL_TEXT = {
|
|
|
26
26
|
title: messages.smallText,
|
|
27
27
|
nodeName: 'paragraph',
|
|
28
28
|
markName: 'fontSize',
|
|
29
|
-
icon: /*#__PURE__*/React.createElement(
|
|
29
|
+
icon: /*#__PURE__*/React.createElement(TextSmallIcon, {
|
|
30
30
|
label: ""
|
|
31
31
|
}),
|
|
32
32
|
LEGACY_icon: /*#__PURE__*/React.createElement(Text, null)
|
|
@@ -145,7 +145,7 @@ export const toolbarBlockTypesWithRank = ({
|
|
|
145
145
|
...(allowFontSize && expValEquals('platform_editor_small_font_size', 'isEnabled', true) && {
|
|
146
146
|
smallText: {
|
|
147
147
|
...SMALL_TEXT,
|
|
148
|
-
icon: /*#__PURE__*/React.createElement(
|
|
148
|
+
icon: /*#__PURE__*/React.createElement(TextSmallIcon, {
|
|
149
149
|
size: "small",
|
|
150
150
|
label: ""
|
|
151
151
|
}),
|
|
@@ -5,8 +5,8 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
7
|
import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, getBlockTypesInDropdown, SMALL_TEXT } from './block-types';
|
|
8
|
-
import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from './commands/block-type';
|
|
9
|
-
import { HEADING_KEYS, HEADING_NUMPAD_KEYS } from './consts';
|
|
8
|
+
import { setHeadingWithAnalytics, setNormalTextWithAnalytics, setSmallTextWithAnalytics } from './commands/block-type';
|
|
9
|
+
import { HEADING_KEYS, HEADING_NUMPAD_KEYS, KEY_7 } from './consts';
|
|
10
10
|
import { areBlockTypesDisabled, checkFormattingIsPresent, hasBlockQuoteInOptions } from './utils';
|
|
11
11
|
const blockTypeForNode = (node, schema) => {
|
|
12
12
|
if (node.type === schema.nodes.heading) {
|
|
@@ -148,6 +148,14 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
|
|
|
148
148
|
var _editorAPI$core$actio2, _editorAPI$core2;
|
|
149
149
|
return (_editorAPI$core$actio2 = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$core2 = editorAPI.core) === null || _editorAPI$core2 === void 0 ? void 0 : _editorAPI$core2.actions.execute(autoformatHeading(headingLevel, editorAnalyticsApi))) !== null && _editorAPI$core$actio2 !== void 0 ? _editorAPI$core$actio2 : false;
|
|
150
150
|
}
|
|
151
|
+
} else if (event.keyCode === KEY_7 && event.altKey && expValEquals('platform_editor_small_font_size', 'isEnabled', true)) {
|
|
152
|
+
if (browser.mac && event.metaKey) {
|
|
153
|
+
var _editorAPI$core$actio3, _editorAPI$core3;
|
|
154
|
+
return (_editorAPI$core$actio3 = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$core3 = editorAPI.core) === null || _editorAPI$core3 === void 0 ? void 0 : _editorAPI$core3.actions.execute(setSmallTextWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio3 !== void 0 ? _editorAPI$core$actio3 : false;
|
|
155
|
+
} else if (!browser.mac && event.ctrlKey && altKeyLocation !== event.DOM_KEY_LOCATION_RIGHT) {
|
|
156
|
+
var _editorAPI$core$actio4, _editorAPI$core4;
|
|
157
|
+
return (_editorAPI$core$actio4 = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$core4 = editorAPI.core) === null || _editorAPI$core4 === void 0 ? void 0 : _editorAPI$core4.actions.execute(setSmallTextWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio4 !== void 0 ? _editorAPI$core$actio4 : false;
|
|
158
|
+
}
|
|
151
159
|
} else if (event.key === 'Alt') {
|
|
152
160
|
// event.location is for the current key only; when a user hits Ctrl-Alt-1 the
|
|
153
161
|
// location refers to the location of the '1' key
|
|
@@ -6,7 +6,7 @@ import * as React from 'react';
|
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
8
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
|
-
import { formatShortcut, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6 } from '@atlaskit/editor-common/keymaps';
|
|
9
|
+
import { formatShortcut, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleSmallText } from '@atlaskit/editor-common/keymaps';
|
|
10
10
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
11
11
|
import { editorUGCToken } from '@atlaskit/editor-common/ugc-tokens';
|
|
12
12
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
@@ -98,11 +98,7 @@ const headingSizeStylesMap = {
|
|
|
98
98
|
};
|
|
99
99
|
const shortcuts = {
|
|
100
100
|
normal: setNormalText,
|
|
101
|
-
smallText:
|
|
102
|
-
description: '',
|
|
103
|
-
mac: '',
|
|
104
|
-
windows: ''
|
|
105
|
-
},
|
|
101
|
+
smallText: toggleSmallText,
|
|
106
102
|
heading1: toggleHeading1,
|
|
107
103
|
heading2: toggleHeading2,
|
|
108
104
|
heading3: toggleHeading3,
|
|
@@ -65,7 +65,9 @@ export const BlockTypeButton = props => {
|
|
|
65
65
|
color: "currentColor",
|
|
66
66
|
size: "small"
|
|
67
67
|
}))))
|
|
68
|
-
}, !shouldUseIconAsButton && jsx(Box
|
|
68
|
+
}, !shouldUseIconAsButton && jsx(Box
|
|
69
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
70
|
+
, {
|
|
69
71
|
xcss: [buttonContentStyle, props.isReducedSpacing && buttonContentReducedSpacingStyle]
|
|
70
72
|
}, jsx(FormattedMessage
|
|
71
73
|
// Ignored via go/ees005
|
|
@@ -223,12 +223,15 @@ class ToolbarBlockType extends React.PureComponent {
|
|
|
223
223
|
scrollableElement: popupsScrollableElement,
|
|
224
224
|
zIndex: akEditorMenuZIndex,
|
|
225
225
|
fitHeight: 360,
|
|
226
|
-
fitWidth: 106
|
|
226
|
+
fitWidth: 106
|
|
227
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
228
|
+
,
|
|
227
229
|
section: {
|
|
228
230
|
hasSeparator: true
|
|
229
231
|
},
|
|
230
232
|
shouldUseDefaultRole: shouldUseDefaultRole
|
|
231
233
|
// hasSeparator={true}
|
|
234
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
232
235
|
,
|
|
233
236
|
shouldFocusFirstItem: () => {
|
|
234
237
|
if (isOpenedByKeyboard) {
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { BLOCK_QUOTE_MENU_ITEM, HEADING_1_MENU_ITEM, HEADING_2_MENU_ITEM, HEADING_3_MENU_ITEM, HEADING_4_MENU_ITEM, HEADING_5_MENU_ITEM, HEADING_6_MENU_ITEM, NORMAL_TEXT_MENU_ITEM, SMALL_TEXT_MENU_ITEM, TEXT_STYLES_MENU_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
|
|
7
|
-
import { TextIcon as EditorToolbarTextIcon, QuoteIcon, HeadingOneIcon, HeadingTwoIcon, HeadingThreeIcon, HeadingFourIcon, HeadingFiveIcon, HeadingSixIcon } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import { TextIcon as EditorToolbarTextIcon, QuoteIcon, HeadingOneIcon, HeadingTwoIcon, HeadingThreeIcon, HeadingFourIcon, HeadingFiveIcon, HeadingSixIcon, TextSmallIcon } from '@atlaskit/editor-toolbar';
|
|
8
8
|
import TextHeadingFiveIcon from '@atlaskit/icon-lab/core/text-heading-five';
|
|
9
9
|
import TextHeadingFourIcon from '@atlaskit/icon-lab/core/text-heading-four';
|
|
10
10
|
import TextHeadingOneIcon from '@atlaskit/icon-lab/core/text-heading-one';
|
|
@@ -29,7 +29,7 @@ export var SMALL_TEXT = {
|
|
|
29
29
|
title: messages.smallText,
|
|
30
30
|
nodeName: 'paragraph',
|
|
31
31
|
markName: 'fontSize',
|
|
32
|
-
icon: /*#__PURE__*/React.createElement(
|
|
32
|
+
icon: /*#__PURE__*/React.createElement(TextSmallIcon, {
|
|
33
33
|
label: ""
|
|
34
34
|
}),
|
|
35
35
|
LEGACY_icon: /*#__PURE__*/React.createElement(Text, null)
|
|
@@ -146,7 +146,7 @@ export var toolbarBlockTypesWithRank = function toolbarBlockTypesWithRank(_ref)
|
|
|
146
146
|
})
|
|
147
147
|
}, allowFontSize && expValEquals('platform_editor_small_font_size', 'isEnabled', true) && {
|
|
148
148
|
smallText: _objectSpread(_objectSpread({}, SMALL_TEXT), {}, {
|
|
149
|
-
icon: /*#__PURE__*/React.createElement(
|
|
149
|
+
icon: /*#__PURE__*/React.createElement(TextSmallIcon, {
|
|
150
150
|
size: "small",
|
|
151
151
|
label: ""
|
|
152
152
|
}),
|
|
@@ -8,8 +8,8 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
10
|
import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, getBlockTypesInDropdown, SMALL_TEXT } from './block-types';
|
|
11
|
-
import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from './commands/block-type';
|
|
12
|
-
import { HEADING_KEYS, HEADING_NUMPAD_KEYS } from './consts';
|
|
11
|
+
import { setHeadingWithAnalytics, setNormalTextWithAnalytics, setSmallTextWithAnalytics } from './commands/block-type';
|
|
12
|
+
import { HEADING_KEYS, HEADING_NUMPAD_KEYS, KEY_7 } from './consts';
|
|
13
13
|
import { areBlockTypesDisabled, checkFormattingIsPresent, hasBlockQuoteInOptions } from './utils';
|
|
14
14
|
var blockTypeForNode = function blockTypeForNode(node, schema) {
|
|
15
15
|
if (node.type === schema.nodes.heading) {
|
|
@@ -157,6 +157,14 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
|
|
|
157
157
|
var _editorAPI$core$actio2, _editorAPI$core2;
|
|
158
158
|
return (_editorAPI$core$actio2 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core2 = editorAPI.core) === null || _editorAPI$core2 === void 0 ? void 0 : _editorAPI$core2.actions.execute(autoformatHeading(headingLevel, editorAnalyticsApi))) !== null && _editorAPI$core$actio2 !== void 0 ? _editorAPI$core$actio2 : false;
|
|
159
159
|
}
|
|
160
|
+
} else if (event.keyCode === KEY_7 && event.altKey && expValEquals('platform_editor_small_font_size', 'isEnabled', true)) {
|
|
161
|
+
if (browser.mac && event.metaKey) {
|
|
162
|
+
var _editorAPI$core$actio3, _editorAPI$core3;
|
|
163
|
+
return (_editorAPI$core$actio3 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core3 = editorAPI.core) === null || _editorAPI$core3 === void 0 ? void 0 : _editorAPI$core3.actions.execute(setSmallTextWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio3 !== void 0 ? _editorAPI$core$actio3 : false;
|
|
164
|
+
} else if (!browser.mac && event.ctrlKey && altKeyLocation !== event.DOM_KEY_LOCATION_RIGHT) {
|
|
165
|
+
var _editorAPI$core$actio4, _editorAPI$core4;
|
|
166
|
+
return (_editorAPI$core$actio4 = editorAPI === null || editorAPI === void 0 || (_editorAPI$core4 = editorAPI.core) === null || _editorAPI$core4 === void 0 ? void 0 : _editorAPI$core4.actions.execute(setSmallTextWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsApi))) !== null && _editorAPI$core$actio4 !== void 0 ? _editorAPI$core$actio4 : false;
|
|
167
|
+
}
|
|
160
168
|
} else if (event.key === 'Alt') {
|
|
161
169
|
// event.location is for the current key only; when a user hits Ctrl-Alt-1 the
|
|
162
170
|
// location refers to the location of the '1' key
|
|
@@ -6,7 +6,7 @@ import * as React from 'react';
|
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
8
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
|
-
import { formatShortcut, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6 } from '@atlaskit/editor-common/keymaps';
|
|
9
|
+
import { formatShortcut, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleSmallText } from '@atlaskit/editor-common/keymaps';
|
|
10
10
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
11
11
|
import { editorUGCToken } from '@atlaskit/editor-common/ugc-tokens';
|
|
12
12
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
@@ -97,11 +97,7 @@ var headingSizeStylesMap = {
|
|
|
97
97
|
};
|
|
98
98
|
var shortcuts = {
|
|
99
99
|
normal: setNormalText,
|
|
100
|
-
smallText:
|
|
101
|
-
description: '',
|
|
102
|
-
mac: '',
|
|
103
|
-
windows: ''
|
|
104
|
-
},
|
|
100
|
+
smallText: toggleSmallText,
|
|
105
101
|
heading1: toggleHeading1,
|
|
106
102
|
heading2: toggleHeading2,
|
|
107
103
|
heading3: toggleHeading3,
|
|
@@ -65,7 +65,9 @@ export var BlockTypeButton = function BlockTypeButton(props) {
|
|
|
65
65
|
color: "currentColor",
|
|
66
66
|
size: "small"
|
|
67
67
|
}))))
|
|
68
|
-
}, !shouldUseIconAsButton && jsx(Box
|
|
68
|
+
}, !shouldUseIconAsButton && jsx(Box
|
|
69
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
70
|
+
, {
|
|
69
71
|
xcss: [buttonContentStyle, props.isReducedSpacing && buttonContentReducedSpacingStyle]
|
|
70
72
|
}, jsx(FormattedMessage
|
|
71
73
|
// Ignored via go/ees005
|
|
@@ -249,12 +249,15 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
249
249
|
scrollableElement: popupsScrollableElement,
|
|
250
250
|
zIndex: akEditorMenuZIndex,
|
|
251
251
|
fitHeight: 360,
|
|
252
|
-
fitWidth: 106
|
|
252
|
+
fitWidth: 106
|
|
253
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
254
|
+
,
|
|
253
255
|
section: {
|
|
254
256
|
hasSeparator: true
|
|
255
257
|
},
|
|
256
258
|
shouldUseDefaultRole: shouldUseDefaultRole
|
|
257
259
|
// hasSeparator={true}
|
|
260
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
258
261
|
,
|
|
259
262
|
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
260
263
|
if (isOpenedByKeyboard) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-type",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.9",
|
|
4
4
|
"description": "BlockType plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@atlaskit/css": "^0.19.0",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^8.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-block-menu": "^7.0.0",
|
|
36
|
-
"@atlaskit/editor-plugin-list": "^10.
|
|
36
|
+
"@atlaskit/editor-plugin-list": "^10.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-primary-toolbar": "^9.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-selection": "^8.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-selection-toolbar": "^9.0.0",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
51
51
|
"@atlaskit/prosemirror-input-rules": "^3.6.0",
|
|
52
52
|
"@atlaskit/theme": "^22.0.0",
|
|
53
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
53
|
+
"@atlaskit/tmp-editor-statsig": "^44.2.0",
|
|
54
54
|
"@atlaskit/tokens": "^11.1.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|
|
56
56
|
"@compiled/react": "^0.20.0",
|
|
57
57
|
"@emotion/react": "^11.7.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^112.
|
|
60
|
+
"@atlaskit/editor-common": "^112.8.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
63
|
"react-intl-next": "npm:react-intl@^5.18.1"
|