@atlaskit/editor-core 187.3.6 → 187.4.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 +12 -0
- package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +105 -88
- package/dist/cjs/plugins/text-formatting/index.js +8 -6
- package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +5 -5
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +64 -59
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +2 -1
- package/dist/cjs/ui/ColorPickerButton/index.js +8 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +18 -17
- package/dist/es2019/plugins/text-formatting/index.js +12 -6
- package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +5 -5
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +24 -21
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +2 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +13 -5
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/text-formatting/commands/text-formatting.js +105 -88
- package/dist/esm/plugins/text-formatting/index.js +8 -6
- package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/esm/plugins/text-formatting/pm-plugins/main.js +5 -5
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +64 -59
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +2 -1
- package/dist/esm/ui/ColorPickerButton/index.js +9 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +9 -9
- package/dist/types/plugins/text-formatting/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +8 -3
- package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +9 -9
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +8 -3
- package/package.json +3 -3
- package/report.api.md +21 -7
- package/tmp/api-report-tmp.d.ts +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e64541c6fda`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e64541c6fda) - [ux] [ED-18759] Updated table border, handlebar controls, blanket, icon, icon background and table cell options button colour tokens on light and dark theme for table selection and table deletion. Borders for Table Floating Contextual Button & Floating toolbar color palette button on dark & light theme are also updated.
|
|
8
|
+
|
|
9
|
+
## 187.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`315332d1509`](https://bitbucket.org/atlassian/atlassian-frontend/commits/315332d1509) - Converts the existing withAnalytics events within the text-formatting to use the new EditorAnalyticsAPI instead
|
|
14
|
+
|
|
3
15
|
## 187.3.6
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.toggleUnderlineWithAnalytics = exports.toggleUnderline = exports.toggleSuperscriptWithAnalytics = exports.toggleSuperscript = exports.toggleSubscriptWithAnalytics = exports.toggleSubscript = exports.toggleStrongWithAnalytics = exports.toggleStrong = exports.toggleStrikeWithAnalytics = exports.toggleStrike = exports.toggleEmWithAnalytics = exports.toggleEm = exports.toggleCodeWithAnalytics = exports.toggleCode = exports.moveRight = exports.moveLeft = exports.createInlineCodeFromTextInputWithAnalytics = void 0;
|
|
7
7
|
var _prosemirrorState = require("prosemirror-state");
|
|
8
8
|
var _commands = require("../../../utils/commands");
|
|
9
|
-
var _analytics = require("
|
|
9
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _utils = require("../utils");
|
|
11
|
+
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
11
12
|
var moveRight = function moveRight() {
|
|
12
13
|
return function (state, dispatch) {
|
|
13
14
|
var code = state.schema.marks.code;
|
|
@@ -114,17 +115,19 @@ var toggleEm = function toggleEm() {
|
|
|
114
115
|
};
|
|
115
116
|
};
|
|
116
117
|
exports.toggleEm = toggleEm;
|
|
117
|
-
var toggleEmWithAnalytics = function toggleEmWithAnalytics(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
118
|
+
var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsAPI) {
|
|
119
|
+
return function (_ref3) {
|
|
120
|
+
var inputMethod = _ref3.inputMethod;
|
|
121
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
122
|
+
action: _analytics.ACTION.FORMATTED,
|
|
123
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
124
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
125
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
|
126
|
+
attributes: {
|
|
127
|
+
inputMethod: inputMethod
|
|
128
|
+
}
|
|
129
|
+
})(toggleEm());
|
|
130
|
+
};
|
|
128
131
|
};
|
|
129
132
|
exports.toggleEmWithAnalytics = toggleEmWithAnalytics;
|
|
130
133
|
var toggleStrike = function toggleStrike() {
|
|
@@ -137,17 +140,19 @@ var toggleStrike = function toggleStrike() {
|
|
|
137
140
|
};
|
|
138
141
|
};
|
|
139
142
|
exports.toggleStrike = toggleStrike;
|
|
140
|
-
var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyticsAPI) {
|
|
144
|
+
return function (_ref4) {
|
|
145
|
+
var inputMethod = _ref4.inputMethod;
|
|
146
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
147
|
+
action: _analytics.ACTION.FORMATTED,
|
|
148
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
149
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
150
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_STRIKE,
|
|
151
|
+
attributes: {
|
|
152
|
+
inputMethod: inputMethod
|
|
153
|
+
}
|
|
154
|
+
})(toggleStrike());
|
|
155
|
+
};
|
|
151
156
|
};
|
|
152
157
|
exports.toggleStrikeWithAnalytics = toggleStrikeWithAnalytics;
|
|
153
158
|
var toggleStrong = function toggleStrong() {
|
|
@@ -160,17 +165,19 @@ var toggleStrong = function toggleStrong() {
|
|
|
160
165
|
};
|
|
161
166
|
};
|
|
162
167
|
exports.toggleStrong = toggleStrong;
|
|
163
|
-
var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyticsAPI) {
|
|
169
|
+
return function (_ref5) {
|
|
170
|
+
var inputMethod = _ref5.inputMethod;
|
|
171
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
172
|
+
action: _analytics.ACTION.FORMATTED,
|
|
173
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
174
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
175
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_STRONG,
|
|
176
|
+
attributes: {
|
|
177
|
+
inputMethod: inputMethod
|
|
178
|
+
}
|
|
179
|
+
})(toggleStrong());
|
|
180
|
+
};
|
|
174
181
|
};
|
|
175
182
|
exports.toggleStrongWithAnalytics = toggleStrongWithAnalytics;
|
|
176
183
|
var toggleUnderline = function toggleUnderline() {
|
|
@@ -183,17 +190,19 @@ var toggleUnderline = function toggleUnderline() {
|
|
|
183
190
|
};
|
|
184
191
|
};
|
|
185
192
|
exports.toggleUnderline = toggleUnderline;
|
|
186
|
-
var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorAnalyticsAPI) {
|
|
194
|
+
return function (_ref6) {
|
|
195
|
+
var inputMethod = _ref6.inputMethod;
|
|
196
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
197
|
+
action: _analytics.ACTION.FORMATTED,
|
|
198
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
199
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
200
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
|
|
201
|
+
attributes: {
|
|
202
|
+
inputMethod: inputMethod
|
|
203
|
+
}
|
|
204
|
+
})(toggleUnderline());
|
|
205
|
+
};
|
|
197
206
|
};
|
|
198
207
|
exports.toggleUnderlineWithAnalytics = toggleUnderlineWithAnalytics;
|
|
199
208
|
var toggleSuperscript = function toggleSuperscript() {
|
|
@@ -208,17 +217,19 @@ var toggleSuperscript = function toggleSuperscript() {
|
|
|
208
217
|
};
|
|
209
218
|
};
|
|
210
219
|
exports.toggleSuperscript = toggleSuperscript;
|
|
211
|
-
var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(editorAnalyticsAPI) {
|
|
221
|
+
return function (_ref7) {
|
|
222
|
+
var inputMethod = _ref7.inputMethod;
|
|
223
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
224
|
+
action: _analytics.ACTION.FORMATTED,
|
|
225
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
226
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
227
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_SUPER,
|
|
228
|
+
attributes: {
|
|
229
|
+
inputMethod: inputMethod
|
|
230
|
+
}
|
|
231
|
+
})(toggleSuperscript());
|
|
232
|
+
};
|
|
222
233
|
};
|
|
223
234
|
exports.toggleSuperscriptWithAnalytics = toggleSuperscriptWithAnalytics;
|
|
224
235
|
var toggleSubscript = function toggleSubscript() {
|
|
@@ -233,17 +244,19 @@ var toggleSubscript = function toggleSubscript() {
|
|
|
233
244
|
};
|
|
234
245
|
};
|
|
235
246
|
exports.toggleSubscript = toggleSubscript;
|
|
236
|
-
var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorAnalyticsAPI) {
|
|
248
|
+
return function (_ref8) {
|
|
249
|
+
var inputMethod = _ref8.inputMethod;
|
|
250
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
251
|
+
action: _analytics.ACTION.FORMATTED,
|
|
252
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
253
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
254
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_SUB,
|
|
255
|
+
attributes: {
|
|
256
|
+
inputMethod: inputMethod
|
|
257
|
+
}
|
|
258
|
+
})(toggleSubscript());
|
|
259
|
+
};
|
|
247
260
|
};
|
|
248
261
|
exports.toggleSubscriptWithAnalytics = toggleSubscriptWithAnalytics;
|
|
249
262
|
var toggleCode = function toggleCode() {
|
|
@@ -256,17 +269,19 @@ var toggleCode = function toggleCode() {
|
|
|
256
269
|
};
|
|
257
270
|
};
|
|
258
271
|
exports.toggleCode = toggleCode;
|
|
259
|
-
var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
272
|
+
var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsAPI) {
|
|
273
|
+
return function (_ref9) {
|
|
274
|
+
var inputMethod = _ref9.inputMethod;
|
|
275
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
276
|
+
action: _analytics.ACTION.FORMATTED,
|
|
277
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
278
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
279
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
280
|
+
attributes: {
|
|
281
|
+
inputMethod: inputMethod
|
|
282
|
+
}
|
|
283
|
+
})(toggleCode());
|
|
284
|
+
};
|
|
270
285
|
};
|
|
271
286
|
exports.toggleCodeWithAnalytics = toggleCodeWithAnalytics;
|
|
272
287
|
var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from, to, text) {
|
|
@@ -291,15 +306,17 @@ var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from,
|
|
|
291
306
|
return false;
|
|
292
307
|
};
|
|
293
308
|
};
|
|
294
|
-
var createInlineCodeFromTextInputWithAnalytics = function createInlineCodeFromTextInputWithAnalytics(
|
|
295
|
-
return (
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
309
|
+
var createInlineCodeFromTextInputWithAnalytics = function createInlineCodeFromTextInputWithAnalytics(editorAnalyticsAPI) {
|
|
310
|
+
return function (from, to, text) {
|
|
311
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
312
|
+
action: _analytics.ACTION.FORMATTED,
|
|
313
|
+
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
314
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
315
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
316
|
+
attributes: {
|
|
317
|
+
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
318
|
+
}
|
|
319
|
+
})(createInlineCodeFromTextInput(from, to, text));
|
|
320
|
+
};
|
|
304
321
|
};
|
|
305
322
|
exports.createInlineCodeFromTextInputWithAnalytics = createInlineCodeFromTextInputWithAnalytics;
|
|
@@ -46,8 +46,9 @@ var textFormatting = function textFormatting() {
|
|
|
46
46
|
return [{
|
|
47
47
|
name: 'textFormatting',
|
|
48
48
|
plugin: function plugin(_ref) {
|
|
49
|
+
var _api$dependencies$ana;
|
|
49
50
|
var dispatch = _ref.dispatch;
|
|
50
|
-
return (0, _main.plugin)(dispatch);
|
|
51
|
+
return (0, _main.plugin)(dispatch, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
|
|
51
52
|
}
|
|
52
53
|
}, {
|
|
53
54
|
name: 'textFormattingCursor',
|
|
@@ -76,14 +77,15 @@ var textFormatting = function textFormatting() {
|
|
|
76
77
|
}, {
|
|
77
78
|
name: 'textFormattingClearKeymap',
|
|
78
79
|
plugin: function plugin() {
|
|
79
|
-
var _api$dependencies$
|
|
80
|
-
return (0, _clearFormattingKeymap.default)(api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
80
|
+
var _api$dependencies$ana2;
|
|
81
|
+
return (0, _clearFormattingKeymap.default)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
|
|
81
82
|
}
|
|
82
83
|
}, {
|
|
83
84
|
name: 'textFormattingKeymap',
|
|
84
85
|
plugin: function plugin(_ref5) {
|
|
86
|
+
var _api$dependencies$ana3;
|
|
85
87
|
var schema = _ref5.schema;
|
|
86
|
-
return (0, _keymap.default)(schema);
|
|
88
|
+
return (0, _keymap.default)(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions);
|
|
87
89
|
}
|
|
88
90
|
}];
|
|
89
91
|
},
|
|
@@ -100,7 +102,7 @@ var textFormatting = function textFormatting() {
|
|
|
100
102
|
clearFormattingPluginState: _clearFormatting.pluginKey
|
|
101
103
|
},
|
|
102
104
|
render: function render() {
|
|
103
|
-
var _api$dependencies$
|
|
105
|
+
var _api$dependencies$ana4;
|
|
104
106
|
return /*#__PURE__*/_react.default.createElement(_Toolbar.default, {
|
|
105
107
|
editorState: editorView.state,
|
|
106
108
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -110,7 +112,7 @@ var textFormatting = function textFormatting() {
|
|
|
110
112
|
editorView: editorView,
|
|
111
113
|
isToolbarDisabled: disabled,
|
|
112
114
|
shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
|
|
113
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
115
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
118
|
});
|
|
@@ -11,40 +11,40 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
11
11
|
var commands = _interopRequireWildcard(require("../commands/text-formatting"));
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
function keymapPlugin(schema) {
|
|
14
|
+
function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
15
15
|
var list = {};
|
|
16
16
|
if (schema.marks.strong) {
|
|
17
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, commands.toggleStrongWithAnalytics({
|
|
17
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, commands.toggleStrongWithAnalytics(editorAnalyticsAPI)({
|
|
18
18
|
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
19
19
|
}), list);
|
|
20
20
|
}
|
|
21
21
|
if (schema.marks.em) {
|
|
22
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, commands.toggleEmWithAnalytics({
|
|
22
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, commands.toggleEmWithAnalytics(editorAnalyticsAPI)({
|
|
23
23
|
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
24
24
|
}), list);
|
|
25
25
|
}
|
|
26
26
|
if (schema.marks.code) {
|
|
27
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, commands.toggleCodeWithAnalytics({
|
|
27
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, commands.toggleCodeWithAnalytics(editorAnalyticsAPI)({
|
|
28
28
|
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
29
29
|
}), list);
|
|
30
30
|
}
|
|
31
31
|
if (schema.marks.strike) {
|
|
32
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, commands.toggleStrikeWithAnalytics({
|
|
32
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)({
|
|
33
33
|
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
34
34
|
}), list);
|
|
35
35
|
}
|
|
36
36
|
if (schema.marks.subsup) {
|
|
37
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, commands.toggleSubscriptWithAnalytics({
|
|
37
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)({
|
|
38
38
|
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
39
39
|
}), list);
|
|
40
40
|
}
|
|
41
41
|
if (schema.marks.subsup) {
|
|
42
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, commands.toggleSuperscriptWithAnalytics({
|
|
42
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)({
|
|
43
43
|
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
44
44
|
}), list);
|
|
45
45
|
}
|
|
46
46
|
if (schema.marks.underline) {
|
|
47
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, commands.toggleUnderlineWithAnalytics({
|
|
47
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)({
|
|
48
48
|
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
49
49
|
}), list);
|
|
50
50
|
}
|
|
@@ -22,7 +22,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
22
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
23
|
// eslint-disable-next-line no-duplicate-imports
|
|
24
24
|
|
|
25
|
-
var getTextFormattingState = function getTextFormattingState(editorState) {
|
|
25
|
+
var getTextFormattingState = function getTextFormattingState(editorState, editorAnalyticsAPI) {
|
|
26
26
|
var _editorState$schema$m = editorState.schema.marks,
|
|
27
27
|
em = _editorState$schema$m.em,
|
|
28
28
|
code = _editorState$schema$m.code,
|
|
@@ -69,14 +69,14 @@ var getTextFormattingState = function getTextFormattingState(editorState) {
|
|
|
69
69
|
}
|
|
70
70
|
return state;
|
|
71
71
|
};
|
|
72
|
-
var plugin = function plugin(dispatch) {
|
|
72
|
+
var plugin = function plugin(dispatch, editorAnalyticsAPI) {
|
|
73
73
|
return new _safePlugin.SafePlugin({
|
|
74
74
|
state: {
|
|
75
75
|
init: function init(_config, state) {
|
|
76
|
-
return getTextFormattingState(state);
|
|
76
|
+
return getTextFormattingState(state, editorAnalyticsAPI);
|
|
77
77
|
},
|
|
78
78
|
apply: function apply(_tr, pluginState, _oldState, newState) {
|
|
79
|
-
var state = getTextFormattingState(newState);
|
|
79
|
+
var state = getTextFormattingState(newState, editorAnalyticsAPI);
|
|
80
80
|
if (!(0, _utils.shallowEqual)(pluginState, state)) {
|
|
81
81
|
dispatch(_pluginKey.pluginKey, state);
|
|
82
82
|
return state;
|
|
@@ -102,7 +102,7 @@ var plugin = function plugin(dispatch) {
|
|
|
102
102
|
var schema = state.schema,
|
|
103
103
|
parentNodeType = state.selection.$from.parent.type;
|
|
104
104
|
if (parentNodeType.allowsMarkType(schema.marks.code)) {
|
|
105
|
-
return (0, commands.createInlineCodeFromTextInputWithAnalytics)(from, to, text)(state, dispatch);
|
|
105
|
+
return (0, commands.createInlineCodeFromTextInputWithAnalytics)(editorAnalyticsAPI)(from, to, text)(state, dispatch);
|
|
106
106
|
}
|
|
107
107
|
return false;
|
|
108
108
|
}
|
|
@@ -29,61 +29,64 @@ var withToolbarInputMethod = function withToolbarInputMethod(func) {
|
|
|
29
29
|
inputMethod: _enums.INPUT_METHOD.TOOLBAR
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
-
var IconButtons = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
var IconButtons = function IconButtons(editorAnalyticsAPI) {
|
|
33
|
+
return {
|
|
34
|
+
strong: {
|
|
35
|
+
buttonId: _toolbarButton.TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
|
|
36
|
+
command: withToolbarInputMethod(commands.toggleStrongWithAnalytics(editorAnalyticsAPI)),
|
|
37
|
+
message: _toolbarMessages.toolbarMessages.bold,
|
|
38
|
+
tooltipKeymap: _keymaps.toggleBold,
|
|
39
|
+
component: function component() {
|
|
40
|
+
return (0, _react2.jsx)(_bold.default, {
|
|
41
|
+
label: ""
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
em: {
|
|
46
|
+
buttonId: _toolbarButton.TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
|
|
47
|
+
command: withToolbarInputMethod(commands.toggleEmWithAnalytics(editorAnalyticsAPI)),
|
|
48
|
+
message: _toolbarMessages.toolbarMessages.italic,
|
|
49
|
+
tooltipKeymap: _keymaps.toggleItalic,
|
|
50
|
+
component: function component() {
|
|
51
|
+
return (0, _react2.jsx)(_italic.default, {
|
|
52
|
+
label: ""
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
underline: {
|
|
57
|
+
command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
|
|
58
|
+
message: _toolbarMessages.toolbarMessages.underline,
|
|
59
|
+
tooltipKeymap: _keymaps.toggleUnderline
|
|
60
|
+
},
|
|
61
|
+
strike: {
|
|
62
|
+
command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)),
|
|
63
|
+
message: _toolbarMessages.toolbarMessages.strike,
|
|
64
|
+
tooltipKeymap: _keymaps.toggleStrikethrough
|
|
65
|
+
},
|
|
66
|
+
code: {
|
|
67
|
+
command: withToolbarInputMethod(commands.toggleCodeWithAnalytics(editorAnalyticsAPI)),
|
|
68
|
+
message: _toolbarMessages.toolbarMessages.code,
|
|
69
|
+
tooltipKeymap: _keymaps.toggleCode
|
|
70
|
+
},
|
|
71
|
+
subscript: {
|
|
72
|
+
command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
|
|
73
|
+
message: _toolbarMessages.toolbarMessages.subscript,
|
|
74
|
+
tooltipKeymap: _keymaps.toggleSubscript
|
|
75
|
+
},
|
|
76
|
+
superscript: {
|
|
77
|
+
command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
|
|
78
|
+
message: _toolbarMessages.toolbarMessages.superscript,
|
|
79
|
+
tooltipKeymap: _keymaps.toggleSuperscript
|
|
53
80
|
}
|
|
54
|
-
}
|
|
55
|
-
underline: {
|
|
56
|
-
command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics),
|
|
57
|
-
message: _toolbarMessages.toolbarMessages.underline,
|
|
58
|
-
tooltipKeymap: _keymaps.toggleUnderline
|
|
59
|
-
},
|
|
60
|
-
strike: {
|
|
61
|
-
command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics),
|
|
62
|
-
message: _toolbarMessages.toolbarMessages.strike,
|
|
63
|
-
tooltipKeymap: _keymaps.toggleStrikethrough
|
|
64
|
-
},
|
|
65
|
-
code: {
|
|
66
|
-
command: withToolbarInputMethod(commands.toggleCodeWithAnalytics),
|
|
67
|
-
message: _toolbarMessages.toolbarMessages.code,
|
|
68
|
-
tooltipKeymap: _keymaps.toggleCode
|
|
69
|
-
},
|
|
70
|
-
subscript: {
|
|
71
|
-
command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics),
|
|
72
|
-
message: _toolbarMessages.toolbarMessages.subscript,
|
|
73
|
-
tooltipKeymap: _keymaps.toggleSubscript
|
|
74
|
-
},
|
|
75
|
-
superscript: {
|
|
76
|
-
command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics),
|
|
77
|
-
message: _toolbarMessages.toolbarMessages.superscript,
|
|
78
|
-
tooltipKeymap: _keymaps.toggleSuperscript
|
|
79
|
-
}
|
|
81
|
+
};
|
|
80
82
|
};
|
|
81
83
|
var getIcon = function getIcon(_ref) {
|
|
82
84
|
var iconType = _ref.iconType,
|
|
83
85
|
isDisabled = _ref.isDisabled,
|
|
84
86
|
isActive = _ref.isActive,
|
|
85
|
-
intl = _ref.intl
|
|
86
|
-
|
|
87
|
+
intl = _ref.intl,
|
|
88
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI;
|
|
89
|
+
var icon = IconButtons(editorAnalyticsAPI)[iconType];
|
|
87
90
|
var content = intl.formatMessage(icon.message);
|
|
88
91
|
var tooltipKeymap = icon.tooltipKeymap;
|
|
89
92
|
return {
|
|
@@ -136,7 +139,7 @@ var buildMenuIconState = function buildMenuIconState(iconMark) {
|
|
|
136
139
|
};
|
|
137
140
|
};
|
|
138
141
|
};
|
|
139
|
-
var buildIcon = function buildIcon(iconMark) {
|
|
142
|
+
var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI) {
|
|
140
143
|
var getState = buildMenuIconState(iconMark);
|
|
141
144
|
return function (_ref3) {
|
|
142
145
|
var schema = _ref3.schema,
|
|
@@ -156,7 +159,8 @@ var buildIcon = function buildIcon(iconMark) {
|
|
|
156
159
|
iconType: _types.IconTypes[iconMark],
|
|
157
160
|
isDisabled: isToolbarDisabled || isDisabled,
|
|
158
161
|
isActive: isActive,
|
|
159
|
-
intl: intl
|
|
162
|
+
intl: intl,
|
|
163
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
160
164
|
});
|
|
161
165
|
}, [isToolbarDisabled, isDisabled, isActive, intl]);
|
|
162
166
|
var shouldRenderIcon = hasSchemaMark && !isHidden;
|
|
@@ -165,13 +169,6 @@ var buildIcon = function buildIcon(iconMark) {
|
|
|
165
169
|
}, [shouldRenderIcon, iconComponent]);
|
|
166
170
|
};
|
|
167
171
|
};
|
|
168
|
-
var buildStrongIcon = buildIcon(_types.IconTypes.strong);
|
|
169
|
-
var buildEmIcon = buildIcon(_types.IconTypes.em);
|
|
170
|
-
var buildUnderlineIcon = buildIcon(_types.IconTypes.underline);
|
|
171
|
-
var buildStrikeIcon = buildIcon(_types.IconTypes.strike);
|
|
172
|
-
var buildCodeIcon = buildIcon(_types.IconTypes.code);
|
|
173
|
-
var buildSubscriptIcon = buildIcon(_types.IconTypes.subscript);
|
|
174
|
-
var buildSuperscriptIcon = buildIcon(_types.IconTypes.superscript);
|
|
175
172
|
var useTextFormattingPluginState = function useTextFormattingPluginState(editorState) {
|
|
176
173
|
return (0, _react.useMemo)(function () {
|
|
177
174
|
var pluginState = _pluginKey.pluginKey.getState(editorState);
|
|
@@ -183,7 +180,8 @@ var useTextFormattingPluginState = function useTextFormattingPluginState(editorS
|
|
|
183
180
|
var useFormattingIcons = function useFormattingIcons(_ref4) {
|
|
184
181
|
var isToolbarDisabled = _ref4.isToolbarDisabled,
|
|
185
182
|
editorState = _ref4.editorState,
|
|
186
|
-
intl = _ref4.intl
|
|
183
|
+
intl = _ref4.intl,
|
|
184
|
+
editorAnalyticsAPI = _ref4.editorAnalyticsAPI;
|
|
187
185
|
var textFormattingPluginState = useTextFormattingPluginState(editorState);
|
|
188
186
|
var schema = editorState.schema;
|
|
189
187
|
var props = {
|
|
@@ -192,6 +190,13 @@ var useFormattingIcons = function useFormattingIcons(_ref4) {
|
|
|
192
190
|
intl: intl,
|
|
193
191
|
isToolbarDisabled: Boolean(isToolbarDisabled)
|
|
194
192
|
};
|
|
193
|
+
var buildStrongIcon = buildIcon(_types.IconTypes.strong, editorAnalyticsAPI);
|
|
194
|
+
var buildEmIcon = buildIcon(_types.IconTypes.em, editorAnalyticsAPI);
|
|
195
|
+
var buildUnderlineIcon = buildIcon(_types.IconTypes.underline, editorAnalyticsAPI);
|
|
196
|
+
var buildStrikeIcon = buildIcon(_types.IconTypes.strike, editorAnalyticsAPI);
|
|
197
|
+
var buildCodeIcon = buildIcon(_types.IconTypes.code, editorAnalyticsAPI);
|
|
198
|
+
var buildSubscriptIcon = buildIcon(_types.IconTypes.subscript, editorAnalyticsAPI);
|
|
199
|
+
var buildSuperscriptIcon = buildIcon(_types.IconTypes.superscript, editorAnalyticsAPI);
|
|
195
200
|
var strongIcon = buildStrongIcon(props);
|
|
196
201
|
var emIcon = buildEmIcon(props);
|
|
197
202
|
var underlineIcon = buildUnderlineIcon(props);
|
|
@@ -53,7 +53,8 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
53
53
|
var defaultIcons = (0, _formattingIcons.useFormattingIcons)({
|
|
54
54
|
editorState: editorState,
|
|
55
55
|
intl: intl,
|
|
56
|
-
isToolbarDisabled: isToolbarDisabled
|
|
56
|
+
isToolbarDisabled: isToolbarDisabled,
|
|
57
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
57
58
|
});
|
|
58
59
|
var clearIcon = (0, _clearFormattingIcon.useClearIcon)({
|
|
59
60
|
editorState: editorState,
|
|
@@ -41,7 +41,6 @@ var colorPickerWrapper = function colorPickerWrapper(theme) {
|
|
|
41
41
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
42
42
|
|
|
43
43
|
var ColorPickerButton = function ColorPickerButton(props) {
|
|
44
|
-
var _props$size, _props$size2, _props$size3;
|
|
45
44
|
var buttonRef = _react.default.useRef(null);
|
|
46
45
|
var _React$useState = _react.default.useState(false),
|
|
47
46
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
@@ -168,8 +167,14 @@ var ColorPickerButton = function ColorPickerButton(props) {
|
|
|
168
167
|
};
|
|
169
168
|
var title = props.title || '';
|
|
170
169
|
var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
171
|
-
var buttonStyle =
|
|
172
|
-
|
|
170
|
+
var buttonStyle = function buttonStyle(theme) {
|
|
171
|
+
var _props$size, _props$size2, _props$size3;
|
|
172
|
+
return (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0 10px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n margin: 0px 2px;\n }\n &:hover {\n background: ", ";\n }\n "])), "var(--ds-background-neutral-subtle, transparent)", /* If custom props size height, override the button base height property */
|
|
173
|
+
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", _common.DEFAULT_BORDER_COLOR, (0, _constants.borderRadius)(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px', (0, _components.themed)({
|
|
174
|
+
light: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30A, ")"),
|
|
175
|
+
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30A, ")")
|
|
176
|
+
})(theme));
|
|
177
|
+
};
|
|
173
178
|
return (0, _react2.jsx)("div", {
|
|
174
179
|
css: colorPickerButtonWrapper
|
|
175
180
|
}, (0, _react2.jsx)(_tooltip.default, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.
|
|
9
|
+
var version = "187.4.2";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED