@atlaskit/editor-core 187.9.0 → 187.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/commands/index.js +8 -134
- package/dist/cjs/plugins/base/index.js +2 -2
- package/dist/cjs/plugins/block-type/commands/block-type.js +34 -36
- package/dist/cjs/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/cjs/plugins/block-type/index.js +16 -13
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +19 -18
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +12 -14
- package/dist/cjs/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +7 -7
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +3 -4
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +13 -5
- package/dist/cjs/plugins/block-type/utils.js +73 -2
- package/dist/cjs/plugins/caption/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/emoji/commands/insert-emoji.js +31 -28
- package/dist/cjs/plugins/emoji/index.js +4 -3
- package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +23 -18
- package/dist/cjs/plugins/extension/pm-plugins/main.js +54 -9
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +1 -1
- package/dist/cjs/plugins/media/utils/media-common.js +5 -5
- package/dist/cjs/plugins/selection/pm-plugins/events/keydown.js +61 -25
- package/dist/cjs/plugins/undo-redo/pm-plugins/keymaps.js +2 -2
- package/dist/cjs/ui/styles.js +4 -11
- package/dist/cjs/utils/index.js +4 -80
- package/dist/cjs/utils/input-rules.js +6 -66
- package/dist/cjs/utils/mark.js +2 -38
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/commands/index.js +1 -128
- package/dist/es2019/plugins/base/index.js +1 -1
- package/dist/es2019/plugins/block-type/commands/block-type.js +11 -13
- package/dist/es2019/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/es2019/plugins/block-type/index.js +21 -12
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +18 -18
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +8 -9
- package/dist/es2019/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +21 -2
- package/dist/es2019/plugins/block-type/utils.js +70 -1
- package/dist/es2019/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/emoji/commands/insert-emoji.js +5 -5
- package/dist/es2019/plugins/emoji/index.js +6 -3
- package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +14 -11
- package/dist/es2019/plugins/extension/pm-plugins/main.js +50 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +1 -1
- package/dist/es2019/plugins/media/utils/media-common.js +1 -1
- package/dist/es2019/plugins/selection/pm-plugins/events/keydown.js +60 -24
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
- package/dist/es2019/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
- package/dist/es2019/ui/styles.js +0 -16
- package/dist/es2019/utils/index.js +0 -80
- package/dist/es2019/utils/input-rules.js +4 -61
- package/dist/es2019/utils/mark.js +0 -33
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/commands/index.js +7 -125
- package/dist/esm/plugins/base/index.js +1 -1
- package/dist/esm/plugins/block-type/commands/block-type.js +11 -13
- package/dist/esm/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/esm/plugins/block-type/index.js +15 -12
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +18 -18
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +8 -9
- package/dist/esm/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +8 -4
- package/dist/esm/plugins/block-type/utils.js +69 -1
- package/dist/esm/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/emoji/commands/insert-emoji.js +29 -27
- package/dist/esm/plugins/emoji/index.js +4 -3
- package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +23 -18
- package/dist/esm/plugins/extension/pm-plugins/main.js +45 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +1 -1
- package/dist/esm/plugins/media/utils/media-common.js +1 -1
- package/dist/esm/plugins/selection/pm-plugins/events/keydown.js +62 -25
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
- package/dist/esm/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
- package/dist/esm/ui/styles.js +3 -6
- package/dist/esm/utils/index.js +3 -77
- package/dist/esm/utils/input-rules.js +4 -61
- package/dist/esm/utils/mark.js +0 -35
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/commands/index.d.ts +0 -6
- package/dist/types/plugins/block-type/commands/block-type.d.ts +5 -6
- package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +1 -1
- package/dist/types/plugins/block-type/index.d.ts +1 -1
- package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
- package/dist/types/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/plugins/block-type/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/block-type/styles.d.ts +1 -1
- package/dist/types/plugins/block-type/types.d.ts +2 -3
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
- package/dist/types/plugins/block-type/utils.d.ts +15 -1
- package/dist/types/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types/plugins/emoji/pm-plugins/ascii-input-rules.d.ts +3 -2
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/styles.d.ts +0 -3
- package/dist/types/utils/index.d.ts +0 -6
- package/dist/types/utils/input-rules.d.ts +4 -16
- package/dist/types/utils/mark.d.ts +0 -1
- package/dist/types-ts4.5/commands/index.d.ts +0 -6
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +5 -6
- package/dist/types-ts4.5/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/commands/delete-block-content.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/block-type/styles.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/types.d.ts +2 -3
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
- package/dist/types-ts4.5/plugins/block-type/utils.d.ts +15 -1
- package/dist/types-ts4.5/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types-ts4.5/plugins/emoji/pm-plugins/ascii-input-rules.d.ts +3 -2
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/styles.d.ts +0 -3
- package/dist/types-ts4.5/utils/index.d.ts +0 -6
- package/dist/types-ts4.5/utils/input-rules.d.ts +4 -16
- package/dist/types-ts4.5/utils/mark.d.ts +0 -1
- package/package.json +4 -4
- package/report.api.md +6 -16
- package/tmp/api-report-tmp.d.ts +5 -16
- package/dist/cjs/types/allowed-block-types.js +0 -5
- package/dist/cjs/utils/keymap.js +0 -38
- package/dist/es2019/types/allowed-block-types.js +0 -1
- package/dist/es2019/utils/keymap.js +0 -33
- package/dist/esm/types/allowed-block-types.js +0 -1
- package/dist/esm/utils/keymap.js +0 -33
- package/dist/types/types/allowed-block-types.d.ts +0 -1
- package/dist/types/utils/keymap.d.ts +0 -11
- package/dist/types-ts4.5/types/allowed-block-types.d.ts +0 -1
- package/dist/types-ts4.5/utils/keymap.d.ts +0 -11
- /package/dist/cjs/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/es2019/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/esm/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/types/{keymaps → plugins/block-type}/consts.d.ts +0 -0
- /package/dist/types-ts4.5/{keymaps → plugins/block-type}/consts.d.ts +0 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from '@atlaskit/editor-common/selection';
|
|
5
8
|
import { createSelectionClickHandler } from '../../selection/utils';
|
|
6
9
|
import ExtensionNodeView from '../nodeviews/extension';
|
|
7
10
|
import { updateState, clearEditingContext } from '../commands';
|
|
@@ -234,6 +237,48 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
234
237
|
},
|
|
235
238
|
key: pluginKey,
|
|
236
239
|
props: {
|
|
240
|
+
handleDOMEvents: {
|
|
241
|
+
/**
|
|
242
|
+
* ED-18072 - Cannot shift + arrow past bodied extension if it is not empty.
|
|
243
|
+
* This code is to handle the case where the selection starts inside or on the node and the user is trying to shift + arrow.
|
|
244
|
+
* For other part of the solution see code in: packages/editor/editor-core/src/plugins/selection/pm-plugins/events/keydown.ts
|
|
245
|
+
*/
|
|
246
|
+
keydown: function keydown(view, event) {
|
|
247
|
+
if (event instanceof KeyboardEvent && event.shiftKey && ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {
|
|
248
|
+
var _view$state = view.state,
|
|
249
|
+
schema = _view$state.schema,
|
|
250
|
+
selection = _view$state.selection,
|
|
251
|
+
$head = _view$state.selection.$head,
|
|
252
|
+
doc = _view$state.doc,
|
|
253
|
+
tr = _view$state.tr;
|
|
254
|
+
var bodiedExtension = schema.nodes.bodiedExtension;
|
|
255
|
+
if (selection instanceof TextSelection || selection instanceof NodeSelection) {
|
|
256
|
+
var maybeBodiedExtension = selection instanceof TextSelection ? findParentNodeOfTypeClosestToPos($head, bodiedExtension) : findSelectedNodeOfType(bodiedExtension)(selection);
|
|
257
|
+
if (maybeBodiedExtension) {
|
|
258
|
+
var end = maybeBodiedExtension.pos + maybeBodiedExtension.node.nodeSize;
|
|
259
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && isSelectionAtStartOfNode($head, maybeBodiedExtension)) {
|
|
260
|
+
var anchor = end + 1;
|
|
261
|
+
|
|
262
|
+
// an offset is used here so that left arrow selects the first character before the node (consistent with arrow right)
|
|
263
|
+
var headOffset = event.key === 'ArrowLeft' ? -1 : 0;
|
|
264
|
+
var head = maybeBodiedExtension.pos + headOffset;
|
|
265
|
+
var newSelection = TextSelection.create(doc, Math.max(anchor, selection.anchor), head);
|
|
266
|
+
view.dispatch(tr.setSelection(newSelection));
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && isSelectionAtEndOfNode($head, maybeBodiedExtension)) {
|
|
270
|
+
var _anchor = maybeBodiedExtension.pos - 1;
|
|
271
|
+
var _head = end + 1;
|
|
272
|
+
var _newSelection = TextSelection.create(doc, Math.min(_anchor, selection.anchor), _head);
|
|
273
|
+
view.dispatch(tr.setSelection(_newSelection));
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
},
|
|
237
282
|
nodeViews: {
|
|
238
283
|
// WARNING: referentiality-plugin also creates these nodeviews
|
|
239
284
|
extension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions, pluginInjectionApi),
|
|
@@ -283,7 +283,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
283
283
|
});
|
|
284
284
|
_defineProperty(_assertThisInitialized(_this), "handleSelectedEmoji", function (emojiId) {
|
|
285
285
|
_this.props.editorView.focus();
|
|
286
|
-
insertEmoji(emojiId, INPUT_METHOD.PICKER)(_this.props.editorView.state, _this.props.editorView.dispatch);
|
|
286
|
+
insertEmoji(_this.editorAnalyticsAPI)(emojiId, INPUT_METHOD.PICKER)(_this.props.editorView.state, _this.props.editorView.dispatch);
|
|
287
287
|
_this.toggleEmojiPicker();
|
|
288
288
|
return true;
|
|
289
289
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deleteSelection, splitBlock } from '@atlaskit/editor-prosemirror/commands';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { createParagraphNear, createNewParagraphBelow } from '
|
|
4
|
+
import { createParagraphNear, createNewParagraphBelow } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { isTemporary } from '../../../utils';
|
|
6
6
|
import { mapSlice } from '../../../utils/slice';
|
|
7
7
|
import { walkUpTreeUntil, removeNestedEmptyEls, unwrap } from '../../../utils/dom';
|
|
@@ -1,36 +1,68 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* The way expand was built, no browser reconize selection on it.
|
|
5
|
+
* For instance, when a selection going to a "collapsed" expand
|
|
6
|
+
* the browser will try to send the cursor to inside the expand content (wrong),
|
|
7
|
+
* this behavior is caused because the expand content is never true hidden
|
|
8
|
+
* we just set the height to 1px.
|
|
9
|
+
*
|
|
10
|
+
* So, we need to capture a possible selection event
|
|
11
|
+
* when a collapsed exxpand is the next node in the common depth.
|
|
12
|
+
* If that is true, we create a new TextSelection and stop the event bubble
|
|
13
|
+
*/
|
|
2
14
|
var isCollpasedExpand = function isCollpasedExpand(node) {
|
|
3
15
|
return Boolean(node && ['expand', 'nestedExpand'].includes(node.type.name) && !node.attrs.__expanded);
|
|
4
16
|
};
|
|
5
|
-
|
|
6
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* ED-18072 - Cannot shift + arrow past bodied extension if it is not empty
|
|
20
|
+
*/
|
|
21
|
+
var isBodiedExtension = function isBodiedExtension(node) {
|
|
22
|
+
return Boolean(node && ['bodiedExtension'].includes(node.type.name));
|
|
23
|
+
};
|
|
24
|
+
var isProblematicNode = function isProblematicNode(node) {
|
|
25
|
+
return isCollpasedExpand(node) || isBodiedExtension(node);
|
|
26
|
+
};
|
|
27
|
+
var findFixedProblematicNodePosition = function findFixedProblematicNodePosition(doc, $head, direction) {
|
|
28
|
+
if ($head.pos === 0 || $head.depth === 0) {
|
|
7
29
|
return null;
|
|
8
30
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
31
|
+
if (direction === 'up') {
|
|
32
|
+
var pos = $head.before();
|
|
33
|
+
var $posResolved = $head.doc.resolve(pos);
|
|
34
|
+
var maybeProblematicNode = $posResolved.nodeBefore;
|
|
35
|
+
if (maybeProblematicNode && isProblematicNode(maybeProblematicNode)) {
|
|
36
|
+
var nodeSize = maybeProblematicNode.nodeSize;
|
|
37
|
+
var nodeStartPosition = pos - nodeSize;
|
|
38
|
+
|
|
39
|
+
// ($head.pos - 1) will correspond to (nodeStartPosition + nodeSize) when we are at the start of the text node
|
|
40
|
+
var isAtEndOfProblematicNode = $head.pos - 1 === nodeStartPosition + nodeSize;
|
|
41
|
+
if (isAtEndOfProblematicNode) {
|
|
42
|
+
var startPosNode = Math.max(nodeStartPosition, 0);
|
|
43
|
+
var $startPosNode = $head.doc.resolve(Math.min(startPosNode, $head.doc.content.size));
|
|
44
|
+
return $startPosNode;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (direction === 'down') {
|
|
49
|
+
var _pos = $head.after();
|
|
50
|
+
var _maybeProblematicNode = doc.nodeAt(_pos);
|
|
51
|
+
if (_maybeProblematicNode && isProblematicNode(_maybeProblematicNode) && $head.pos + 1 === _pos) {
|
|
52
|
+
var _nodeSize = _maybeProblematicNode.nodeSize;
|
|
53
|
+
var nodePosition = _pos + _nodeSize;
|
|
54
|
+
var _startPosNode = Math.max(nodePosition, 0);
|
|
55
|
+
var _$startPosNode = $head.doc.resolve(Math.min(_startPosNode, $head.doc.content.size));
|
|
56
|
+
return _$startPosNode;
|
|
57
|
+
}
|
|
18
58
|
}
|
|
19
59
|
return null;
|
|
20
60
|
};
|
|
21
61
|
export var onKeydown = function onKeydown(view, event) {
|
|
22
62
|
/*
|
|
23
|
-
* This workaround is needed for some specific
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* For instance, when a selection going to a "collapsed" expand
|
|
27
|
-
* the browser will try to send the cursor to inside the expand content (wrong),
|
|
28
|
-
* this behavior is caused because the expand content is never true hidden
|
|
29
|
-
* we just set the height to 1px.
|
|
30
|
-
*
|
|
31
|
-
* So, we need to capture a possible selection event
|
|
32
|
-
* when a collapsed exxpand is the next node in the common depth.
|
|
33
|
-
* If that is true, we create a new TextSelection and stop the event bubble
|
|
63
|
+
* This workaround is needed for some specific situations.
|
|
64
|
+
* - expand collapse
|
|
65
|
+
* - bodied extension
|
|
34
66
|
*/
|
|
35
67
|
if (!(event instanceof KeyboardEvent)) {
|
|
36
68
|
return false;
|
|
@@ -41,16 +73,21 @@ export var onKeydown = function onKeydown(view, event) {
|
|
|
41
73
|
if (!['ArrowUp', 'ArrowDown', 'ArrowRight', 'ArrowLeft', 'Home', 'End'].includes(event.key)) {
|
|
42
74
|
return false;
|
|
43
75
|
}
|
|
44
|
-
var _view$state
|
|
76
|
+
var _view$state = view.state,
|
|
77
|
+
doc = _view$state.doc,
|
|
78
|
+
_view$state$selection = _view$state.selection,
|
|
45
79
|
$head = _view$state$selection.$head,
|
|
46
80
|
$anchor = _view$state$selection.$anchor;
|
|
47
81
|
if (event.key === 'ArrowRight' && $head.nodeAfter || event.key === 'ArrowLeft' && $head.nodeBefore) {
|
|
48
82
|
return false;
|
|
49
83
|
}
|
|
50
84
|
var direction = ['ArrowLeft', 'ArrowUp', 'Home'].includes(event.key) ? 'up' : 'down';
|
|
51
|
-
var $fixedProblematicNodePosition = findFixedProblematicNodePosition($head, direction);
|
|
85
|
+
var $fixedProblematicNodePosition = findFixedProblematicNodePosition(doc, $head, direction);
|
|
52
86
|
if ($fixedProblematicNodePosition) {
|
|
53
|
-
|
|
87
|
+
// an offset is used here so that left arrow selects the first character before the node (consistent with arrow right)
|
|
88
|
+
var headOffset = event.key === 'ArrowLeft' ? -1 : 0;
|
|
89
|
+
var head = $fixedProblematicNodePosition.pos + headOffset;
|
|
90
|
+
var forcedTextSelection = TextSelection.create(view.state.doc, $anchor.pos, head);
|
|
54
91
|
var tr = view.state.tr;
|
|
55
92
|
tr.setSelection(forcedTextSelection);
|
|
56
93
|
view.dispatch(tr);
|
|
@@ -7,7 +7,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
7
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { uuid } from '@atlaskit/adf-schema';
|
|
10
|
-
import { filterCommand as filter, isEmptySelectionAtStart,
|
|
10
|
+
import { filterCommand as filter, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, withAnalytics } from '../../analytics';
|
|
12
12
|
import { insertTaskDecisionWithAnalytics } from '../commands';
|
|
13
13
|
import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as keymaps from '../../../keymaps';
|
|
2
|
-
import { keymap } from '
|
|
2
|
+
import { keymap } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { redoFromKeyboard, undoFromKeyboard } from '../commands';
|
|
4
4
|
export function keymapPlugin() {
|
|
5
5
|
var list = {};
|
package/dist/esm/ui/styles.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
5
5
|
export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
6
|
-
export var
|
|
7
|
-
export var
|
|
8
|
-
export var buttonContentStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n min-width: 80px;\n align-items: center;\n overflow: hidden;\n justify-content: center;\n flex-direction: column;\n padding: ", ";\n"])), "var(--ds-space-075, 6px)");
|
|
9
|
-
export var buttonContentReducedSpacingStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: ", ";\n"])), "var(--ds-space-100, 8px)");
|
|
10
|
-
export var clickSelectWrapperStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n user-select: all;\n"])));
|
|
6
|
+
export var expandIconWrapperStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-left: -8px;\n"])));
|
|
7
|
+
export var clickSelectWrapperStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n user-select: all;\n"])));
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { toggleMark } from '@atlaskit/editor-prosemirror/commands';
|
|
2
|
-
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
4
3
|
import { FakeTextCursorSelection } from '../plugins/fake-text-cursor/cursor';
|
|
5
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
5
|
import { isNodeEmpty } from './document';
|
|
7
|
-
import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
|
|
8
|
-
import { isMediaNode } from '@atlaskit/editor-common/utils';
|
|
9
6
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
10
7
|
export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
|
|
11
8
|
export { sanitiseMarksInSelection } from './mark';
|
|
@@ -18,37 +15,6 @@ function isMarkTypeCompatibleWithMark(markType, mark) {
|
|
|
18
15
|
function isMarkTypeAllowedInNode(markType, state) {
|
|
19
16
|
return toggleMark(markType)(state);
|
|
20
17
|
}
|
|
21
|
-
export function canMoveUp(state) {
|
|
22
|
-
var selection = state.selection;
|
|
23
|
-
/**
|
|
24
|
-
* If there's a media element on the selection it will use a gap cursor to move
|
|
25
|
-
*/
|
|
26
|
-
if (selection instanceof NodeSelection && isMediaNode(selection.node)) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
if (selection instanceof TextSelection) {
|
|
30
|
-
if (!selection.empty) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return !atTheBeginningOfDoc(state);
|
|
35
|
-
}
|
|
36
|
-
export function canMoveDown(state) {
|
|
37
|
-
var selection = state.selection;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* If there's a media element on the selection it will use a gap cursor to move
|
|
41
|
-
*/
|
|
42
|
-
if (selection instanceof NodeSelection && isMediaNode(selection.node)) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
if (selection instanceof TextSelection) {
|
|
46
|
-
if (!selection.empty) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return !atTheEndOfDoc(state);
|
|
51
|
-
}
|
|
52
18
|
export function isSelectionInsideLastNodeInDocument(selection) {
|
|
53
19
|
var docNode = selection.$anchor.node(0);
|
|
54
20
|
var rootNode = selection.$anchor.node(1);
|
|
@@ -173,46 +139,6 @@ export function whichTransitionEvent() {
|
|
|
173
139
|
}
|
|
174
140
|
return;
|
|
175
141
|
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Function will create a list of wrapper blocks present in a selection.
|
|
179
|
-
*/
|
|
180
|
-
function getSelectedWrapperNodes(state) {
|
|
181
|
-
var nodes = [];
|
|
182
|
-
if (state.selection) {
|
|
183
|
-
var _state$selection = state.selection,
|
|
184
|
-
$from = _state$selection.$from,
|
|
185
|
-
$to = _state$selection.$to;
|
|
186
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
187
|
-
blockquote = _state$schema$nodes.blockquote,
|
|
188
|
-
panel = _state$schema$nodes.panel,
|
|
189
|
-
orderedList = _state$schema$nodes.orderedList,
|
|
190
|
-
bulletList = _state$schema$nodes.bulletList,
|
|
191
|
-
listItem = _state$schema$nodes.listItem,
|
|
192
|
-
codeBlock = _state$schema$nodes.codeBlock,
|
|
193
|
-
decisionItem = _state$schema$nodes.decisionItem,
|
|
194
|
-
decisionList = _state$schema$nodes.decisionList,
|
|
195
|
-
taskItem = _state$schema$nodes.taskItem,
|
|
196
|
-
taskList = _state$schema$nodes.taskList;
|
|
197
|
-
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
|
198
|
-
if (node.isBlock && [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList].indexOf(node.type) >= 0) {
|
|
199
|
-
nodes.push(node.type);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
return nodes;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Function will check if changing block types: Paragraph, Heading is enabled.
|
|
208
|
-
*/
|
|
209
|
-
export function areBlockTypesDisabled(state) {
|
|
210
|
-
var nodesTypes = getSelectedWrapperNodes(state);
|
|
211
|
-
var panel = state.schema.nodes.panel;
|
|
212
|
-
return nodesTypes.filter(function (type) {
|
|
213
|
-
return type !== panel;
|
|
214
|
-
}).length > 0;
|
|
215
|
-
}
|
|
216
142
|
export var isTemporary = function isTemporary(id) {
|
|
217
143
|
return id.indexOf('temporary:') === 0;
|
|
218
144
|
};
|
|
@@ -269,9 +195,9 @@ export var isEmptyNode = function isEmptyNode(schema) {
|
|
|
269
195
|
return innerIsEmptyNode;
|
|
270
196
|
};
|
|
271
197
|
export var insideTableCell = function insideTableCell(state) {
|
|
272
|
-
var _state$schema$
|
|
273
|
-
tableCell = _state$schema$
|
|
274
|
-
tableHeader = _state$schema$
|
|
198
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
199
|
+
tableCell = _state$schema$nodes.tableCell,
|
|
200
|
+
tableHeader = _state$schema$nodes.tableHeader;
|
|
275
201
|
return hasParentNodeOfType([tableCell, tableHeader])(state.selection);
|
|
276
202
|
};
|
|
277
203
|
export var isInListItem = function isInListItem(state) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import { canJoin, findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
5
|
-
import { createRule } from '@atlaskit/prosemirror-input-rules';
|
|
6
4
|
import { addAnalytics } from '../plugins/analytics';
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
* @deprecated Use import {inputRuleWithAnalytics} from "@atlaskit/editor-common/utils"; instead
|
|
8
|
+
*/
|
|
8
9
|
export var ruleWithAnalytics = function ruleWithAnalytics(getPayload) {
|
|
9
10
|
return function (originalRule) {
|
|
10
11
|
var onHandlerApply = function onHandlerApply(state, tr, matchResult) {
|
|
@@ -18,62 +19,4 @@ export var ruleWithAnalytics = function ruleWithAnalytics(getPayload) {
|
|
|
18
19
|
onHandlerApply: onHandlerApply
|
|
19
20
|
});
|
|
20
21
|
};
|
|
21
|
-
};
|
|
22
|
-
export var createWrappingTextBlockRule = function createWrappingTextBlockRule(_ref) {
|
|
23
|
-
var match = _ref.match,
|
|
24
|
-
nodeType = _ref.nodeType,
|
|
25
|
-
getAttrs = _ref.getAttrs;
|
|
26
|
-
var handler = function handler(state, match, start, end) {
|
|
27
|
-
var fixedStart = Math.max(start, 1);
|
|
28
|
-
var $start = state.doc.resolve(fixedStart);
|
|
29
|
-
var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
|
|
30
|
-
var nodeBefore = $start.node(-1);
|
|
31
|
-
if (nodeBefore && !nodeBefore.canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType)) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return state.tr.delete(fixedStart, end).setBlockType(fixedStart, fixedStart, nodeType, attrs);
|
|
35
|
-
};
|
|
36
|
-
return createRule(match, handler);
|
|
37
|
-
};
|
|
38
|
-
export var createWrappingJoinRule = function createWrappingJoinRule(_ref2) {
|
|
39
|
-
var match = _ref2.match,
|
|
40
|
-
nodeType = _ref2.nodeType,
|
|
41
|
-
getAttrs = _ref2.getAttrs,
|
|
42
|
-
joinPredicate = _ref2.joinPredicate;
|
|
43
|
-
var handler = function handler(state, match, start, end) {
|
|
44
|
-
var attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
|
|
45
|
-
var tr = state.tr;
|
|
46
|
-
var fixedStart = Math.max(start, 1);
|
|
47
|
-
tr.delete(fixedStart, end);
|
|
48
|
-
var $start = tr.doc.resolve(fixedStart);
|
|
49
|
-
var range = $start.blockRange();
|
|
50
|
-
var wrapping = range && findWrapping(range, nodeType, attrs);
|
|
51
|
-
if (!wrapping || !range) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
var parentNodePosMapped = tr.mapping.map(range.start);
|
|
55
|
-
var parentNode = tr.doc.nodeAt(parentNodePosMapped);
|
|
56
|
-
var lastWrap = wrapping[wrapping.length - 1];
|
|
57
|
-
if (parentNode && lastWrap) {
|
|
58
|
-
var allowedMarks = lastWrap.type.allowedMarks(parentNode.marks) || [];
|
|
59
|
-
tr.setNodeMarkup(parentNodePosMapped, parentNode.type, parentNode.attrs, allowedMarks);
|
|
60
|
-
}
|
|
61
|
-
tr.wrap(range, wrapping);
|
|
62
|
-
var before = tr.doc.resolve(fixedStart - 1).nodeBefore;
|
|
63
|
-
if (before && before.type === nodeType && canJoin(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_ABOVE))) {
|
|
64
|
-
tr.join(fixedStart - 1);
|
|
65
|
-
}
|
|
66
|
-
return tr;
|
|
67
|
-
};
|
|
68
|
-
return createRule(match, handler);
|
|
69
|
-
};
|
|
70
|
-
export var createJoinNodesRule = function createJoinNodesRule(match, nodeType) {
|
|
71
|
-
return createWrappingJoinRule({
|
|
72
|
-
nodeType: nodeType,
|
|
73
|
-
match: match,
|
|
74
|
-
getAttrs: {},
|
|
75
|
-
joinPredicate: function joinPredicate(_, node) {
|
|
76
|
-
return node.type === nodeType;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
22
|
};
|
package/dist/esm/utils/mark.js
CHANGED
|
@@ -32,41 +32,6 @@ export var isMarkExcluded = function isMarkExcluded(type, marks) {
|
|
|
32
32
|
}
|
|
33
33
|
return false;
|
|
34
34
|
};
|
|
35
|
-
var not = function not(fn) {
|
|
36
|
-
return function (arg) {
|
|
37
|
-
return !fn(arg);
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export var removeBlockMarks = function removeBlockMarks(state, marks) {
|
|
41
|
-
var selection = state.selection,
|
|
42
|
-
schema = state.schema;
|
|
43
|
-
var tr = state.tr;
|
|
44
|
-
|
|
45
|
-
// Marks might not exist in Schema
|
|
46
|
-
var marksToRemove = marks.filter(Boolean);
|
|
47
|
-
if (marksToRemove.length === 0) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Saves an extra dispatch */
|
|
52
|
-
var blockMarksExists = false;
|
|
53
|
-
var hasMark = function hasMark(mark) {
|
|
54
|
-
return marksToRemove.indexOf(mark.type) > -1;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* When you need to toggle the selection
|
|
58
|
-
* when another type which does not allow alignment is applied
|
|
59
|
-
*/
|
|
60
|
-
state.doc.nodesBetween(selection.from, selection.to, function (node, pos) {
|
|
61
|
-
if (node.type === schema.nodes.paragraph && node.marks.some(hasMark)) {
|
|
62
|
-
blockMarksExists = true;
|
|
63
|
-
var resolvedPos = state.doc.resolve(pos);
|
|
64
|
-
var withoutBlockMarks = node.marks.filter(not(hasMark));
|
|
65
|
-
tr = tr.setNodeMarkup(resolvedPos.pos, undefined, node.attrs, withoutBlockMarks);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return blockMarksExists ? tr : undefined;
|
|
69
|
-
};
|
|
70
35
|
|
|
71
36
|
/**
|
|
72
37
|
* Removes marks from nodes in the current selection that are not supported
|
package/dist/esm/version.json
CHANGED
|
@@ -2,12 +2,6 @@ import type { MarkType, NodeType, Node as PMNode, Schema } from '@atlaskit/edito
|
|
|
2
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { AlignmentState } from '../plugins/alignment/pm-plugins/types';
|
|
4
4
|
import type { Command } from '../types';
|
|
5
|
-
export declare function preventDefault(): Command;
|
|
6
|
-
export declare function insertNewLine(): Command;
|
|
7
|
-
export declare const insertNewLineWithAnalytics: Command;
|
|
8
|
-
export declare const createNewParagraphAbove: Command;
|
|
9
|
-
export declare const createNewParagraphBelow: Command;
|
|
10
|
-
export declare function createParagraphNear(append?: boolean): Command;
|
|
11
5
|
export declare function addParagraphAtEnd(tr: Transaction): void;
|
|
12
6
|
export declare function createParagraphAtEnd(): Command;
|
|
13
7
|
export declare const changeImageAlignment: (align?: AlignmentState) => Command;
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
/// <reference path="../../../../../../../../typings/prosemirror-state.d.ts" />
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import type { Command } from '
|
|
6
|
-
import type { HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { HeadingLevelsAndNormalText, Command } from '@atlaskit/editor-common/types';
|
|
7
6
|
import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
8
7
|
export type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING | INPUT_METHOD.KEYBOARD;
|
|
9
8
|
export declare function setBlockType(name: string): Command;
|
|
10
|
-
export declare function setBlockTypeWithAnalytics(name: string, inputMethod: InputMethod): Command;
|
|
9
|
+
export declare function setBlockTypeWithAnalytics(name: string, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
|
|
11
10
|
export declare function setNormalText(): Command;
|
|
12
|
-
export declare function setNormalTextWithAnalytics(inputMethod: InputMethod): Command;
|
|
11
|
+
export declare function setNormalTextWithAnalytics(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
|
|
13
12
|
export declare function setHeading(level: HeadingLevelsAndNormalText): Command;
|
|
14
|
-
export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod) => Command;
|
|
13
|
+
export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
15
14
|
export declare function insertBlockType(name: string): Command;
|
|
16
15
|
/**
|
|
17
16
|
*
|
|
@@ -21,7 +20,7 @@ export declare function insertBlockType(name: string): Command;
|
|
|
21
20
|
* otherwise Editor becomes very sad and crashes
|
|
22
21
|
* @returns - command that inserts block type
|
|
23
22
|
*/
|
|
24
|
-
export declare const insertBlockTypesWithAnalytics: (name: string, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) =>
|
|
23
|
+
export declare const insertBlockTypesWithAnalytics: (name: string, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
25
24
|
/**
|
|
26
25
|
* This function creates a new transaction that wraps the current selection
|
|
27
26
|
* in the specified node type if it results in a valid transaction.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { BlockTypePluginOptions } from './types';
|
|
3
2
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { BlockTypePluginOptions } from './types';
|
|
4
4
|
declare const blockTypePlugin: NextEditorPlugin<'blockType', {
|
|
5
5
|
pluginConfiguration: BlockTypePluginOptions | undefined;
|
|
6
6
|
dependencies: [OptionalPlugin<typeof analyticsPlugin>];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
4
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
|
|
4
|
-
declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
|
|
5
|
+
declare function inputRulePlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined, schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
|
|
5
6
|
export default inputRulePlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { FeatureFlags } from '../../../types/feature-flags';
|
|
4
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
|
|
4
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
export default function keymapPlugin(editorAnalyticsApi: EditorAnalyticsAPI | undefined, schema: Schema, _featureFlags: FeatureFlags): SafePlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { BlockType } from '../types';
|
|
4
5
|
export type BlockTypeState = {
|
|
5
6
|
currentBlockType: BlockType;
|
|
@@ -8,4 +9,4 @@ export type BlockTypeState = {
|
|
|
8
9
|
availableWrapperBlockTypes: BlockType[];
|
|
9
10
|
};
|
|
10
11
|
export declare const pluginKey: PluginKey<BlockTypeState>;
|
|
11
|
-
export declare const createPlugin: (dispatch: (eventName: string | PluginKey, data: any) => void, lastNodeMustBeParagraph?: boolean) => SafePlugin<BlockTypeState>;
|
|
12
|
+
export declare const createPlugin: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, dispatch: (eventName: string | PluginKey, data: any) => void, lastNodeMustBeParagraph?: boolean) => SafePlugin<BlockTypeState>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
1
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
2
2
|
export declare const blocktypeStyles: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { MessageDescriptor } from '../../types/i18n';
|
|
1
|
+
import type { MessageDescriptor } from 'react-intl-next';
|
|
3
2
|
import type { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { HeadingLevelsAndNormalText, AllowedBlockTypes } from '@atlaskit/editor-common/types';
|
|
5
4
|
export declare const NORMAL_TEXT: BlockType;
|
|
6
5
|
export declare const HEADING_1: BlockType;
|
|
7
6
|
export declare const HEADING_2: BlockType;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
-
import type { MessageDescriptor } from '../../../../types/i18n';
|
|
3
|
+
import type { WrappedComponentProps, MessageDescriptor } from 'react-intl-next';
|
|
5
4
|
export interface BlockTypeButtonProps {
|
|
6
5
|
isSmall?: boolean;
|
|
7
6
|
isReducedSpacing?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
6
|
import type { BlockTypeState } from '../../pm-plugins/main';
|
|
5
7
|
import type { BlockType } from '../../types';
|
|
6
|
-
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
7
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
export type DropdownItem = MenuItem & {
|
|
9
9
|
value: BlockType;
|
|
10
10
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
1
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
2
2
|
export declare const blockTypeMenuItemStyle: (tagName: string, selected?: boolean) => (themeProps: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
3
3
|
export declare const keyboardShortcut: import("@emotion/react").SerializedStyles;
|
|
4
4
|
export declare const keyboardShortcutSelect: import("@emotion/react").SerializedStyles;
|
|
5
|
+
export declare const buttonContentStyle: import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const buttonContentReducedSpacingStyle: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const wrapperSmallStyle: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const expandIconWrapperStyle: import("@emotion/react").SerializedStyles;
|