@atlaskit/editor-core 187.23.0 → 187.23.1
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 +7 -0
- 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/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/keymap-media-single.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/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/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/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/keymap-media-single.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/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/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/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/keymap-media-single.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/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
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.23.
|
|
9
|
+
var version = "187.23.1";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import { closeDatePicker, openDatePicker, focusDateInput } from '../actions';
|
|
4
|
-
import
|
|
3
|
+
import { keymap, enter, tab, bindKeymapWithCommand } from '@atlaskit/editor-common/keymaps';
|
|
5
4
|
import { getPluginState } from './main';
|
|
6
5
|
export function keymapPlugin() {
|
|
7
6
|
const list = {};
|
|
8
|
-
|
|
7
|
+
bindKeymapWithCommand(enter.common, (state, dispatch) => {
|
|
9
8
|
const datePlugin = getPluginState(state);
|
|
10
9
|
const isDateNode = state.selection instanceof NodeSelection ? state.selection.node.type === state.schema.nodes.date : false;
|
|
11
10
|
if (!isDateNode) {
|
|
@@ -18,7 +17,7 @@ export function keymapPlugin() {
|
|
|
18
17
|
closeDatePicker()(state, dispatch);
|
|
19
18
|
return true;
|
|
20
19
|
}, list);
|
|
21
|
-
|
|
20
|
+
bindKeymapWithCommand(tab.common, (state, dispatch) => {
|
|
22
21
|
const datePlugin = getPluginState(state);
|
|
23
22
|
const isDateNode = state.selection instanceof NodeSelection ? state.selection.node.type === state.schema.nodes.date : false;
|
|
24
23
|
if (!isDateNode) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import
|
|
3
|
+
import { bindKeymapWithCommand, moveRight, moveLeft, moveUp, moveDown, tab, backspace } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { GapCursorSelection, Side } from '../../selection/gap-cursor-selection';
|
|
5
5
|
import { findExpand } from '../utils';
|
|
6
6
|
import { isEmptyNode } from '../../../utils';
|
|
@@ -15,7 +15,7 @@ const isExpandNode = node => {
|
|
|
15
15
|
const isExpandSelected = selection => selection instanceof NodeSelection && isExpandNode(selection.node);
|
|
16
16
|
export function expandKeymap() {
|
|
17
17
|
const list = {};
|
|
18
|
-
|
|
18
|
+
bindKeymapWithCommand(moveRight.common, (state, dispatch, editorView) => {
|
|
19
19
|
if (!editorView) {
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
@@ -30,7 +30,7 @@ export function expandKeymap() {
|
|
|
30
30
|
}
|
|
31
31
|
return false;
|
|
32
32
|
}, list);
|
|
33
|
-
|
|
33
|
+
bindKeymapWithCommand(moveLeft.common, (state, dispatch, editorView) => {
|
|
34
34
|
if (!editorView) {
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
@@ -45,7 +45,7 @@ export function expandKeymap() {
|
|
|
45
45
|
}
|
|
46
46
|
return false;
|
|
47
47
|
}, list);
|
|
48
|
-
|
|
48
|
+
bindKeymapWithCommand(tab.common, (state, dispatch, editorView) => {
|
|
49
49
|
if (state.selection instanceof NodeSelection && state.selection.node.type === state.schema.nodes.expand && editorView && editorView.dom instanceof HTMLElement) {
|
|
50
50
|
const {
|
|
51
51
|
from
|
|
@@ -71,7 +71,7 @@ export function expandKeymap() {
|
|
|
71
71
|
}
|
|
72
72
|
return false;
|
|
73
73
|
}, list);
|
|
74
|
-
|
|
74
|
+
bindKeymapWithCommand(moveUp.common, (state, dispatch, editorView) => {
|
|
75
75
|
if (!editorView) {
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
@@ -122,7 +122,7 @@ export function expandKeymap() {
|
|
|
122
122
|
}
|
|
123
123
|
return false;
|
|
124
124
|
}, list);
|
|
125
|
-
|
|
125
|
+
bindKeymapWithCommand(moveDown.common, (state, dispatch, editorView) => {
|
|
126
126
|
if (!editorView) {
|
|
127
127
|
return false;
|
|
128
128
|
}
|
|
@@ -156,7 +156,7 @@ export function expandKeymap() {
|
|
|
156
156
|
}
|
|
157
157
|
return false;
|
|
158
158
|
}, list);
|
|
159
|
-
|
|
159
|
+
bindKeymapWithCommand(backspace.common, (state, dispatch, editorView) => {
|
|
160
160
|
const {
|
|
161
161
|
selection
|
|
162
162
|
} = state;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { getPluginState } from './main';
|
|
3
|
-
import
|
|
3
|
+
import { bindKeymapWithCommand, escape } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { clearEditingContext } from '../commands';
|
|
5
5
|
export default function keymapPlugin(applyChange) {
|
|
6
6
|
const list = {};
|
|
7
|
-
|
|
7
|
+
bindKeymapWithCommand(escape.common, (state, dispatch) => {
|
|
8
8
|
const extensionState = getPluginState(state);
|
|
9
9
|
if (!extensionState.showContextPanel) {
|
|
10
10
|
return false;
|
|
@@ -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,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
|
}
|
|
@@ -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,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
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import { closeDatePicker, openDatePicker, focusDateInput } from '../actions';
|
|
4
|
-
import
|
|
3
|
+
import { keymap, enter, tab, bindKeymapWithCommand } from '@atlaskit/editor-common/keymaps';
|
|
5
4
|
import { getPluginState } from './main';
|
|
6
5
|
export function keymapPlugin() {
|
|
7
6
|
var list = {};
|
|
8
|
-
|
|
7
|
+
bindKeymapWithCommand(enter.common, function (state, dispatch) {
|
|
9
8
|
var datePlugin = getPluginState(state);
|
|
10
9
|
var isDateNode = state.selection instanceof NodeSelection ? state.selection.node.type === state.schema.nodes.date : false;
|
|
11
10
|
if (!isDateNode) {
|
|
@@ -18,7 +17,7 @@ export function keymapPlugin() {
|
|
|
18
17
|
closeDatePicker()(state, dispatch);
|
|
19
18
|
return true;
|
|
20
19
|
}, list);
|
|
21
|
-
|
|
20
|
+
bindKeymapWithCommand(tab.common, function (state, dispatch) {
|
|
22
21
|
var datePlugin = getPluginState(state);
|
|
23
22
|
var isDateNode = state.selection instanceof NodeSelection ? state.selection.node.type === state.schema.nodes.date : false;
|
|
24
23
|
if (!isDateNode) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import
|
|
3
|
+
import { bindKeymapWithCommand, moveRight, moveLeft, moveUp, moveDown, tab, backspace } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { GapCursorSelection, Side } from '../../selection/gap-cursor-selection';
|
|
5
5
|
import { findExpand } from '../utils';
|
|
6
6
|
import { isEmptyNode } from '../../../utils';
|
|
@@ -17,7 +17,7 @@ var isExpandSelected = function isExpandSelected(selection) {
|
|
|
17
17
|
};
|
|
18
18
|
export function expandKeymap() {
|
|
19
19
|
var list = {};
|
|
20
|
-
|
|
20
|
+
bindKeymapWithCommand(moveRight.common, function (state, dispatch, editorView) {
|
|
21
21
|
if (!editorView) {
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
@@ -29,7 +29,7 @@ export function expandKeymap() {
|
|
|
29
29
|
}
|
|
30
30
|
return false;
|
|
31
31
|
}, list);
|
|
32
|
-
|
|
32
|
+
bindKeymapWithCommand(moveLeft.common, function (state, dispatch, editorView) {
|
|
33
33
|
if (!editorView) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
@@ -41,7 +41,7 @@ export function expandKeymap() {
|
|
|
41
41
|
}
|
|
42
42
|
return false;
|
|
43
43
|
}, list);
|
|
44
|
-
|
|
44
|
+
bindKeymapWithCommand(tab.common, function (state, dispatch, editorView) {
|
|
45
45
|
if (state.selection instanceof NodeSelection && state.selection.node.type === state.schema.nodes.expand && editorView && editorView.dom instanceof HTMLElement) {
|
|
46
46
|
var from = state.selection.from;
|
|
47
47
|
var expand = editorView.nodeDOM(from);
|
|
@@ -63,7 +63,7 @@ export function expandKeymap() {
|
|
|
63
63
|
}
|
|
64
64
|
return false;
|
|
65
65
|
}, list);
|
|
66
|
-
|
|
66
|
+
bindKeymapWithCommand(moveUp.common, function (state, dispatch, editorView) {
|
|
67
67
|
if (!editorView) {
|
|
68
68
|
return false;
|
|
69
69
|
}
|
|
@@ -106,7 +106,7 @@ export function expandKeymap() {
|
|
|
106
106
|
}
|
|
107
107
|
return false;
|
|
108
108
|
}, list);
|
|
109
|
-
|
|
109
|
+
bindKeymapWithCommand(moveDown.common, function (state, dispatch, editorView) {
|
|
110
110
|
if (!editorView) {
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
@@ -131,7 +131,7 @@ export function expandKeymap() {
|
|
|
131
131
|
}
|
|
132
132
|
return false;
|
|
133
133
|
}, list);
|
|
134
|
-
|
|
134
|
+
bindKeymapWithCommand(backspace.common, function (state, dispatch, editorView) {
|
|
135
135
|
var selection = state.selection;
|
|
136
136
|
var $from = selection.$from;
|
|
137
137
|
if (!editorView || !selection.empty) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { getPluginState } from './main';
|
|
3
|
-
import
|
|
3
|
+
import { bindKeymapWithCommand, escape } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { clearEditingContext } from '../commands';
|
|
5
5
|
export default function keymapPlugin(applyChange) {
|
|
6
6
|
var list = {};
|
|
7
|
-
|
|
7
|
+
bindKeymapWithCommand(escape.common, function (state, dispatch) {
|
|
8
8
|
var extensionState = getPluginState(state);
|
|
9
9
|
if (!extensionState.showContextPanel) {
|
|
10
10
|
return false;
|