@atlaskit/editor-core 187.22.1 → 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 +13 -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/type-ahead/ui/TypeAheadList.js +12 -1
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +12 -5
- 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/type-ahead/ui/TypeAheadList.js +10 -1
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +15 -9
- 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/type-ahead/ui/TypeAheadList.js +12 -1
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +13 -6
- 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
|
@@ -39,7 +39,7 @@ var itemText = function itemText(theme) {
|
|
|
39
39
|
})(theme), (0, _editorSharedStyles.relativeFontSizeToBase16)(12), "var(--ds-text-subtlest, ".concat(_colors.N200, ")"));
|
|
40
40
|
};
|
|
41
41
|
var itemAfter = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n"])));
|
|
42
|
-
var customRenderItemDivStyle = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n &:
|
|
42
|
+
var customRenderItemDivStyle = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n &:focus {\n box-shadow: inset 2px 0px 0px ", ";\n background-color: ", ";\n outline: none;\n }\n"])), "var(--ds-border-focused, ".concat(_colors.B400, ")"), "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30, ")"));
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* This CSS emulates the desired behaviour with :focus-visible for firefox.
|
|
@@ -48,14 +48,19 @@ var customRenderItemDivStyle = (0, _react2.css)(_templateObject5 || (_templateOb
|
|
|
48
48
|
*/
|
|
49
49
|
var selectionFrame = {
|
|
50
50
|
'& > button:focus': {
|
|
51
|
-
boxShadow: "inset
|
|
51
|
+
boxShadow: "inset 2px 0px 0px ".concat("var(--ds-border-focused, ".concat(_colors.B400, ")"), ";"),
|
|
52
|
+
backgroundColor: "".concat("var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30, ")")),
|
|
52
53
|
outline: 'none',
|
|
53
54
|
'&:active': {
|
|
54
55
|
boxShadow: 'none'
|
|
55
56
|
}
|
|
57
|
+
},
|
|
58
|
+
'& > button:hover': {
|
|
59
|
+
backgroundColor: 'inherit',
|
|
60
|
+
outline: 'none'
|
|
56
61
|
}
|
|
57
62
|
};
|
|
58
|
-
var selectedStyle = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n"])), "var(--ds-background-
|
|
63
|
+
var selectedStyle = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n box-shadow: inset 2px 0px 0px ", ";\n"])), "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30, ")"), "var(--ds-border-focused, ".concat(_colors.B400, ")"));
|
|
59
64
|
var FallbackIcon = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
60
65
|
var label = _ref.label;
|
|
61
66
|
return (0, _react2.jsx)(_quickInsert.IconFallback, null);
|
|
@@ -141,8 +146,9 @@ var TypeAheadListItem = function TypeAheadListItem(_ref3) {
|
|
|
141
146
|
if (customItem) {
|
|
142
147
|
return customItem;
|
|
143
148
|
}
|
|
149
|
+
var listItemClasses = [selectionFrame, isSelected && selectedStyle];
|
|
144
150
|
return (0, _react2.jsx)("span", {
|
|
145
|
-
css:
|
|
151
|
+
css: listItemClasses
|
|
146
152
|
}, (0, _react2.jsx)(_menu.ButtonItem, {
|
|
147
153
|
onClick: insertSelectedItem,
|
|
148
154
|
iconBefore: elementIcon,
|
|
@@ -151,7 +157,8 @@ var TypeAheadListItem = function TypeAheadListItem(_ref3) {
|
|
|
151
157
|
"aria-label": title,
|
|
152
158
|
"aria-setsize": itemsLength,
|
|
153
159
|
role: "option",
|
|
154
|
-
ref: buttonItemRef
|
|
160
|
+
ref: buttonItemRef,
|
|
161
|
+
css: listItemClasses
|
|
155
162
|
}, (0, _react2.jsx)("div", {
|
|
156
163
|
"aria-hidden": true
|
|
157
164
|
}, (0, _react2.jsx)("div", {
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.keymapPlugin = keymapPlugin;
|
|
8
|
-
var
|
|
9
|
-
var _keymaps2 = require("@atlaskit/editor-common/keymaps");
|
|
7
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
8
|
var _commands = require("../commands");
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
9
|
function keymapPlugin() {
|
|
14
10
|
var list = {};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return (0,
|
|
11
|
+
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findKeyMapForBrowser)(_keymaps.redo), _commands.redoFromKeyboard, list);
|
|
12
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.undo.common, _commands.undoFromKeyboard, list);
|
|
13
|
+
return (0, _keymaps.keymap)(list);
|
|
18
14
|
}
|
|
@@ -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.
|
|
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
|
}
|
|
@@ -110,6 +110,14 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
112
|
}, [selectedIndex, lastVisibleStartIndex, lastVisibleStopIndex]);
|
|
113
|
+
const onMouseMove = (event, index) => {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
event.stopPropagation();
|
|
116
|
+
if (selectedIndex === index) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
updateSelectedIndex(index)(editorView.state, editorView.dispatch);
|
|
120
|
+
};
|
|
113
121
|
useLayoutEffect(() => {
|
|
114
122
|
if (!listRef.current) {
|
|
115
123
|
return;
|
|
@@ -213,7 +221,8 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
213
221
|
style: style,
|
|
214
222
|
"data-index": index
|
|
215
223
|
}, jsx("div", {
|
|
216
|
-
"data-testid": `list-item-height-observed-${index}
|
|
224
|
+
"data-testid": `list-item-height-observed-${index}`,
|
|
225
|
+
onMouseMove: e => onMouseMove(e, index)
|
|
217
226
|
}, jsx(TypeAheadListItem, {
|
|
218
227
|
key: items[index].title,
|
|
219
228
|
item: currentItem,
|