@atlaskit/editor-core 187.23.0 → 187.23.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 +14 -0
- package/dist/cjs/plugins/block-type/index.js +3 -6
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +12 -12
- package/dist/cjs/plugins/caption/pm-plugins/keymap.js +9 -12
- package/dist/cjs/plugins/date/pm-plugins/keymap.js +4 -8
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +7 -10
- package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -5
- package/dist/cjs/plugins/help-dialog/index.js +3 -6
- package/dist/cjs/plugins/help-dialog/ui/index.js +29 -29
- package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +5 -8
- package/dist/cjs/plugins/list/pm-plugins/keymap.js +9 -12
- package/dist/cjs/plugins/media/pm-plugins/alt-text/keymap.js +3 -6
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +4 -6
- package/dist/cjs/plugins/media/pm-plugins/keymap-media-single.js +2 -5
- package/dist/cjs/plugins/media/pm-plugins/keymap.js +8 -11
- package/dist/cjs/plugins/media/pm-plugins/linking/keymap.js +2 -5
- package/dist/cjs/plugins/media/toolbar/index.js +7 -2
- package/dist/cjs/plugins/rule/pm-plugins/keymap.js +4 -7
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-keymap.js +8 -11
- package/dist/cjs/plugins/status/keymap.js +3 -6
- package/dist/cjs/plugins/submit-editor/index.js +3 -6
- package/dist/cjs/plugins/undo-redo/pm-plugins/keymaps.js +4 -8
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/block-type/index.js +3 -3
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +11 -12
- package/dist/es2019/plugins/caption/pm-plugins/keymap.js +9 -9
- package/dist/es2019/plugins/date/pm-plugins/keymap.js +3 -4
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +7 -7
- package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/help-dialog/index.js +2 -3
- package/dist/es2019/plugins/help-dialog/ui/index.js +29 -29
- package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +5 -5
- package/dist/es2019/plugins/list/pm-plugins/keymap.js +10 -11
- package/dist/es2019/plugins/media/pm-plugins/alt-text/keymap.js +3 -3
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/keymap-media-single.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/keymap.js +8 -8
- package/dist/es2019/plugins/media/pm-plugins/linking/keymap.js +2 -2
- package/dist/es2019/plugins/media/toolbar/index.js +7 -2
- package/dist/es2019/plugins/rule/pm-plugins/keymap.js +4 -4
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-keymap.js +8 -8
- package/dist/es2019/plugins/status/keymap.js +3 -3
- package/dist/es2019/plugins/submit-editor/index.js +3 -3
- package/dist/es2019/plugins/undo-redo/pm-plugins/keymaps.js +3 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/block-type/index.js +3 -3
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +11 -12
- package/dist/esm/plugins/caption/pm-plugins/keymap.js +9 -9
- package/dist/esm/plugins/date/pm-plugins/keymap.js +3 -4
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +7 -7
- package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/help-dialog/index.js +2 -3
- package/dist/esm/plugins/help-dialog/ui/index.js +29 -29
- package/dist/esm/plugins/indentation/pm-plugins/keymap.js +5 -5
- package/dist/esm/plugins/list/pm-plugins/keymap.js +10 -11
- package/dist/esm/plugins/media/pm-plugins/alt-text/keymap.js +3 -3
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/keymap-media-single.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/keymap.js +8 -8
- package/dist/esm/plugins/media/pm-plugins/linking/keymap.js +2 -2
- package/dist/esm/plugins/media/toolbar/index.js +7 -2
- package/dist/esm/plugins/rule/pm-plugins/keymap.js +4 -4
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-keymap.js +8 -8
- package/dist/esm/plugins/status/keymap.js +3 -3
- package/dist/esm/plugins/submit-editor/index.js +3 -3
- package/dist/esm/plugins/undo-redo/pm-plugins/keymaps.js +3 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/help-dialog/ui/index.d.ts +2 -2
- package/dist/types/plugins/list/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/plugins/help-dialog/ui/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/list/pm-plugins/keymap.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
import
|
|
5
|
-
import { openHelp, tooltip } from '../../keymaps';
|
|
4
|
+
import { bindKeymapWithCommand, openHelp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
5
|
import WithPluginState from '../../ui/WithPluginState';
|
|
7
6
|
import { HelpDialogLoader } from './ui/HelpDialogLoader';
|
|
8
7
|
import { pluginKey as quickInsertPluginKey } from '../quick-insert';
|
|
@@ -105,7 +104,7 @@ const helpDialog = (imageUploadProviderExists = false, api) => ({
|
|
|
105
104
|
});
|
|
106
105
|
const keymapPlugin = editorAnalyticsAPI => {
|
|
107
106
|
const list = {};
|
|
108
|
-
|
|
107
|
+
bindKeymapWithCommand(openHelp.common, (state, dispatch) => {
|
|
109
108
|
let {
|
|
110
109
|
tr
|
|
111
110
|
} = state;
|
|
@@ -8,7 +8,7 @@ import { browser } from '@atlaskit/editor-common/utils';
|
|
|
8
8
|
import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
9
9
|
import AkModalDialog, { ModalTransition, useModal } from '@atlaskit/modal-dialog';
|
|
10
10
|
import { header, footer, contentWrapper, line, content, row, codeSm, codeMd, codeLg, title, column, dialogHeader } from './styles';
|
|
11
|
-
import
|
|
11
|
+
import { navToFloatingToolbar, navToEditorToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, insertRule, addLink, setNormalText, alignLeft, clearFormatting, undo, redo, pastePlainText, addInlineComment, toggleCode, openHelp, toggleBulletList, toggleBlockQuote } from '@atlaskit/editor-common/keymaps';
|
|
12
12
|
import ToolbarButton from '../../../ui/ToolbarButton';
|
|
13
13
|
import { toolbarMessages, listMessages } from '@atlaskit/editor-common/messages';
|
|
14
14
|
import { messages as insertBlockMessages } from '../../insert-block/ui/ToolbarInsertBlock/messages';
|
|
@@ -65,51 +65,51 @@ const navigationKeymaps = ({
|
|
|
65
65
|
}) => [{
|
|
66
66
|
name: formatMessage(toolbarMessages.navigateToEditorToolbar),
|
|
67
67
|
type: 'navigation',
|
|
68
|
-
keymap: () =>
|
|
68
|
+
keymap: () => navToEditorToolbar
|
|
69
69
|
}, {
|
|
70
70
|
name: formatMessage(toolbarMessages.navigateToFloatingToolbar),
|
|
71
71
|
type: 'navigation',
|
|
72
|
-
keymap: () =>
|
|
72
|
+
keymap: () => navToFloatingToolbar
|
|
73
73
|
}];
|
|
74
74
|
export const formatting = ({
|
|
75
75
|
formatMessage
|
|
76
76
|
}) => [{
|
|
77
77
|
name: formatMessage(toolbarMessages.bold),
|
|
78
78
|
type: 'strong',
|
|
79
|
-
keymap: () =>
|
|
79
|
+
keymap: () => toggleBold,
|
|
80
80
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
81
81
|
css: codeLg
|
|
82
82
|
}, "**", jsx(FormattedMessage, toolbarMessages.bold), "**"))
|
|
83
83
|
}, {
|
|
84
84
|
name: formatMessage(toolbarMessages.italic),
|
|
85
85
|
type: 'em',
|
|
86
|
-
keymap: () =>
|
|
86
|
+
keymap: () => toggleItalic,
|
|
87
87
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
88
88
|
css: codeLg
|
|
89
89
|
}, "*", jsx(FormattedMessage, toolbarMessages.italic), "*"))
|
|
90
90
|
}, {
|
|
91
91
|
name: formatMessage(toolbarMessages.underline),
|
|
92
92
|
type: 'underline',
|
|
93
|
-
keymap: () =>
|
|
93
|
+
keymap: () => toggleUnderline
|
|
94
94
|
}, {
|
|
95
95
|
name: formatMessage(toolbarMessages.strike),
|
|
96
96
|
type: 'strike',
|
|
97
|
-
keymap: () =>
|
|
97
|
+
keymap: () => toggleStrikethrough,
|
|
98
98
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
99
99
|
css: codeLg
|
|
100
100
|
}, "~~", jsx(FormattedMessage, toolbarMessages.strike), "~~"))
|
|
101
101
|
}, {
|
|
102
102
|
name: formatMessage(toolbarMessages.subscript),
|
|
103
103
|
type: 'subsup',
|
|
104
|
-
keymap: () =>
|
|
104
|
+
keymap: () => toggleSubscript
|
|
105
105
|
}, {
|
|
106
106
|
name: formatMessage(toolbarMessages.superscript),
|
|
107
107
|
type: 'subsup',
|
|
108
|
-
keymap: () =>
|
|
108
|
+
keymap: () => toggleSuperscript
|
|
109
109
|
}, {
|
|
110
110
|
name: formatMessage(blockTypeMessages.heading1),
|
|
111
111
|
type: 'heading',
|
|
112
|
-
keymap: () =>
|
|
112
|
+
keymap: () => toggleHeading1,
|
|
113
113
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
114
114
|
css: codeSm
|
|
115
115
|
}, "#"), " ", jsx("span", {
|
|
@@ -118,7 +118,7 @@ export const formatting = ({
|
|
|
118
118
|
}, {
|
|
119
119
|
name: formatMessage(blockTypeMessages.heading2),
|
|
120
120
|
type: 'heading',
|
|
121
|
-
keymap: () =>
|
|
121
|
+
keymap: () => toggleHeading2,
|
|
122
122
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
123
123
|
css: codeLg
|
|
124
124
|
}, "##"), " ", jsx("span", {
|
|
@@ -127,7 +127,7 @@ export const formatting = ({
|
|
|
127
127
|
}, {
|
|
128
128
|
name: formatMessage(blockTypeMessages.heading3),
|
|
129
129
|
type: 'heading',
|
|
130
|
-
keymap: () =>
|
|
130
|
+
keymap: () => toggleHeading3,
|
|
131
131
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
132
132
|
css: codeLg
|
|
133
133
|
}, "###"), " ", jsx("span", {
|
|
@@ -136,7 +136,7 @@ export const formatting = ({
|
|
|
136
136
|
}, {
|
|
137
137
|
name: formatMessage(blockTypeMessages.heading4),
|
|
138
138
|
type: 'heading',
|
|
139
|
-
keymap: () =>
|
|
139
|
+
keymap: () => toggleHeading4,
|
|
140
140
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
141
141
|
css: codeLg
|
|
142
142
|
}, "####"), " ", jsx("span", {
|
|
@@ -145,7 +145,7 @@ export const formatting = ({
|
|
|
145
145
|
}, {
|
|
146
146
|
name: formatMessage(blockTypeMessages.heading5),
|
|
147
147
|
type: 'heading',
|
|
148
|
-
keymap: () =>
|
|
148
|
+
keymap: () => toggleHeading5,
|
|
149
149
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
150
150
|
css: codeLg
|
|
151
151
|
}, "#####"), " ", jsx("span", {
|
|
@@ -154,7 +154,7 @@ export const formatting = ({
|
|
|
154
154
|
}, {
|
|
155
155
|
name: formatMessage(blockTypeMessages.heading6),
|
|
156
156
|
type: 'heading',
|
|
157
|
-
keymap: () =>
|
|
157
|
+
keymap: () => toggleHeading6,
|
|
158
158
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
159
159
|
css: codeLg
|
|
160
160
|
}, "######"), " ", jsx("span", {
|
|
@@ -163,11 +163,11 @@ export const formatting = ({
|
|
|
163
163
|
}, {
|
|
164
164
|
name: formatMessage(blockTypeMessages.normal),
|
|
165
165
|
type: 'paragraph',
|
|
166
|
-
keymap: () =>
|
|
166
|
+
keymap: () => setNormalText
|
|
167
167
|
}, {
|
|
168
168
|
name: formatMessage(listMessages.orderedList),
|
|
169
169
|
type: 'orderedList',
|
|
170
|
-
keymap: () =>
|
|
170
|
+
keymap: () => toggleOrderedList,
|
|
171
171
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
172
172
|
css: codeSm
|
|
173
173
|
}, "1."), " ", jsx("span", {
|
|
@@ -176,7 +176,7 @@ export const formatting = ({
|
|
|
176
176
|
}, {
|
|
177
177
|
name: formatMessage(listMessages.unorderedList),
|
|
178
178
|
type: 'bulletList',
|
|
179
|
-
keymap: () =>
|
|
179
|
+
keymap: () => toggleBulletList,
|
|
180
180
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
181
181
|
css: codeSm
|
|
182
182
|
}, "*"), " ", jsx("span", {
|
|
@@ -185,7 +185,7 @@ export const formatting = ({
|
|
|
185
185
|
}, {
|
|
186
186
|
name: formatMessage(blockTypeMessages.blockquote),
|
|
187
187
|
type: 'blockquote',
|
|
188
|
-
keymap: () =>
|
|
188
|
+
keymap: () => toggleBlockQuote,
|
|
189
189
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
190
190
|
css: codeLg
|
|
191
191
|
}, '>'), " ", jsx("span", {
|
|
@@ -200,21 +200,21 @@ export const formatting = ({
|
|
|
200
200
|
}, {
|
|
201
201
|
name: formatMessage(insertBlockMessages.horizontalRule),
|
|
202
202
|
type: 'rule',
|
|
203
|
-
keymap: () =>
|
|
203
|
+
keymap: () => insertRule,
|
|
204
204
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
205
205
|
css: codeLg
|
|
206
206
|
}, "---"))
|
|
207
207
|
}, {
|
|
208
208
|
name: formatMessage(insertBlockMessages.link),
|
|
209
209
|
type: 'link',
|
|
210
|
-
keymap: () =>
|
|
210
|
+
keymap: () => addLink,
|
|
211
211
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
212
212
|
css: codeLg
|
|
213
213
|
}, "[", jsx(FormattedMessage, insertBlockMessages.link), "](http://a.com)"))
|
|
214
214
|
}, {
|
|
215
215
|
name: formatMessage(toolbarMessages.code),
|
|
216
216
|
type: 'code',
|
|
217
|
-
keymap: () =>
|
|
217
|
+
keymap: () => toggleCode,
|
|
218
218
|
autoFormatting: () => jsx("span", null, jsx("span", {
|
|
219
219
|
css: codeLg
|
|
220
220
|
}, "`", jsx(FormattedMessage, toolbarMessages.code), "`"))
|
|
@@ -249,7 +249,7 @@ export const formatting = ({
|
|
|
249
249
|
}, {
|
|
250
250
|
name: formatMessage(alignmentMessages.alignLeft),
|
|
251
251
|
type: 'alignment',
|
|
252
|
-
keymap: () =>
|
|
252
|
+
keymap: () => alignLeft
|
|
253
253
|
}, {
|
|
254
254
|
name: formatMessage(alignmentMessages.alignRight),
|
|
255
255
|
type: 'alignment'
|
|
@@ -260,23 +260,23 @@ const otherFormatting = ({
|
|
|
260
260
|
}) => [{
|
|
261
261
|
name: formatMessage(toolbarMessages.clearFormatting),
|
|
262
262
|
type: 'clearFormatting',
|
|
263
|
-
keymap: () =>
|
|
263
|
+
keymap: () => clearFormatting
|
|
264
264
|
}, {
|
|
265
265
|
name: formatMessage(undoRedoMessages.undo),
|
|
266
266
|
type: 'undo',
|
|
267
|
-
keymap: () =>
|
|
267
|
+
keymap: () => undo
|
|
268
268
|
}, {
|
|
269
269
|
name: formatMessage(undoRedoMessages.redo),
|
|
270
270
|
type: 'redo',
|
|
271
|
-
keymap: () =>
|
|
271
|
+
keymap: () => redo
|
|
272
272
|
}, {
|
|
273
273
|
name: formatMessage(messages.pastePlainText),
|
|
274
274
|
type: 'paste',
|
|
275
|
-
keymap: () =>
|
|
275
|
+
keymap: () => pastePlainText
|
|
276
276
|
}, {
|
|
277
277
|
name: formatMessage(annotationMessages.createComment),
|
|
278
278
|
type: 'annotation',
|
|
279
|
-
keymap: () =>
|
|
279
|
+
keymap: () => addInlineComment
|
|
280
280
|
}];
|
|
281
281
|
const imageAutoFormat = {
|
|
282
282
|
name: 'Image',
|
|
@@ -362,7 +362,7 @@ const ModalFooter = () => jsx("div", {
|
|
|
362
362
|
css: footer
|
|
363
363
|
}, jsx(FormattedMessage, _extends({}, messages.helpDialogTips, {
|
|
364
364
|
values: {
|
|
365
|
-
keyMap: getComponentFromKeymap(
|
|
365
|
+
keyMap: getComponentFromKeymap(openHelp)
|
|
366
366
|
}
|
|
367
367
|
})));
|
|
368
368
|
class HelpDialog extends React.Component {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
2
|
+
import { bindKeymapWithCommand, findShortcutByKeymap, outdent, indent, backspace } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { isTextSelection } from '../../../utils';
|
|
4
4
|
import { getIndentCommand, getOutdentCommand } from '../commands';
|
|
5
|
-
import { INPUT_METHOD } from '
|
|
5
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
export function keymapPlugin() {
|
|
7
7
|
const list = {};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
bindKeymapWithCommand(findShortcutByKeymap(indent), getIndentCommand(INPUT_METHOD.KEYBOARD), list);
|
|
9
|
+
bindKeymapWithCommand(findShortcutByKeymap(outdent), getOutdentCommand(INPUT_METHOD.KEYBOARD), list);
|
|
10
|
+
bindKeymapWithCommand(findShortcutByKeymap(backspace), (state, dispatch) => {
|
|
11
11
|
const {
|
|
12
12
|
selection
|
|
13
13
|
} = state;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
3
|
-
import { indentList, enterKeyCommand, toggleList, backspaceKeyCommand, deleteKeyCommand } from '../commands';
|
|
4
|
-
import { outdentList } from '../commands';
|
|
2
|
+
import { bindKeymapWithCommand, findShortcutByKeymap, toggleOrderedList, toggleBulletList, indentList, outdentList, enter, backspace, deleteKey, findKeyMapForBrowser, forwardDelete } from '@atlaskit/editor-common/keymaps';
|
|
3
|
+
import { indentList as indentListCommand, outdentList as outdentListCommand, enterKeyCommand, toggleList, backspaceKeyCommand, deleteKeyCommand } from '../commands';
|
|
5
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
5
|
export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
7
6
|
const list = {};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
bindKeymapWithCommand(findShortcutByKeymap(toggleOrderedList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'orderedList'), list);
|
|
8
|
+
bindKeymapWithCommand(findShortcutByKeymap(toggleBulletList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'bulletList'), list);
|
|
9
|
+
bindKeymapWithCommand(indentList.common, indentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
10
|
+
bindKeymapWithCommand(outdentList.common, outdentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, featureFlags), list);
|
|
11
|
+
bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(featureFlags), list);
|
|
12
|
+
bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(featureFlags), list);
|
|
13
|
+
bindKeymapWithCommand(deleteKey.common, deleteKeyCommand(editorAnalyticsAPI), list);
|
|
15
14
|
|
|
16
15
|
// This shortcut is Mac only
|
|
17
|
-
|
|
16
|
+
bindKeymapWithCommand(findKeyMapForBrowser(forwardDelete), deleteKeyCommand(editorAnalyticsAPI), list);
|
|
18
17
|
return keymap(list);
|
|
19
18
|
}
|
|
20
19
|
export default keymapPlugin;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
2
|
+
import { bindKeymapWithCommand, addAltText, escape } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { openMediaAltTextMenu, closeMediaAltTextMenu } from './commands';
|
|
4
4
|
export default function keymapPlugin(schema, editorAnalyticsAPI) {
|
|
5
5
|
const list = {};
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
bindKeymapWithCommand(addAltText.common, openMediaAltTextMenu(editorAnalyticsAPI), list);
|
|
7
|
+
bindKeymapWithCommand(escape.common, closeMediaAltTextMenu, list);
|
|
8
8
|
return keymap(list);
|
|
9
9
|
}
|
|
@@ -10,7 +10,7 @@ import { messages } from '../messages';
|
|
|
10
10
|
import { injectIntl } from 'react-intl-next';
|
|
11
11
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { PanelTextInput } from '@atlaskit/editor-common/ui';
|
|
13
|
-
import
|
|
13
|
+
import { escape } from '@atlaskit/editor-common/keymaps';
|
|
14
14
|
import { ToolTipContent } from '../../../../../keymaps';
|
|
15
15
|
import { closeMediaAltTextMenu, updateAltText } from '../commands';
|
|
16
16
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -157,7 +157,7 @@ export class AltTextEditComponent extends React.Component {
|
|
|
157
157
|
const backButtonMessage = formatMessage(messages.back);
|
|
158
158
|
const backButtonMessageComponent = jsx(ToolTipContent, {
|
|
159
159
|
description: backButtonMessage,
|
|
160
|
-
keymap:
|
|
160
|
+
keymap: escape,
|
|
161
161
|
shortcutOverride: "Esc"
|
|
162
162
|
});
|
|
163
163
|
const errorsList = (this.state.validationErrors || []).map(function (error, index) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
2
|
+
import { bindKeymapWithCommand, backspace } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { isEmptyNode, isSelectionInsideLastNodeInDocument } from '../../../utils';
|
|
4
4
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { selectNodeBackward } from '@atlaskit/editor-prosemirror/commands';
|
|
@@ -167,6 +167,6 @@ const maybeRemoveMediaSingleNode = schema => {
|
|
|
167
167
|
export default function keymapPlugin(schema) {
|
|
168
168
|
const list = {};
|
|
169
169
|
const removeMediaSingleCommand = maybeRemoveMediaSingleNode(schema);
|
|
170
|
-
|
|
170
|
+
bindKeymapWithCommand(backspace.common, removeMediaSingleCommand, list);
|
|
171
171
|
return keymap(list);
|
|
172
172
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import
|
|
3
|
+
import { bindKeymapWithCommand, undo, enter, tab, moveLeft, moveRight, moveDown, insertNewLine } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { stateKey } from '../pm-plugins/plugin-key';
|
|
5
5
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
6
6
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
@@ -10,15 +10,15 @@ export function keymapPlugin(options, editorAnalyticsAPI) {
|
|
|
10
10
|
const {
|
|
11
11
|
featureFlags
|
|
12
12
|
} = options || {};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
bindKeymapWithCommand(undo.common, ignoreLinksInSteps, list);
|
|
14
|
+
bindKeymapWithCommand(enter.common, splitMediaGroup, list);
|
|
15
15
|
if (getMediaFeatureFlag('captions', featureFlags)) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
bindKeymapWithCommand(moveDown.common, insertAndSelectCaption(editorAnalyticsAPI), list);
|
|
17
|
+
bindKeymapWithCommand(tab.common, insertAndSelectCaption(editorAnalyticsAPI), list);
|
|
18
|
+
bindKeymapWithCommand(moveLeft.common, arrowLeftFromMediaSingle(options === null || options === void 0 ? void 0 : options.editorSelectionAPI), list);
|
|
19
|
+
bindKeymapWithCommand(moveRight.common, arrowRightFromMediaSingle(options === null || options === void 0 ? void 0 : options.editorSelectionAPI), list);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
bindKeymapWithCommand(insertNewLine.common, splitMediaGroup, list);
|
|
22
22
|
return keymap(list);
|
|
23
23
|
}
|
|
24
24
|
const ignoreLinksInSteps = state => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
2
|
+
import { bindKeymapWithCommand, addLink } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { showLinkingToolbarWithMediaTypeCheck } from '../../commands/linking';
|
|
4
4
|
export default function keymapPlugin(schema) {
|
|
5
5
|
const list = {};
|
|
6
|
-
|
|
6
|
+
bindKeymapWithCommand(addLink.common, showLinkingToolbarWithMediaTypeCheck, list);
|
|
7
7
|
return keymap(list);
|
|
8
8
|
}
|
|
@@ -262,7 +262,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
262
262
|
|
|
263
263
|
// Pixel Entry Toolbar Support
|
|
264
264
|
if (getBooleanFF('platform.editor.media.extended-resize-experience') && allowResizing) {
|
|
265
|
-
|
|
265
|
+
const sizeInput = {
|
|
266
266
|
type: 'custom',
|
|
267
267
|
fallback: [],
|
|
268
268
|
render: editorView => {
|
|
@@ -325,7 +325,12 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
|
-
}
|
|
328
|
+
};
|
|
329
|
+
if (pluginState.isResizing) {
|
|
330
|
+
// If the image is resizing then only return `sizeInput` as the only toolbar item
|
|
331
|
+
return [sizeInput];
|
|
332
|
+
}
|
|
333
|
+
toolbarButtons.push(sizeInput);
|
|
329
334
|
toolbarButtons.push({
|
|
330
335
|
type: 'separator'
|
|
331
336
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
3
|
-
import { INPUT_METHOD } from '
|
|
2
|
+
import { bindKeymapWithCommand, insertRule, escape } from '@atlaskit/editor-common/keymaps';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { insertHorizontalRule } from '../commands';
|
|
5
5
|
export function keymapPlugin(featureFlags) {
|
|
6
6
|
const list = {};
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
bindKeymapWithCommand(insertRule.common, insertHorizontalRule(INPUT_METHOD.SHORTCUT, featureFlags), list);
|
|
8
|
+
bindKeymapWithCommand(escape.common, () => true, list);
|
|
9
9
|
return keymap(list);
|
|
10
10
|
}
|
|
11
11
|
export default keymapPlugin;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
2
|
+
import { bindKeymapWithCommand, insertNewLine, moveLeft, moveRight, moveUp, moveDown, backspace, deleteKey } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { arrow, deleteNode } from '../gap-cursor/actions';
|
|
4
4
|
import { Direction } from '../gap-cursor/direction';
|
|
5
5
|
import { GapCursorSelection } from '../gap-cursor/selection';
|
|
6
6
|
import { createParagraphNear } from '@atlaskit/editor-prosemirror/commands';
|
|
7
7
|
export default function keymapPlugin() {
|
|
8
8
|
const map = {};
|
|
9
|
-
|
|
9
|
+
bindKeymapWithCommand(insertNewLine.common, (state, dispatch, view) => {
|
|
10
10
|
const isInGapCursor = state.selection instanceof GapCursorSelection;
|
|
11
11
|
// Only operate in gap cursor
|
|
12
12
|
if (!isInGapCursor) {
|
|
@@ -14,27 +14,27 @@ export default function keymapPlugin() {
|
|
|
14
14
|
}
|
|
15
15
|
return createParagraphNear(state, dispatch);
|
|
16
16
|
}, map);
|
|
17
|
-
|
|
17
|
+
bindKeymapWithCommand(moveLeft.common, (state, dispatch, view) => {
|
|
18
18
|
const endOfTextblock = view ? view.endOfTextblock.bind(view) : undefined;
|
|
19
19
|
return arrow(Direction.LEFT, endOfTextblock)(state, dispatch, view);
|
|
20
20
|
}, map);
|
|
21
|
-
|
|
21
|
+
bindKeymapWithCommand(moveRight.common, (state, dispatch, view) => {
|
|
22
22
|
const endOfTextblock = view ? view.endOfTextblock.bind(view) : undefined;
|
|
23
23
|
return arrow(Direction.RIGHT, endOfTextblock)(state, dispatch);
|
|
24
24
|
}, map);
|
|
25
|
-
|
|
25
|
+
bindKeymapWithCommand(moveUp.common, (state, dispatch, view) => {
|
|
26
26
|
const endOfTextblock = view ? view.endOfTextblock.bind(view) : undefined;
|
|
27
27
|
return arrow(Direction.UP, endOfTextblock)(state, dispatch);
|
|
28
28
|
}, map);
|
|
29
|
-
|
|
29
|
+
bindKeymapWithCommand(moveDown.common, (state, dispatch, view) => {
|
|
30
30
|
const endOfTextblock = view ? view.endOfTextblock.bind(view) : undefined;
|
|
31
31
|
return arrow(Direction.DOWN, endOfTextblock)(state, dispatch);
|
|
32
32
|
}, map);
|
|
33
33
|
|
|
34
34
|
// default PM's Backspace doesn't handle removing block nodes when cursor is after it
|
|
35
|
-
|
|
35
|
+
bindKeymapWithCommand(backspace.common, deleteNode(Direction.BACKWARD), map);
|
|
36
36
|
|
|
37
37
|
// handle Delete key (remove node after the cursor)
|
|
38
|
-
|
|
38
|
+
bindKeymapWithCommand(deleteKey.common, deleteNode(Direction.FORWARD), map);
|
|
39
39
|
return keymap(map);
|
|
40
40
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
2
|
+
import { bindKeymapWithCommand, enter, tab } from '../../keymaps';
|
|
3
3
|
import { mayGetStatusAtSelection } from './utils';
|
|
4
4
|
export function keymapPlugin() {
|
|
5
5
|
const list = {};
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
bindKeymapWithCommand(enter.common, consumeKeyEvent, list);
|
|
7
|
+
bindKeymapWithCommand(tab.common, consumeKeyEvent, list);
|
|
8
8
|
return keymap(list);
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import
|
|
3
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '
|
|
2
|
+
import { submit } from '@atlaskit/editor-common/keymaps';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { stateKey as mediaPluginKey } from '../../plugins/media/pm-plugins/plugin-key';
|
|
5
5
|
import { analyticsEventKey } from '../analytics/consts';
|
|
6
6
|
export function createPlugin(eventDispatch, onSave) {
|
|
@@ -8,7 +8,7 @@ export function createPlugin(eventDispatch, onSave) {
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
return keymap({
|
|
11
|
-
[`${
|
|
11
|
+
[`${submit.common}`]: (state, _dispatch, editorView) => {
|
|
12
12
|
const mediaState = mediaPluginKey.getState(state);
|
|
13
13
|
if (mediaState && mediaState.waitForMediaUpload && !mediaState.allUploadsFinished) {
|
|
14
14
|
return true;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { keymap } from '@atlaskit/editor-common/keymaps';
|
|
1
|
+
import { undo, redo, keymap, bindKeymapWithCommand, findKeyMapForBrowser } from '@atlaskit/editor-common/keymaps';
|
|
3
2
|
import { redoFromKeyboard, undoFromKeyboard } from '../commands';
|
|
4
3
|
export function keymapPlugin() {
|
|
5
4
|
const list = {};
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
bindKeymapWithCommand(findKeyMapForBrowser(redo), redoFromKeyboard, list);
|
|
6
|
+
bindKeymapWithCommand(undo.common, undoFromKeyboard, list);
|
|
8
7
|
return keymap(list);
|
|
9
8
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -5,7 +5,7 @@ import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
|
5
5
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
|
|
8
|
-
import
|
|
8
|
+
import { tooltip, toggleBlockQuote, keymap } from '@atlaskit/editor-common/keymaps';
|
|
9
9
|
import { createPlugin, pluginKey } from './pm-plugins/main';
|
|
10
10
|
import keymapPlugin from './pm-plugins/keymap';
|
|
11
11
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
@@ -22,7 +22,7 @@ var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editor
|
|
|
22
22
|
}, function (_v, idx) {
|
|
23
23
|
var level = idx + 1;
|
|
24
24
|
var descriptionDescriptor = messages["heading".concat(level, "Description")];
|
|
25
|
-
var keyshortcut =
|
|
25
|
+
var keyshortcut = tooltip(keymap["toggleHeading".concat(level)]);
|
|
26
26
|
var id = "heading".concat(level);
|
|
27
27
|
return {
|
|
28
28
|
id: id,
|
|
@@ -65,7 +65,7 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
|
|
|
65
65
|
title: formatMessage(messages.blockquote),
|
|
66
66
|
description: formatMessage(messages.blockquoteDescription),
|
|
67
67
|
priority: 1300,
|
|
68
|
-
keyshortcut:
|
|
68
|
+
keyshortcut: tooltip(toggleBlockQuote),
|
|
69
69
|
icon: function icon() {
|
|
70
70
|
return /*#__PURE__*/React.createElement(IconQuote, null);
|
|
71
71
|
},
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
2
2
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import
|
|
5
|
-
import { keymap } from '@atlaskit/editor-common/keymaps';
|
|
4
|
+
import { bindKeymapWithCommand, moveUp, moveDown, findKeyMapForBrowser, undo as undoKeymap, redo as redoKeymap, backspace, deleteKey, forwardDelete, toggleBlockQuote, keymap, insertNewLine, findShortcutByKeymap } from '@atlaskit/editor-common/keymaps';
|
|
6
5
|
import { insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
|
|
7
6
|
import * as blockTypes from '../types';
|
|
8
7
|
import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockTypesWithAnalytics } from '../commands';
|
|
9
8
|
import { isNodeAWrappingBlockNode } from '../utils';
|
|
10
|
-
var
|
|
9
|
+
var backspaceCommand = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
|
11
10
|
var del = chainCommands(deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
|
12
11
|
export default function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
|
|
13
12
|
var list = {};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
bindKeymapWithCommand(insertNewLine.common, insertNewLineWithAnalytics(editorAnalyticsApi), list);
|
|
14
|
+
bindKeymapWithCommand(moveUp.common, createNewParagraphAbove, list);
|
|
15
|
+
bindKeymapWithCommand(moveDown.common, createNewParagraphBelow, list);
|
|
16
|
+
bindKeymapWithCommand(findKeyMapForBrowser(redoKeymap), redo, list);
|
|
17
|
+
bindKeymapWithCommand(undoKeymap.common, undo, list);
|
|
18
|
+
bindKeymapWithCommand(backspace.common, backspaceCommand, list);
|
|
19
|
+
bindKeymapWithCommand(deleteKey.common, del, list);
|
|
20
|
+
bindKeymapWithCommand(forwardDelete.mac, del, list);
|
|
22
21
|
if (schema.nodes[blockTypes.BLOCK_QUOTE.nodeName]) {
|
|
23
|
-
|
|
22
|
+
bindKeymapWithCommand(findShortcutByKeymap(toggleBlockQuote), insertBlockTypesWithAnalytics(blockTypes.BLOCK_QUOTE.name, INPUT_METHOD.KEYBOARD, editorAnalyticsApi), list);
|
|
24
23
|
}
|
|
25
24
|
return keymap(list);
|
|
26
25
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import
|
|
3
|
+
import { bindKeymapWithCommand, moveDown, enter, moveUp, shiftTab, tab, moveLeft } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { createNewParagraphBelow } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { GapCursorSelection } from '../../selection/gap-cursor/selection';
|
|
7
7
|
export function captionKeymap() {
|
|
8
8
|
var list = {};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
bindKeymapWithCommand(moveDown.common, createNewParagraphBelowCaption, list);
|
|
10
|
+
bindKeymapWithCommand(enter.common, createNewParagraphBelowCaption, list);
|
|
11
|
+
bindKeymapWithCommand(moveDown.common, getOutOfCaption, list);
|
|
12
|
+
bindKeymapWithCommand(enter.common, getOutOfCaption, list);
|
|
13
|
+
bindKeymapWithCommand(moveUp.common, selectParentMediaSingle, list);
|
|
14
|
+
bindKeymapWithCommand(shiftTab.common, selectParentMediaSingle, list);
|
|
15
|
+
bindKeymapWithCommand(tab.common, getOutOfCaption, list);
|
|
16
|
+
bindKeymapWithCommand(moveLeft.common, gapCursorSelectLeftParentMediaSingle, list);
|
|
17
17
|
return keymap(list);
|
|
18
18
|
}
|
|
19
19
|
var createNewParagraphBelowCaption = function createNewParagraphBelowCaption(state, dispatch) {
|