@atlaskit/editor-core 187.10.6 → 187.11.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 +16 -0
- package/dist/cjs/index.js +2 -94
- package/dist/cjs/plugins/help-dialog/ui/index.js +42 -42
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +5 -5
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +3 -3
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +15 -6
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +18 -16
- package/dist/cjs/plugins/media/utils/media-single.js +5 -9
- package/dist/cjs/plugins/paste/handlers.js +4 -6
- package/dist/cjs/plugins/text-formatting/actions.js +188 -0
- package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +1 -180
- package/dist/cjs/plugins/text-formatting/index.js +17 -0
- package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +8 -8
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +16 -16
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +8 -8
- package/dist/cjs/plugins/text-formatting/utils.js +8 -36
- package/dist/cjs/ui/ContentStyles/index.js +8 -9
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +0 -2
- package/dist/es2019/plugins/help-dialog/ui/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +13 -4
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +11 -10
- package/dist/es2019/plugins/media/utils/media-single.js +6 -7
- package/dist/es2019/plugins/paste/handlers.js +5 -7
- package/dist/es2019/plugins/text-formatting/actions.js +161 -0
- package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +1 -159
- package/dist/es2019/plugins/text-formatting/index.js +17 -0
- package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +1 -1
- package/dist/es2019/plugins/text-formatting/utils.js +1 -29
- package/dist/es2019/ui/ContentStyles/index.js +2 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/plugins/help-dialog/ui/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +13 -4
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +21 -19
- package/dist/esm/plugins/media/utils/media-single.js +6 -10
- package/dist/esm/plugins/paste/handlers.js +5 -7
- package/dist/esm/plugins/text-formatting/actions.js +168 -0
- package/dist/esm/plugins/text-formatting/commands/text-formatting.js +1 -166
- package/dist/esm/plugins/text-formatting/index.js +17 -0
- package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +8 -8
- package/dist/esm/plugins/text-formatting/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +1 -1
- package/dist/esm/plugins/text-formatting/utils.js +6 -33
- package/dist/esm/ui/ContentStyles/index.js +2 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +6 -4
- package/dist/types/labs/next/presets/default.d.ts +78 -15
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -2
- package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
- package/dist/types/plugins/paste/handlers.d.ts +1 -2
- package/dist/types/plugins/text-formatting/actions.d.ts +20 -0
- package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
- package/dist/types/plugins/text-formatting/index.d.ts +18 -2
- package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
- package/dist/types/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +1 -5
- package/dist/types/types/editor-props.d.ts +1 -2
- package/dist/types/ui/ContentStyles/index.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +6 -4
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +78 -15
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -2
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +1 -2
- package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +20 -0
- package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
- package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +18 -2
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
- package/dist/types-ts4.5/plugins/text-formatting/utils.d.ts +1 -5
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -2
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +1 -1
- package/package.json +3 -3
- package/report.api.md +31 -145
- package/tmp/api-report-tmp.d.ts +30 -118
- package/dist/cjs/plugins/text-formatting/styles.js +0 -15
- package/dist/cjs/plugins/text-formatting/types.js +0 -5
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -95
- package/dist/es2019/plugins/text-formatting/styles.js +0 -5
- package/dist/es2019/plugins/text-formatting/types.js +0 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
- package/dist/esm/plugins/text-formatting/styles.js +0 -7
- package/dist/esm/plugins/text-formatting/types.js +0 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
- package/dist/types/plugins/text-formatting/styles.d.ts +0 -2
- package/dist/types/plugins/text-formatting/types.d.ts +0 -30
- package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
- package/dist/types-ts4.5/plugins/text-formatting/styles.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-formatting/types.d.ts +0 -30
- package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
|
@@ -5,18 +5,16 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
import { safeInsert as pmSafeInsert, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { checkNodeDown } from '../../../utils';
|
|
7
7
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { getMediaSingleInitialWidth } from '@atlaskit/editor-common/media-single';
|
|
9
9
|
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
10
10
|
import { mapSlice } from '../../../utils/slice';
|
|
11
11
|
import { addAnalytics } from '../../analytics';
|
|
12
|
-
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
13
12
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
14
13
|
import { safeInsert, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
15
14
|
import { isImage } from './is-image';
|
|
16
15
|
import { atTheBeginningOfBlock } from '../../../utils/prosemirror/position';
|
|
17
16
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
18
17
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
19
|
-
import { DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
20
18
|
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
|
|
21
19
|
return {
|
|
22
20
|
action: ACTION.INSERTED,
|
|
@@ -94,7 +92,9 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
94
92
|
// add undefined as fallback as we don't want media single width to have upper limit as 0
|
|
95
93
|
// if widthPluginState.width is 0, default 760 will be used
|
|
96
94
|
var contentWidth = (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
|
|
97
|
-
var node = createMediaSingleNode(state.schema, collection, contentWidth,
|
|
95
|
+
var node = createMediaSingleNode(state.schema, collection, contentWidth,
|
|
96
|
+
// pass undefined to use default min width
|
|
97
|
+
undefined, alignLeftOnInsert)(mediaState);
|
|
98
98
|
var fileExtension;
|
|
99
99
|
if (mediaState.fileName) {
|
|
100
100
|
var extensionIdx = mediaState.fileName.lastIndexOf('.');
|
|
@@ -127,10 +127,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
127
127
|
}
|
|
128
128
|
return true;
|
|
129
129
|
};
|
|
130
|
-
export var createMediaSingleNode = function createMediaSingleNode(schema, collection) {
|
|
131
|
-
var maxWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : akEditorDefaultLayoutWidth;
|
|
132
|
-
var minWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : MEDIA_SINGLE_MIN_PIXEL_WIDTH;
|
|
133
|
-
var alignLeftOnInsert = arguments.length > 4 ? arguments[4] : undefined;
|
|
130
|
+
export var createMediaSingleNode = function createMediaSingleNode(schema, collection, maxWidth, minWidth, alignLeftOnInsert) {
|
|
134
131
|
return function (mediaState) {
|
|
135
132
|
var id = mediaState.id,
|
|
136
133
|
dimensions = mediaState.dimensions,
|
|
@@ -159,8 +156,7 @@ export var createMediaSingleNode = function createMediaSingleNode(schema, collec
|
|
|
159
156
|
layout: 'align-start'
|
|
160
157
|
} : {};
|
|
161
158
|
var extendedMediaSingleAttrs = getBooleanFF('platform.editor.media.extended-resize-experience') ? _objectSpread(_objectSpread({}, mediaSingleAttrs), {}, {
|
|
162
|
-
|
|
163
|
-
width: Math.max(Math.min(scaledWidth || DEFAULT_IMAGE_WIDTH, maxWidth), minWidth),
|
|
159
|
+
width: getMediaSingleInitialWidth(scaledWidth, maxWidth, minWidth),
|
|
164
160
|
// TODO: change to use enum
|
|
165
161
|
widthType: 'pixel'
|
|
166
162
|
}) : mediaSingleAttrs;
|
|
@@ -16,16 +16,16 @@ import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell,
|
|
|
16
16
|
import { mapSlice } from '../../utils/slice';
|
|
17
17
|
import { INPUT_METHOD } from '../analytics';
|
|
18
18
|
import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
|
|
19
|
-
import { linkifyContent } from '@atlaskit/editor-common/utils';
|
|
20
19
|
import { runMacroAutoConvert } from '../macro';
|
|
21
20
|
import { insertMediaAsMediaSingle } from '../media/utils/media-single';
|
|
22
|
-
import { pluginKey as textFormattingPluginKey } from '../text-formatting/pm-plugins/main';
|
|
23
21
|
import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
|
|
24
|
-
import { isListItemNode, isListNode, canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
22
|
+
import { linkifyContent, isListItemNode, isListNode, canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
25
23
|
import { insertSliceForLists } from './edge-cases';
|
|
26
24
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
27
25
|
import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
|
|
28
26
|
import { doesSelectionWhichStartsOrEndsInListContainEntireList } from '../../utils/lists';
|
|
27
|
+
import { anyMarkActive } from '@atlaskit/editor-common/mark';
|
|
28
|
+
|
|
29
29
|
// remove text attribute from mention for copy/paste (GDPR)
|
|
30
30
|
export function handleMention(slice, schema) {
|
|
31
31
|
return mapSlice(slice, function (node) {
|
|
@@ -86,8 +86,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
86
86
|
}
|
|
87
87
|
var filters = [linkifyContent(schema)];
|
|
88
88
|
var selectionMarks = selection.$head.marks();
|
|
89
|
-
|
|
90
|
-
if (selection instanceof TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && hasOnlyNodesOfType(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.codeActive) // for codeMarks let's make sure mark is active
|
|
89
|
+
if (selection instanceof TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && hasOnlyNodesOfType(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || anyMarkActive(state, codeMark)) // check if there is a code mark anywhere in the selection
|
|
91
90
|
) {
|
|
92
91
|
filters.push(applyTextMarksToSlice(schema, selection.$head.marks()));
|
|
93
92
|
}
|
|
@@ -362,11 +361,10 @@ export function handlePastePreservingMarks(slice, queueCardsFromChangedTr) {
|
|
|
362
361
|
if (selectionMarks.length === 0) {
|
|
363
362
|
return false;
|
|
364
363
|
}
|
|
365
|
-
var textFormattingState = textFormattingPluginKey.getState(state);
|
|
366
364
|
|
|
367
365
|
// special case for codeMark: will preserve mark only if codeMark is currently active
|
|
368
366
|
// won't preserve mark if cursor is on the edge on the mark (namely inactive)
|
|
369
|
-
if (codeMark.isInSet(selectionMarks) && !(
|
|
367
|
+
if (codeMark.isInSet(selectionMarks) && !anyMarkActive(state, codeMark)) {
|
|
370
368
|
return false;
|
|
371
369
|
}
|
|
372
370
|
var isPlainTextSlice = slice.content.childCount === 1 && slice.content.firstChild.type === paragraph && slice.content.firstChild.content.childCount === 1 && slice.content.firstChild.firstChild.type === text;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
3
|
+
import { toggleMark } from '@atlaskit/editor-common/mark';
|
|
4
|
+
export var toggleEm = function toggleEm() {
|
|
5
|
+
return function (state, dispatch) {
|
|
6
|
+
var em = state.schema.marks.em;
|
|
7
|
+
if (em) {
|
|
8
|
+
return toggleMark(em)(state, dispatch);
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsAPI) {
|
|
14
|
+
return function (_ref) {
|
|
15
|
+
var inputMethod = _ref.inputMethod;
|
|
16
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
17
|
+
action: ACTION.FORMATTED,
|
|
18
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
19
|
+
eventType: EVENT_TYPE.TRACK,
|
|
20
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
|
21
|
+
attributes: {
|
|
22
|
+
inputMethod: inputMethod
|
|
23
|
+
}
|
|
24
|
+
})(toggleEm());
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export var toggleStrike = function toggleStrike() {
|
|
28
|
+
return function (state, dispatch) {
|
|
29
|
+
var strike = state.schema.marks.strike;
|
|
30
|
+
if (strike) {
|
|
31
|
+
return toggleMark(strike)(state, dispatch);
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyticsAPI) {
|
|
37
|
+
return function (_ref2) {
|
|
38
|
+
var inputMethod = _ref2.inputMethod;
|
|
39
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
40
|
+
action: ACTION.FORMATTED,
|
|
41
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
42
|
+
eventType: EVENT_TYPE.TRACK,
|
|
43
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
|
|
44
|
+
attributes: {
|
|
45
|
+
inputMethod: inputMethod
|
|
46
|
+
}
|
|
47
|
+
})(toggleStrike());
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export var toggleStrong = function toggleStrong() {
|
|
51
|
+
return function (state, dispatch) {
|
|
52
|
+
var strong = state.schema.marks.strong;
|
|
53
|
+
if (strong) {
|
|
54
|
+
return toggleMark(strong)(state, dispatch);
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyticsAPI) {
|
|
60
|
+
return function (_ref3) {
|
|
61
|
+
var inputMethod = _ref3.inputMethod;
|
|
62
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
63
|
+
action: ACTION.FORMATTED,
|
|
64
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
65
|
+
eventType: EVENT_TYPE.TRACK,
|
|
66
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
|
|
67
|
+
attributes: {
|
|
68
|
+
inputMethod: inputMethod
|
|
69
|
+
}
|
|
70
|
+
})(toggleStrong());
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export var toggleUnderline = function toggleUnderline() {
|
|
74
|
+
return function (state, dispatch) {
|
|
75
|
+
var underline = state.schema.marks.underline;
|
|
76
|
+
if (underline) {
|
|
77
|
+
return toggleMark(underline)(state, dispatch);
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorAnalyticsAPI) {
|
|
83
|
+
return function (_ref4) {
|
|
84
|
+
var inputMethod = _ref4.inputMethod;
|
|
85
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
86
|
+
action: ACTION.FORMATTED,
|
|
87
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
88
|
+
eventType: EVENT_TYPE.TRACK,
|
|
89
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
|
|
90
|
+
attributes: {
|
|
91
|
+
inputMethod: inputMethod
|
|
92
|
+
}
|
|
93
|
+
})(toggleUnderline());
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export var toggleSuperscript = function toggleSuperscript() {
|
|
97
|
+
return function (state, dispatch) {
|
|
98
|
+
var subsup = state.schema.marks.subsup;
|
|
99
|
+
if (subsup) {
|
|
100
|
+
return toggleMark(subsup, {
|
|
101
|
+
type: 'sup'
|
|
102
|
+
})(state, dispatch);
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(editorAnalyticsAPI) {
|
|
108
|
+
return function (_ref5) {
|
|
109
|
+
var inputMethod = _ref5.inputMethod;
|
|
110
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
111
|
+
action: ACTION.FORMATTED,
|
|
112
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
113
|
+
eventType: EVENT_TYPE.TRACK,
|
|
114
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
|
|
115
|
+
attributes: {
|
|
116
|
+
inputMethod: inputMethod
|
|
117
|
+
}
|
|
118
|
+
})(toggleSuperscript());
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
export var toggleSubscript = function toggleSubscript() {
|
|
122
|
+
return function (state, dispatch) {
|
|
123
|
+
var subsup = state.schema.marks.subsup;
|
|
124
|
+
if (subsup) {
|
|
125
|
+
return toggleMark(subsup, {
|
|
126
|
+
type: 'sub'
|
|
127
|
+
})(state, dispatch);
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
export var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorAnalyticsAPI) {
|
|
133
|
+
return function (_ref6) {
|
|
134
|
+
var inputMethod = _ref6.inputMethod;
|
|
135
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
136
|
+
action: ACTION.FORMATTED,
|
|
137
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
138
|
+
eventType: EVENT_TYPE.TRACK,
|
|
139
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUB,
|
|
140
|
+
attributes: {
|
|
141
|
+
inputMethod: inputMethod
|
|
142
|
+
}
|
|
143
|
+
})(toggleSubscript());
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
export var toggleCode = function toggleCode() {
|
|
147
|
+
return function (state, dispatch) {
|
|
148
|
+
var code = state.schema.marks.code;
|
|
149
|
+
if (code) {
|
|
150
|
+
return toggleMark(code)(state, dispatch);
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
export var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsAPI) {
|
|
156
|
+
return function (_ref7) {
|
|
157
|
+
var inputMethod = _ref7.inputMethod;
|
|
158
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
159
|
+
action: ACTION.FORMATTED,
|
|
160
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
161
|
+
eventType: EVENT_TYPE.TRACK,
|
|
162
|
+
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
163
|
+
attributes: {
|
|
164
|
+
inputMethod: inputMethod
|
|
165
|
+
}
|
|
166
|
+
})(toggleCode());
|
|
167
|
+
};
|
|
168
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { applyMarkOnRange
|
|
2
|
+
import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
|
|
3
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
5
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
@@ -97,171 +97,6 @@ export var moveLeft = function moveLeft() {
|
|
|
97
97
|
return false;
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
|
-
export var toggleEm = function toggleEm() {
|
|
101
|
-
return function (state, dispatch) {
|
|
102
|
-
var em = state.schema.marks.em;
|
|
103
|
-
if (em) {
|
|
104
|
-
return toggleMark(em)(state, dispatch);
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
export var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsAPI) {
|
|
110
|
-
return function (_ref3) {
|
|
111
|
-
var inputMethod = _ref3.inputMethod;
|
|
112
|
-
return withAnalytics(editorAnalyticsAPI, {
|
|
113
|
-
action: ACTION.FORMATTED,
|
|
114
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
115
|
-
eventType: EVENT_TYPE.TRACK,
|
|
116
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
|
117
|
-
attributes: {
|
|
118
|
-
inputMethod: inputMethod
|
|
119
|
-
}
|
|
120
|
-
})(toggleEm());
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
export var toggleStrike = function toggleStrike() {
|
|
124
|
-
return function (state, dispatch) {
|
|
125
|
-
var strike = state.schema.marks.strike;
|
|
126
|
-
if (strike) {
|
|
127
|
-
return toggleMark(strike)(state, dispatch);
|
|
128
|
-
}
|
|
129
|
-
return false;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
export var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyticsAPI) {
|
|
133
|
-
return function (_ref4) {
|
|
134
|
-
var inputMethod = _ref4.inputMethod;
|
|
135
|
-
return withAnalytics(editorAnalyticsAPI, {
|
|
136
|
-
action: ACTION.FORMATTED,
|
|
137
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
138
|
-
eventType: EVENT_TYPE.TRACK,
|
|
139
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
|
|
140
|
-
attributes: {
|
|
141
|
-
inputMethod: inputMethod
|
|
142
|
-
}
|
|
143
|
-
})(toggleStrike());
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
export var toggleStrong = function toggleStrong() {
|
|
147
|
-
return function (state, dispatch) {
|
|
148
|
-
var strong = state.schema.marks.strong;
|
|
149
|
-
if (strong) {
|
|
150
|
-
return toggleMark(strong)(state, dispatch);
|
|
151
|
-
}
|
|
152
|
-
return false;
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
export var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyticsAPI) {
|
|
156
|
-
return function (_ref5) {
|
|
157
|
-
var inputMethod = _ref5.inputMethod;
|
|
158
|
-
return withAnalytics(editorAnalyticsAPI, {
|
|
159
|
-
action: ACTION.FORMATTED,
|
|
160
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
161
|
-
eventType: EVENT_TYPE.TRACK,
|
|
162
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
|
|
163
|
-
attributes: {
|
|
164
|
-
inputMethod: inputMethod
|
|
165
|
-
}
|
|
166
|
-
})(toggleStrong());
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
export var toggleUnderline = function toggleUnderline() {
|
|
170
|
-
return function (state, dispatch) {
|
|
171
|
-
var underline = state.schema.marks.underline;
|
|
172
|
-
if (underline) {
|
|
173
|
-
return toggleMark(underline)(state, dispatch);
|
|
174
|
-
}
|
|
175
|
-
return false;
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
export var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorAnalyticsAPI) {
|
|
179
|
-
return function (_ref6) {
|
|
180
|
-
var inputMethod = _ref6.inputMethod;
|
|
181
|
-
return withAnalytics(editorAnalyticsAPI, {
|
|
182
|
-
action: ACTION.FORMATTED,
|
|
183
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
184
|
-
eventType: EVENT_TYPE.TRACK,
|
|
185
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
|
|
186
|
-
attributes: {
|
|
187
|
-
inputMethod: inputMethod
|
|
188
|
-
}
|
|
189
|
-
})(toggleUnderline());
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
export var toggleSuperscript = function toggleSuperscript() {
|
|
193
|
-
return function (state, dispatch) {
|
|
194
|
-
var subsup = state.schema.marks.subsup;
|
|
195
|
-
if (subsup) {
|
|
196
|
-
return toggleMark(subsup, {
|
|
197
|
-
type: 'sup'
|
|
198
|
-
})(state, dispatch);
|
|
199
|
-
}
|
|
200
|
-
return false;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
export var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(editorAnalyticsAPI) {
|
|
204
|
-
return function (_ref7) {
|
|
205
|
-
var inputMethod = _ref7.inputMethod;
|
|
206
|
-
return withAnalytics(editorAnalyticsAPI, {
|
|
207
|
-
action: ACTION.FORMATTED,
|
|
208
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
209
|
-
eventType: EVENT_TYPE.TRACK,
|
|
210
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
|
|
211
|
-
attributes: {
|
|
212
|
-
inputMethod: inputMethod
|
|
213
|
-
}
|
|
214
|
-
})(toggleSuperscript());
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
export var toggleSubscript = function toggleSubscript() {
|
|
218
|
-
return function (state, dispatch) {
|
|
219
|
-
var subsup = state.schema.marks.subsup;
|
|
220
|
-
if (subsup) {
|
|
221
|
-
return toggleMark(subsup, {
|
|
222
|
-
type: 'sub'
|
|
223
|
-
})(state, dispatch);
|
|
224
|
-
}
|
|
225
|
-
return false;
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
export var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorAnalyticsAPI) {
|
|
229
|
-
return function (_ref8) {
|
|
230
|
-
var inputMethod = _ref8.inputMethod;
|
|
231
|
-
return withAnalytics(editorAnalyticsAPI, {
|
|
232
|
-
action: ACTION.FORMATTED,
|
|
233
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
234
|
-
eventType: EVENT_TYPE.TRACK,
|
|
235
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUB,
|
|
236
|
-
attributes: {
|
|
237
|
-
inputMethod: inputMethod
|
|
238
|
-
}
|
|
239
|
-
})(toggleSubscript());
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
export var toggleCode = function toggleCode() {
|
|
243
|
-
return function (state, dispatch) {
|
|
244
|
-
var code = state.schema.marks.code;
|
|
245
|
-
if (code) {
|
|
246
|
-
return toggleMark(code)(state, dispatch);
|
|
247
|
-
}
|
|
248
|
-
return false;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
export var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsAPI) {
|
|
252
|
-
return function (_ref9) {
|
|
253
|
-
var inputMethod = _ref9.inputMethod;
|
|
254
|
-
return withAnalytics(editorAnalyticsAPI, {
|
|
255
|
-
action: ACTION.FORMATTED,
|
|
256
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
257
|
-
eventType: EVENT_TYPE.TRACK,
|
|
258
|
-
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
259
|
-
attributes: {
|
|
260
|
-
inputMethod: inputMethod
|
|
261
|
-
}
|
|
262
|
-
})(toggleCode());
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
100
|
var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from, to, text) {
|
|
266
101
|
return function (state, dispatch) {
|
|
267
102
|
if (state.selection.empty) {
|
|
@@ -9,6 +9,7 @@ import textFormattingInputRulePlugin from './pm-plugins/input-rule';
|
|
|
9
9
|
import keymapPlugin from './pm-plugins/keymap';
|
|
10
10
|
import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
|
|
11
11
|
import Toolbar from './ui/Toolbar';
|
|
12
|
+
import { toggleSuperscript, toggleSuperscriptWithAnalytics, toggleSubscript, toggleSubscriptWithAnalytics, toggleStrike, toggleStrikeWithAnalytics, toggleCode, toggleCodeWithAnalytics, toggleUnderline, toggleUnderlineWithAnalytics, toggleEm, toggleEmWithAnalytics, toggleStrong, toggleStrongWithAnalytics } from './actions';
|
|
12
13
|
var textFormatting = function textFormatting() {
|
|
13
14
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
14
15
|
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -111,6 +112,22 @@ var textFormatting = function textFormatting() {
|
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
114
|
});
|
|
115
|
+
},
|
|
116
|
+
actions: {
|
|
117
|
+
toggleSuperscript: toggleSuperscript,
|
|
118
|
+
toggleSuperscriptWithAnalytics: toggleSuperscriptWithAnalytics,
|
|
119
|
+
toggleSubscript: toggleSubscript,
|
|
120
|
+
toggleSubscriptWithAnalytics: toggleSubscriptWithAnalytics,
|
|
121
|
+
toggleStrike: toggleStrike,
|
|
122
|
+
toggleStrikeWithAnalytics: toggleStrikeWithAnalytics,
|
|
123
|
+
toggleCode: toggleCode,
|
|
124
|
+
toggleCodeWithAnalytics: toggleCodeWithAnalytics,
|
|
125
|
+
toggleUnderline: toggleUnderline,
|
|
126
|
+
toggleUnderlineWithAnalytics: toggleUnderlineWithAnalytics,
|
|
127
|
+
toggleEm: toggleEm,
|
|
128
|
+
toggleEmWithAnalytics: toggleEmWithAnalytics,
|
|
129
|
+
toggleStrong: toggleStrong,
|
|
130
|
+
toggleStrongWithAnalytics: toggleStrongWithAnalytics
|
|
114
131
|
}
|
|
115
132
|
};
|
|
116
133
|
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import * as keymaps from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import
|
|
4
|
+
import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../actions';
|
|
5
5
|
export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
6
6
|
var list = {};
|
|
7
7
|
if (schema.marks.strong) {
|
|
8
|
-
keymaps.bindKeymapWithCommand(keymaps.toggleBold.common,
|
|
8
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, 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,
|
|
13
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, 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,
|
|
18
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, 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,
|
|
23
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, 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,
|
|
28
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, 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,
|
|
33
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, 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,
|
|
38
|
+
keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, toggleUnderlineWithAnalytics(editorAnalyticsAPI)({
|
|
39
39
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
40
40
|
}), list);
|
|
41
41
|
}
|
|
@@ -6,7 +6,7 @@ import * as keymaps from '@atlaskit/editor-common/keymaps';
|
|
|
6
6
|
import { shallowEqual } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { createInlineCodeFromTextInputWithAnalytics } from '../commands/text-formatting';
|
|
8
8
|
import * as commands from '../commands/text-formatting';
|
|
9
|
-
import { anyMarkActive } from '
|
|
9
|
+
import { anyMarkActive } from '@atlaskit/editor-common/mark';
|
|
10
10
|
import { pluginKey } from './plugin-key';
|
|
11
11
|
export { pluginKey };
|
|
12
12
|
var getTextFormattingState = function getTextFormattingState(editorState, editorAnalyticsAPI) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useCallback, useMemo } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
5
|
-
import { toolbarMessages } from '
|
|
5
|
+
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { clearFormattingWithAnalytics } from '../../../commands/clear-formatting';
|
|
7
7
|
import { pluginKey as clearFormattingPluginKey } from '../../../pm-plugins/clear-formatting';
|
|
8
8
|
import { clearFormatting as clearFormattingKeymap, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -6,8 +6,8 @@ import { jsx } from '@emotion/react';
|
|
|
6
6
|
import BoldIcon from '@atlaskit/icon/glyph/editor/bold';
|
|
7
7
|
import ItalicIcon from '@atlaskit/icon/glyph/editor/italic';
|
|
8
8
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
9
|
-
import { toolbarMessages } from '
|
|
10
|
-
import
|
|
9
|
+
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
10
|
+
import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../../../actions';
|
|
11
11
|
import { TOOLBAR_ACTION_SUBJECT_ID, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { pluginKey as textFormattingPluginKey } from '../../../pm-plugins/plugin-key';
|
|
13
13
|
import { toggleCode, toggleStrikethrough, toggleUnderline, tooltip, toggleBold, toggleItalic, toggleSubscript, toggleSuperscript, ToolTipContent, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
@@ -21,7 +21,7 @@ var IconButtons = function IconButtons(editorAnalyticsAPI) {
|
|
|
21
21
|
return {
|
|
22
22
|
strong: {
|
|
23
23
|
buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
|
|
24
|
-
command: withToolbarInputMethod(
|
|
24
|
+
command: withToolbarInputMethod(toggleStrongWithAnalytics(editorAnalyticsAPI)),
|
|
25
25
|
message: toolbarMessages.bold,
|
|
26
26
|
tooltipKeymap: toggleBold,
|
|
27
27
|
component: function component() {
|
|
@@ -32,7 +32,7 @@ var IconButtons = function IconButtons(editorAnalyticsAPI) {
|
|
|
32
32
|
},
|
|
33
33
|
em: {
|
|
34
34
|
buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
|
|
35
|
-
command: withToolbarInputMethod(
|
|
35
|
+
command: withToolbarInputMethod(toggleEmWithAnalytics(editorAnalyticsAPI)),
|
|
36
36
|
message: toolbarMessages.italic,
|
|
37
37
|
tooltipKeymap: toggleItalic,
|
|
38
38
|
component: function component() {
|
|
@@ -42,27 +42,27 @@ var IconButtons = function IconButtons(editorAnalyticsAPI) {
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
underline: {
|
|
45
|
-
command: withToolbarInputMethod(
|
|
45
|
+
command: withToolbarInputMethod(toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
|
|
46
46
|
message: toolbarMessages.underline,
|
|
47
47
|
tooltipKeymap: toggleUnderline
|
|
48
48
|
},
|
|
49
49
|
strike: {
|
|
50
|
-
command: withToolbarInputMethod(
|
|
50
|
+
command: withToolbarInputMethod(toggleStrikeWithAnalytics(editorAnalyticsAPI)),
|
|
51
51
|
message: toolbarMessages.strike,
|
|
52
52
|
tooltipKeymap: toggleStrikethrough
|
|
53
53
|
},
|
|
54
54
|
code: {
|
|
55
|
-
command: withToolbarInputMethod(
|
|
55
|
+
command: withToolbarInputMethod(toggleCodeWithAnalytics(editorAnalyticsAPI)),
|
|
56
56
|
message: toolbarMessages.code,
|
|
57
57
|
tooltipKeymap: toggleCode
|
|
58
58
|
},
|
|
59
59
|
subscript: {
|
|
60
|
-
command: withToolbarInputMethod(
|
|
60
|
+
command: withToolbarInputMethod(toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
|
|
61
61
|
message: toolbarMessages.subscript,
|
|
62
62
|
tooltipKeymap: toggleSubscript
|
|
63
63
|
},
|
|
64
64
|
superscript: {
|
|
65
|
-
command: withToolbarInputMethod(
|
|
65
|
+
command: withToolbarInputMethod(toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
|
|
66
66
|
message: toolbarMessages.superscript,
|
|
67
67
|
tooltipKeymap: toggleSuperscript
|
|
68
68
|
}
|
|
@@ -18,7 +18,7 @@ import { useResponsiveToolbarButtons, useResponsiveIconTypeMenu } from './hooks/
|
|
|
18
18
|
import { SingleToolbarButtons } from './single-toolbar-buttons';
|
|
19
19
|
import { MoreButton } from './more-button';
|
|
20
20
|
import { FormattingTextDropdownMenu } from './dropdown-menu';
|
|
21
|
-
import { toolbarMessages } from '
|
|
21
|
+
import { toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
22
22
|
import { compareItemsArrays, isArrayContainsContent } from '../../utils';
|
|
23
23
|
import { Announcer } from '@atlaskit/editor-common/ui';
|
|
24
24
|
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|