@atlaskit/editor-plugin-text-formatting 3.0.11 → 3.0.12
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 +8 -0
- package/dist/cjs/ui/Toolbar/components/Component.js +6 -6
- package/dist/cjs/ui/Toolbar/components/utils.js +2 -8
- package/dist/es2019/ui/Toolbar/components/Component.js +6 -6
- package/dist/es2019/ui/Toolbar/components/utils.js +1 -7
- package/dist/esm/ui/Toolbar/components/Component.js +6 -6
- package/dist/esm/ui/Toolbar/components/utils.js +1 -7
- package/dist/types/ui/Toolbar/components/utils.d.ts +0 -1
- package/dist/types-ts4.5/ui/Toolbar/components/utils.d.ts +0 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 3.0.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f22ce89845e1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f22ce89845e1e) -
|
|
8
|
+
[ED-28686] Switch to use utility getInputMethodFromParentKeys
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 3.0.11
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -10,6 +10,7 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
10
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
13
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
15
|
var _clearFormatting = require("../../../editor-commands/clear-formatting");
|
|
15
16
|
var _utils = require("./utils");
|
|
@@ -114,10 +115,9 @@ var ClearFormatMenuItem = exports.ClearFormatMenuItem = function ClearFormatMenu
|
|
|
114
115
|
}
|
|
115
116
|
var formatTitle = formatMessage(_messages.toolbarMessages.clearFormatting);
|
|
116
117
|
var shortcutContent = (0, _keymaps.tooltip)(_keymaps.clearFormatting);
|
|
117
|
-
var ariaLabel = (0, _keymaps.tooltip)(_keymaps.clearFormatting, formatTitle);
|
|
118
118
|
var onClick = function onClick() {
|
|
119
119
|
var _api$analytics;
|
|
120
|
-
api === null || api === void 0 || api.core.actions.execute((0, _clearFormatting.clearFormattingWithAnalyticsNext)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)((0,
|
|
120
|
+
api === null || api === void 0 || api.core.actions.execute((0, _clearFormatting.clearFormattingWithAnalyticsNext)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)((0, _toolbar.getInputMethodFromParentKeys)(parents)));
|
|
121
121
|
};
|
|
122
122
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
123
123
|
elemBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ClearFormattingIcon, {
|
|
@@ -128,8 +128,7 @@ var ClearFormatMenuItem = exports.ClearFormatMenuItem = function ClearFormatMenu
|
|
|
128
128
|
}),
|
|
129
129
|
isDisabled: !isFormattingPresent,
|
|
130
130
|
onClick: onClick,
|
|
131
|
-
|
|
132
|
-
"aria-label": ariaLabel
|
|
131
|
+
ariaKeyshortcuts: (0, _keymaps.getAriaKeyshortcuts)(_keymaps.clearFormatting)
|
|
133
132
|
}, formatTitle);
|
|
134
133
|
};
|
|
135
134
|
var MoreFormattingMenu = exports.MoreFormattingMenu = function MoreFormattingMenu(_ref4) {
|
|
@@ -140,9 +139,10 @@ var MoreFormattingMenu = exports.MoreFormattingMenu = function MoreFormattingMen
|
|
|
140
139
|
var content = formatMessage(_messages.toolbarMessages.moreFormatting);
|
|
141
140
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
|
|
142
141
|
iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.MoreItemsIcon, {
|
|
143
|
-
label:
|
|
142
|
+
label: "",
|
|
144
143
|
testId: "more-formatting"
|
|
145
144
|
}),
|
|
146
|
-
groupLocation: groupLocation
|
|
145
|
+
groupLocation: groupLocation,
|
|
146
|
+
label: content
|
|
147
147
|
}, children);
|
|
148
148
|
};
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useComponentInfo = exports.
|
|
7
|
+
exports.useComponentInfo = exports.formatOptions = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
@@ -13,14 +13,8 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
13
13
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
15
|
var _toggleMark = require("../../../editor-commands/toggle-mark");
|
|
16
|
-
var _inputMethodUtils = require("../input-method-utils");
|
|
17
|
-
var _types = require("../types");
|
|
18
16
|
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; }
|
|
19
17
|
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; }
|
|
20
|
-
var getInputMethodFromParentKeys = exports.getInputMethodFromParentKeys = function getInputMethodFromParentKeys(parentKeys) {
|
|
21
|
-
var _parentKeys$at;
|
|
22
|
-
return (0, _inputMethodUtils.getInputMethod)(((_parentKeys$at = parentKeys.at(-1)) === null || _parentKeys$at === void 0 ? void 0 : _parentKeys$at.key) === _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR ? _types.ToolbarType.FLOATING : _types.ToolbarType.PRIMARY);
|
|
23
|
-
};
|
|
24
18
|
var FormatMarkSchema = {
|
|
25
19
|
strong: 'strong',
|
|
26
20
|
em: 'em',
|
|
@@ -73,7 +67,7 @@ var useComponentInfo = exports.useComponentInfo = function useComponentInfo(_ref
|
|
|
73
67
|
var ariaLabel = (0, _keymaps.tooltip)(shortcut, formatTitle);
|
|
74
68
|
var onClick = function onClick() {
|
|
75
69
|
var _api$analytics;
|
|
76
|
-
api === null || api === void 0 || api.core.actions.execute(toggleMarkWithAnalyticsCallback(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(getInputMethodFromParentKeys(parents)));
|
|
70
|
+
api === null || api === void 0 || api.core.actions.execute(toggleMarkWithAnalyticsCallback(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)((0, _toolbar.getInputMethodFromParentKeys)(parents)));
|
|
77
71
|
};
|
|
78
72
|
return _objectSpread(_objectSpread({}, formatOptionState), {}, {
|
|
79
73
|
formatTitle: formatTitle,
|
|
@@ -3,9 +3,10 @@ import { useIntl } from 'react-intl-next';
|
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { clearFormatting, getAriaKeyshortcuts, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
6
7
|
import { ToolbarButton, ToolbarDropdownItem, ClearFormattingIcon, ToolbarKeyboardShortcutHint, ToolbarDropdownMenu, MoreItemsIcon, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
7
8
|
import { clearFormattingWithAnalyticsNext } from '../../../editor-commands/clear-formatting';
|
|
8
|
-
import {
|
|
9
|
+
import { useComponentInfo } from './utils';
|
|
9
10
|
export const FormatMenuItem = ({
|
|
10
11
|
parents,
|
|
11
12
|
api,
|
|
@@ -113,7 +114,6 @@ export const ClearFormatMenuItem = ({
|
|
|
113
114
|
}
|
|
114
115
|
const formatTitle = formatMessage(toolbarMessages.clearFormatting);
|
|
115
116
|
const shortcutContent = tooltip(clearFormatting);
|
|
116
|
-
const ariaLabel = tooltip(clearFormatting, formatTitle);
|
|
117
117
|
const onClick = () => {
|
|
118
118
|
var _api$analytics;
|
|
119
119
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(clearFormattingWithAnalyticsNext(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(getInputMethodFromParentKeys(parents)));
|
|
@@ -127,8 +127,7 @@ export const ClearFormatMenuItem = ({
|
|
|
127
127
|
}),
|
|
128
128
|
isDisabled: !isFormattingPresent,
|
|
129
129
|
onClick: onClick,
|
|
130
|
-
|
|
131
|
-
"aria-label": ariaLabel
|
|
130
|
+
ariaKeyshortcuts: getAriaKeyshortcuts(clearFormatting)
|
|
132
131
|
}, formatTitle);
|
|
133
132
|
};
|
|
134
133
|
export const MoreFormattingMenu = ({
|
|
@@ -141,9 +140,10 @@ export const MoreFormattingMenu = ({
|
|
|
141
140
|
const content = formatMessage(toolbarMessages.moreFormatting);
|
|
142
141
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
143
142
|
iconBefore: /*#__PURE__*/React.createElement(MoreItemsIcon, {
|
|
144
|
-
label:
|
|
143
|
+
label: "",
|
|
145
144
|
testId: "more-formatting"
|
|
146
145
|
}),
|
|
147
|
-
groupLocation: groupLocation
|
|
146
|
+
groupLocation: groupLocation,
|
|
147
|
+
label: content
|
|
148
148
|
}, children);
|
|
149
149
|
};
|
|
@@ -2,15 +2,9 @@ import { useIntl } from 'react-intl-next';
|
|
|
2
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { BOLD_MENU_ITEM, CODE_MENU_ITEM, ITALIC_MENU_ITEM, STRIKE_MENU_ITEM, SUBSCRIPT_MENU_ITEM, SUPERSCRIPT_MENU_ITEM, TEXT_FORMATTING_MENU_SECTION_RANK,
|
|
5
|
+
import { BOLD_MENU_ITEM, CODE_MENU_ITEM, ITALIC_MENU_ITEM, STRIKE_MENU_ITEM, SUBSCRIPT_MENU_ITEM, SUPERSCRIPT_MENU_ITEM, TEXT_FORMATTING_MENU_SECTION_RANK, UNDERLINE_MENU_ITEM, getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
6
6
|
import { BoldIcon, ItalicIcon, UnderlineIcon, CodeIcon, StrikeThroughIcon, SubscriptIcon, SuperscriptIcon } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleUnderlineWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics } from '../../../editor-commands/toggle-mark';
|
|
8
|
-
import { getInputMethod } from '../input-method-utils';
|
|
9
|
-
import { ToolbarType } from '../types';
|
|
10
|
-
export const getInputMethodFromParentKeys = parentKeys => {
|
|
11
|
-
var _parentKeys$at;
|
|
12
|
-
return getInputMethod(((_parentKeys$at = parentKeys.at(-1)) === null || _parentKeys$at === void 0 ? void 0 : _parentKeys$at.key) === TOOLBARS.INLINE_TEXT_TOOLBAR ? ToolbarType.FLOATING : ToolbarType.PRIMARY);
|
|
13
|
-
};
|
|
14
8
|
const FormatMarkSchema = {
|
|
15
9
|
strong: 'strong',
|
|
16
10
|
em: 'em',
|
|
@@ -3,9 +3,10 @@ import { useIntl } from 'react-intl-next';
|
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { clearFormatting, getAriaKeyshortcuts, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
6
7
|
import { ToolbarButton, ToolbarDropdownItem, ClearFormattingIcon, ToolbarKeyboardShortcutHint, ToolbarDropdownMenu, MoreItemsIcon, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
7
8
|
import { clearFormattingWithAnalyticsNext } from '../../../editor-commands/clear-formatting';
|
|
8
|
-
import {
|
|
9
|
+
import { useComponentInfo } from './utils';
|
|
9
10
|
export var FormatMenuItem = function FormatMenuItem(_ref) {
|
|
10
11
|
var parents = _ref.parents,
|
|
11
12
|
api = _ref.api,
|
|
@@ -107,7 +108,6 @@ export var ClearFormatMenuItem = function ClearFormatMenuItem(_ref3) {
|
|
|
107
108
|
}
|
|
108
109
|
var formatTitle = formatMessage(toolbarMessages.clearFormatting);
|
|
109
110
|
var shortcutContent = tooltip(clearFormatting);
|
|
110
|
-
var ariaLabel = tooltip(clearFormatting, formatTitle);
|
|
111
111
|
var onClick = function onClick() {
|
|
112
112
|
var _api$analytics;
|
|
113
113
|
api === null || api === void 0 || api.core.actions.execute(clearFormattingWithAnalyticsNext(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(getInputMethodFromParentKeys(parents)));
|
|
@@ -121,8 +121,7 @@ export var ClearFormatMenuItem = function ClearFormatMenuItem(_ref3) {
|
|
|
121
121
|
}),
|
|
122
122
|
isDisabled: !isFormattingPresent,
|
|
123
123
|
onClick: onClick,
|
|
124
|
-
|
|
125
|
-
"aria-label": ariaLabel
|
|
124
|
+
ariaKeyshortcuts: getAriaKeyshortcuts(clearFormatting)
|
|
126
125
|
}, formatTitle);
|
|
127
126
|
};
|
|
128
127
|
export var MoreFormattingMenu = function MoreFormattingMenu(_ref4) {
|
|
@@ -133,9 +132,10 @@ export var MoreFormattingMenu = function MoreFormattingMenu(_ref4) {
|
|
|
133
132
|
var content = formatMessage(toolbarMessages.moreFormatting);
|
|
134
133
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
|
|
135
134
|
iconBefore: /*#__PURE__*/React.createElement(MoreItemsIcon, {
|
|
136
|
-
label:
|
|
135
|
+
label: "",
|
|
137
136
|
testId: "more-formatting"
|
|
138
137
|
}),
|
|
139
|
-
groupLocation: groupLocation
|
|
138
|
+
groupLocation: groupLocation,
|
|
139
|
+
label: content
|
|
140
140
|
}, children);
|
|
141
141
|
};
|
|
@@ -5,15 +5,9 @@ import { useIntl } from 'react-intl-next';
|
|
|
5
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
7
7
|
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
8
|
-
import { BOLD_MENU_ITEM, CODE_MENU_ITEM, ITALIC_MENU_ITEM, STRIKE_MENU_ITEM, SUBSCRIPT_MENU_ITEM, SUPERSCRIPT_MENU_ITEM, TEXT_FORMATTING_MENU_SECTION_RANK,
|
|
8
|
+
import { BOLD_MENU_ITEM, CODE_MENU_ITEM, ITALIC_MENU_ITEM, STRIKE_MENU_ITEM, SUBSCRIPT_MENU_ITEM, SUPERSCRIPT_MENU_ITEM, TEXT_FORMATTING_MENU_SECTION_RANK, UNDERLINE_MENU_ITEM, getInputMethodFromParentKeys } from '@atlaskit/editor-common/toolbar';
|
|
9
9
|
import { BoldIcon, ItalicIcon, UnderlineIcon, CodeIcon, StrikeThroughIcon, SubscriptIcon, SuperscriptIcon } from '@atlaskit/editor-toolbar';
|
|
10
10
|
import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleUnderlineWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics } from '../../../editor-commands/toggle-mark';
|
|
11
|
-
import { getInputMethod } from '../input-method-utils';
|
|
12
|
-
import { ToolbarType } from '../types';
|
|
13
|
-
export var getInputMethodFromParentKeys = function getInputMethodFromParentKeys(parentKeys) {
|
|
14
|
-
var _parentKeys$at;
|
|
15
|
-
return getInputMethod(((_parentKeys$at = parentKeys.at(-1)) === null || _parentKeys$at === void 0 ? void 0 : _parentKeys$at.key) === TOOLBARS.INLINE_TEXT_TOOLBAR ? ToolbarType.FLOATING : ToolbarType.PRIMARY);
|
|
16
|
-
};
|
|
17
11
|
var FormatMarkSchema = {
|
|
18
12
|
strong: 'strong',
|
|
19
13
|
em: 'em',
|
|
@@ -17,7 +17,6 @@ export type FormatComponentProps = {
|
|
|
17
17
|
ariaLabel?: string;
|
|
18
18
|
groupLocation?: ToolbarButtonGroupLocation;
|
|
19
19
|
};
|
|
20
|
-
export declare const getInputMethodFromParentKeys: (parentKeys: ToolbarComponentTypes) => import("@atlaskit/editor-common/types").InputMethodToolbar;
|
|
21
20
|
export declare const useComponentInfo: ({ api, optionType, title, shortcut, toggleMarkWithAnalyticsCallback, parents, }: Omit<FormatComponentProps, "icon" | "ariaLabel" | "groupLocation">) => {
|
|
22
21
|
formatTitle: string;
|
|
23
22
|
shortcutContent: string | undefined;
|
|
@@ -17,7 +17,6 @@ export type FormatComponentProps = {
|
|
|
17
17
|
ariaLabel?: string;
|
|
18
18
|
groupLocation?: ToolbarButtonGroupLocation;
|
|
19
19
|
};
|
|
20
|
-
export declare const getInputMethodFromParentKeys: (parentKeys: ToolbarComponentTypes) => import("@atlaskit/editor-common/types").InputMethodToolbar;
|
|
21
20
|
export declare const useComponentInfo: ({ api, optionType, title, shortcut, toggleMarkWithAnalyticsCallback, parents, }: Omit<FormatComponentProps, "icon" | "ariaLabel" | "groupLocation">) => {
|
|
22
21
|
formatTitle: string;
|
|
23
22
|
shortcutContent: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.12",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@atlaskit/editor-common": "^107.
|
|
56
|
+
"@atlaskit/editor-common": "^107.21.0",
|
|
57
57
|
"react": "^18.2.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|