@atlaskit/editor-plugin-text-formatting 2.0.1 → 2.0.2
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/textFormattingPlugin.js +20 -30
- package/dist/cjs/ui/Toolbar/constants.js +11 -9
- package/dist/cjs/ui/Toolbar/hooks/formatting-icons.js +10 -1
- package/dist/cjs/ui/Toolbar/hooks/responsive-toolbar-buttons.js +11 -5
- package/dist/es2019/textFormattingPlugin.js +20 -30
- package/dist/es2019/ui/Toolbar/constants.js +24 -22
- package/dist/es2019/ui/Toolbar/hooks/formatting-icons.js +8 -1
- package/dist/es2019/ui/Toolbar/hooks/responsive-toolbar-buttons.js +12 -6
- package/dist/esm/textFormattingPlugin.js +20 -30
- package/dist/esm/ui/Toolbar/constants.js +10 -8
- package/dist/esm/ui/Toolbar/hooks/formatting-icons.js +10 -1
- package/dist/esm/ui/Toolbar/hooks/responsive-toolbar-buttons.js +12 -6
- package/dist/types/ui/Toolbar/constants.d.ts +7 -5
- package/dist/types-ts4.5/ui/Toolbar/constants.d.ts +7 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 2.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#120931](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120931)
|
|
8
|
+
[`624b97c021fea`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/624b97c021fea) -
|
|
9
|
+
[ux] ED-26676 revert to existing primary toolbar components
|
|
10
|
+
|
|
3
11
|
## 2.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -27,7 +27,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
27
27
|
* from `@atlaskit/editor-core`.
|
|
28
28
|
*/
|
|
29
29
|
var textFormattingPlugin = exports.textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
30
|
-
var _api$primaryToolbar, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13
|
|
30
|
+
var _api$primaryToolbar, _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13;
|
|
31
31
|
var options = _ref.config,
|
|
32
32
|
api = _ref.api;
|
|
33
33
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
|
|
@@ -37,16 +37,6 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
37
37
|
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
38
38
|
toolbarSize = _ref2.toolbarSize,
|
|
39
39
|
disabled = _ref2.disabled;
|
|
40
|
-
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
41
|
-
exposure: true
|
|
42
|
-
})) {
|
|
43
|
-
var _api$analytics;
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(_FloatingToolbarComponent.FloatingToolbarTextFormalWithIntl, {
|
|
45
|
-
api: api,
|
|
46
|
-
editorView: editorView,
|
|
47
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
40
|
return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
|
|
51
41
|
api: api,
|
|
52
42
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -89,9 +79,9 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
89
79
|
return [{
|
|
90
80
|
name: 'textFormatting',
|
|
91
81
|
plugin: function plugin(_ref3) {
|
|
92
|
-
var _api$
|
|
82
|
+
var _api$analytics;
|
|
93
83
|
var dispatch = _ref3.dispatch;
|
|
94
|
-
return (0, _main.plugin)(dispatch, api === null || api === void 0 || (_api$
|
|
84
|
+
return (0, _main.plugin)(dispatch, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
95
85
|
}
|
|
96
86
|
}, {
|
|
97
87
|
name: 'textFormattingCursor',
|
|
@@ -101,15 +91,15 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
101
91
|
}, {
|
|
102
92
|
name: 'textFormattingInputRule',
|
|
103
93
|
plugin: function plugin(_ref4) {
|
|
104
|
-
var _api$
|
|
94
|
+
var _api$analytics2;
|
|
105
95
|
var schema = _ref4.schema;
|
|
106
|
-
return (0, _inputRule.default)(schema, api === null || api === void 0 || (_api$
|
|
96
|
+
return (0, _inputRule.default)(schema, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, api);
|
|
107
97
|
}
|
|
108
98
|
}, {
|
|
109
99
|
name: 'textFormattingSmartRule',
|
|
110
100
|
plugin: function plugin() {
|
|
111
|
-
var _api$
|
|
112
|
-
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? (0, _smartInputRule.default)(api === null || api === void 0 || (_api$
|
|
101
|
+
var _api$analytics3;
|
|
102
|
+
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? (0, _smartInputRule.default)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions) : undefined;
|
|
113
103
|
}
|
|
114
104
|
}, {
|
|
115
105
|
name: 'textFormattingClear',
|
|
@@ -120,15 +110,15 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
120
110
|
}, {
|
|
121
111
|
name: 'textFormattingClearKeymap',
|
|
122
112
|
plugin: function plugin() {
|
|
123
|
-
var _api$
|
|
124
|
-
return (0, _clearFormattingKeymap.default)(api === null || api === void 0 || (_api$
|
|
113
|
+
var _api$analytics4;
|
|
114
|
+
return (0, _clearFormattingKeymap.default)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
125
115
|
}
|
|
126
116
|
}, {
|
|
127
117
|
name: 'textFormattingKeymap',
|
|
128
118
|
plugin: function plugin(_ref6) {
|
|
129
|
-
var _api$
|
|
119
|
+
var _api$analytics5;
|
|
130
120
|
var schema = _ref6.schema;
|
|
131
|
-
return (0, _keymap.default)(schema, api === null || api === void 0 || (_api$
|
|
121
|
+
return (0, _keymap.default)(schema, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
132
122
|
}
|
|
133
123
|
}];
|
|
134
124
|
},
|
|
@@ -159,14 +149,14 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
159
149
|
var toolbarCustom = {
|
|
160
150
|
type: 'custom',
|
|
161
151
|
render: function render(view) {
|
|
162
|
-
var _api$
|
|
152
|
+
var _api$analytics6;
|
|
163
153
|
if (!view) {
|
|
164
154
|
return;
|
|
165
155
|
}
|
|
166
156
|
return /*#__PURE__*/_react.default.createElement(_FloatingToolbarComponent.FloatingToolbarTextFormalWithIntl, {
|
|
167
157
|
api: api,
|
|
168
158
|
editorView: view,
|
|
169
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$
|
|
159
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions
|
|
170
160
|
});
|
|
171
161
|
},
|
|
172
162
|
fallback: []
|
|
@@ -183,13 +173,13 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
183
173
|
},
|
|
184
174
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
185
175
|
commands: {
|
|
186
|
-
toggleSuperscript: (0, _commands.toggleSuperscriptWithAnalytics)(api === null || api === void 0 || (_api$
|
|
187
|
-
toggleSubscript: (0, _commands.toggleSubscriptWithAnalytics)(api === null || api === void 0 || (_api$
|
|
188
|
-
toggleStrike: (0, _commands.toggleStrikeWithAnalytics)(api === null || api === void 0 || (_api$
|
|
189
|
-
toggleCode: (0, _commands.toggleCodeWithAnalytics)(api === null || api === void 0 || (_api$
|
|
190
|
-
toggleUnderline: (0, _commands.toggleUnderlineWithAnalytics)(api === null || api === void 0 || (_api$
|
|
191
|
-
toggleEm: (0, _commands.toggleEmWithAnalytics)(api === null || api === void 0 || (_api$
|
|
192
|
-
toggleStrong: (0, _commands.toggleStrongWithAnalytics)(api === null || api === void 0 || (_api$
|
|
176
|
+
toggleSuperscript: (0, _commands.toggleSuperscriptWithAnalytics)(api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
177
|
+
toggleSubscript: (0, _commands.toggleSubscriptWithAnalytics)(api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions),
|
|
178
|
+
toggleStrike: (0, _commands.toggleStrikeWithAnalytics)(api === null || api === void 0 || (_api$analytics9 = api.analytics) === null || _api$analytics9 === void 0 ? void 0 : _api$analytics9.actions),
|
|
179
|
+
toggleCode: (0, _commands.toggleCodeWithAnalytics)(api === null || api === void 0 || (_api$analytics10 = api.analytics) === null || _api$analytics10 === void 0 ? void 0 : _api$analytics10.actions),
|
|
180
|
+
toggleUnderline: (0, _commands.toggleUnderlineWithAnalytics)(api === null || api === void 0 || (_api$analytics11 = api.analytics) === null || _api$analytics11 === void 0 ? void 0 : _api$analytics11.actions),
|
|
181
|
+
toggleEm: (0, _commands.toggleEmWithAnalytics)(api === null || api === void 0 || (_api$analytics12 = api.analytics) === null || _api$analytics12 === void 0 ? void 0 : _api$analytics12.actions),
|
|
182
|
+
toggleStrong: (0, _commands.toggleStrongWithAnalytics)(api === null || api === void 0 || (_api$analytics13 = api.analytics) === null || _api$analytics13 === void 0 ? void 0 : _api$analytics13.actions)
|
|
193
183
|
}
|
|
194
184
|
};
|
|
195
185
|
};
|
|
@@ -4,25 +4,27 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.ResponsiveCustomMenuNext = exports.ResponsiveCustomMenu = exports.ResponsiveCustomButtonToolbarNext = exports.ResponsiveCustomButtonToolbar = exports.DefaultButtonsToolbar = exports.DefaultButtonsMenu = void 0;
|
|
7
|
+
exports.ResponsiveCustomMenuNext = exports.ResponsiveCustomMenu = exports.ResponsiveCustomButtonToolbarNext = exports.ResponsiveCustomButtonToolbar = exports.DefaultButtonsToolbarNext = exports.DefaultButtonsToolbar = exports.DefaultButtonsMenuNext = exports.DefaultButtonsMenu = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _types = require("@atlaskit/editor-common/types");
|
|
10
10
|
var _types2 = require("./types");
|
|
11
11
|
var DefaultButtonsToolbar = exports.DefaultButtonsToolbar = [_types2.IconTypes.strong, _types2.IconTypes.em];
|
|
12
|
+
var DefaultButtonsToolbarNext = exports.DefaultButtonsToolbarNext = [_types2.IconTypes.strong, _types2.IconTypes.em, _types2.IconTypes.underline];
|
|
12
13
|
var DefaultButtonsMenu = exports.DefaultButtonsMenu = [_types2.IconTypes.underline, _types2.IconTypes.strike, _types2.IconTypes.code, _types2.IconTypes.subscript, _types2.IconTypes.superscript];
|
|
14
|
+
var DefaultButtonsMenuNext = exports.DefaultButtonsMenuNext = [_types2.IconTypes.strike, _types2.IconTypes.code, _types2.IconTypes.subscript, _types2.IconTypes.superscript];
|
|
13
15
|
|
|
14
16
|
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
15
17
|
/** @deprecated
|
|
16
|
-
*
|
|
17
|
-
* to
|
|
18
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomButtonToolbarNext
|
|
19
|
+
* along with references to platform_editor_controls gate
|
|
18
20
|
*/
|
|
19
|
-
var ResponsiveCustomButtonToolbar = exports.ResponsiveCustomButtonToolbar = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, DefaultButtonsToolbar), _types.ToolbarSize.XL, DefaultButtonsToolbar), _types.ToolbarSize.L, DefaultButtonsToolbar), _types.ToolbarSize.M,
|
|
21
|
+
var ResponsiveCustomButtonToolbar = exports.ResponsiveCustomButtonToolbar = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, DefaultButtonsToolbar), _types.ToolbarSize.XL, DefaultButtonsToolbar), _types.ToolbarSize.L, DefaultButtonsToolbar), _types.ToolbarSize.M, DefaultButtonsToolbar), _types.ToolbarSize.S, DefaultButtonsToolbar), _types.ToolbarSize.XXXS, []);
|
|
22
|
+
var ResponsiveCustomButtonToolbarNext = exports.ResponsiveCustomButtonToolbarNext = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, DefaultButtonsToolbarNext), _types.ToolbarSize.XL, DefaultButtonsToolbarNext), _types.ToolbarSize.L, DefaultButtonsToolbarNext), _types.ToolbarSize.M, DefaultButtonsToolbarNext), _types.ToolbarSize.S, DefaultButtonsToolbarNext), _types.ToolbarSize.XXXS, []);
|
|
20
23
|
|
|
21
24
|
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
22
25
|
/** @deprecated
|
|
23
|
-
*
|
|
24
|
-
* to
|
|
26
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
27
|
+
* along with references to platform_editor_controls gate
|
|
25
28
|
*/
|
|
26
|
-
var ResponsiveCustomMenu = exports.ResponsiveCustomMenu = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, DefaultButtonsMenu), _types.ToolbarSize.XL, DefaultButtonsMenu), _types.ToolbarSize.L, DefaultButtonsMenu), _types.ToolbarSize.M,
|
|
27
|
-
var
|
|
28
|
-
var ResponsiveCustomMenuNext = exports.ResponsiveCustomMenuNext = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, DefaultButtonsMenu), _types.ToolbarSize.XL, DefaultButtonsMenu), _types.ToolbarSize.L, DefaultButtonsMenu), _types.ToolbarSize.M, DefaultButtonsMenu), _types.ToolbarSize.S, DefaultButtonsMenu), _types.ToolbarSize.XXXS, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(DefaultButtonsMenu));
|
|
29
|
+
var ResponsiveCustomMenu = exports.ResponsiveCustomMenu = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, DefaultButtonsMenu), _types.ToolbarSize.XL, DefaultButtonsMenu), _types.ToolbarSize.L, DefaultButtonsMenu), _types.ToolbarSize.M, DefaultButtonsMenu), _types.ToolbarSize.S, DefaultButtonsMenu), _types.ToolbarSize.XXXS, [_types2.IconTypes.strong, _types2.IconTypes.em].concat(DefaultButtonsMenu));
|
|
30
|
+
var ResponsiveCustomMenuNext = exports.ResponsiveCustomMenuNext = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.ToolbarSize.XXL, DefaultButtonsMenuNext), _types.ToolbarSize.XL, DefaultButtonsMenuNext), _types.ToolbarSize.L, DefaultButtonsMenuNext), _types.ToolbarSize.M, DefaultButtonsMenuNext), _types.ToolbarSize.S, DefaultButtonsMenuNext), _types.ToolbarSize.XXXS, [_types2.IconTypes.strong, _types2.IconTypes.em, _types2.IconTypes.underline].concat(DefaultButtonsMenuNext));
|
|
@@ -16,6 +16,7 @@ var _preset = require("@atlaskit/editor-common/preset");
|
|
|
16
16
|
var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
|
|
17
17
|
var _textBoldEditorBold = _interopRequireDefault(require("@atlaskit/icon/core/migration/text-bold--editor-bold"));
|
|
18
18
|
var _textItalicEditorItalic = _interopRequireDefault(require("@atlaskit/icon/core/migration/text-italic--editor-italic"));
|
|
19
|
+
var _textUnderline = _interopRequireDefault(require("@atlaskit/icon/core/text-underline"));
|
|
19
20
|
var _commands = require("../../../pm-plugins/commands");
|
|
20
21
|
var _inputMethodUtils = require("../input-method-utils");
|
|
21
22
|
var _types = require("../types");
|
|
@@ -60,9 +61,17 @@ var IconButtons = function IconButtons(editorAnalyticsAPI, toolbarType) {
|
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
underline: {
|
|
64
|
+
buttonId: _analytics.TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_UNDERLINE,
|
|
63
65
|
command: withInputMethod(toolbarType, (0, _commands.toggleUnderlineWithAnalytics)(editorAnalyticsAPI)),
|
|
64
66
|
message: _messages.toolbarMessages.underline,
|
|
65
|
-
tooltipKeymap: _keymaps.toggleUnderline
|
|
67
|
+
tooltipKeymap: _keymaps.toggleUnderline,
|
|
68
|
+
component: function component() {
|
|
69
|
+
return (0, _react2.jsx)(_textUnderline.default, {
|
|
70
|
+
color: "currentColor",
|
|
71
|
+
spacing: "spacious",
|
|
72
|
+
label: ""
|
|
73
|
+
});
|
|
74
|
+
}
|
|
66
75
|
},
|
|
67
76
|
strike: {
|
|
68
77
|
command: withInputMethod(toolbarType, (0, _commands.toggleStrikeWithAnalytics)(editorAnalyticsAPI)),
|
|
@@ -7,25 +7,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useResponsiveToolbarButtons = exports.useResponsiveIconTypeMenu = exports.useResponsiveIconTypeButtons = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var
|
|
10
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
11
|
var _constants = require("../constants");
|
|
12
12
|
var useResponsiveIconTypeButtons = exports.useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(_ref) {
|
|
13
13
|
var toolbarSize = _ref.toolbarSize,
|
|
14
14
|
responsivenessEnabled = _ref.responsivenessEnabled;
|
|
15
|
-
var ResponsiveCustomButtonToolbar = (0,
|
|
15
|
+
var ResponsiveCustomButtonToolbar = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _constants.ResponsiveCustomButtonToolbarNext : _constants.ResponsiveCustomButtonToolbar;
|
|
16
16
|
var iconTypeList = (0, _react.useMemo)(function () {
|
|
17
17
|
return ResponsiveCustomButtonToolbar[toolbarSize];
|
|
18
18
|
}, [toolbarSize, ResponsiveCustomButtonToolbar]);
|
|
19
|
-
|
|
19
|
+
if (responsivenessEnabled) {
|
|
20
|
+
return iconTypeList;
|
|
21
|
+
}
|
|
22
|
+
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _constants.DefaultButtonsToolbarNext : _constants.DefaultButtonsToolbar;
|
|
20
23
|
};
|
|
21
24
|
var useResponsiveIconTypeMenu = exports.useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2) {
|
|
22
25
|
var toolbarSize = _ref2.toolbarSize,
|
|
23
26
|
responsivenessEnabled = _ref2.responsivenessEnabled;
|
|
24
|
-
var ResponsiveCustomMenu = (0,
|
|
27
|
+
var ResponsiveCustomMenu = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _constants.ResponsiveCustomMenuNext : _constants.ResponsiveCustomMenu;
|
|
25
28
|
var iconTypeList = (0, _react.useMemo)(function () {
|
|
26
29
|
return ResponsiveCustomMenu[toolbarSize];
|
|
27
30
|
}, [toolbarSize, ResponsiveCustomMenu]);
|
|
28
|
-
|
|
31
|
+
if (responsivenessEnabled) {
|
|
32
|
+
return iconTypeList;
|
|
33
|
+
}
|
|
34
|
+
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _constants.DefaultButtonsMenuNext : _constants.DefaultButtonsMenu;
|
|
29
35
|
};
|
|
30
36
|
var useResponsiveToolbarButtons = exports.useResponsiveToolbarButtons = function useResponsiveToolbarButtons(_ref3) {
|
|
31
37
|
var icons = _ref3.icons,
|
|
@@ -21,7 +21,7 @@ export const textFormattingPlugin = ({
|
|
|
21
21
|
config: options,
|
|
22
22
|
api
|
|
23
23
|
}) => {
|
|
24
|
-
var _api$primaryToolbar, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13
|
|
24
|
+
var _api$primaryToolbar, _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13;
|
|
25
25
|
const primaryToolbarComponent = ({
|
|
26
26
|
editorView,
|
|
27
27
|
popupsMountPoint,
|
|
@@ -30,16 +30,6 @@ export const textFormattingPlugin = ({
|
|
|
30
30
|
toolbarSize,
|
|
31
31
|
disabled
|
|
32
32
|
}) => {
|
|
33
|
-
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
34
|
-
exposure: true
|
|
35
|
-
})) {
|
|
36
|
-
var _api$analytics;
|
|
37
|
-
return /*#__PURE__*/React.createElement(FloatingToolbarComponent, {
|
|
38
|
-
api: api,
|
|
39
|
-
editorView: editorView,
|
|
40
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
33
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
44
34
|
api: api,
|
|
45
35
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -84,8 +74,8 @@ export const textFormattingPlugin = ({
|
|
|
84
74
|
plugin: ({
|
|
85
75
|
dispatch
|
|
86
76
|
}) => {
|
|
87
|
-
var _api$
|
|
88
|
-
return pmPlugin(dispatch, api === null || api === void 0 ? void 0 : (_api$
|
|
77
|
+
var _api$analytics;
|
|
78
|
+
return pmPlugin(dispatch, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
89
79
|
}
|
|
90
80
|
}, {
|
|
91
81
|
name: 'textFormattingCursor',
|
|
@@ -95,14 +85,14 @@ export const textFormattingPlugin = ({
|
|
|
95
85
|
plugin: ({
|
|
96
86
|
schema
|
|
97
87
|
}) => {
|
|
98
|
-
var _api$
|
|
99
|
-
return textFormattingInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
88
|
+
var _api$analytics2;
|
|
89
|
+
return textFormattingInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, api);
|
|
100
90
|
}
|
|
101
91
|
}, {
|
|
102
92
|
name: 'textFormattingSmartRule',
|
|
103
93
|
plugin: () => {
|
|
104
|
-
var _api$
|
|
105
|
-
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? textFormattingSmartInputRulePlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
94
|
+
var _api$analytics3;
|
|
95
|
+
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? textFormattingSmartInputRulePlugin(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions) : undefined;
|
|
106
96
|
}
|
|
107
97
|
}, {
|
|
108
98
|
name: 'textFormattingClear',
|
|
@@ -112,16 +102,16 @@ export const textFormattingPlugin = ({
|
|
|
112
102
|
}, {
|
|
113
103
|
name: 'textFormattingClearKeymap',
|
|
114
104
|
plugin: () => {
|
|
115
|
-
var _api$
|
|
116
|
-
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
105
|
+
var _api$analytics4;
|
|
106
|
+
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
117
107
|
}
|
|
118
108
|
}, {
|
|
119
109
|
name: 'textFormattingKeymap',
|
|
120
110
|
plugin: ({
|
|
121
111
|
schema
|
|
122
112
|
}) => {
|
|
123
|
-
var _api$
|
|
124
|
-
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
113
|
+
var _api$analytics5;
|
|
114
|
+
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
125
115
|
}
|
|
126
116
|
}];
|
|
127
117
|
},
|
|
@@ -153,14 +143,14 @@ export const textFormattingPlugin = ({
|
|
|
153
143
|
const toolbarCustom = {
|
|
154
144
|
type: 'custom',
|
|
155
145
|
render: view => {
|
|
156
|
-
var _api$
|
|
146
|
+
var _api$analytics6;
|
|
157
147
|
if (!view) {
|
|
158
148
|
return;
|
|
159
149
|
}
|
|
160
150
|
return /*#__PURE__*/React.createElement(FloatingToolbarComponent, {
|
|
161
151
|
api: api,
|
|
162
152
|
editorView: view,
|
|
163
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$
|
|
153
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions
|
|
164
154
|
});
|
|
165
155
|
},
|
|
166
156
|
fallback: []
|
|
@@ -177,13 +167,13 @@ export const textFormattingPlugin = ({
|
|
|
177
167
|
},
|
|
178
168
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
179
169
|
commands: {
|
|
180
|
-
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
181
|
-
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
182
|
-
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
183
|
-
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
184
|
-
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
185
|
-
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
186
|
-
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
170
|
+
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
171
|
+
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions),
|
|
172
|
+
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics9 = api.analytics) === null || _api$analytics9 === void 0 ? void 0 : _api$analytics9.actions),
|
|
173
|
+
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics10 = api.analytics) === null || _api$analytics10 === void 0 ? void 0 : _api$analytics10.actions),
|
|
174
|
+
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics11 = api.analytics) === null || _api$analytics11 === void 0 ? void 0 : _api$analytics11.actions),
|
|
175
|
+
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics12 = api.analytics) === null || _api$analytics12 === void 0 ? void 0 : _api$analytics12.actions),
|
|
176
|
+
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics13 = api.analytics) === null || _api$analytics13 === void 0 ? void 0 : _api$analytics13.actions)
|
|
187
177
|
}
|
|
188
178
|
};
|
|
189
179
|
};
|
|
@@ -1,48 +1,50 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { IconTypes } from './types';
|
|
3
3
|
export const DefaultButtonsToolbar = [IconTypes.strong, IconTypes.em];
|
|
4
|
+
export const DefaultButtonsToolbarNext = [IconTypes.strong, IconTypes.em, IconTypes.underline];
|
|
4
5
|
export const DefaultButtonsMenu = [IconTypes.underline, IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
6
|
+
export const DefaultButtonsMenuNext = [IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
5
7
|
|
|
6
8
|
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
7
9
|
/** @deprecated
|
|
8
|
-
*
|
|
9
|
-
* to
|
|
10
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomButtonToolbarNext
|
|
11
|
+
* along with references to platform_editor_controls gate
|
|
10
12
|
*/
|
|
11
13
|
export const ResponsiveCustomButtonToolbar = {
|
|
12
14
|
[ToolbarSize.XXL]: DefaultButtonsToolbar,
|
|
13
15
|
[ToolbarSize.XL]: DefaultButtonsToolbar,
|
|
14
16
|
[ToolbarSize.L]: DefaultButtonsToolbar,
|
|
15
|
-
[ToolbarSize.M]:
|
|
16
|
-
[ToolbarSize.S]:
|
|
17
|
+
[ToolbarSize.M]: DefaultButtonsToolbar,
|
|
18
|
+
[ToolbarSize.S]: DefaultButtonsToolbar,
|
|
19
|
+
[ToolbarSize.XXXS]: []
|
|
20
|
+
};
|
|
21
|
+
export const ResponsiveCustomButtonToolbarNext = {
|
|
22
|
+
[ToolbarSize.XXL]: DefaultButtonsToolbarNext,
|
|
23
|
+
[ToolbarSize.XL]: DefaultButtonsToolbarNext,
|
|
24
|
+
[ToolbarSize.L]: DefaultButtonsToolbarNext,
|
|
25
|
+
[ToolbarSize.M]: DefaultButtonsToolbarNext,
|
|
26
|
+
[ToolbarSize.S]: DefaultButtonsToolbarNext,
|
|
17
27
|
[ToolbarSize.XXXS]: []
|
|
18
28
|
};
|
|
19
29
|
|
|
20
30
|
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
21
31
|
/** @deprecated
|
|
22
|
-
*
|
|
23
|
-
* to
|
|
32
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
33
|
+
* along with references to platform_editor_controls gate
|
|
24
34
|
*/
|
|
25
35
|
export const ResponsiveCustomMenu = {
|
|
26
|
-
[ToolbarSize.XXL]: DefaultButtonsMenu,
|
|
27
|
-
[ToolbarSize.XL]: DefaultButtonsMenu,
|
|
28
|
-
[ToolbarSize.L]: DefaultButtonsMenu,
|
|
29
|
-
[ToolbarSize.M]: [IconTypes.strong, IconTypes.em, ...DefaultButtonsMenu],
|
|
30
|
-
[ToolbarSize.S]: [IconTypes.strong, IconTypes.em, ...DefaultButtonsMenu],
|
|
31
|
-
[ToolbarSize.XXXS]: [IconTypes.strong, IconTypes.em, ...DefaultButtonsMenu]
|
|
32
|
-
};
|
|
33
|
-
export const ResponsiveCustomButtonToolbarNext = {
|
|
34
|
-
[ToolbarSize.XXL]: DefaultButtonsToolbar,
|
|
35
|
-
[ToolbarSize.XL]: DefaultButtonsToolbar,
|
|
36
|
-
[ToolbarSize.L]: DefaultButtonsToolbar,
|
|
37
|
-
[ToolbarSize.M]: DefaultButtonsToolbar,
|
|
38
|
-
[ToolbarSize.S]: DefaultButtonsToolbar,
|
|
39
|
-
[ToolbarSize.XXXS]: []
|
|
40
|
-
};
|
|
41
|
-
export const ResponsiveCustomMenuNext = {
|
|
42
36
|
[ToolbarSize.XXL]: DefaultButtonsMenu,
|
|
43
37
|
[ToolbarSize.XL]: DefaultButtonsMenu,
|
|
44
38
|
[ToolbarSize.L]: DefaultButtonsMenu,
|
|
45
39
|
[ToolbarSize.M]: DefaultButtonsMenu,
|
|
46
40
|
[ToolbarSize.S]: DefaultButtonsMenu,
|
|
47
41
|
[ToolbarSize.XXXS]: [IconTypes.strong, IconTypes.em, ...DefaultButtonsMenu]
|
|
42
|
+
};
|
|
43
|
+
export const ResponsiveCustomMenuNext = {
|
|
44
|
+
[ToolbarSize.XXL]: DefaultButtonsMenuNext,
|
|
45
|
+
[ToolbarSize.XL]: DefaultButtonsMenuNext,
|
|
46
|
+
[ToolbarSize.L]: DefaultButtonsMenuNext,
|
|
47
|
+
[ToolbarSize.M]: DefaultButtonsMenuNext,
|
|
48
|
+
[ToolbarSize.S]: DefaultButtonsMenuNext,
|
|
49
|
+
[ToolbarSize.XXXS]: [IconTypes.strong, IconTypes.em, IconTypes.underline, ...DefaultButtonsMenuNext]
|
|
48
50
|
};
|
|
@@ -13,6 +13,7 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
|
13
13
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
14
14
|
import BoldIcon from '@atlaskit/icon/core/migration/text-bold--editor-bold';
|
|
15
15
|
import ItalicIcon from '@atlaskit/icon/core/migration/text-italic--editor-italic';
|
|
16
|
+
import UnderlineIcon from '@atlaskit/icon/core/text-underline';
|
|
16
17
|
import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../../../pm-plugins/commands';
|
|
17
18
|
import { getInputMethod } from '../input-method-utils';
|
|
18
19
|
import { IconTypes } from '../types';
|
|
@@ -41,9 +42,15 @@ const IconButtons = (editorAnalyticsAPI, toolbarType) => ({
|
|
|
41
42
|
})
|
|
42
43
|
},
|
|
43
44
|
underline: {
|
|
45
|
+
buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_UNDERLINE,
|
|
44
46
|
command: withInputMethod(toolbarType, toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
|
|
45
47
|
message: toolbarMessages.underline,
|
|
46
|
-
tooltipKeymap: toggleUnderline
|
|
48
|
+
tooltipKeymap: toggleUnderline,
|
|
49
|
+
component: () => jsx(UnderlineIcon, {
|
|
50
|
+
color: "currentColor",
|
|
51
|
+
spacing: "spacious",
|
|
52
|
+
label: ""
|
|
53
|
+
})
|
|
47
54
|
},
|
|
48
55
|
strike: {
|
|
49
56
|
command: withInputMethod(toolbarType, toggleStrikeWithAnalytics(editorAnalyticsAPI)),
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { DefaultButtonsMenu, DefaultButtonsToolbar, ResponsiveCustomButtonToolbar as ResponsiveCustomButtonToolbarLegacy, ResponsiveCustomButtonToolbarNext, ResponsiveCustomMenu as ResponsiveCustomMenuLegacy, ResponsiveCustomMenuNext } from '../constants';
|
|
2
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
+
import { DefaultButtonsMenu, DefaultButtonsMenuNext, DefaultButtonsToolbar, DefaultButtonsToolbarNext, ResponsiveCustomButtonToolbar as ResponsiveCustomButtonToolbarLegacy, ResponsiveCustomButtonToolbarNext, ResponsiveCustomMenu as ResponsiveCustomMenuLegacy, ResponsiveCustomMenuNext } from '../constants';
|
|
4
4
|
export const useResponsiveIconTypeButtons = ({
|
|
5
5
|
toolbarSize,
|
|
6
6
|
responsivenessEnabled
|
|
7
7
|
}) => {
|
|
8
|
-
const ResponsiveCustomButtonToolbar =
|
|
8
|
+
const ResponsiveCustomButtonToolbar = editorExperiment('platform_editor_controls', 'variant1') ? ResponsiveCustomButtonToolbarNext : ResponsiveCustomButtonToolbarLegacy;
|
|
9
9
|
const iconTypeList = useMemo(() => ResponsiveCustomButtonToolbar[toolbarSize], [toolbarSize, ResponsiveCustomButtonToolbar]);
|
|
10
|
-
|
|
10
|
+
if (responsivenessEnabled) {
|
|
11
|
+
return iconTypeList;
|
|
12
|
+
}
|
|
13
|
+
return editorExperiment('platform_editor_controls', 'variant1') ? DefaultButtonsToolbarNext : DefaultButtonsToolbar;
|
|
11
14
|
};
|
|
12
15
|
export const useResponsiveIconTypeMenu = ({
|
|
13
16
|
toolbarSize,
|
|
14
17
|
responsivenessEnabled
|
|
15
18
|
}) => {
|
|
16
|
-
const ResponsiveCustomMenu =
|
|
19
|
+
const ResponsiveCustomMenu = editorExperiment('platform_editor_controls', 'variant1') ? ResponsiveCustomMenuNext : ResponsiveCustomMenuLegacy;
|
|
17
20
|
const iconTypeList = useMemo(() => ResponsiveCustomMenu[toolbarSize], [toolbarSize, ResponsiveCustomMenu]);
|
|
18
|
-
|
|
21
|
+
if (responsivenessEnabled) {
|
|
22
|
+
return iconTypeList;
|
|
23
|
+
}
|
|
24
|
+
return editorExperiment('platform_editor_controls', 'variant1') ? DefaultButtonsMenuNext : DefaultButtonsMenu;
|
|
19
25
|
};
|
|
20
26
|
export const useResponsiveToolbarButtons = ({
|
|
21
27
|
icons,
|
|
@@ -21,7 +21,7 @@ import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
|
21
21
|
* from `@atlaskit/editor-core`.
|
|
22
22
|
*/
|
|
23
23
|
export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
24
|
-
var _api$primaryToolbar, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13
|
|
24
|
+
var _api$primaryToolbar, _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13;
|
|
25
25
|
var options = _ref.config,
|
|
26
26
|
api = _ref.api;
|
|
27
27
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
|
|
@@ -31,16 +31,6 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
31
31
|
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
32
32
|
toolbarSize = _ref2.toolbarSize,
|
|
33
33
|
disabled = _ref2.disabled;
|
|
34
|
-
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
35
|
-
exposure: true
|
|
36
|
-
})) {
|
|
37
|
-
var _api$analytics;
|
|
38
|
-
return /*#__PURE__*/React.createElement(FloatingToolbarComponent, {
|
|
39
|
-
api: api,
|
|
40
|
-
editorView: editorView,
|
|
41
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
34
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
45
35
|
api: api,
|
|
46
36
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -83,9 +73,9 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
83
73
|
return [{
|
|
84
74
|
name: 'textFormatting',
|
|
85
75
|
plugin: function plugin(_ref3) {
|
|
86
|
-
var _api$
|
|
76
|
+
var _api$analytics;
|
|
87
77
|
var dispatch = _ref3.dispatch;
|
|
88
|
-
return pmPlugin(dispatch, api === null || api === void 0 || (_api$
|
|
78
|
+
return pmPlugin(dispatch, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
89
79
|
}
|
|
90
80
|
}, {
|
|
91
81
|
name: 'textFormattingCursor',
|
|
@@ -95,15 +85,15 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
95
85
|
}, {
|
|
96
86
|
name: 'textFormattingInputRule',
|
|
97
87
|
plugin: function plugin(_ref4) {
|
|
98
|
-
var _api$
|
|
88
|
+
var _api$analytics2;
|
|
99
89
|
var schema = _ref4.schema;
|
|
100
|
-
return textFormattingInputRulePlugin(schema, api === null || api === void 0 || (_api$
|
|
90
|
+
return textFormattingInputRulePlugin(schema, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, api);
|
|
101
91
|
}
|
|
102
92
|
}, {
|
|
103
93
|
name: 'textFormattingSmartRule',
|
|
104
94
|
plugin: function plugin() {
|
|
105
|
-
var _api$
|
|
106
|
-
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? textFormattingSmartInputRulePlugin(api === null || api === void 0 || (_api$
|
|
95
|
+
var _api$analytics3;
|
|
96
|
+
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? textFormattingSmartInputRulePlugin(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions) : undefined;
|
|
107
97
|
}
|
|
108
98
|
}, {
|
|
109
99
|
name: 'textFormattingClear',
|
|
@@ -114,15 +104,15 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
114
104
|
}, {
|
|
115
105
|
name: 'textFormattingClearKeymap',
|
|
116
106
|
plugin: function plugin() {
|
|
117
|
-
var _api$
|
|
118
|
-
return clearFormattingKeymapPlugin(api === null || api === void 0 || (_api$
|
|
107
|
+
var _api$analytics4;
|
|
108
|
+
return clearFormattingKeymapPlugin(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
119
109
|
}
|
|
120
110
|
}, {
|
|
121
111
|
name: 'textFormattingKeymap',
|
|
122
112
|
plugin: function plugin(_ref6) {
|
|
123
|
-
var _api$
|
|
113
|
+
var _api$analytics5;
|
|
124
114
|
var schema = _ref6.schema;
|
|
125
|
-
return keymapPlugin(schema, api === null || api === void 0 || (_api$
|
|
115
|
+
return keymapPlugin(schema, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
126
116
|
}
|
|
127
117
|
}];
|
|
128
118
|
},
|
|
@@ -153,14 +143,14 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
153
143
|
var toolbarCustom = {
|
|
154
144
|
type: 'custom',
|
|
155
145
|
render: function render(view) {
|
|
156
|
-
var _api$
|
|
146
|
+
var _api$analytics6;
|
|
157
147
|
if (!view) {
|
|
158
148
|
return;
|
|
159
149
|
}
|
|
160
150
|
return /*#__PURE__*/React.createElement(FloatingToolbarComponent, {
|
|
161
151
|
api: api,
|
|
162
152
|
editorView: view,
|
|
163
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$
|
|
153
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions
|
|
164
154
|
});
|
|
165
155
|
},
|
|
166
156
|
fallback: []
|
|
@@ -177,13 +167,13 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
177
167
|
},
|
|
178
168
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
179
169
|
commands: {
|
|
180
|
-
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 || (_api$
|
|
181
|
-
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 || (_api$
|
|
182
|
-
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 || (_api$
|
|
183
|
-
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 || (_api$
|
|
184
|
-
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 || (_api$
|
|
185
|
-
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 || (_api$
|
|
186
|
-
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 || (_api$
|
|
170
|
+
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
171
|
+
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions),
|
|
172
|
+
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 || (_api$analytics9 = api.analytics) === null || _api$analytics9 === void 0 ? void 0 : _api$analytics9.actions),
|
|
173
|
+
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 || (_api$analytics10 = api.analytics) === null || _api$analytics10 === void 0 ? void 0 : _api$analytics10.actions),
|
|
174
|
+
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 || (_api$analytics11 = api.analytics) === null || _api$analytics11 === void 0 ? void 0 : _api$analytics11.actions),
|
|
175
|
+
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 || (_api$analytics12 = api.analytics) === null || _api$analytics12 === void 0 ? void 0 : _api$analytics12.actions),
|
|
176
|
+
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 || (_api$analytics13 = api.analytics) === null || _api$analytics13 === void 0 ? void 0 : _api$analytics13.actions)
|
|
187
177
|
}
|
|
188
178
|
};
|
|
189
179
|
};
|
|
@@ -2,20 +2,22 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { IconTypes } from './types';
|
|
4
4
|
export var DefaultButtonsToolbar = [IconTypes.strong, IconTypes.em];
|
|
5
|
+
export var DefaultButtonsToolbarNext = [IconTypes.strong, IconTypes.em, IconTypes.underline];
|
|
5
6
|
export var DefaultButtonsMenu = [IconTypes.underline, IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
7
|
+
export var DefaultButtonsMenuNext = [IconTypes.strike, IconTypes.code, IconTypes.subscript, IconTypes.superscript];
|
|
6
8
|
|
|
7
9
|
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
8
10
|
/** @deprecated
|
|
9
|
-
*
|
|
10
|
-
* to
|
|
11
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomButtonToolbarNext
|
|
12
|
+
* along with references to platform_editor_controls gate
|
|
11
13
|
*/
|
|
12
|
-
export var ResponsiveCustomButtonToolbar = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsToolbar), ToolbarSize.XL, DefaultButtonsToolbar), ToolbarSize.L, DefaultButtonsToolbar), ToolbarSize.M,
|
|
14
|
+
export var ResponsiveCustomButtonToolbar = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsToolbar), ToolbarSize.XL, DefaultButtonsToolbar), ToolbarSize.L, DefaultButtonsToolbar), ToolbarSize.M, DefaultButtonsToolbar), ToolbarSize.S, DefaultButtonsToolbar), ToolbarSize.XXXS, []);
|
|
15
|
+
export var ResponsiveCustomButtonToolbarNext = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsToolbarNext), ToolbarSize.XL, DefaultButtonsToolbarNext), ToolbarSize.L, DefaultButtonsToolbarNext), ToolbarSize.M, DefaultButtonsToolbarNext), ToolbarSize.S, DefaultButtonsToolbarNext), ToolbarSize.XXXS, []);
|
|
13
16
|
|
|
14
17
|
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
15
18
|
/** @deprecated
|
|
16
|
-
*
|
|
17
|
-
* to
|
|
19
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
20
|
+
* along with references to platform_editor_controls gate
|
|
18
21
|
*/
|
|
19
|
-
export var ResponsiveCustomMenu = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsMenu), ToolbarSize.XL, DefaultButtonsMenu), ToolbarSize.L, DefaultButtonsMenu), ToolbarSize.M,
|
|
20
|
-
export var
|
|
21
|
-
export var ResponsiveCustomMenuNext = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsMenu), ToolbarSize.XL, DefaultButtonsMenu), ToolbarSize.L, DefaultButtonsMenu), ToolbarSize.M, DefaultButtonsMenu), ToolbarSize.S, DefaultButtonsMenu), ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu));
|
|
22
|
+
export var ResponsiveCustomMenu = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsMenu), ToolbarSize.XL, DefaultButtonsMenu), ToolbarSize.L, DefaultButtonsMenu), ToolbarSize.M, DefaultButtonsMenu), ToolbarSize.S, DefaultButtonsMenu), ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em].concat(DefaultButtonsMenu));
|
|
23
|
+
export var ResponsiveCustomMenuNext = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ToolbarSize.XXL, DefaultButtonsMenuNext), ToolbarSize.XL, DefaultButtonsMenuNext), ToolbarSize.L, DefaultButtonsMenuNext), ToolbarSize.M, DefaultButtonsMenuNext), ToolbarSize.S, DefaultButtonsMenuNext), ToolbarSize.XXXS, [IconTypes.strong, IconTypes.em, IconTypes.underline].concat(DefaultButtonsMenuNext));
|
|
@@ -14,6 +14,7 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
|
14
14
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
15
15
|
import BoldIcon from '@atlaskit/icon/core/migration/text-bold--editor-bold';
|
|
16
16
|
import ItalicIcon from '@atlaskit/icon/core/migration/text-italic--editor-italic';
|
|
17
|
+
import UnderlineIcon from '@atlaskit/icon/core/text-underline';
|
|
17
18
|
import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../../../pm-plugins/commands';
|
|
18
19
|
import { getInputMethod } from '../input-method-utils';
|
|
19
20
|
import { IconTypes } from '../types';
|
|
@@ -49,9 +50,17 @@ var IconButtons = function IconButtons(editorAnalyticsAPI, toolbarType) {
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
underline: {
|
|
53
|
+
buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_UNDERLINE,
|
|
52
54
|
command: withInputMethod(toolbarType, toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
|
|
53
55
|
message: toolbarMessages.underline,
|
|
54
|
-
tooltipKeymap: toggleUnderline
|
|
56
|
+
tooltipKeymap: toggleUnderline,
|
|
57
|
+
component: function component() {
|
|
58
|
+
return jsx(UnderlineIcon, {
|
|
59
|
+
color: "currentColor",
|
|
60
|
+
spacing: "spacious",
|
|
61
|
+
label: ""
|
|
62
|
+
});
|
|
63
|
+
}
|
|
55
64
|
},
|
|
56
65
|
strike: {
|
|
57
66
|
command: withInputMethod(toolbarType, toggleStrikeWithAnalytics(editorAnalyticsAPI)),
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { DefaultButtonsMenu, DefaultButtonsToolbar, ResponsiveCustomButtonToolbar as ResponsiveCustomButtonToolbarLegacy, ResponsiveCustomButtonToolbarNext, ResponsiveCustomMenu as ResponsiveCustomMenuLegacy, ResponsiveCustomMenuNext } from '../constants';
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
|
+
import { DefaultButtonsMenu, DefaultButtonsMenuNext, DefaultButtonsToolbar, DefaultButtonsToolbarNext, ResponsiveCustomButtonToolbar as ResponsiveCustomButtonToolbarLegacy, ResponsiveCustomButtonToolbarNext, ResponsiveCustomMenu as ResponsiveCustomMenuLegacy, ResponsiveCustomMenuNext } from '../constants';
|
|
5
5
|
export var useResponsiveIconTypeButtons = function useResponsiveIconTypeButtons(_ref) {
|
|
6
6
|
var toolbarSize = _ref.toolbarSize,
|
|
7
7
|
responsivenessEnabled = _ref.responsivenessEnabled;
|
|
8
|
-
var ResponsiveCustomButtonToolbar =
|
|
8
|
+
var ResponsiveCustomButtonToolbar = editorExperiment('platform_editor_controls', 'variant1') ? ResponsiveCustomButtonToolbarNext : ResponsiveCustomButtonToolbarLegacy;
|
|
9
9
|
var iconTypeList = useMemo(function () {
|
|
10
10
|
return ResponsiveCustomButtonToolbar[toolbarSize];
|
|
11
11
|
}, [toolbarSize, ResponsiveCustomButtonToolbar]);
|
|
12
|
-
|
|
12
|
+
if (responsivenessEnabled) {
|
|
13
|
+
return iconTypeList;
|
|
14
|
+
}
|
|
15
|
+
return editorExperiment('platform_editor_controls', 'variant1') ? DefaultButtonsToolbarNext : DefaultButtonsToolbar;
|
|
13
16
|
};
|
|
14
17
|
export var useResponsiveIconTypeMenu = function useResponsiveIconTypeMenu(_ref2) {
|
|
15
18
|
var toolbarSize = _ref2.toolbarSize,
|
|
16
19
|
responsivenessEnabled = _ref2.responsivenessEnabled;
|
|
17
|
-
var ResponsiveCustomMenu =
|
|
20
|
+
var ResponsiveCustomMenu = editorExperiment('platform_editor_controls', 'variant1') ? ResponsiveCustomMenuNext : ResponsiveCustomMenuLegacy;
|
|
18
21
|
var iconTypeList = useMemo(function () {
|
|
19
22
|
return ResponsiveCustomMenu[toolbarSize];
|
|
20
23
|
}, [toolbarSize, ResponsiveCustomMenu]);
|
|
21
|
-
|
|
24
|
+
if (responsivenessEnabled) {
|
|
25
|
+
return iconTypeList;
|
|
26
|
+
}
|
|
27
|
+
return editorExperiment('platform_editor_controls', 'variant1') ? DefaultButtonsMenuNext : DefaultButtonsMenu;
|
|
22
28
|
};
|
|
23
29
|
export var useResponsiveToolbarButtons = function useResponsiveToolbarButtons(_ref3) {
|
|
24
30
|
var icons = _ref3.icons,
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { IconTypes } from './types';
|
|
3
3
|
export declare const DefaultButtonsToolbar: IconTypes[];
|
|
4
|
+
export declare const DefaultButtonsToolbarNext: IconTypes[];
|
|
4
5
|
export declare const DefaultButtonsMenu: IconTypes[];
|
|
6
|
+
export declare const DefaultButtonsMenuNext: IconTypes[];
|
|
5
7
|
/** @deprecated
|
|
6
|
-
*
|
|
7
|
-
* to
|
|
8
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomButtonToolbarNext
|
|
9
|
+
* along with references to platform_editor_controls gate
|
|
8
10
|
*/
|
|
9
11
|
export declare const ResponsiveCustomButtonToolbar: Record<ToolbarSize, IconTypes[]>;
|
|
12
|
+
export declare const ResponsiveCustomButtonToolbarNext: Record<ToolbarSize, IconTypes[]>;
|
|
10
13
|
/** @deprecated
|
|
11
|
-
*
|
|
12
|
-
* to
|
|
14
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
15
|
+
* along with references to platform_editor_controls gate
|
|
13
16
|
*/
|
|
14
17
|
export declare const ResponsiveCustomMenu: Record<ToolbarSize, IconTypes[]>;
|
|
15
|
-
export declare const ResponsiveCustomButtonToolbarNext: Record<ToolbarSize, IconTypes[]>;
|
|
16
18
|
export declare const ResponsiveCustomMenuNext: Record<ToolbarSize, IconTypes[]>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { IconTypes } from './types';
|
|
3
3
|
export declare const DefaultButtonsToolbar: IconTypes[];
|
|
4
|
+
export declare const DefaultButtonsToolbarNext: IconTypes[];
|
|
4
5
|
export declare const DefaultButtonsMenu: IconTypes[];
|
|
6
|
+
export declare const DefaultButtonsMenuNext: IconTypes[];
|
|
5
7
|
/** @deprecated
|
|
6
|
-
*
|
|
7
|
-
* to
|
|
8
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomButtonToolbarNext
|
|
9
|
+
* along with references to platform_editor_controls gate
|
|
8
10
|
*/
|
|
9
11
|
export declare const ResponsiveCustomButtonToolbar: Record<ToolbarSize, IconTypes[]>;
|
|
12
|
+
export declare const ResponsiveCustomButtonToolbarNext: Record<ToolbarSize, IconTypes[]>;
|
|
10
13
|
/** @deprecated
|
|
11
|
-
*
|
|
12
|
-
* to
|
|
14
|
+
* When tidying platform_editor_controls this is to be removed in favor of ResponsiveCustomMenuNext
|
|
15
|
+
* along with references to platform_editor_controls gate
|
|
13
16
|
*/
|
|
14
17
|
export declare const ResponsiveCustomMenu: Record<ToolbarSize, IconTypes[]>;
|
|
15
|
-
export declare const ResponsiveCustomButtonToolbarNext: Record<ToolbarSize, IconTypes[]>;
|
|
16
18
|
export declare const ResponsiveCustomMenuNext: Record<ToolbarSize, IconTypes[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
48
48
|
"@atlaskit/tmp-editor-statsig": "^3.3.0",
|
|
49
|
-
"@atlaskit/tokens": "^4.
|
|
49
|
+
"@atlaskit/tokens": "^4.3.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|
|
52
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|