@atlaskit/editor-plugin-text-formatting 1.6.0 → 1.7.0
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 +23 -0
- package/dist/cjs/plugin.js +33 -25
- package/dist/cjs/ui/PrimaryToolbarComponent.js +2 -1
- package/dist/cjs/ui/Toolbar/index.js +8 -4
- package/dist/es2019/plugin.js +26 -18
- package/dist/es2019/ui/PrimaryToolbarComponent.js +2 -1
- package/dist/es2019/ui/Toolbar/index.js +8 -4
- package/dist/esm/plugin.js +33 -25
- package/dist/esm/ui/PrimaryToolbarComponent.js +2 -1
- package/dist/esm/ui/Toolbar/index.js +8 -4
- package/dist/types/plugin.d.ts +6 -2
- package/dist/types/ui/Toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/plugin.d.ts +4 -2
- package/dist/types-ts4.5/ui/Toolbar/index.d.ts +3 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 1.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#101406](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101406)
|
|
8
|
+
[`6daffd65aec4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6daffd65aec4) -
|
|
9
|
+
[ED-23298] Extract primary toolbar components to editor plugin to allow for custom ordering
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#102478](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102478)
|
|
14
|
+
[`3378951608b0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3378951608b0) -
|
|
15
|
+
[ED-23332] Update adf-schema package to 36.10.1
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 1.6.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#101524](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101524)
|
|
23
|
+
[`4821570088e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4821570088e6) -
|
|
24
|
+
ED-23362 Bump ADF schema to version 36.8.1 and add support for adf validation and transformation
|
|
25
|
+
|
|
3
26
|
## 1.6.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -27,6 +27,24 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
27
27
|
var _api$analytics6, _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12;
|
|
28
28
|
var options = _ref.config,
|
|
29
29
|
api = _ref.api;
|
|
30
|
+
var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
|
|
31
|
+
var editorView = _ref2.editorView,
|
|
32
|
+
popupsMountPoint = _ref2.popupsMountPoint,
|
|
33
|
+
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
34
|
+
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
35
|
+
toolbarSize = _ref2.toolbarSize,
|
|
36
|
+
disabled = _ref2.disabled;
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
|
|
38
|
+
api: api,
|
|
39
|
+
popupsMountPoint: popupsMountPoint,
|
|
40
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
41
|
+
toolbarSize: toolbarSize,
|
|
42
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
43
|
+
editorView: editorView,
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
46
|
+
});
|
|
47
|
+
};
|
|
30
48
|
return {
|
|
31
49
|
name: 'textFormatting',
|
|
32
50
|
marks: function marks() {
|
|
@@ -53,9 +71,9 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
53
71
|
pmPlugins: function pmPlugins() {
|
|
54
72
|
return [{
|
|
55
73
|
name: 'textFormatting',
|
|
56
|
-
plugin: function plugin(
|
|
74
|
+
plugin: function plugin(_ref3) {
|
|
57
75
|
var _api$analytics;
|
|
58
|
-
var dispatch =
|
|
76
|
+
var dispatch = _ref3.dispatch;
|
|
59
77
|
return (0, _main.plugin)(dispatch, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
60
78
|
}
|
|
61
79
|
}, {
|
|
@@ -65,9 +83,9 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
65
83
|
}
|
|
66
84
|
}, {
|
|
67
85
|
name: 'textFormattingInputRule',
|
|
68
|
-
plugin: function plugin(
|
|
86
|
+
plugin: function plugin(_ref4) {
|
|
69
87
|
var _api$analytics2;
|
|
70
|
-
var schema =
|
|
88
|
+
var schema = _ref4.schema;
|
|
71
89
|
return (0, _inputRule.default)(schema, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
72
90
|
}
|
|
73
91
|
}, {
|
|
@@ -78,8 +96,8 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
78
96
|
}
|
|
79
97
|
}, {
|
|
80
98
|
name: 'textFormattingClear',
|
|
81
|
-
plugin: function plugin(
|
|
82
|
-
var dispatch =
|
|
99
|
+
plugin: function plugin(_ref5) {
|
|
100
|
+
var dispatch = _ref5.dispatch;
|
|
83
101
|
return (0, _clearFormatting.plugin)(dispatch);
|
|
84
102
|
}
|
|
85
103
|
}, {
|
|
@@ -90,9 +108,9 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
90
108
|
}
|
|
91
109
|
}, {
|
|
92
110
|
name: 'textFormattingKeymap',
|
|
93
|
-
plugin: function plugin(
|
|
111
|
+
plugin: function plugin(_ref6) {
|
|
94
112
|
var _api$analytics5;
|
|
95
|
-
var schema =
|
|
113
|
+
var schema = _ref6.schema;
|
|
96
114
|
return (0, _keymap.default)(schema, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
97
115
|
}
|
|
98
116
|
}];
|
|
@@ -106,24 +124,14 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
106
124
|
formattingIsPresent: (_clearFormattingPlugi = _clearFormatting.pluginKey.getState(editorState)) === null || _clearFormattingPlugi === void 0 ? void 0 : _clearFormattingPlugi.formattingIsPresent
|
|
107
125
|
});
|
|
108
126
|
},
|
|
109
|
-
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
disabled = _ref6.disabled;
|
|
116
|
-
return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
|
|
117
|
-
api: api,
|
|
118
|
-
popupsMountPoint: popupsMountPoint,
|
|
119
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
120
|
-
toolbarSize: toolbarSize,
|
|
121
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
122
|
-
editorView: editorView,
|
|
123
|
-
disabled: disabled,
|
|
124
|
-
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
125
|
-
});
|
|
127
|
+
usePluginHook: function usePluginHook() {
|
|
128
|
+
var _api$core, _api$primaryToolbar;
|
|
129
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
|
|
130
|
+
name: 'textFormatting',
|
|
131
|
+
component: primaryToolbarComponent
|
|
132
|
+
}));
|
|
126
133
|
},
|
|
134
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
127
135
|
commands: {
|
|
128
136
|
toggleSuperscript: (0, _commands.toggleSuperscriptWithAnalytics)(api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions),
|
|
129
137
|
toggleSubscript: (0, _commands.toggleSubscriptWithAnalytics)(api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
@@ -29,6 +29,7 @@ function PrimaryToolbarComponent(_ref) {
|
|
|
29
29
|
editorView: editorView,
|
|
30
30
|
isToolbarDisabled: disabled,
|
|
31
31
|
shouldUseResponsiveToolbar: shouldUseResponsiveToolbar,
|
|
32
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
32
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
33
|
+
api: api
|
|
33
34
|
});
|
|
34
35
|
}
|
|
@@ -35,7 +35,8 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
35
35
|
isToolbarDisabled = _ref.isToolbarDisabled,
|
|
36
36
|
intl = _ref.intl,
|
|
37
37
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
38
|
-
textFormattingState = _ref.textFormattingState
|
|
38
|
+
textFormattingState = _ref.textFormattingState,
|
|
39
|
+
api = _ref.api;
|
|
39
40
|
var _useState = (0, _react.useState)(''),
|
|
40
41
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
41
42
|
message = _useState2[0],
|
|
@@ -156,7 +157,8 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
156
157
|
moreButtonLabel: moreFormattingButtonLabel,
|
|
157
158
|
hasFormattingActive: hasFormattingActive,
|
|
158
159
|
items: items
|
|
159
|
-
}))), (0
|
|
160
|
+
}))), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
161
|
+
(0, _react2.jsx)("span", {
|
|
160
162
|
css: _styles.separatorStyles
|
|
161
163
|
}))
|
|
162
164
|
);
|
|
@@ -171,7 +173,8 @@ var Toolbar = function Toolbar(_ref2) {
|
|
|
171
173
|
shouldUseResponsiveToolbar = _ref2.shouldUseResponsiveToolbar,
|
|
172
174
|
intl = _ref2.intl,
|
|
173
175
|
editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
|
|
174
|
-
textFormattingState = _ref2.textFormattingState
|
|
176
|
+
textFormattingState = _ref2.textFormattingState,
|
|
177
|
+
api = _ref2.api;
|
|
175
178
|
return (0, _react2.jsx)(ToolbarFormatting, {
|
|
176
179
|
textFormattingState: textFormattingState,
|
|
177
180
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -182,7 +185,8 @@ var Toolbar = function Toolbar(_ref2) {
|
|
|
182
185
|
isToolbarDisabled: isToolbarDisabled,
|
|
183
186
|
shouldUseResponsiveToolbar: shouldUseResponsiveToolbar,
|
|
184
187
|
intl: intl,
|
|
185
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
188
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
189
|
+
api: api
|
|
186
190
|
});
|
|
187
191
|
};
|
|
188
192
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(Toolbar);
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -18,6 +18,25 @@ export const textFormattingPlugin = ({
|
|
|
18
18
|
api
|
|
19
19
|
}) => {
|
|
20
20
|
var _api$analytics6, _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12;
|
|
21
|
+
const primaryToolbarComponent = ({
|
|
22
|
+
editorView,
|
|
23
|
+
popupsMountPoint,
|
|
24
|
+
popupsScrollableElement,
|
|
25
|
+
isToolbarReducedSpacing,
|
|
26
|
+
toolbarSize,
|
|
27
|
+
disabled
|
|
28
|
+
}) => {
|
|
29
|
+
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
30
|
+
api: api,
|
|
31
|
+
popupsMountPoint: popupsMountPoint,
|
|
32
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
33
|
+
toolbarSize: toolbarSize,
|
|
34
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
35
|
+
editorView: editorView,
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
38
|
+
});
|
|
39
|
+
};
|
|
21
40
|
return {
|
|
22
41
|
name: 'textFormatting',
|
|
23
42
|
marks() {
|
|
@@ -98,25 +117,14 @@ export const textFormattingPlugin = ({
|
|
|
98
117
|
formattingIsPresent: (_clearFormattingPlugi = clearFormattingPluginKey.getState(editorState)) === null || _clearFormattingPlugi === void 0 ? void 0 : _clearFormattingPlugi.formattingIsPresent
|
|
99
118
|
};
|
|
100
119
|
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
disabled
|
|
108
|
-
}) {
|
|
109
|
-
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
110
|
-
api: api,
|
|
111
|
-
popupsMountPoint: popupsMountPoint,
|
|
112
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
113
|
-
toolbarSize: toolbarSize,
|
|
114
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
115
|
-
editorView: editorView,
|
|
116
|
-
disabled: disabled,
|
|
117
|
-
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
118
|
-
});
|
|
120
|
+
usePluginHook: () => {
|
|
121
|
+
var _api$core, _api$primaryToolbar;
|
|
122
|
+
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
|
|
123
|
+
name: 'textFormatting',
|
|
124
|
+
component: primaryToolbarComponent
|
|
125
|
+
}));
|
|
119
126
|
},
|
|
127
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
120
128
|
commands: {
|
|
121
129
|
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions),
|
|
122
130
|
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
@@ -24,6 +24,7 @@ export function PrimaryToolbarComponent({
|
|
|
24
24
|
editorView: editorView,
|
|
25
25
|
isToolbarDisabled: disabled,
|
|
26
26
|
shouldUseResponsiveToolbar: shouldUseResponsiveToolbar,
|
|
27
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
27
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
28
|
+
api: api
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -24,7 +24,8 @@ const ToolbarFormatting = ({
|
|
|
24
24
|
isToolbarDisabled,
|
|
25
25
|
intl,
|
|
26
26
|
editorAnalyticsAPI,
|
|
27
|
-
textFormattingState
|
|
27
|
+
textFormattingState,
|
|
28
|
+
api
|
|
28
29
|
}) => {
|
|
29
30
|
var _usePreviousState;
|
|
30
31
|
const [message, setMessage] = useState('');
|
|
@@ -143,7 +144,8 @@ const ToolbarFormatting = ({
|
|
|
143
144
|
moreButtonLabel: moreFormattingButtonLabel,
|
|
144
145
|
hasFormattingActive: hasFormattingActive,
|
|
145
146
|
items: items
|
|
146
|
-
}))),
|
|
147
|
+
}))), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
148
|
+
jsx("span", {
|
|
147
149
|
css: separatorStyles
|
|
148
150
|
}))
|
|
149
151
|
);
|
|
@@ -158,7 +160,8 @@ const Toolbar = ({
|
|
|
158
160
|
shouldUseResponsiveToolbar,
|
|
159
161
|
intl,
|
|
160
162
|
editorAnalyticsAPI,
|
|
161
|
-
textFormattingState
|
|
163
|
+
textFormattingState,
|
|
164
|
+
api
|
|
162
165
|
}) => {
|
|
163
166
|
return jsx(ToolbarFormatting, {
|
|
164
167
|
textFormattingState: textFormattingState,
|
|
@@ -170,7 +173,8 @@ const Toolbar = ({
|
|
|
170
173
|
isToolbarDisabled: isToolbarDisabled,
|
|
171
174
|
shouldUseResponsiveToolbar: shouldUseResponsiveToolbar,
|
|
172
175
|
intl: intl,
|
|
173
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
176
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
177
|
+
api: api
|
|
174
178
|
});
|
|
175
179
|
};
|
|
176
180
|
export default injectIntl(Toolbar);
|
package/dist/esm/plugin.js
CHANGED
|
@@ -20,6 +20,24 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
20
20
|
var _api$analytics6, _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12;
|
|
21
21
|
var options = _ref.config,
|
|
22
22
|
api = _ref.api;
|
|
23
|
+
var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
|
|
24
|
+
var editorView = _ref2.editorView,
|
|
25
|
+
popupsMountPoint = _ref2.popupsMountPoint,
|
|
26
|
+
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
27
|
+
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
28
|
+
toolbarSize = _ref2.toolbarSize,
|
|
29
|
+
disabled = _ref2.disabled;
|
|
30
|
+
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
31
|
+
api: api,
|
|
32
|
+
popupsMountPoint: popupsMountPoint,
|
|
33
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
34
|
+
toolbarSize: toolbarSize,
|
|
35
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
36
|
+
editorView: editorView,
|
|
37
|
+
disabled: disabled,
|
|
38
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
39
|
+
});
|
|
40
|
+
};
|
|
23
41
|
return {
|
|
24
42
|
name: 'textFormatting',
|
|
25
43
|
marks: function marks() {
|
|
@@ -46,9 +64,9 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
46
64
|
pmPlugins: function pmPlugins() {
|
|
47
65
|
return [{
|
|
48
66
|
name: 'textFormatting',
|
|
49
|
-
plugin: function plugin(
|
|
67
|
+
plugin: function plugin(_ref3) {
|
|
50
68
|
var _api$analytics;
|
|
51
|
-
var dispatch =
|
|
69
|
+
var dispatch = _ref3.dispatch;
|
|
52
70
|
return pmPlugin(dispatch, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
53
71
|
}
|
|
54
72
|
}, {
|
|
@@ -58,9 +76,9 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
58
76
|
}
|
|
59
77
|
}, {
|
|
60
78
|
name: 'textFormattingInputRule',
|
|
61
|
-
plugin: function plugin(
|
|
79
|
+
plugin: function plugin(_ref4) {
|
|
62
80
|
var _api$analytics2;
|
|
63
|
-
var schema =
|
|
81
|
+
var schema = _ref4.schema;
|
|
64
82
|
return textFormattingInputRulePlugin(schema, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
65
83
|
}
|
|
66
84
|
}, {
|
|
@@ -71,8 +89,8 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
71
89
|
}
|
|
72
90
|
}, {
|
|
73
91
|
name: 'textFormattingClear',
|
|
74
|
-
plugin: function plugin(
|
|
75
|
-
var dispatch =
|
|
92
|
+
plugin: function plugin(_ref5) {
|
|
93
|
+
var dispatch = _ref5.dispatch;
|
|
76
94
|
return clearFormattingPlugin(dispatch);
|
|
77
95
|
}
|
|
78
96
|
}, {
|
|
@@ -83,9 +101,9 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
83
101
|
}
|
|
84
102
|
}, {
|
|
85
103
|
name: 'textFormattingKeymap',
|
|
86
|
-
plugin: function plugin(
|
|
104
|
+
plugin: function plugin(_ref6) {
|
|
87
105
|
var _api$analytics5;
|
|
88
|
-
var schema =
|
|
106
|
+
var schema = _ref6.schema;
|
|
89
107
|
return keymapPlugin(schema, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
90
108
|
}
|
|
91
109
|
}];
|
|
@@ -99,24 +117,14 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
99
117
|
formattingIsPresent: (_clearFormattingPlugi = clearFormattingPluginKey.getState(editorState)) === null || _clearFormattingPlugi === void 0 ? void 0 : _clearFormattingPlugi.formattingIsPresent
|
|
100
118
|
});
|
|
101
119
|
},
|
|
102
|
-
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
disabled = _ref6.disabled;
|
|
109
|
-
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
110
|
-
api: api,
|
|
111
|
-
popupsMountPoint: popupsMountPoint,
|
|
112
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
113
|
-
toolbarSize: toolbarSize,
|
|
114
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
115
|
-
editorView: editorView,
|
|
116
|
-
disabled: disabled,
|
|
117
|
-
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
118
|
-
});
|
|
120
|
+
usePluginHook: function usePluginHook() {
|
|
121
|
+
var _api$core, _api$primaryToolbar;
|
|
122
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
|
|
123
|
+
name: 'textFormatting',
|
|
124
|
+
component: primaryToolbarComponent
|
|
125
|
+
}));
|
|
119
126
|
},
|
|
127
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
120
128
|
commands: {
|
|
121
129
|
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions),
|
|
122
130
|
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
@@ -22,6 +22,7 @@ export function PrimaryToolbarComponent(_ref) {
|
|
|
22
22
|
editorView: editorView,
|
|
23
23
|
isToolbarDisabled: disabled,
|
|
24
24
|
shouldUseResponsiveToolbar: shouldUseResponsiveToolbar,
|
|
25
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
25
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
26
|
+
api: api
|
|
26
27
|
});
|
|
27
28
|
}
|
|
@@ -27,7 +27,8 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
27
27
|
isToolbarDisabled = _ref.isToolbarDisabled,
|
|
28
28
|
intl = _ref.intl,
|
|
29
29
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
30
|
-
textFormattingState = _ref.textFormattingState
|
|
30
|
+
textFormattingState = _ref.textFormattingState,
|
|
31
|
+
api = _ref.api;
|
|
31
32
|
var _useState = useState(''),
|
|
32
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
33
34
|
message = _useState2[0],
|
|
@@ -148,7 +149,8 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
148
149
|
moreButtonLabel: moreFormattingButtonLabel,
|
|
149
150
|
hasFormattingActive: hasFormattingActive,
|
|
150
151
|
items: items
|
|
151
|
-
}))),
|
|
152
|
+
}))), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
153
|
+
jsx("span", {
|
|
152
154
|
css: separatorStyles
|
|
153
155
|
}))
|
|
154
156
|
);
|
|
@@ -163,7 +165,8 @@ var Toolbar = function Toolbar(_ref2) {
|
|
|
163
165
|
shouldUseResponsiveToolbar = _ref2.shouldUseResponsiveToolbar,
|
|
164
166
|
intl = _ref2.intl,
|
|
165
167
|
editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
|
|
166
|
-
textFormattingState = _ref2.textFormattingState
|
|
168
|
+
textFormattingState = _ref2.textFormattingState,
|
|
169
|
+
api = _ref2.api;
|
|
167
170
|
return jsx(ToolbarFormatting, {
|
|
168
171
|
textFormattingState: textFormattingState,
|
|
169
172
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -174,7 +177,8 @@ var Toolbar = function Toolbar(_ref2) {
|
|
|
174
177
|
isToolbarDisabled: isToolbarDisabled,
|
|
175
178
|
shouldUseResponsiveToolbar: shouldUseResponsiveToolbar,
|
|
176
179
|
intl: intl,
|
|
177
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
180
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
181
|
+
api: api
|
|
178
182
|
});
|
|
179
183
|
};
|
|
180
184
|
export default injectIntl(Toolbar);
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin, TextFormattingOptions, TextFormattingState } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
3
4
|
import type { ToggleMarkEditorCommand } from './commands';
|
|
4
5
|
export type TextFormattingPlugin = NextEditorPlugin<'textFormatting', {
|
|
5
6
|
pluginConfiguration: TextFormattingOptions | undefined;
|
|
6
|
-
dependencies: [
|
|
7
|
+
dependencies: [
|
|
8
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
9
|
+
OptionalPlugin<PrimaryToolbarPlugin>
|
|
10
|
+
];
|
|
7
11
|
commands: {
|
|
8
12
|
toggleSuperscript: ToggleMarkEditorCommand;
|
|
9
13
|
toggleSubscript: ToggleMarkEditorCommand;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { TextFormattingState, ToolbarSize } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { ExtractInjectionAPI, TextFormattingState, ToolbarSize } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { TextFormattingPlugin } from '../../plugin';
|
|
6
7
|
export type ToolbarFormattingProps = {
|
|
7
8
|
editorView: EditorView;
|
|
8
9
|
isToolbarDisabled: boolean;
|
|
@@ -14,6 +15,7 @@ export type ToolbarFormattingProps = {
|
|
|
14
15
|
popupsScrollableElement?: HTMLElement;
|
|
15
16
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
16
17
|
textFormattingState: TextFormattingState | undefined;
|
|
18
|
+
api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
|
|
17
19
|
};
|
|
18
20
|
declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<ToolbarFormattingProps & WrappedComponentProps>> & {
|
|
19
21
|
WrappedComponent: import("react").ComponentType<ToolbarFormattingProps & WrappedComponentProps>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin, TextFormattingOptions, TextFormattingState } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
3
4
|
import type { ToggleMarkEditorCommand } from './commands';
|
|
4
5
|
export type TextFormattingPlugin = NextEditorPlugin<'textFormatting', {
|
|
5
6
|
pluginConfiguration: TextFormattingOptions | undefined;
|
|
6
7
|
dependencies: [
|
|
7
|
-
OptionalPlugin<
|
|
8
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
9
|
+
OptionalPlugin<PrimaryToolbarPlugin>
|
|
8
10
|
];
|
|
9
11
|
commands: {
|
|
10
12
|
toggleSuperscript: ToggleMarkEditorCommand;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { TextFormattingState, ToolbarSize } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { ExtractInjectionAPI, TextFormattingState, ToolbarSize } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { TextFormattingPlugin } from '../../plugin';
|
|
6
7
|
export type ToolbarFormattingProps = {
|
|
7
8
|
editorView: EditorView;
|
|
8
9
|
isToolbarDisabled: boolean;
|
|
@@ -14,6 +15,7 @@ export type ToolbarFormattingProps = {
|
|
|
14
15
|
popupsScrollableElement?: HTMLElement;
|
|
15
16
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
16
17
|
textFormattingState: TextFormattingState | undefined;
|
|
18
|
+
api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
|
|
17
19
|
};
|
|
18
20
|
declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<ToolbarFormattingProps & WrappedComponentProps>> & {
|
|
19
21
|
WrappedComponent: import("react").ComponentType<ToolbarFormattingProps & WrappedComponentProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,13 +32,14 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^36.
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
35
|
+
"@atlaskit/adf-schema": "^36.10.7",
|
|
36
|
+
"@atlaskit/editor-common": "^81.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
38
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^1.1.0",
|
|
38
39
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
39
40
|
"@atlaskit/editor-shared-styles": "^2.11.0",
|
|
40
41
|
"@atlaskit/editor-tables": "^2.7.0",
|
|
41
|
-
"@atlaskit/icon": "^22.
|
|
42
|
+
"@atlaskit/icon": "^22.3.0",
|
|
42
43
|
"@atlaskit/prosemirror-input-rules": "^3.1.0",
|
|
43
44
|
"@babel/runtime": "^7.0.0",
|
|
44
45
|
"@emotion/react": "^11.7.1",
|