@atlaskit/editor-plugin-text-formatting 0.3.1 → 0.3.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 +30 -0
- package/dist/cjs/plugin.js +42 -42
- package/dist/es2019/plugin.js +28 -25
- package/dist/esm/plugin.js +42 -42
- package/package.json +2 -2
- package/tmp/api-report-tmp.d.ts +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8467bdcdf4f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8467bdcdf4f) - Removing `dependencies` prop from PluginInjectionAPI and changing
|
|
8
|
+
signature of `NextEditorPlugin`.
|
|
9
|
+
|
|
10
|
+
Previously a `NextEditorPlugin` would be consumed as so:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const plugin: NextEditorPlugin< ... > = (config, api) => {
|
|
14
|
+
// Can use api like so:
|
|
15
|
+
api.dependencies.core.actions.execute( ... )
|
|
16
|
+
return { ... }
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Now these have become named parameters like so and the `pluginInjectionAPI` is used
|
|
21
|
+
without the `dependencies` prop:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const plugin: NextEditorPlugin< ... > = ({ config, api }) => {
|
|
25
|
+
// Can use api like so:
|
|
26
|
+
api.core.actions.execute( ... )
|
|
27
|
+
return { ... }
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 0.3.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -17,10 +17,10 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
|
17
17
|
var _main = require("./pm-plugins/main");
|
|
18
18
|
var _smartInputRule = _interopRequireDefault(require("./pm-plugins/smart-input-rule"));
|
|
19
19
|
var _Toolbar = _interopRequireDefault(require("./ui/Toolbar"));
|
|
20
|
-
var textFormattingPlugin = function textFormattingPlugin() {
|
|
21
|
-
var _api$
|
|
22
|
-
var options =
|
|
23
|
-
|
|
20
|
+
var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
21
|
+
var _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13;
|
|
22
|
+
var options = _ref.config,
|
|
23
|
+
api = _ref.api;
|
|
24
24
|
return {
|
|
25
25
|
name: 'textFormatting',
|
|
26
26
|
marks: function marks() {
|
|
@@ -33,13 +33,13 @@ var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
33
33
|
}, {
|
|
34
34
|
name: 'strike',
|
|
35
35
|
mark: _adfSchema.strike
|
|
36
|
-
}].concat(options.disableCode ? [] : {
|
|
36
|
+
}].concat(options !== null && options !== void 0 && options.disableCode ? [] : {
|
|
37
37
|
name: 'code',
|
|
38
38
|
mark: _adfSchema.code
|
|
39
|
-
}).concat(options.disableSuperscriptAndSubscript ? [] : {
|
|
39
|
+
}).concat(options !== null && options !== void 0 && options.disableSuperscriptAndSubscript ? [] : {
|
|
40
40
|
name: 'subsup',
|
|
41
41
|
mark: _adfSchema.subsup
|
|
42
|
-
}).concat(options.disableUnderline ? [] : {
|
|
42
|
+
}).concat(options !== null && options !== void 0 && options.disableUnderline ? [] : {
|
|
43
43
|
name: 'underline',
|
|
44
44
|
mark: _adfSchema.underline
|
|
45
45
|
});
|
|
@@ -47,10 +47,10 @@ var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
47
47
|
pmPlugins: function pmPlugins() {
|
|
48
48
|
return [{
|
|
49
49
|
name: 'textFormatting',
|
|
50
|
-
plugin: function plugin(
|
|
51
|
-
var _api$
|
|
52
|
-
var dispatch =
|
|
53
|
-
return (0, _main.plugin)(dispatch, api === null || api === void 0 ? void 0 : (_api$
|
|
50
|
+
plugin: function plugin(_ref2) {
|
|
51
|
+
var _api$analytics;
|
|
52
|
+
var dispatch = _ref2.dispatch;
|
|
53
|
+
return (0, _main.plugin)(dispatch, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
54
54
|
}
|
|
55
55
|
}, {
|
|
56
56
|
name: 'textFormattingCursor',
|
|
@@ -59,35 +59,35 @@ var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
59
59
|
}
|
|
60
60
|
}, {
|
|
61
61
|
name: 'textFormattingInputRule',
|
|
62
|
-
plugin: function plugin(
|
|
63
|
-
var _api$
|
|
64
|
-
var schema =
|
|
65
|
-
return (0, _inputRule.default)(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
62
|
+
plugin: function plugin(_ref3) {
|
|
63
|
+
var _api$analytics2;
|
|
64
|
+
var schema = _ref3.schema;
|
|
65
|
+
return (0, _inputRule.default)(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
66
66
|
}
|
|
67
67
|
}, {
|
|
68
68
|
name: 'textFormattingSmartRule',
|
|
69
69
|
plugin: function plugin() {
|
|
70
|
-
var _api$
|
|
71
|
-
return !options.disableSmartTextCompletion ? (0, _smartInputRule.default)(api === null || api === void 0 ? void 0 : (_api$
|
|
70
|
+
var _api$analytics3;
|
|
71
|
+
return !(options !== null && options !== void 0 && options.disableSmartTextCompletion) ? (0, _smartInputRule.default)(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions) : undefined;
|
|
72
72
|
}
|
|
73
73
|
}, {
|
|
74
74
|
name: 'textFormattingClear',
|
|
75
|
-
plugin: function plugin(
|
|
76
|
-
var dispatch =
|
|
75
|
+
plugin: function plugin(_ref4) {
|
|
76
|
+
var dispatch = _ref4.dispatch;
|
|
77
77
|
return (0, _clearFormatting.plugin)(dispatch);
|
|
78
78
|
}
|
|
79
79
|
}, {
|
|
80
80
|
name: 'textFormattingClearKeymap',
|
|
81
81
|
plugin: function plugin() {
|
|
82
|
-
var _api$
|
|
83
|
-
return (0, _clearFormattingKeymap.default)(api === null || api === void 0 ? void 0 : (_api$
|
|
82
|
+
var _api$analytics4;
|
|
83
|
+
return (0, _clearFormattingKeymap.default)(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
84
84
|
}
|
|
85
85
|
}, {
|
|
86
86
|
name: 'textFormattingKeymap',
|
|
87
|
-
plugin: function plugin(
|
|
88
|
-
var _api$
|
|
89
|
-
var schema =
|
|
90
|
-
return (0, _keymap.default)(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
87
|
+
plugin: function plugin(_ref5) {
|
|
88
|
+
var _api$analytics5;
|
|
89
|
+
var schema = _ref5.schema;
|
|
90
|
+
return (0, _keymap.default)(schema, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
91
91
|
}
|
|
92
92
|
}];
|
|
93
93
|
},
|
|
@@ -97,20 +97,20 @@ var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
97
97
|
}
|
|
98
98
|
return _main.pluginKey.getState(editorState);
|
|
99
99
|
},
|
|
100
|
-
primaryToolbarComponent: function primaryToolbarComponent(
|
|
101
|
-
var editorView =
|
|
102
|
-
popupsMountPoint =
|
|
103
|
-
popupsScrollableElement =
|
|
104
|
-
isToolbarReducedSpacing =
|
|
105
|
-
toolbarSize =
|
|
106
|
-
disabled =
|
|
100
|
+
primaryToolbarComponent: function primaryToolbarComponent(_ref6) {
|
|
101
|
+
var editorView = _ref6.editorView,
|
|
102
|
+
popupsMountPoint = _ref6.popupsMountPoint,
|
|
103
|
+
popupsScrollableElement = _ref6.popupsScrollableElement,
|
|
104
|
+
isToolbarReducedSpacing = _ref6.isToolbarReducedSpacing,
|
|
105
|
+
toolbarSize = _ref6.toolbarSize,
|
|
106
|
+
disabled = _ref6.disabled;
|
|
107
107
|
return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
|
|
108
108
|
plugins: {
|
|
109
109
|
textFormattingState: _main.pluginKey,
|
|
110
110
|
clearFormattingPluginState: _clearFormatting.pluginKey
|
|
111
111
|
},
|
|
112
112
|
render: function render() {
|
|
113
|
-
var _api$
|
|
113
|
+
var _api$analytics6;
|
|
114
114
|
return /*#__PURE__*/_react.default.createElement(_Toolbar.default, {
|
|
115
115
|
editorState: editorView.state,
|
|
116
116
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -119,20 +119,20 @@ var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
119
119
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
120
120
|
editorView: editorView,
|
|
121
121
|
isToolbarDisabled: disabled,
|
|
122
|
-
shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
|
|
123
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$
|
|
122
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu),
|
|
123
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
128
|
commands: {
|
|
129
|
-
toggleSuperscript: (0, _commands.toggleSuperscriptWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$
|
|
130
|
-
toggleSubscript: (0, _commands.toggleSubscriptWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$
|
|
131
|
-
toggleStrike: (0, _commands.toggleStrikeWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$
|
|
132
|
-
toggleCode: (0, _commands.toggleCodeWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$
|
|
133
|
-
toggleUnderline: (0, _commands.toggleUnderlineWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$
|
|
134
|
-
toggleEm: (0, _commands.toggleEmWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$
|
|
135
|
-
toggleStrong: (0, _commands.toggleStrongWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$
|
|
129
|
+
toggleSuperscript: (0, _commands.toggleSuperscriptWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
130
|
+
toggleSubscript: (0, _commands.toggleSubscriptWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions),
|
|
131
|
+
toggleStrike: (0, _commands.toggleStrikeWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$analytics9 = api.analytics) === null || _api$analytics9 === void 0 ? void 0 : _api$analytics9.actions),
|
|
132
|
+
toggleCode: (0, _commands.toggleCodeWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$analytics10 = api.analytics) === null || _api$analytics10 === void 0 ? void 0 : _api$analytics10.actions),
|
|
133
|
+
toggleUnderline: (0, _commands.toggleUnderlineWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$analytics11 = api.analytics) === null || _api$analytics11 === void 0 ? void 0 : _api$analytics11.actions),
|
|
134
|
+
toggleEm: (0, _commands.toggleEmWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$analytics12 = api.analytics) === null || _api$analytics12 === void 0 ? void 0 : _api$analytics12.actions),
|
|
135
|
+
toggleStrong: (0, _commands.toggleStrongWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$analytics13 = api.analytics) === null || _api$analytics13 === void 0 ? void 0 : _api$analytics13.actions)
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
};
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -10,8 +10,11 @@ import keymapPlugin from './pm-plugins/keymap';
|
|
|
10
10
|
import { plugin as pmPlugin, pluginKey as textFormattingPluginKey } from './pm-plugins/main';
|
|
11
11
|
import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
|
|
12
12
|
import Toolbar from './ui/Toolbar';
|
|
13
|
-
export const textFormattingPlugin = (
|
|
14
|
-
|
|
13
|
+
export const textFormattingPlugin = ({
|
|
14
|
+
config: options,
|
|
15
|
+
api
|
|
16
|
+
}) => {
|
|
17
|
+
var _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13;
|
|
15
18
|
return {
|
|
16
19
|
name: 'textFormatting',
|
|
17
20
|
marks() {
|
|
@@ -24,13 +27,13 @@ export const textFormattingPlugin = (options = {}, api) => {
|
|
|
24
27
|
}, {
|
|
25
28
|
name: 'strike',
|
|
26
29
|
mark: strike
|
|
27
|
-
}].concat(options.disableCode ? [] : {
|
|
30
|
+
}].concat(options !== null && options !== void 0 && options.disableCode ? [] : {
|
|
28
31
|
name: 'code',
|
|
29
32
|
mark: code
|
|
30
|
-
}).concat(options.disableSuperscriptAndSubscript ? [] : {
|
|
33
|
+
}).concat(options !== null && options !== void 0 && options.disableSuperscriptAndSubscript ? [] : {
|
|
31
34
|
name: 'subsup',
|
|
32
35
|
mark: subsup
|
|
33
|
-
}).concat(options.disableUnderline ? [] : {
|
|
36
|
+
}).concat(options !== null && options !== void 0 && options.disableUnderline ? [] : {
|
|
34
37
|
name: 'underline',
|
|
35
38
|
mark: underline
|
|
36
39
|
});
|
|
@@ -41,8 +44,8 @@ export const textFormattingPlugin = (options = {}, api) => {
|
|
|
41
44
|
plugin: ({
|
|
42
45
|
dispatch
|
|
43
46
|
}) => {
|
|
44
|
-
var _api$
|
|
45
|
-
return pmPlugin(dispatch, api === null || api === void 0 ? void 0 : (_api$
|
|
47
|
+
var _api$analytics;
|
|
48
|
+
return pmPlugin(dispatch, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
46
49
|
}
|
|
47
50
|
}, {
|
|
48
51
|
name: 'textFormattingCursor',
|
|
@@ -52,14 +55,14 @@ export const textFormattingPlugin = (options = {}, api) => {
|
|
|
52
55
|
plugin: ({
|
|
53
56
|
schema
|
|
54
57
|
}) => {
|
|
55
|
-
var _api$
|
|
56
|
-
return textFormattingInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
58
|
+
var _api$analytics2;
|
|
59
|
+
return textFormattingInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
57
60
|
}
|
|
58
61
|
}, {
|
|
59
62
|
name: 'textFormattingSmartRule',
|
|
60
63
|
plugin: () => {
|
|
61
|
-
var _api$
|
|
62
|
-
return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
64
|
+
var _api$analytics3;
|
|
65
|
+
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;
|
|
63
66
|
}
|
|
64
67
|
}, {
|
|
65
68
|
name: 'textFormattingClear',
|
|
@@ -69,16 +72,16 @@ export const textFormattingPlugin = (options = {}, api) => {
|
|
|
69
72
|
}, {
|
|
70
73
|
name: 'textFormattingClearKeymap',
|
|
71
74
|
plugin: () => {
|
|
72
|
-
var _api$
|
|
73
|
-
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
75
|
+
var _api$analytics4;
|
|
76
|
+
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
74
77
|
}
|
|
75
78
|
}, {
|
|
76
79
|
name: 'textFormattingKeymap',
|
|
77
80
|
plugin: ({
|
|
78
81
|
schema
|
|
79
82
|
}) => {
|
|
80
|
-
var _api$
|
|
81
|
-
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
83
|
+
var _api$analytics5;
|
|
84
|
+
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
82
85
|
}
|
|
83
86
|
}];
|
|
84
87
|
},
|
|
@@ -102,7 +105,7 @@ export const textFormattingPlugin = (options = {}, api) => {
|
|
|
102
105
|
clearFormattingPluginState: clearFormattingPluginKey
|
|
103
106
|
},
|
|
104
107
|
render: () => {
|
|
105
|
-
var _api$
|
|
108
|
+
var _api$analytics6;
|
|
106
109
|
return /*#__PURE__*/React.createElement(Toolbar, {
|
|
107
110
|
editorState: editorView.state,
|
|
108
111
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -111,20 +114,20 @@ export const textFormattingPlugin = (options = {}, api) => {
|
|
|
111
114
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
112
115
|
editorView: editorView,
|
|
113
116
|
isToolbarDisabled: disabled,
|
|
114
|
-
shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
|
|
115
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$
|
|
117
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu),
|
|
118
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions
|
|
116
119
|
});
|
|
117
120
|
}
|
|
118
121
|
});
|
|
119
122
|
},
|
|
120
123
|
commands: {
|
|
121
|
-
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
122
|
-
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
123
|
-
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
124
|
-
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
125
|
-
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
126
|
-
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
127
|
-
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
124
|
+
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
125
|
+
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions),
|
|
126
|
+
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics9 = api.analytics) === null || _api$analytics9 === void 0 ? void 0 : _api$analytics9.actions),
|
|
127
|
+
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics10 = api.analytics) === null || _api$analytics10 === void 0 ? void 0 : _api$analytics10.actions),
|
|
128
|
+
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics11 = api.analytics) === null || _api$analytics11 === void 0 ? void 0 : _api$analytics11.actions),
|
|
129
|
+
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics12 = api.analytics) === null || _api$analytics12 === void 0 ? void 0 : _api$analytics12.actions),
|
|
130
|
+
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics13 = api.analytics) === null || _api$analytics13 === void 0 ? void 0 : _api$analytics13.actions)
|
|
128
131
|
}
|
|
129
132
|
};
|
|
130
133
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -10,10 +10,10 @@ import keymapPlugin from './pm-plugins/keymap';
|
|
|
10
10
|
import { plugin as pmPlugin, pluginKey as textFormattingPluginKey } from './pm-plugins/main';
|
|
11
11
|
import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
|
|
12
12
|
import Toolbar from './ui/Toolbar';
|
|
13
|
-
export var textFormattingPlugin = function textFormattingPlugin() {
|
|
14
|
-
var _api$
|
|
15
|
-
var options =
|
|
16
|
-
|
|
13
|
+
export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
14
|
+
var _api$analytics7, _api$analytics8, _api$analytics9, _api$analytics10, _api$analytics11, _api$analytics12, _api$analytics13;
|
|
15
|
+
var options = _ref.config,
|
|
16
|
+
api = _ref.api;
|
|
17
17
|
return {
|
|
18
18
|
name: 'textFormatting',
|
|
19
19
|
marks: function marks() {
|
|
@@ -26,13 +26,13 @@ export var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
26
26
|
}, {
|
|
27
27
|
name: 'strike',
|
|
28
28
|
mark: strike
|
|
29
|
-
}].concat(options.disableCode ? [] : {
|
|
29
|
+
}].concat(options !== null && options !== void 0 && options.disableCode ? [] : {
|
|
30
30
|
name: 'code',
|
|
31
31
|
mark: code
|
|
32
|
-
}).concat(options.disableSuperscriptAndSubscript ? [] : {
|
|
32
|
+
}).concat(options !== null && options !== void 0 && options.disableSuperscriptAndSubscript ? [] : {
|
|
33
33
|
name: 'subsup',
|
|
34
34
|
mark: subsup
|
|
35
|
-
}).concat(options.disableUnderline ? [] : {
|
|
35
|
+
}).concat(options !== null && options !== void 0 && options.disableUnderline ? [] : {
|
|
36
36
|
name: 'underline',
|
|
37
37
|
mark: underline
|
|
38
38
|
});
|
|
@@ -40,10 +40,10 @@ export var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
40
40
|
pmPlugins: function pmPlugins() {
|
|
41
41
|
return [{
|
|
42
42
|
name: 'textFormatting',
|
|
43
|
-
plugin: function plugin(
|
|
44
|
-
var _api$
|
|
45
|
-
var dispatch =
|
|
46
|
-
return pmPlugin(dispatch, api === null || api === void 0 ? void 0 : (_api$
|
|
43
|
+
plugin: function plugin(_ref2) {
|
|
44
|
+
var _api$analytics;
|
|
45
|
+
var dispatch = _ref2.dispatch;
|
|
46
|
+
return pmPlugin(dispatch, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
47
47
|
}
|
|
48
48
|
}, {
|
|
49
49
|
name: 'textFormattingCursor',
|
|
@@ -52,35 +52,35 @@ export var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
52
52
|
}
|
|
53
53
|
}, {
|
|
54
54
|
name: 'textFormattingInputRule',
|
|
55
|
-
plugin: function plugin(
|
|
56
|
-
var _api$
|
|
57
|
-
var schema =
|
|
58
|
-
return textFormattingInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
55
|
+
plugin: function plugin(_ref3) {
|
|
56
|
+
var _api$analytics2;
|
|
57
|
+
var schema = _ref3.schema;
|
|
58
|
+
return textFormattingInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
59
59
|
}
|
|
60
60
|
}, {
|
|
61
61
|
name: 'textFormattingSmartRule',
|
|
62
62
|
plugin: function plugin() {
|
|
63
|
-
var _api$
|
|
64
|
-
return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
63
|
+
var _api$analytics3;
|
|
64
|
+
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;
|
|
65
65
|
}
|
|
66
66
|
}, {
|
|
67
67
|
name: 'textFormattingClear',
|
|
68
|
-
plugin: function plugin(
|
|
69
|
-
var dispatch =
|
|
68
|
+
plugin: function plugin(_ref4) {
|
|
69
|
+
var dispatch = _ref4.dispatch;
|
|
70
70
|
return clearFormattingPlugin(dispatch);
|
|
71
71
|
}
|
|
72
72
|
}, {
|
|
73
73
|
name: 'textFormattingClearKeymap',
|
|
74
74
|
plugin: function plugin() {
|
|
75
|
-
var _api$
|
|
76
|
-
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
75
|
+
var _api$analytics4;
|
|
76
|
+
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
77
77
|
}
|
|
78
78
|
}, {
|
|
79
79
|
name: 'textFormattingKeymap',
|
|
80
|
-
plugin: function plugin(
|
|
81
|
-
var _api$
|
|
82
|
-
var schema =
|
|
83
|
-
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
80
|
+
plugin: function plugin(_ref5) {
|
|
81
|
+
var _api$analytics5;
|
|
82
|
+
var schema = _ref5.schema;
|
|
83
|
+
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
84
84
|
}
|
|
85
85
|
}];
|
|
86
86
|
},
|
|
@@ -90,20 +90,20 @@ export var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
90
90
|
}
|
|
91
91
|
return textFormattingPluginKey.getState(editorState);
|
|
92
92
|
},
|
|
93
|
-
primaryToolbarComponent: function primaryToolbarComponent(
|
|
94
|
-
var editorView =
|
|
95
|
-
popupsMountPoint =
|
|
96
|
-
popupsScrollableElement =
|
|
97
|
-
isToolbarReducedSpacing =
|
|
98
|
-
toolbarSize =
|
|
99
|
-
disabled =
|
|
93
|
+
primaryToolbarComponent: function primaryToolbarComponent(_ref6) {
|
|
94
|
+
var editorView = _ref6.editorView,
|
|
95
|
+
popupsMountPoint = _ref6.popupsMountPoint,
|
|
96
|
+
popupsScrollableElement = _ref6.popupsScrollableElement,
|
|
97
|
+
isToolbarReducedSpacing = _ref6.isToolbarReducedSpacing,
|
|
98
|
+
toolbarSize = _ref6.toolbarSize,
|
|
99
|
+
disabled = _ref6.disabled;
|
|
100
100
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
101
101
|
plugins: {
|
|
102
102
|
textFormattingState: textFormattingPluginKey,
|
|
103
103
|
clearFormattingPluginState: clearFormattingPluginKey
|
|
104
104
|
},
|
|
105
105
|
render: function render() {
|
|
106
|
-
var _api$
|
|
106
|
+
var _api$analytics6;
|
|
107
107
|
return /*#__PURE__*/React.createElement(Toolbar, {
|
|
108
108
|
editorState: editorView.state,
|
|
109
109
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -112,20 +112,20 @@ export var textFormattingPlugin = function textFormattingPlugin() {
|
|
|
112
112
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
113
113
|
editorView: editorView,
|
|
114
114
|
isToolbarDisabled: disabled,
|
|
115
|
-
shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
|
|
116
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$
|
|
115
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu),
|
|
116
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
},
|
|
121
121
|
commands: {
|
|
122
|
-
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
123
|
-
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
124
|
-
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
125
|
-
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
126
|
-
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
127
|
-
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
128
|
-
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$
|
|
122
|
+
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions),
|
|
123
|
+
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions),
|
|
124
|
+
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics9 = api.analytics) === null || _api$analytics9 === void 0 ? void 0 : _api$analytics9.actions),
|
|
125
|
+
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics10 = api.analytics) === null || _api$analytics10 === void 0 ? void 0 : _api$analytics10.actions),
|
|
126
|
+
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics11 = api.analytics) === null || _api$analytics11 === void 0 ? void 0 : _api$analytics11.actions),
|
|
127
|
+
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics12 = api.analytics) === null || _api$analytics12 === void 0 ? void 0 : _api$analytics12.actions),
|
|
128
|
+
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics13 = api.analytics) === null || _api$analytics13 === void 0 ? void 0 : _api$analytics13.actions)
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "28.1.2",
|
|
35
|
-
"@atlaskit/editor-common": "^74.
|
|
35
|
+
"@atlaskit/editor-common": "^74.53.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^2.5.0",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/editor-plugin-text-formatting"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
8
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { InputMethodBasic } from '@atlaskit/editor-common/types';
|
|
10
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
11
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
12
|
+
import type { TextFormattingOptions } from '@atlaskit/editor-common/types';
|
|
13
|
+
import type { TextFormattingState } from '@atlaskit/editor-common/types';
|
|
14
|
+
|
|
15
|
+
// @public (undocumented)
|
|
16
|
+
export type TextFormattingPlugin = NextEditorPlugin<'textFormatting', {
|
|
17
|
+
pluginConfiguration: TextFormattingOptions | undefined;
|
|
18
|
+
dependencies: [OptionalPlugin<typeof analyticsPlugin>];
|
|
19
|
+
commands: {
|
|
20
|
+
toggleSuperscript: ToggleMarkEditorCommand;
|
|
21
|
+
toggleSubscript: ToggleMarkEditorCommand;
|
|
22
|
+
toggleStrike: ToggleMarkEditorCommand;
|
|
23
|
+
toggleCode: ToggleMarkEditorCommand;
|
|
24
|
+
toggleUnderline: ToggleMarkEditorCommand;
|
|
25
|
+
toggleEm: ToggleMarkEditorCommand;
|
|
26
|
+
toggleStrong: ToggleMarkEditorCommand;
|
|
27
|
+
};
|
|
28
|
+
sharedState: TextFormattingState | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
|
|
31
|
+
// @public (undocumented)
|
|
32
|
+
export const textFormattingPlugin: TextFormattingPlugin;
|
|
33
|
+
|
|
34
|
+
// @public (undocumented)
|
|
35
|
+
export type ToggleMarkEditorCommand = (inputMethod: InputMethodBasic) => EditorCommand;
|
|
36
|
+
|
|
37
|
+
// (No @packageDocumentation comment for this package)
|
|
38
|
+
|
|
39
|
+
```
|