@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Selection } from 'prosemirror-state';
|
|
2
2
|
import { applyMarkOnRange, toggleMark } from '../../../utils/commands';
|
|
3
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { hasCode, markActive } from '../utils';
|
|
5
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
5
6
|
export const moveRight = () => {
|
|
6
7
|
return (state, dispatch) => {
|
|
7
8
|
const {
|
|
@@ -117,9 +118,9 @@ export const toggleEm = () => {
|
|
|
117
118
|
return false;
|
|
118
119
|
};
|
|
119
120
|
};
|
|
120
|
-
export const toggleEmWithAnalytics = ({
|
|
121
|
+
export const toggleEmWithAnalytics = editorAnalyticsAPI => ({
|
|
121
122
|
inputMethod
|
|
122
|
-
}) => withAnalytics({
|
|
123
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
123
124
|
action: ACTION.FORMATTED,
|
|
124
125
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
125
126
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -139,9 +140,9 @@ export const toggleStrike = () => {
|
|
|
139
140
|
return false;
|
|
140
141
|
};
|
|
141
142
|
};
|
|
142
|
-
export const toggleStrikeWithAnalytics = ({
|
|
143
|
+
export const toggleStrikeWithAnalytics = editorAnalyticsAPI => ({
|
|
143
144
|
inputMethod
|
|
144
|
-
}) => withAnalytics({
|
|
145
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
145
146
|
action: ACTION.FORMATTED,
|
|
146
147
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
147
148
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -161,9 +162,9 @@ export const toggleStrong = () => {
|
|
|
161
162
|
return false;
|
|
162
163
|
};
|
|
163
164
|
};
|
|
164
|
-
export const toggleStrongWithAnalytics = ({
|
|
165
|
+
export const toggleStrongWithAnalytics = editorAnalyticsAPI => ({
|
|
165
166
|
inputMethod
|
|
166
|
-
}) => withAnalytics({
|
|
167
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
167
168
|
action: ACTION.FORMATTED,
|
|
168
169
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
169
170
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -183,9 +184,9 @@ export const toggleUnderline = () => {
|
|
|
183
184
|
return false;
|
|
184
185
|
};
|
|
185
186
|
};
|
|
186
|
-
export const toggleUnderlineWithAnalytics = ({
|
|
187
|
+
export const toggleUnderlineWithAnalytics = editorAnalyticsAPI => ({
|
|
187
188
|
inputMethod
|
|
188
|
-
}) => withAnalytics({
|
|
189
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
189
190
|
action: ACTION.FORMATTED,
|
|
190
191
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
191
192
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -207,9 +208,9 @@ export const toggleSuperscript = () => {
|
|
|
207
208
|
return false;
|
|
208
209
|
};
|
|
209
210
|
};
|
|
210
|
-
export const toggleSuperscriptWithAnalytics = ({
|
|
211
|
+
export const toggleSuperscriptWithAnalytics = editorAnalyticsAPI => ({
|
|
211
212
|
inputMethod
|
|
212
|
-
}) => withAnalytics({
|
|
213
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
213
214
|
action: ACTION.FORMATTED,
|
|
214
215
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
215
216
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -231,9 +232,9 @@ export const toggleSubscript = () => {
|
|
|
231
232
|
return false;
|
|
232
233
|
};
|
|
233
234
|
};
|
|
234
|
-
export const toggleSubscriptWithAnalytics = ({
|
|
235
|
+
export const toggleSubscriptWithAnalytics = editorAnalyticsAPI => ({
|
|
235
236
|
inputMethod
|
|
236
|
-
}) => withAnalytics({
|
|
237
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
237
238
|
action: ACTION.FORMATTED,
|
|
238
239
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
239
240
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -253,9 +254,9 @@ export const toggleCode = () => {
|
|
|
253
254
|
return false;
|
|
254
255
|
};
|
|
255
256
|
};
|
|
256
|
-
export const toggleCodeWithAnalytics = ({
|
|
257
|
+
export const toggleCodeWithAnalytics = editorAnalyticsAPI => ({
|
|
257
258
|
inputMethod
|
|
258
|
-
}) => withAnalytics({
|
|
259
|
+
}) => withAnalytics(editorAnalyticsAPI, {
|
|
259
260
|
action: ACTION.FORMATTED,
|
|
260
261
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
261
262
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -288,8 +289,8 @@ const createInlineCodeFromTextInput = (from, to, text) => {
|
|
|
288
289
|
return false;
|
|
289
290
|
};
|
|
290
291
|
};
|
|
291
|
-
export const createInlineCodeFromTextInputWithAnalytics = (from, to, text) => {
|
|
292
|
-
return withAnalytics({
|
|
292
|
+
export const createInlineCodeFromTextInputWithAnalytics = editorAnalyticsAPI => (from, to, text) => {
|
|
293
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
293
294
|
action: ACTION.FORMATTED,
|
|
294
295
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
295
296
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -37,7 +37,10 @@ const textFormatting = (options = {}, api) => ({
|
|
|
37
37
|
name: 'textFormatting',
|
|
38
38
|
plugin: ({
|
|
39
39
|
dispatch
|
|
40
|
-
}) =>
|
|
40
|
+
}) => {
|
|
41
|
+
var _api$dependencies$ana;
|
|
42
|
+
return textFormattingPlugin(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);
|
|
43
|
+
}
|
|
41
44
|
}, {
|
|
42
45
|
name: 'textFormattingCursor',
|
|
43
46
|
plugin: () => textFormattingCursorPlugin
|
|
@@ -60,14 +63,17 @@ const textFormatting = (options = {}, api) => ({
|
|
|
60
63
|
}, {
|
|
61
64
|
name: 'textFormattingClearKeymap',
|
|
62
65
|
plugin: () => {
|
|
63
|
-
var _api$dependencies$
|
|
64
|
-
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
66
|
+
var _api$dependencies$ana2;
|
|
67
|
+
return clearFormattingKeymapPlugin(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);
|
|
65
68
|
}
|
|
66
69
|
}, {
|
|
67
70
|
name: 'textFormattingKeymap',
|
|
68
71
|
plugin: ({
|
|
69
72
|
schema
|
|
70
|
-
}) =>
|
|
73
|
+
}) => {
|
|
74
|
+
var _api$dependencies$ana3;
|
|
75
|
+
return keymapPlugin(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);
|
|
76
|
+
}
|
|
71
77
|
}];
|
|
72
78
|
},
|
|
73
79
|
primaryToolbarComponent({
|
|
@@ -84,7 +90,7 @@ const textFormatting = (options = {}, api) => ({
|
|
|
84
90
|
clearFormattingPluginState: clearFormattingPluginKey
|
|
85
91
|
},
|
|
86
92
|
render: () => {
|
|
87
|
-
var _api$dependencies$
|
|
93
|
+
var _api$dependencies$ana4;
|
|
88
94
|
return /*#__PURE__*/React.createElement(Toolbar, {
|
|
89
95
|
editorState: editorView.state,
|
|
90
96
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -94,7 +100,7 @@ const textFormatting = (options = {}, api) => ({
|
|
|
94
100
|
editorView: editorView,
|
|
95
101
|
isToolbarDisabled: disabled,
|
|
96
102
|
shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
|
|
97
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
103
|
+
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
|
|
98
104
|
});
|
|
99
105
|
}
|
|
100
106
|
});
|
|
@@ -2,40 +2,40 @@ import * as keymaps from '../../../keymaps';
|
|
|
2
2
|
import { keymap } from '../../../utils/keymap';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import * as commands from '../commands/text-formatting';
|
|
5
|
-
export default function keymapPlugin(schema) {
|
|
5
|
+
export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
6
6
|
const list = {};
|
|
7
7
|
if (schema.marks.strong) {
|
|
8
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, commands.toggleStrongWithAnalytics({
|
|
8
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, commands.toggleStrongWithAnalytics(editorAnalyticsAPI)({
|
|
9
9
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
10
10
|
}), list);
|
|
11
11
|
}
|
|
12
12
|
if (schema.marks.em) {
|
|
13
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, commands.toggleEmWithAnalytics({
|
|
13
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, commands.toggleEmWithAnalytics(editorAnalyticsAPI)({
|
|
14
14
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
15
15
|
}), list);
|
|
16
16
|
}
|
|
17
17
|
if (schema.marks.code) {
|
|
18
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, commands.toggleCodeWithAnalytics({
|
|
18
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, commands.toggleCodeWithAnalytics(editorAnalyticsAPI)({
|
|
19
19
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
20
20
|
}), list);
|
|
21
21
|
}
|
|
22
22
|
if (schema.marks.strike) {
|
|
23
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, commands.toggleStrikeWithAnalytics({
|
|
23
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)({
|
|
24
24
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
25
25
|
}), list);
|
|
26
26
|
}
|
|
27
27
|
if (schema.marks.subsup) {
|
|
28
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, commands.toggleSubscriptWithAnalytics({
|
|
28
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)({
|
|
29
29
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
30
30
|
}), list);
|
|
31
31
|
}
|
|
32
32
|
if (schema.marks.subsup) {
|
|
33
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, commands.toggleSuperscriptWithAnalytics({
|
|
33
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)({
|
|
34
34
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
35
35
|
}), list);
|
|
36
36
|
}
|
|
37
37
|
if (schema.marks.underline) {
|
|
38
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, commands.toggleUnderlineWithAnalytics({
|
|
38
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)({
|
|
39
39
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
40
40
|
}), list);
|
|
41
41
|
}
|
|
@@ -8,7 +8,7 @@ import * as commands from '../commands/text-formatting';
|
|
|
8
8
|
import { anyMarkActive } from '../utils';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
10
10
|
export { pluginKey };
|
|
11
|
-
const getTextFormattingState = editorState => {
|
|
11
|
+
const getTextFormattingState = (editorState, editorAnalyticsAPI) => {
|
|
12
12
|
const {
|
|
13
13
|
em,
|
|
14
14
|
code,
|
|
@@ -56,13 +56,13 @@ const getTextFormattingState = editorState => {
|
|
|
56
56
|
}
|
|
57
57
|
return state;
|
|
58
58
|
};
|
|
59
|
-
export const plugin = dispatch => new SafePlugin({
|
|
59
|
+
export const plugin = (dispatch, editorAnalyticsAPI) => new SafePlugin({
|
|
60
60
|
state: {
|
|
61
61
|
init(_config, state) {
|
|
62
|
-
return getTextFormattingState(state);
|
|
62
|
+
return getTextFormattingState(state, editorAnalyticsAPI);
|
|
63
63
|
},
|
|
64
64
|
apply(_tr, pluginState, _oldState, newState) {
|
|
65
|
-
const state = getTextFormattingState(newState);
|
|
65
|
+
const state = getTextFormattingState(newState, editorAnalyticsAPI);
|
|
66
66
|
if (!shallowEqual(pluginState, state)) {
|
|
67
67
|
dispatch(pluginKey, state);
|
|
68
68
|
return state;
|
|
@@ -100,7 +100,7 @@ export const plugin = dispatch => new SafePlugin({
|
|
|
100
100
|
}
|
|
101
101
|
} = state;
|
|
102
102
|
if (parentNodeType.allowsMarkType(schema.marks.code)) {
|
|
103
|
-
return createInlineCodeFromTextInputWithAnalytics(from, to, text)(state, dispatch);
|
|
103
|
+
return createInlineCodeFromTextInputWithAnalytics(editorAnalyticsAPI)(from, to, text)(state, dispatch);
|
|
104
104
|
}
|
|
105
105
|
return false;
|
|
106
106
|
}
|
|
@@ -15,10 +15,10 @@ import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
|
15
15
|
const withToolbarInputMethod = func => func({
|
|
16
16
|
inputMethod: INPUT_METHOD.TOOLBAR
|
|
17
17
|
});
|
|
18
|
-
const IconButtons = {
|
|
18
|
+
const IconButtons = editorAnalyticsAPI => ({
|
|
19
19
|
strong: {
|
|
20
20
|
buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
|
|
21
|
-
command: withToolbarInputMethod(commands.toggleStrongWithAnalytics),
|
|
21
|
+
command: withToolbarInputMethod(commands.toggleStrongWithAnalytics(editorAnalyticsAPI)),
|
|
22
22
|
message: toolbarMessages.bold,
|
|
23
23
|
tooltipKeymap: toggleBold,
|
|
24
24
|
component: () => jsx(BoldIcon, {
|
|
@@ -27,7 +27,7 @@ const IconButtons = {
|
|
|
27
27
|
},
|
|
28
28
|
em: {
|
|
29
29
|
buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
|
|
30
|
-
command: withToolbarInputMethod(commands.toggleEmWithAnalytics),
|
|
30
|
+
command: withToolbarInputMethod(commands.toggleEmWithAnalytics(editorAnalyticsAPI)),
|
|
31
31
|
message: toolbarMessages.italic,
|
|
32
32
|
tooltipKeymap: toggleItalic,
|
|
33
33
|
component: () => jsx(ItalicIcon, {
|
|
@@ -35,38 +35,39 @@ const IconButtons = {
|
|
|
35
35
|
})
|
|
36
36
|
},
|
|
37
37
|
underline: {
|
|
38
|
-
command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics),
|
|
38
|
+
command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
|
|
39
39
|
message: toolbarMessages.underline,
|
|
40
40
|
tooltipKeymap: toggleUnderline
|
|
41
41
|
},
|
|
42
42
|
strike: {
|
|
43
|
-
command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics),
|
|
43
|
+
command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)),
|
|
44
44
|
message: toolbarMessages.strike,
|
|
45
45
|
tooltipKeymap: toggleStrikethrough
|
|
46
46
|
},
|
|
47
47
|
code: {
|
|
48
|
-
command: withToolbarInputMethod(commands.toggleCodeWithAnalytics),
|
|
48
|
+
command: withToolbarInputMethod(commands.toggleCodeWithAnalytics(editorAnalyticsAPI)),
|
|
49
49
|
message: toolbarMessages.code,
|
|
50
50
|
tooltipKeymap: toggleCode
|
|
51
51
|
},
|
|
52
52
|
subscript: {
|
|
53
|
-
command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics),
|
|
53
|
+
command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
|
|
54
54
|
message: toolbarMessages.subscript,
|
|
55
55
|
tooltipKeymap: toggleSubscript
|
|
56
56
|
},
|
|
57
57
|
superscript: {
|
|
58
|
-
command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics),
|
|
58
|
+
command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
|
|
59
59
|
message: toolbarMessages.superscript,
|
|
60
60
|
tooltipKeymap: toggleSuperscript
|
|
61
61
|
}
|
|
62
|
-
};
|
|
62
|
+
});
|
|
63
63
|
const getIcon = ({
|
|
64
64
|
iconType,
|
|
65
65
|
isDisabled,
|
|
66
66
|
isActive,
|
|
67
|
-
intl
|
|
67
|
+
intl,
|
|
68
|
+
editorAnalyticsAPI
|
|
68
69
|
}) => {
|
|
69
|
-
const icon = IconButtons[iconType];
|
|
70
|
+
const icon = IconButtons(editorAnalyticsAPI)[iconType];
|
|
70
71
|
const content = intl.formatMessage(icon.message);
|
|
71
72
|
const {
|
|
72
73
|
tooltipKeymap
|
|
@@ -128,7 +129,7 @@ const buildMenuIconState = iconMark => ({
|
|
|
128
129
|
hasSchemaMark
|
|
129
130
|
};
|
|
130
131
|
};
|
|
131
|
-
const buildIcon = iconMark => {
|
|
132
|
+
const buildIcon = (iconMark, editorAnalyticsAPI) => {
|
|
132
133
|
const getState = buildMenuIconState(iconMark);
|
|
133
134
|
return ({
|
|
134
135
|
schema,
|
|
@@ -150,19 +151,13 @@ const buildIcon = iconMark => {
|
|
|
150
151
|
iconType: IconTypes[iconMark],
|
|
151
152
|
isDisabled: isToolbarDisabled || isDisabled,
|
|
152
153
|
isActive,
|
|
153
|
-
intl
|
|
154
|
+
intl,
|
|
155
|
+
editorAnalyticsAPI
|
|
154
156
|
}), [isToolbarDisabled, isDisabled, isActive, intl]);
|
|
155
157
|
const shouldRenderIcon = hasSchemaMark && !isHidden;
|
|
156
158
|
return useMemo(() => shouldRenderIcon ? iconComponent : null, [shouldRenderIcon, iconComponent]);
|
|
157
159
|
};
|
|
158
160
|
};
|
|
159
|
-
const buildStrongIcon = buildIcon(IconTypes.strong);
|
|
160
|
-
const buildEmIcon = buildIcon(IconTypes.em);
|
|
161
|
-
const buildUnderlineIcon = buildIcon(IconTypes.underline);
|
|
162
|
-
const buildStrikeIcon = buildIcon(IconTypes.strike);
|
|
163
|
-
const buildCodeIcon = buildIcon(IconTypes.code);
|
|
164
|
-
const buildSubscriptIcon = buildIcon(IconTypes.subscript);
|
|
165
|
-
const buildSuperscriptIcon = buildIcon(IconTypes.superscript);
|
|
166
161
|
const useTextFormattingPluginState = editorState => useMemo(() => {
|
|
167
162
|
const pluginState = textFormattingPluginKey.getState(editorState);
|
|
168
163
|
|
|
@@ -172,7 +167,8 @@ const useTextFormattingPluginState = editorState => useMemo(() => {
|
|
|
172
167
|
export const useFormattingIcons = ({
|
|
173
168
|
isToolbarDisabled,
|
|
174
169
|
editorState,
|
|
175
|
-
intl
|
|
170
|
+
intl,
|
|
171
|
+
editorAnalyticsAPI
|
|
176
172
|
}) => {
|
|
177
173
|
const textFormattingPluginState = useTextFormattingPluginState(editorState);
|
|
178
174
|
const {
|
|
@@ -184,6 +180,13 @@ export const useFormattingIcons = ({
|
|
|
184
180
|
intl,
|
|
185
181
|
isToolbarDisabled: Boolean(isToolbarDisabled)
|
|
186
182
|
};
|
|
183
|
+
const buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI);
|
|
184
|
+
const buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI);
|
|
185
|
+
const buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI);
|
|
186
|
+
const buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI);
|
|
187
|
+
const buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI);
|
|
188
|
+
const buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI);
|
|
189
|
+
const buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI);
|
|
187
190
|
const strongIcon = buildStrongIcon(props);
|
|
188
191
|
const emIcon = buildEmIcon(props);
|
|
189
192
|
const underlineIcon = buildUnderlineIcon(props);
|
|
@@ -6,7 +6,7 @@ import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/ed
|
|
|
6
6
|
import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
|
|
7
7
|
import Button from '@atlaskit/button';
|
|
8
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
|
-
import { DN50, N0, N60A } from '@atlaskit/theme/colors';
|
|
9
|
+
import { DN50, N0, N60A, N30A } from '@atlaskit/theme/colors';
|
|
10
10
|
import { themed } from '@atlaskit/theme/components';
|
|
11
11
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
12
12
|
import ColorPalette from '../ColorPalette';
|
|
@@ -39,7 +39,6 @@ const colorPickerWrapper = theme => css`
|
|
|
39
39
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
40
40
|
|
|
41
41
|
const ColorPickerButton = props => {
|
|
42
|
-
var _props$size, _props$size2, _props$size3;
|
|
43
42
|
const buttonRef = React.useRef(null);
|
|
44
43
|
const [isPopupOpen, setIsPopupOpen] = React.useState(false);
|
|
45
44
|
const [isPopupPositioned, setIsPopupPositioned] = React.useState(false);
|
|
@@ -156,11 +155,13 @@ const ColorPickerButton = props => {
|
|
|
156
155
|
};
|
|
157
156
|
const title = props.title || '';
|
|
158
157
|
const currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
159
|
-
const buttonStyle =
|
|
158
|
+
const buttonStyle = theme => {
|
|
159
|
+
var _props$size, _props$size2, _props$size3;
|
|
160
|
+
return css`
|
|
160
161
|
padding: 0 10px;
|
|
161
|
-
background-color: ${"var(--ds-background-neutral, transparent)"};
|
|
162
|
+
background-color: ${"var(--ds-background-neutral-subtle, transparent)"};
|
|
162
163
|
${
|
|
163
|
-
|
|
164
|
+
/* If custom props size height, override the button base height property */!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && `height: inherit;`}
|
|
164
165
|
&:before {
|
|
165
166
|
display: flex;
|
|
166
167
|
justify-content: center;
|
|
@@ -175,7 +176,14 @@ const ColorPickerButton = props => {
|
|
|
175
176
|
padding: 0;
|
|
176
177
|
margin: 0px 2px;
|
|
177
178
|
}
|
|
179
|
+
&:hover {
|
|
180
|
+
background: ${themed({
|
|
181
|
+
light: `var(--ds-background-neutral-subtle-hovered, ${N30A})`,
|
|
182
|
+
dark: `var(--ds-background-neutral-subtle-hovered, ${N30A})`
|
|
183
|
+
})(theme)};
|
|
184
|
+
}
|
|
178
185
|
`;
|
|
186
|
+
};
|
|
179
187
|
return jsx("div", {
|
|
180
188
|
css: colorPickerButtonWrapper
|
|
181
189
|
}, jsx(Tooltip, {
|
package/dist/es2019/version.json
CHANGED