@atlaskit/editor-plugin-text-formatting 8.2.11 → 8.2.13
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/pm-plugins/clear-formatting-keymap.js +2 -5
- package/dist/cjs/pm-plugins/keymap.js +28 -57
- package/dist/es2019/pm-plugins/clear-formatting-keymap.js +2 -5
- package/dist/es2019/pm-plugins/keymap.js +28 -57
- package/dist/esm/pm-plugins/clear-formatting-keymap.js +2 -5
- package/dist/esm/pm-plugins/keymap.js +28 -57
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -8,15 +8,12 @@ exports.keymapPlugin = keymapPlugin;
|
|
|
8
8
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
9
9
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
10
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
11
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
11
|
var _clearFormatting = require("../editor-commands/clear-formatting");
|
|
13
12
|
function keymapPlugin(editorAnalyticsAPI) {
|
|
14
13
|
var list = {};
|
|
15
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
14
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
16
15
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
17
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.clearFormatting)
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
19
|
-
_keymaps.clearFormatting.common, (0, _clearFormatting.clearFormattingWithAnalyticsNext)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
16
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.clearFormatting), (0, _clearFormatting.clearFormattingWithAnalyticsNext)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
20
17
|
return (0, _keymap.keymap)(list);
|
|
21
18
|
}
|
|
22
19
|
var _default = exports.default = keymapPlugin;
|
|
@@ -8,112 +8,83 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
8
8
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
10
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
11
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
11
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
12
|
var _toggleMark = require("../editor-commands/toggle-mark");
|
|
14
13
|
var _pluginKey = require("./plugin-key");
|
|
15
14
|
function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
16
15
|
var list = {};
|
|
17
16
|
if (schema.marks.strong) {
|
|
18
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
17
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
19
18
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBold)
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22
|
-
_keymaps.toggleBold.common, (0, _toggleMark.toggleStrongWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
19
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBold), (0, _toggleMark.toggleStrongWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
23
20
|
}
|
|
24
21
|
if (schema.marks.em) {
|
|
25
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleItalic) :
|
|
22
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
28
23
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
29
|
-
_keymaps.toggleItalic
|
|
24
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleItalic), (0, _toggleMark.toggleEmWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
30
25
|
}
|
|
31
26
|
if (schema.marks.code) {
|
|
32
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
27
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
33
28
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
34
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleCode)
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
36
|
-
_keymaps.toggleCode.common, (0, _toggleMark.toggleCodeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
29
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleCode), (0, _toggleMark.toggleCodeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
37
30
|
}
|
|
38
31
|
if (schema.marks.strike) {
|
|
39
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
41
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleStrikethrough) :
|
|
32
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
42
33
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
43
|
-
_keymaps.toggleStrikethrough
|
|
34
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleStrikethrough), (0, _toggleMark.toggleStrikeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
44
35
|
}
|
|
45
36
|
if (schema.marks.subsup) {
|
|
46
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
37
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
47
38
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
48
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleSubscript)
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
50
|
-
_keymaps.toggleSubscript.common, (0, _toggleMark.toggleSubscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
39
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleSubscript), (0, _toggleMark.toggleSubscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
51
40
|
}
|
|
52
41
|
if (schema.marks.subsup) {
|
|
53
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
55
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleSuperscript) :
|
|
42
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
56
43
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
57
|
-
_keymaps.toggleSuperscript
|
|
44
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleSuperscript), (0, _toggleMark.toggleSuperscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
58
45
|
}
|
|
59
46
|
if (schema.marks.underline) {
|
|
60
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
62
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleUnderline) :
|
|
47
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
63
48
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
64
|
-
_keymaps.toggleUnderline
|
|
49
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleUnderline), (0, _toggleMark.toggleUnderlineWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
65
50
|
}
|
|
66
51
|
var getEnabledKeylist = function getEnabledKeylist(view) {
|
|
67
52
|
var textFormattingState = _pluginKey.pluginKey.getState(view.state);
|
|
68
53
|
var list = {};
|
|
69
54
|
if (schema.marks.strong && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.strongDisabled)) {
|
|
70
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
55
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
71
56
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
72
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBold)
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
74
|
-
_keymaps.toggleBold.common, (0, _toggleMark.toggleStrongWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
57
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBold), (0, _toggleMark.toggleStrongWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
75
58
|
}
|
|
76
59
|
if (schema.marks.em && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.emDisabled)) {
|
|
77
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
79
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleItalic) :
|
|
60
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
80
61
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
81
|
-
_keymaps.toggleItalic
|
|
62
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleItalic), (0, _toggleMark.toggleEmWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
82
63
|
}
|
|
83
64
|
if (schema.marks.code && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.codeDisabled)) {
|
|
84
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
65
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
85
66
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
86
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleCode)
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
88
|
-
_keymaps.toggleCode.common, (0, _toggleMark.toggleCodeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
67
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleCode), (0, _toggleMark.toggleCodeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
89
68
|
}
|
|
90
69
|
if (schema.marks.strike && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.strikeDisabled)) {
|
|
91
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
93
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleStrikethrough) :
|
|
70
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
94
71
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
95
|
-
_keymaps.toggleStrikethrough
|
|
72
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleStrikethrough), (0, _toggleMark.toggleStrikeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
96
73
|
}
|
|
97
74
|
if (schema.marks.subsup && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.subscriptDisabled)) {
|
|
98
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
75
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
99
76
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
100
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleSubscript)
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
102
|
-
_keymaps.toggleSubscript.common, (0, _toggleMark.toggleSubscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
77
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleSubscript), (0, _toggleMark.toggleSubscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
103
78
|
}
|
|
104
79
|
if (schema.marks.subsup && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.superscriptDisabled)) {
|
|
105
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
107
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleSuperscript) :
|
|
80
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
108
81
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
109
|
-
_keymaps.toggleSuperscript
|
|
82
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleSuperscript), (0, _toggleMark.toggleSuperscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
110
83
|
}
|
|
111
84
|
if (schema.marks.underline && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.underlineDisabled)) {
|
|
112
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
114
|
-
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleUnderline) :
|
|
85
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
115
86
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
116
|
-
_keymaps.toggleUnderline
|
|
87
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleUnderline), (0, _toggleMark.toggleUnderlineWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
117
88
|
}
|
|
118
89
|
return list;
|
|
119
90
|
};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { bindKeymapWithEditorCommand, clearFormatting, findShortcutByKeymap } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { clearFormattingWithAnalyticsNext } from '../editor-commands/clear-formatting';
|
|
6
5
|
export function keymapPlugin(editorAnalyticsAPI) {
|
|
7
6
|
const list = {};
|
|
8
|
-
bindKeymapWithEditorCommand(
|
|
7
|
+
bindKeymapWithEditorCommand(
|
|
9
8
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10
|
-
findShortcutByKeymap(clearFormatting)
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
|
-
clearFormatting.common, clearFormattingWithAnalyticsNext(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
9
|
+
findShortcutByKeymap(clearFormatting), clearFormattingWithAnalyticsNext(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
13
10
|
return keymap(list);
|
|
14
11
|
}
|
|
15
12
|
export default keymapPlugin;
|
|
@@ -2,112 +2,83 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { bindKeymapWithEditorCommand, findShortcutByKeymap, isCapsLockOnAndModifyKeyboardEvent, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../editor-commands/toggle-mark';
|
|
8
7
|
import { pluginKey } from './plugin-key';
|
|
9
8
|
export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
10
9
|
const list = {};
|
|
11
10
|
if (schema.marks.strong) {
|
|
12
|
-
bindKeymapWithEditorCommand(
|
|
11
|
+
bindKeymapWithEditorCommand(
|
|
13
12
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14
|
-
findShortcutByKeymap(toggleBold)
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16
|
-
toggleBold.common, toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
13
|
+
findShortcutByKeymap(toggleBold), toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
17
14
|
}
|
|
18
15
|
if (schema.marks.em) {
|
|
19
|
-
bindKeymapWithEditorCommand(
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
21
|
-
findShortcutByKeymap(toggleItalic) :
|
|
16
|
+
bindKeymapWithEditorCommand(
|
|
22
17
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
-
toggleItalic
|
|
18
|
+
findShortcutByKeymap(toggleItalic), toggleEmWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
24
19
|
}
|
|
25
20
|
if (schema.marks.code) {
|
|
26
|
-
bindKeymapWithEditorCommand(
|
|
21
|
+
bindKeymapWithEditorCommand(
|
|
27
22
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
28
|
-
findShortcutByKeymap(toggleCode)
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
30
|
-
toggleCode.common, toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
23
|
+
findShortcutByKeymap(toggleCode), toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
31
24
|
}
|
|
32
25
|
if (schema.marks.strike) {
|
|
33
|
-
bindKeymapWithEditorCommand(
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
|
-
findShortcutByKeymap(toggleStrikethrough) :
|
|
26
|
+
bindKeymapWithEditorCommand(
|
|
36
27
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
|
-
toggleStrikethrough
|
|
28
|
+
findShortcutByKeymap(toggleStrikethrough), toggleStrikeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
38
29
|
}
|
|
39
30
|
if (schema.marks.subsup) {
|
|
40
|
-
bindKeymapWithEditorCommand(
|
|
31
|
+
bindKeymapWithEditorCommand(
|
|
41
32
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
42
|
-
findShortcutByKeymap(toggleSubscript)
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
44
|
-
toggleSubscript.common, toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
33
|
+
findShortcutByKeymap(toggleSubscript), toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
45
34
|
}
|
|
46
35
|
if (schema.marks.subsup) {
|
|
47
|
-
bindKeymapWithEditorCommand(
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
|
-
findShortcutByKeymap(toggleSuperscript) :
|
|
36
|
+
bindKeymapWithEditorCommand(
|
|
50
37
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
51
|
-
toggleSuperscript
|
|
38
|
+
findShortcutByKeymap(toggleSuperscript), toggleSuperscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
52
39
|
}
|
|
53
40
|
if (schema.marks.underline) {
|
|
54
|
-
bindKeymapWithEditorCommand(
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
|
-
findShortcutByKeymap(toggleUnderline) :
|
|
41
|
+
bindKeymapWithEditorCommand(
|
|
57
42
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
58
|
-
toggleUnderline
|
|
43
|
+
findShortcutByKeymap(toggleUnderline), toggleUnderlineWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
59
44
|
}
|
|
60
45
|
const getEnabledKeylist = view => {
|
|
61
46
|
const textFormattingState = pluginKey.getState(view.state);
|
|
62
47
|
const list = {};
|
|
63
48
|
if (schema.marks.strong && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.strongDisabled)) {
|
|
64
|
-
bindKeymapWithEditorCommand(
|
|
49
|
+
bindKeymapWithEditorCommand(
|
|
65
50
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
66
|
-
findShortcutByKeymap(toggleBold)
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
68
|
-
toggleBold.common, toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
51
|
+
findShortcutByKeymap(toggleBold), toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
69
52
|
}
|
|
70
53
|
if (schema.marks.em && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.emDisabled)) {
|
|
71
|
-
bindKeymapWithEditorCommand(
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
73
|
-
findShortcutByKeymap(toggleItalic) :
|
|
54
|
+
bindKeymapWithEditorCommand(
|
|
74
55
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
75
|
-
toggleItalic
|
|
56
|
+
findShortcutByKeymap(toggleItalic), toggleEmWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
76
57
|
}
|
|
77
58
|
if (schema.marks.code && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.codeDisabled)) {
|
|
78
|
-
bindKeymapWithEditorCommand(
|
|
59
|
+
bindKeymapWithEditorCommand(
|
|
79
60
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
80
|
-
findShortcutByKeymap(toggleCode)
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
82
|
-
toggleCode.common, toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
61
|
+
findShortcutByKeymap(toggleCode), toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
83
62
|
}
|
|
84
63
|
if (schema.marks.strike && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.strikeDisabled)) {
|
|
85
|
-
bindKeymapWithEditorCommand(
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
87
|
-
findShortcutByKeymap(toggleStrikethrough) :
|
|
64
|
+
bindKeymapWithEditorCommand(
|
|
88
65
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
89
|
-
toggleStrikethrough
|
|
66
|
+
findShortcutByKeymap(toggleStrikethrough), toggleStrikeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
90
67
|
}
|
|
91
68
|
if (schema.marks.subsup && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.subscriptDisabled)) {
|
|
92
|
-
bindKeymapWithEditorCommand(
|
|
69
|
+
bindKeymapWithEditorCommand(
|
|
93
70
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
94
|
-
findShortcutByKeymap(toggleSubscript)
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
96
|
-
toggleSubscript.common, toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
71
|
+
findShortcutByKeymap(toggleSubscript), toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
97
72
|
}
|
|
98
73
|
if (schema.marks.subsup && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.superscriptDisabled)) {
|
|
99
|
-
bindKeymapWithEditorCommand(
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
101
|
-
findShortcutByKeymap(toggleSuperscript) :
|
|
74
|
+
bindKeymapWithEditorCommand(
|
|
102
75
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
|
-
toggleSuperscript
|
|
76
|
+
findShortcutByKeymap(toggleSuperscript), toggleSuperscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
104
77
|
}
|
|
105
78
|
if (schema.marks.underline && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.underlineDisabled)) {
|
|
106
|
-
bindKeymapWithEditorCommand(
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
108
|
-
findShortcutByKeymap(toggleUnderline) :
|
|
79
|
+
bindKeymapWithEditorCommand(
|
|
109
80
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
110
|
-
toggleUnderline
|
|
81
|
+
findShortcutByKeymap(toggleUnderline), toggleUnderlineWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
111
82
|
}
|
|
112
83
|
return list;
|
|
113
84
|
};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { bindKeymapWithEditorCommand, clearFormatting, findShortcutByKeymap } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { clearFormattingWithAnalyticsNext } from '../editor-commands/clear-formatting';
|
|
6
5
|
export function keymapPlugin(editorAnalyticsAPI) {
|
|
7
6
|
var list = {};
|
|
8
|
-
bindKeymapWithEditorCommand(
|
|
7
|
+
bindKeymapWithEditorCommand(
|
|
9
8
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10
|
-
findShortcutByKeymap(clearFormatting)
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
|
-
clearFormatting.common, clearFormattingWithAnalyticsNext(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
9
|
+
findShortcutByKeymap(clearFormatting), clearFormattingWithAnalyticsNext(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
13
10
|
return keymap(list);
|
|
14
11
|
}
|
|
15
12
|
export default keymapPlugin;
|
|
@@ -2,112 +2,83 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { bindKeymapWithEditorCommand, findShortcutByKeymap, isCapsLockOnAndModifyKeyboardEvent, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../editor-commands/toggle-mark';
|
|
8
7
|
import { pluginKey } from './plugin-key';
|
|
9
8
|
export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
10
9
|
var list = {};
|
|
11
10
|
if (schema.marks.strong) {
|
|
12
|
-
bindKeymapWithEditorCommand(
|
|
11
|
+
bindKeymapWithEditorCommand(
|
|
13
12
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14
|
-
findShortcutByKeymap(toggleBold)
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16
|
-
toggleBold.common, toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
13
|
+
findShortcutByKeymap(toggleBold), toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
17
14
|
}
|
|
18
15
|
if (schema.marks.em) {
|
|
19
|
-
bindKeymapWithEditorCommand(
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
21
|
-
findShortcutByKeymap(toggleItalic) :
|
|
16
|
+
bindKeymapWithEditorCommand(
|
|
22
17
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
-
toggleItalic
|
|
18
|
+
findShortcutByKeymap(toggleItalic), toggleEmWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
24
19
|
}
|
|
25
20
|
if (schema.marks.code) {
|
|
26
|
-
bindKeymapWithEditorCommand(
|
|
21
|
+
bindKeymapWithEditorCommand(
|
|
27
22
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
28
|
-
findShortcutByKeymap(toggleCode)
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
30
|
-
toggleCode.common, toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
23
|
+
findShortcutByKeymap(toggleCode), toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
31
24
|
}
|
|
32
25
|
if (schema.marks.strike) {
|
|
33
|
-
bindKeymapWithEditorCommand(
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
|
-
findShortcutByKeymap(toggleStrikethrough) :
|
|
26
|
+
bindKeymapWithEditorCommand(
|
|
36
27
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
|
-
toggleStrikethrough
|
|
28
|
+
findShortcutByKeymap(toggleStrikethrough), toggleStrikeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
38
29
|
}
|
|
39
30
|
if (schema.marks.subsup) {
|
|
40
|
-
bindKeymapWithEditorCommand(
|
|
31
|
+
bindKeymapWithEditorCommand(
|
|
41
32
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
42
|
-
findShortcutByKeymap(toggleSubscript)
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
44
|
-
toggleSubscript.common, toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
33
|
+
findShortcutByKeymap(toggleSubscript), toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
45
34
|
}
|
|
46
35
|
if (schema.marks.subsup) {
|
|
47
|
-
bindKeymapWithEditorCommand(
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
|
-
findShortcutByKeymap(toggleSuperscript) :
|
|
36
|
+
bindKeymapWithEditorCommand(
|
|
50
37
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
51
|
-
toggleSuperscript
|
|
38
|
+
findShortcutByKeymap(toggleSuperscript), toggleSuperscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
52
39
|
}
|
|
53
40
|
if (schema.marks.underline) {
|
|
54
|
-
bindKeymapWithEditorCommand(
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
|
-
findShortcutByKeymap(toggleUnderline) :
|
|
41
|
+
bindKeymapWithEditorCommand(
|
|
57
42
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
58
|
-
toggleUnderline
|
|
43
|
+
findShortcutByKeymap(toggleUnderline), toggleUnderlineWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
59
44
|
}
|
|
60
45
|
var getEnabledKeylist = function getEnabledKeylist(view) {
|
|
61
46
|
var textFormattingState = pluginKey.getState(view.state);
|
|
62
47
|
var list = {};
|
|
63
48
|
if (schema.marks.strong && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.strongDisabled)) {
|
|
64
|
-
bindKeymapWithEditorCommand(
|
|
49
|
+
bindKeymapWithEditorCommand(
|
|
65
50
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
66
|
-
findShortcutByKeymap(toggleBold)
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
68
|
-
toggleBold.common, toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
51
|
+
findShortcutByKeymap(toggleBold), toggleStrongWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
69
52
|
}
|
|
70
53
|
if (schema.marks.em && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.emDisabled)) {
|
|
71
|
-
bindKeymapWithEditorCommand(
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
73
|
-
findShortcutByKeymap(toggleItalic) :
|
|
54
|
+
bindKeymapWithEditorCommand(
|
|
74
55
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
75
|
-
toggleItalic
|
|
56
|
+
findShortcutByKeymap(toggleItalic), toggleEmWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
76
57
|
}
|
|
77
58
|
if (schema.marks.code && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.codeDisabled)) {
|
|
78
|
-
bindKeymapWithEditorCommand(
|
|
59
|
+
bindKeymapWithEditorCommand(
|
|
79
60
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
80
|
-
findShortcutByKeymap(toggleCode)
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
82
|
-
toggleCode.common, toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
61
|
+
findShortcutByKeymap(toggleCode), toggleCodeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
83
62
|
}
|
|
84
63
|
if (schema.marks.strike && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.strikeDisabled)) {
|
|
85
|
-
bindKeymapWithEditorCommand(
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
87
|
-
findShortcutByKeymap(toggleStrikethrough) :
|
|
64
|
+
bindKeymapWithEditorCommand(
|
|
88
65
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
89
|
-
toggleStrikethrough
|
|
66
|
+
findShortcutByKeymap(toggleStrikethrough), toggleStrikeWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
90
67
|
}
|
|
91
68
|
if (schema.marks.subsup && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.subscriptDisabled)) {
|
|
92
|
-
bindKeymapWithEditorCommand(
|
|
69
|
+
bindKeymapWithEditorCommand(
|
|
93
70
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
94
|
-
findShortcutByKeymap(toggleSubscript)
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
96
|
-
toggleSubscript.common, toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
71
|
+
findShortcutByKeymap(toggleSubscript), toggleSubscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
97
72
|
}
|
|
98
73
|
if (schema.marks.subsup && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.superscriptDisabled)) {
|
|
99
|
-
bindKeymapWithEditorCommand(
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
101
|
-
findShortcutByKeymap(toggleSuperscript) :
|
|
74
|
+
bindKeymapWithEditorCommand(
|
|
102
75
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
|
-
toggleSuperscript
|
|
76
|
+
findShortcutByKeymap(toggleSuperscript), toggleSuperscriptWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
104
77
|
}
|
|
105
78
|
if (schema.marks.underline && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.underlineDisabled)) {
|
|
106
|
-
bindKeymapWithEditorCommand(
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
108
|
-
findShortcutByKeymap(toggleUnderline) :
|
|
79
|
+
bindKeymapWithEditorCommand(
|
|
109
80
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
110
|
-
toggleUnderline
|
|
81
|
+
findShortcutByKeymap(toggleUnderline), toggleUnderlineWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
111
82
|
}
|
|
112
83
|
return list;
|
|
113
84
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.13",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
44
44
|
"@atlaskit/editor-toolbar": "^0.20.0",
|
|
45
45
|
"@atlaskit/editor-toolbar-model": "^0.4.0",
|
|
46
|
-
"@atlaskit/icon": "^34.
|
|
46
|
+
"@atlaskit/icon": "^34.1.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
48
|
"@atlaskit/prosemirror-input-rules": "^3.6.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^62.0.0",
|
|
50
50
|
"@atlaskit/tokens": "^13.0.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@emotion/react": "^11.7.1",
|
|
53
53
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@atlaskit/editor-common": "^112.
|
|
56
|
+
"@atlaskit/editor-common": "^112.21.0",
|
|
57
57
|
"react": "^18.2.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|