@atlaskit/editor-core 188.5.0 → 188.6.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 +13 -0
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/labs/next/presets/universal.js +1 -6
- package/dist/cjs/plugins/expand/index.js +0 -2
- package/dist/cjs/plugins/expand/nodeviews/index.js +37 -13
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +30 -29
- package/dist/cjs/plugins/status/actions.js +14 -11
- package/dist/cjs/plugins/status/index.js +17 -8
- package/dist/cjs/plugins/status/keymap.js +1 -1
- package/dist/cjs/plugins/status/ui/statusPicker.js +2 -2
- package/dist/cjs/ui/Addon/click-area-helper.js +9 -11
- package/dist/cjs/ui/ContentStyles/index.js +13 -13
- package/dist/cjs/utils/selection.js +12 -14
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +1 -6
- package/dist/es2019/plugins/expand/index.js +0 -2
- package/dist/es2019/plugins/expand/nodeviews/index.js +37 -13
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/es2019/plugins/status/actions.js +3 -2
- package/dist/es2019/plugins/status/index.js +91 -80
- package/dist/es2019/plugins/status/keymap.js +1 -1
- package/dist/es2019/plugins/status/ui/statusPicker.js +1 -1
- package/dist/es2019/ui/Addon/click-area-helper.js +4 -6
- package/dist/es2019/ui/ContentStyles/index.js +1 -1
- package/dist/es2019/utils/selection.js +2 -17
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +1 -6
- package/dist/esm/plugins/expand/index.js +0 -2
- package/dist/esm/plugins/expand/nodeviews/index.js +37 -13
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +30 -29
- package/dist/esm/plugins/status/actions.js +14 -11
- package/dist/esm/plugins/status/index.js +17 -8
- package/dist/esm/plugins/status/keymap.js +1 -1
- package/dist/esm/plugins/status/ui/statusPicker.js +1 -1
- package/dist/esm/ui/Addon/click-area-helper.js +4 -6
- package/dist/esm/ui/ContentStyles/index.js +1 -1
- package/dist/esm/utils/selection.js +2 -13
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +22 -8
- package/dist/types/plugins/expand/index.d.ts +1 -1
- package/dist/types/plugins/expand/nodeviews/index.d.ts +3 -2
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/status/actions.d.ts +4 -2
- package/dist/types/plugins/status/index.d.ts +12 -3
- package/dist/types/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types/plugins/status/plugin.d.ts +1 -1
- package/dist/types/utils/selection.d.ts +1 -4
- package/package.json +4 -3
- package/dist/cjs/plugins/selection/actions.js +0 -11
- package/dist/cjs/plugins/selection/commands.js +0 -257
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +0 -272
- package/dist/cjs/plugins/selection/gap-cursor/direction.js +0 -23
- package/dist/cjs/plugins/selection/gap-cursor/selection.js +0 -30
- package/dist/cjs/plugins/selection/gap-cursor/styles.js +0 -17
- package/dist/cjs/plugins/selection/gap-cursor/utils/is-ignored.js +0 -12
- package/dist/cjs/plugins/selection/gap-cursor/utils/is-valid-target-node.js +0 -12
- package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +0 -103
- package/dist/cjs/plugins/selection/gap-cursor/utils.js +0 -137
- package/dist/cjs/plugins/selection/gap-cursor-selection.js +0 -37
- package/dist/cjs/plugins/selection/index.js +0 -65
- package/dist/cjs/plugins/selection/plugin-factory.js +0 -49
- package/dist/cjs/plugins/selection/pm-plugins/events/create-selection-between.js +0 -92
- package/dist/cjs/plugins/selection/pm-plugins/events/keydown.js +0 -115
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-keymap.js +0 -46
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-main.js +0 -160
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-plugin-key.js +0 -8
- package/dist/cjs/plugins/selection/pm-plugins/keymap.js +0 -16
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +0 -104
- package/dist/cjs/plugins/selection/reducer.js +0 -26
- package/dist/cjs/plugins/selection/types.js +0 -20
- package/dist/cjs/plugins/selection/utils.js +0 -280
- package/dist/cjs/selection-api/api.js +0 -27
- package/dist/es2019/plugins/selection/actions.js +0 -5
- package/dist/es2019/plugins/selection/commands.js +0 -250
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +0 -270
- package/dist/es2019/plugins/selection/gap-cursor/direction.js +0 -15
- package/dist/es2019/plugins/selection/gap-cursor/selection.js +0 -1
- package/dist/es2019/plugins/selection/gap-cursor/styles.js +0 -145
- package/dist/es2019/plugins/selection/gap-cursor/utils/is-ignored.js +0 -1
- package/dist/es2019/plugins/selection/gap-cursor/utils/is-valid-target-node.js +0 -1
- package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +0 -94
- package/dist/es2019/plugins/selection/gap-cursor/utils.js +0 -124
- package/dist/es2019/plugins/selection/gap-cursor-selection.js +0 -2
- package/dist/es2019/plugins/selection/index.js +0 -51
- package/dist/es2019/plugins/selection/plugin-factory.js +0 -43
- package/dist/es2019/plugins/selection/pm-plugins/events/create-selection-between.js +0 -89
- package/dist/es2019/plugins/selection/pm-plugins/events/keydown.js +0 -112
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-keymap.js +0 -40
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-main.js +0 -158
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-plugin-key.js +0 -2
- package/dist/es2019/plugins/selection/pm-plugins/keymap.js +0 -10
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +0 -97
- package/dist/es2019/plugins/selection/reducer.js +0 -18
- package/dist/es2019/plugins/selection/types.js +0 -9
- package/dist/es2019/plugins/selection/utils.js +0 -233
- package/dist/es2019/selection-api/api.js +0 -20
- package/dist/esm/plugins/selection/actions.js +0 -5
- package/dist/esm/plugins/selection/commands.js +0 -251
- package/dist/esm/plugins/selection/gap-cursor/actions.js +0 -266
- package/dist/esm/plugins/selection/gap-cursor/direction.js +0 -15
- package/dist/esm/plugins/selection/gap-cursor/selection.js +0 -1
- package/dist/esm/plugins/selection/gap-cursor/styles.js +0 -10
- package/dist/esm/plugins/selection/gap-cursor/utils/is-ignored.js +0 -1
- package/dist/esm/plugins/selection/gap-cursor/utils/is-valid-target-node.js +0 -1
- package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +0 -97
- package/dist/esm/plugins/selection/gap-cursor/utils.js +0 -128
- package/dist/esm/plugins/selection/gap-cursor-selection.js +0 -2
- package/dist/esm/plugins/selection/index.js +0 -58
- package/dist/esm/plugins/selection/plugin-factory.js +0 -43
- package/dist/esm/plugins/selection/pm-plugins/events/create-selection-between.js +0 -86
- package/dist/esm/plugins/selection/pm-plugins/events/keydown.js +0 -110
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-keymap.js +0 -40
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-main.js +0 -154
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-plugin-key.js +0 -2
- package/dist/esm/plugins/selection/pm-plugins/keymap.js +0 -10
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +0 -98
- package/dist/esm/plugins/selection/reducer.js +0 -19
- package/dist/esm/plugins/selection/types.js +0 -9
- package/dist/esm/plugins/selection/utils.js +0 -241
- package/dist/esm/selection-api/api.js +0 -21
- package/dist/types/plugins/selection/actions.d.ts +0 -17
- package/dist/types/plugins/selection/commands.d.ts +0 -10
- package/dist/types/plugins/selection/gap-cursor/actions.d.ts +0 -25
- package/dist/types/plugins/selection/gap-cursor/direction.d.ts +0 -10
- package/dist/types/plugins/selection/gap-cursor/selection.d.ts +0 -1
- package/dist/types/plugins/selection/gap-cursor/styles.d.ts +0 -2
- package/dist/types/plugins/selection/gap-cursor/utils/is-ignored.d.ts +0 -1
- package/dist/types/plugins/selection/gap-cursor/utils/is-valid-target-node.d.ts +0 -1
- package/dist/types/plugins/selection/gap-cursor/utils/place-gap-cursor.d.ts +0 -2
- package/dist/types/plugins/selection/gap-cursor/utils.d.ts +0 -8
- package/dist/types/plugins/selection/gap-cursor-selection.d.ts +0 -2
- package/dist/types/plugins/selection/index.d.ts +0 -13
- package/dist/types/plugins/selection/plugin-factory.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/events/create-selection-between.d.ts +0 -4
- package/dist/types/plugins/selection/pm-plugins/events/keydown.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/gap-cursor-keymap.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/gap-cursor-main.d.ts +0 -6
- package/dist/types/plugins/selection/pm-plugins/gap-cursor-plugin-key.d.ts +0 -2
- package/dist/types/plugins/selection/pm-plugins/keymap.d.ts +0 -3
- package/dist/types/plugins/selection/pm-plugins/selection-main.d.ts +0 -7
- package/dist/types/plugins/selection/reducer.d.ts +0 -3
- package/dist/types/plugins/selection/types.d.ts +0 -12
- package/dist/types/plugins/selection/utils.d.ts +0 -58
- package/dist/types/selection-api/api.d.ts +0 -11
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { SelectionActionTypes } from '../actions';
|
|
4
|
-
import { createPluginState, getPluginState } from '../plugin-factory';
|
|
5
|
-
import { selectionPluginKey } from '../types';
|
|
6
|
-
import { getAllSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, getDecorations, getNodeSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, shouldRecalcDecorations } from '../utils';
|
|
7
|
-
import { onKeydown } from './events/keydown';
|
|
8
|
-
import { onCreateSelectionBetween } from './events/create-selection-between';
|
|
9
|
-
export var getInitialState = function getInitialState(state) {
|
|
10
|
-
return {
|
|
11
|
-
decorationSet: getDecorations(state.tr),
|
|
12
|
-
selection: state.selection
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent) {
|
|
16
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
17
|
-
return new SafePlugin({
|
|
18
|
-
key: selectionPluginKey,
|
|
19
|
-
state: createPluginState(dispatch, getInitialState),
|
|
20
|
-
view: function view() {
|
|
21
|
-
return {
|
|
22
|
-
update: function update(editorView, oldEditorState) {
|
|
23
|
-
var state = editorView.state;
|
|
24
|
-
if (!shouldRecalcDecorations({
|
|
25
|
-
oldEditorState: oldEditorState,
|
|
26
|
-
newEditorState: state
|
|
27
|
-
})) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
var analyticsPayload = getNodeSelectionAnalyticsPayload(state.selection) || getAllSelectionAnalyticsPayload(state.selection) ||
|
|
31
|
-
// We handle all range/cell selections except click and drag here, which is
|
|
32
|
-
// handled in mouseup handler below
|
|
33
|
-
!editorView.mouseDown && (getRangeSelectionAnalyticsPayload(state.selection, state.doc) || getCellSelectionAnalyticsPayload(state));
|
|
34
|
-
|
|
35
|
-
// We have to use dispatchAnalyticsEvent over any of the analytics plugin helpers
|
|
36
|
-
// as there were several issues caused by the fact that adding analytics through
|
|
37
|
-
// the plugin adds a new step to the transaction
|
|
38
|
-
// This causes prosemirror to run through some different code paths, eg. attempting
|
|
39
|
-
// to map selection
|
|
40
|
-
if (analyticsPayload) {
|
|
41
|
-
dispatchAnalyticsEvent(analyticsPayload);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
appendTransaction: function appendTransaction(_transactions, oldEditorState, newEditorState) {
|
|
47
|
-
if (!shouldRecalcDecorations({
|
|
48
|
-
oldEditorState: oldEditorState,
|
|
49
|
-
newEditorState: newEditorState
|
|
50
|
-
})) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
var tr = newEditorState.tr;
|
|
54
|
-
tr.setMeta(selectionPluginKey, {
|
|
55
|
-
type: SelectionActionTypes.SET_DECORATIONS,
|
|
56
|
-
selection: tr.selection,
|
|
57
|
-
decorationSet: getDecorations(tr)
|
|
58
|
-
});
|
|
59
|
-
return tr;
|
|
60
|
-
},
|
|
61
|
-
filterTransaction: function filterTransaction(tr, state) {
|
|
62
|
-
// Prevent single click selecting atom nodes on mobile (we want to select with long press gesture instead)
|
|
63
|
-
if (options.useLongPressSelection && tr.selectionSet && tr.selection instanceof NodeSelection && !tr.getMeta(selectionPluginKey)) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Prevent prosemirror's mutation observer overriding a node selection with a text selection
|
|
68
|
-
// for exact same range - this was cause of being unable to change dates in collab:
|
|
69
|
-
// https://product-fabric.atlassian.net/browse/ED-10645
|
|
70
|
-
if (state.selection instanceof NodeSelection && tr.selection instanceof TextSelection && state.selection.from === tr.selection.from && state.selection.to === tr.selection.to) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return true;
|
|
74
|
-
},
|
|
75
|
-
props: {
|
|
76
|
-
createSelectionBetween: onCreateSelectionBetween,
|
|
77
|
-
decorations: function decorations(state) {
|
|
78
|
-
return getPluginState(state).decorationSet;
|
|
79
|
-
},
|
|
80
|
-
handleDOMEvents: {
|
|
81
|
-
keydown: onKeydown,
|
|
82
|
-
// We only want to fire analytics for a click and drag range/cell selection when
|
|
83
|
-
// the user has finished, otherwise we will get an event almost every time they move
|
|
84
|
-
// their mouse which is too much
|
|
85
|
-
mouseup: function mouseup(editorView, event) {
|
|
86
|
-
var mouseEvent = event;
|
|
87
|
-
if (!mouseEvent.shiftKey) {
|
|
88
|
-
var analyticsPayload = getRangeSelectionAnalyticsPayload(editorView.state.selection, editorView.state.doc) || getCellSelectionAnalyticsPayload(editorView.state);
|
|
89
|
-
if (analyticsPayload) {
|
|
90
|
-
dispatchAnalyticsEvent(analyticsPayload);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { SelectionActionTypes } from './actions';
|
|
5
|
-
export function reducer(pluginState, action) {
|
|
6
|
-
switch (action.type) {
|
|
7
|
-
case SelectionActionTypes.SET_DECORATIONS:
|
|
8
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
9
|
-
decorationSet: action.decorationSet,
|
|
10
|
-
selection: action.selection
|
|
11
|
-
});
|
|
12
|
-
case SelectionActionTypes.SET_RELATIVE_SELECTION:
|
|
13
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
14
|
-
selectionRelativeToNode: action.selectionRelativeToNode
|
|
15
|
-
});
|
|
16
|
-
default:
|
|
17
|
-
return pluginState;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { RelativeSelectionPos } from '@atlaskit/editor-common/selection';
|
|
3
|
-
export var selectionPluginKey = new PluginKey('selection');
|
|
4
|
-
export { RelativeSelectionPos };
|
|
5
|
-
export var SelectionDirection = /*#__PURE__*/function (SelectionDirection) {
|
|
6
|
-
SelectionDirection[SelectionDirection["Before"] = -1] = "Before";
|
|
7
|
-
SelectionDirection[SelectionDirection["After"] = 1] = "After";
|
|
8
|
-
return SelectionDirection;
|
|
9
|
-
}({});
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { NodeSelection, TextSelection, Selection, AllSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import { flatten, findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode, getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler, isIgnored as isIgnoredByGapCursor } from '@atlaskit/editor-common/selection';
|
|
6
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import { selectionPluginKey } from './types';
|
|
8
|
-
export var getDecorations = function getDecorations(tr) {
|
|
9
|
-
if (tr.selection instanceof NodeSelection) {
|
|
10
|
-
return DecorationSet.create(tr.doc, [Decoration.node(tr.selection.from, tr.selection.to, {
|
|
11
|
-
class: akEditorSelectedNodeClassName
|
|
12
|
-
})]);
|
|
13
|
-
}
|
|
14
|
-
if (tr.selection instanceof TextSelection || tr.selection instanceof AllSelection) {
|
|
15
|
-
var decorations = getNodesToDecorateFromSelection(tr.selection, tr.doc).map(function (_ref) {
|
|
16
|
-
var node = _ref.node,
|
|
17
|
-
pos = _ref.pos;
|
|
18
|
-
return Decoration.node(pos, pos + node.nodeSize, {
|
|
19
|
-
class: akEditorSelectedNodeClassName
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
return DecorationSet.create(tr.doc, decorations);
|
|
23
|
-
}
|
|
24
|
-
return DecorationSet.empty;
|
|
25
|
-
};
|
|
26
|
-
var topLevelBlockNodesThatHaveSelectionStyles = ['table', 'panel', 'expand', 'layoutSection', 'decisionList', 'decisionItem', 'codeBlock'];
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Use `getNodesToDecorateFromSelection` to collect and return
|
|
30
|
-
* a list of nodes within the Selection that should have Selection
|
|
31
|
-
* decorations applied. This allows selection styles to be added to
|
|
32
|
-
* nested nodes. It will ignore text nodes as decorations are
|
|
33
|
-
* applied natively and also ignore nodes that don't completely
|
|
34
|
-
* sit within the given `Selection`.
|
|
35
|
-
*/
|
|
36
|
-
export var getNodesToDecorateFromSelection = function getNodesToDecorateFromSelection(selection, doc) {
|
|
37
|
-
var nodes = [];
|
|
38
|
-
if (selection.from !== selection.to) {
|
|
39
|
-
var from = selection.from,
|
|
40
|
-
to = selection.to;
|
|
41
|
-
doc.nodesBetween(from, to, function (node, pos) {
|
|
42
|
-
var withinSelection = from <= pos && pos + node.nodeSize <= to;
|
|
43
|
-
// The reason we need to check for these nodes is to stop
|
|
44
|
-
// traversing their children if they are within a selection -
|
|
45
|
-
// this is to prevent selection styles from being added to
|
|
46
|
-
// the children as well as the parent node.
|
|
47
|
-
// Example scenario is if an entire table has been selected
|
|
48
|
-
// we should not traverse its children so we can apply the
|
|
49
|
-
// selection styles to the table. But if an entire tableRow
|
|
50
|
-
// has been selected (but the parent table has not) we should
|
|
51
|
-
// traverse it as it could contain other nodes that need
|
|
52
|
-
// selection styles. I couldn’t see a clear way to differentiate
|
|
53
|
-
// without explicitly stating which nodes should be traversed
|
|
54
|
-
// and which shouldn’t.
|
|
55
|
-
var isTopLevelNodeThatHasSelectionStyles = topLevelBlockNodesThatHaveSelectionStyles.includes(node.type.name);
|
|
56
|
-
// If the node is a top-level block node and completely sits within
|
|
57
|
-
// the selection, we do not recurse it's children to prevent selection
|
|
58
|
-
// styles being added to its child nodes. The expected behaviour
|
|
59
|
-
// is that selection styles are only added to the parent.
|
|
60
|
-
if (node && withinSelection && isTopLevelNodeThatHasSelectionStyles) {
|
|
61
|
-
nodes.push({
|
|
62
|
-
node: node,
|
|
63
|
-
pos: pos
|
|
64
|
-
});
|
|
65
|
-
return false;
|
|
66
|
-
// Otherwise we recurse the children and return them so we can apply
|
|
67
|
-
// selection styles. Text is handled by the browser.
|
|
68
|
-
} else if (node && withinSelection && !node.isText) {
|
|
69
|
-
nodes.push({
|
|
70
|
-
node: node,
|
|
71
|
-
pos: pos
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return nodes;
|
|
78
|
-
};
|
|
79
|
-
export function shouldRecalcDecorations(_ref2) {
|
|
80
|
-
var oldEditorState = _ref2.oldEditorState,
|
|
81
|
-
newEditorState = _ref2.newEditorState;
|
|
82
|
-
var oldSelection = oldEditorState.selection;
|
|
83
|
-
var newSelection = newEditorState.selection;
|
|
84
|
-
var oldPluginState = selectionPluginKey.getState(oldEditorState);
|
|
85
|
-
var newPluginState = selectionPluginKey.getState(newEditorState);
|
|
86
|
-
if (!oldPluginState || !newPluginState) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// If selection is unchanged, no need to recalculate
|
|
91
|
-
if (oldSelection.eq(newSelection)) {
|
|
92
|
-
// We need this special case for NodeSelection, as Prosemirror still thinks the
|
|
93
|
-
// selections are equal when the node has changed
|
|
94
|
-
if (oldSelection instanceof NodeSelection && newSelection instanceof NodeSelection) {
|
|
95
|
-
var oldDecorations = oldPluginState.decorationSet.find();
|
|
96
|
-
var newDecorations = newPluginState.decorationSet.find();
|
|
97
|
-
// There might not be old or new decorations if the node selection is for a text node
|
|
98
|
-
// This wouldn't have happened intentionally, but we need to handle this case regardless
|
|
99
|
-
if (oldDecorations.length > 0 && newDecorations.length > 0) {
|
|
100
|
-
return !oldDecorations[0].eq(newDecorations[0]);
|
|
101
|
-
}
|
|
102
|
-
return !(oldDecorations.length === 0 && newDecorations.length === 0);
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// There's no point updating decorations if going from one standard TextSelection to another
|
|
108
|
-
if (oldSelection instanceof TextSelection && newSelection instanceof TextSelection && oldSelection.from === oldSelection.to && newSelection.from === newSelection.to) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
export var isSelectableContainerNode = function isSelectableContainerNode(node) {
|
|
114
|
-
return !!(node && !node.isAtom && NodeSelection.isSelectable(node));
|
|
115
|
-
};
|
|
116
|
-
export var isSelectableChildNode = function isSelectableChildNode(node) {
|
|
117
|
-
return !!(node && (node.isText || isEmptyParagraph(node) || NodeSelection.isSelectable(node)));
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Finds closest parent node that is a selectable block container node
|
|
122
|
-
* If it finds a parent that is not selectable but supports gap cursor, will
|
|
123
|
-
* return undefined
|
|
124
|
-
*/
|
|
125
|
-
export var findSelectableContainerParent = function findSelectableContainerParent(selection) {
|
|
126
|
-
var foundNodeThatSupportsGapCursor = false;
|
|
127
|
-
var selectableNode = findParentNode(function (node) {
|
|
128
|
-
var isSelectable = isSelectableContainerNode(node);
|
|
129
|
-
if (!isSelectable && !isIgnoredByGapCursor(node)) {
|
|
130
|
-
foundNodeThatSupportsGapCursor = true;
|
|
131
|
-
}
|
|
132
|
-
return isSelectable;
|
|
133
|
-
})(selection);
|
|
134
|
-
if (!foundNodeThatSupportsGapCursor) {
|
|
135
|
-
return selectableNode;
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Finds node before that is a selectable block container node, starting
|
|
141
|
-
* from $pos.depth + 1 and working in
|
|
142
|
-
* If it finds a node that is not selectable but supports gap cursor, will
|
|
143
|
-
* return undefined
|
|
144
|
-
*/
|
|
145
|
-
export var findSelectableContainerBefore = function findSelectableContainerBefore($pos, doc) {
|
|
146
|
-
// prosemirror just returns the same pos from Selection.findFrom when
|
|
147
|
-
// parent.inlineContent is true, so we move position back one here
|
|
148
|
-
// to counteract that
|
|
149
|
-
if ($pos.parent.inlineContent && isSelectableContainerNode($pos.parent)) {
|
|
150
|
-
$pos = doc.resolve($pos.start() - 1);
|
|
151
|
-
}
|
|
152
|
-
var selectionBefore = Selection.findFrom($pos, -1);
|
|
153
|
-
if (selectionBefore) {
|
|
154
|
-
var $selectionBefore = doc.resolve(selectionBefore.from);
|
|
155
|
-
for (var i = $pos.depth + 1; i <= $selectionBefore.depth; i++) {
|
|
156
|
-
var node = $selectionBefore.node(i);
|
|
157
|
-
if (isSelectableContainerNode(node)) {
|
|
158
|
-
return {
|
|
159
|
-
node: node,
|
|
160
|
-
pos: $selectionBefore.start(i) - 1
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
if (i > $pos.depth + 1 && !isIgnoredByGapCursor(node)) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Stick to the default left selection behaviour,
|
|
170
|
-
* useful for mediaSingleWithCaption
|
|
171
|
-
*/
|
|
172
|
-
if (selectionBefore instanceof NodeSelection && NodeSelection.isSelectable(selectionBefore.node)) {
|
|
173
|
-
return {
|
|
174
|
-
node: selectionBefore.node,
|
|
175
|
-
pos: selectionBefore.from
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Finds node after that is a selectable block container node, starting
|
|
183
|
-
* from $pos.depth + 1 and working in
|
|
184
|
-
* If it finds a node that is not selectable but supports gap cursor, will
|
|
185
|
-
* return undefined
|
|
186
|
-
*/
|
|
187
|
-
export var findSelectableContainerAfter = function findSelectableContainerAfter($pos, doc) {
|
|
188
|
-
var selectionAfter = Selection.findFrom($pos, 1);
|
|
189
|
-
if (selectionAfter) {
|
|
190
|
-
var $selectionAfter = doc.resolve(selectionAfter.from);
|
|
191
|
-
for (var i = $pos.depth + 1; i <= $selectionAfter.depth; i++) {
|
|
192
|
-
var node = $selectionAfter.node(i);
|
|
193
|
-
if (isSelectableContainerNode(node)) {
|
|
194
|
-
return {
|
|
195
|
-
node: node,
|
|
196
|
-
pos: $selectionAfter.start(i) - 1
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
if (i > $pos.depth + 1 && !isIgnoredByGapCursor(node)) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Finds first child node that is a selectable block container node OR that
|
|
208
|
-
* supports gap cursor
|
|
209
|
-
*/
|
|
210
|
-
export var findFirstChildNodeToSelect = function findFirstChildNodeToSelect(parent) {
|
|
211
|
-
return flatten(parent).find(function (child) {
|
|
212
|
-
return isSelectableChildNode(child.node) || !isIgnoredByGapCursor(child.node);
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Finds last child node that is a selectable block container node OR that
|
|
218
|
-
* supports gap cursor
|
|
219
|
-
*/
|
|
220
|
-
export var findLastChildNodeToSelect = function findLastChildNodeToSelect(parent) {
|
|
221
|
-
var child;
|
|
222
|
-
parent.descendants(function (node, pos) {
|
|
223
|
-
if (isSelectableChildNode(node) || !isIgnoredByGapCursor(node)) {
|
|
224
|
-
child = {
|
|
225
|
-
node: node,
|
|
226
|
-
pos: pos
|
|
227
|
-
};
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
if (child) {
|
|
232
|
-
return child;
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
export var isSelectionAtStartOfParentNode = function isSelectionAtStartOfParentNode($pos, selection) {
|
|
236
|
-
return isSelectionAtStartOfNode($pos, findSelectableContainerParent(selection));
|
|
237
|
-
};
|
|
238
|
-
export var isSelectionAtEndOfParentNode = function isSelectionAtEndOfParentNode($pos, selection) {
|
|
239
|
-
return isSelectionAtEndOfNode($pos, findSelectableContainerParent(selection));
|
|
240
|
-
};
|
|
241
|
-
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { setSelectionRelativeToNode as setSelectionRelativeToNodeOriginalCommand } from '../plugins/selection/commands';
|
|
2
|
-
import { getPluginState as _getSelectionPluginState } from '../plugins/selection/plugin-factory';
|
|
3
|
-
export var createEditorSelectionAPI = function createEditorSelectionAPI() {
|
|
4
|
-
return {
|
|
5
|
-
getSelectionPluginState: function getSelectionPluginState(state) {
|
|
6
|
-
return _getSelectionPluginState(state);
|
|
7
|
-
},
|
|
8
|
-
setSelectionRelativeToNode: function setSelectionRelativeToNode(_ref) {
|
|
9
|
-
var selectionRelativeToNode = _ref.selectionRelativeToNode,
|
|
10
|
-
selection = _ref.selection;
|
|
11
|
-
return function (state) {
|
|
12
|
-
var tr = state.tr;
|
|
13
|
-
var fakeDispatch = function fakeDispatch(_tr) {
|
|
14
|
-
tr = _tr;
|
|
15
|
-
};
|
|
16
|
-
setSelectionRelativeToNodeOriginalCommand(selectionRelativeToNode, selection)(state, fakeDispatch);
|
|
17
|
-
return tr;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { RelativeSelectionPos } from './types';
|
|
4
|
-
export declare enum SelectionActionTypes {
|
|
5
|
-
SET_DECORATIONS = "SET_DECORATIONS",
|
|
6
|
-
SET_RELATIVE_SELECTION = "SET_RELATIVE_SELECTION"
|
|
7
|
-
}
|
|
8
|
-
export interface SetDecorations {
|
|
9
|
-
type: SelectionActionTypes.SET_DECORATIONS;
|
|
10
|
-
decorationSet: DecorationSet;
|
|
11
|
-
selection: Selection;
|
|
12
|
-
}
|
|
13
|
-
export interface SetRelativeSelection {
|
|
14
|
-
type: SelectionActionTypes.SET_RELATIVE_SELECTION;
|
|
15
|
-
selectionRelativeToNode?: RelativeSelectionPos;
|
|
16
|
-
}
|
|
17
|
-
export type SelectionAction = SetDecorations | SetRelativeSelection;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Command } from '../../types';
|
|
4
|
-
import { RelativeSelectionPos } from './types';
|
|
5
|
-
import type { EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
|
|
6
|
-
export declare const selectNearNode: EditorCommandWithMetadata;
|
|
7
|
-
export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => import("@atlaskit/editor-common/types").Command;
|
|
8
|
-
export declare const arrowRight: Command;
|
|
9
|
-
export declare const arrowLeft: Command;
|
|
10
|
-
export declare const setSelectionInsideAtNodeEnd: (selectionRelativeToNode: RelativeSelectionPos, node: PmNode, from: number, to: number) => Command;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { Direction } from './direction';
|
|
4
|
-
import { Side } from './selection';
|
|
5
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
|
-
export type DirectionString = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
|
|
7
|
-
export declare const shouldSkipGapCursor: (direction: Direction, state: EditorState, $pos: ResolvedPos) => boolean;
|
|
8
|
-
export declare const arrow: (dir: Direction, endOfTextblock?: ((dir: DirectionString, state?: EditorState) => boolean) | undefined) => Command;
|
|
9
|
-
export declare const deleteNode: (dir: Direction) => Command;
|
|
10
|
-
export declare const setGapCursorAtPos: (position: number, side?: Side) => Command;
|
|
11
|
-
export declare const setSelectionTopLevelBlocks: (tr: Transaction, event: React.MouseEvent<any>, editorRef: HTMLElement, posAtCoords: (coords: {
|
|
12
|
-
left: number;
|
|
13
|
-
top: number;
|
|
14
|
-
}) => {
|
|
15
|
-
pos: number;
|
|
16
|
-
inside: number;
|
|
17
|
-
} | null | void, editorFocused: boolean) => void;
|
|
18
|
-
export declare const setCursorForTopLevelBlocks: (event: React.MouseEvent<any>, editorRef: HTMLElement, posAtCoords: (coords: {
|
|
19
|
-
left: number;
|
|
20
|
-
top: number;
|
|
21
|
-
}) => {
|
|
22
|
-
pos: number;
|
|
23
|
-
inside: number;
|
|
24
|
-
} | null | void, editorFocused: boolean) => Command;
|
|
25
|
-
export declare const hasGapCursorPlugin: (state: EditorState) => boolean;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare enum Direction {
|
|
2
|
-
UP = "up",
|
|
3
|
-
RIGHT = "right",
|
|
4
|
-
DOWN = "down",
|
|
5
|
-
LEFT = "left",
|
|
6
|
-
BACKWARD = "backward",
|
|
7
|
-
FORWARD = "forward"
|
|
8
|
-
}
|
|
9
|
-
export declare function isBackward(dir: Direction): boolean;
|
|
10
|
-
export declare function isForward(dir: Direction): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { GapCursorSelection, JSON_ID, Side, GapBookmark, } from '@atlaskit/editor-common/selection';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { isIgnored } from '@atlaskit/editor-common/selection';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { isValidTargetNode } from '@atlaskit/editor-common/selection';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { Side } from './selection';
|
|
3
|
-
export declare const isLeftCursor: (side: Side) => side is Side.LEFT;
|
|
4
|
-
export declare function getMediaNearPos(doc: PMNode, $pos: ResolvedPos, schema: Schema, dir?: number): PMNode | null;
|
|
5
|
-
export declare const isTextBlockNearPos: (doc: PMNode, schema: Schema, $pos: ResolvedPos, dir: number) => boolean;
|
|
6
|
-
export declare function getLayoutModeFromTargetNode(node: PMNode): string;
|
|
7
|
-
export declare const isIgnoredClick: (elem: HTMLElement) => boolean;
|
|
8
|
-
export declare const getComputedStyleForLayoutMode: (dom: HTMLElement, node: PMNode | undefined | null, style: CSSStyleDeclaration) => CSSStyleDeclaration;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { EditorCommand, NextEditorPlugin, EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { SelectionSharedState } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import type { SelectionPluginOptions } from './types';
|
|
4
|
-
export type SelectionPlugin = NextEditorPlugin<'selection', {
|
|
5
|
-
pluginConfiguration: SelectionPluginOptions | undefined;
|
|
6
|
-
commands: {
|
|
7
|
-
displayGapCursor: (toggle: boolean) => EditorCommand;
|
|
8
|
-
selectNearNode: EditorCommandWithMetadata;
|
|
9
|
-
};
|
|
10
|
-
sharedState: SelectionSharedState;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const selectionPlugin: SelectionPlugin;
|
|
13
|
-
export default selectionPlugin;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import type { SelectionPluginState } from './types';
|
|
2
|
-
export declare const createCommand: <A = import("./actions").SelectionAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => SelectionPluginState, createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: SelectionPluginState | ((state: import("prosemirror-state").EditorState) => SelectionPluginState)) => import("prosemirror-state").SafeStateField<SelectionPluginState>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
export declare const onCreateSelectionBetween: (view: EditorView, $anchor: ResolvedPos, $head: ResolvedPos) => TextSelection | null;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { Dispatch } from '../../../event-dispatcher';
|
|
4
|
-
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import type { SelectionPluginOptions, SelectionPluginState } from '../types';
|
|
6
|
-
export declare const getInitialState: (state: EditorState) => SelectionPluginState;
|
|
7
|
-
export declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, options?: SelectionPluginOptions) => SafePlugin<SelectionPluginState>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { RelativeSelectionPos } from '@atlaskit/editor-common/selection';
|
|
3
|
-
export type { SelectionPluginState } from '@atlaskit/editor-common/selection';
|
|
4
|
-
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
5
|
-
export declare const selectionPluginKey: PluginKey<any>;
|
|
6
|
-
export { RelativeSelectionPos };
|
|
7
|
-
export declare enum SelectionDirection {
|
|
8
|
-
Before = -1,
|
|
9
|
-
After = 1
|
|
10
|
-
}
|
|
11
|
-
export interface SelectionPluginOptions extends LongPressSelectionPluginOptions {
|
|
12
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { Transaction, ReadonlyTransaction, EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type { Node as PmNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import type { ContentNodeWithPos, NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
7
|
-
export declare const getDecorations: (tr: Transaction | ReadonlyTransaction) => DecorationSet;
|
|
8
|
-
/**
|
|
9
|
-
* Use `getNodesToDecorateFromSelection` to collect and return
|
|
10
|
-
* a list of nodes within the Selection that should have Selection
|
|
11
|
-
* decorations applied. This allows selection styles to be added to
|
|
12
|
-
* nested nodes. It will ignore text nodes as decorations are
|
|
13
|
-
* applied natively and also ignore nodes that don't completely
|
|
14
|
-
* sit within the given `Selection`.
|
|
15
|
-
*/
|
|
16
|
-
export declare const getNodesToDecorateFromSelection: (selection: Selection, doc: PmNode) => {
|
|
17
|
-
node: PmNode;
|
|
18
|
-
pos: number;
|
|
19
|
-
}[];
|
|
20
|
-
export declare function shouldRecalcDecorations({ oldEditorState, newEditorState, }: {
|
|
21
|
-
oldEditorState: EditorState;
|
|
22
|
-
newEditorState: EditorState;
|
|
23
|
-
}): boolean;
|
|
24
|
-
export declare const isSelectableContainerNode: (node?: PmNode | null) => boolean;
|
|
25
|
-
export declare const isSelectableChildNode: (node?: PmNode | null) => boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Finds closest parent node that is a selectable block container node
|
|
28
|
-
* If it finds a parent that is not selectable but supports gap cursor, will
|
|
29
|
-
* return undefined
|
|
30
|
-
*/
|
|
31
|
-
export declare const findSelectableContainerParent: (selection: Selection) => ContentNodeWithPos | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Finds node before that is a selectable block container node, starting
|
|
34
|
-
* from $pos.depth + 1 and working in
|
|
35
|
-
* If it finds a node that is not selectable but supports gap cursor, will
|
|
36
|
-
* return undefined
|
|
37
|
-
*/
|
|
38
|
-
export declare const findSelectableContainerBefore: ($pos: ResolvedPos, doc: PmNode) => NodeWithPos | undefined;
|
|
39
|
-
/**
|
|
40
|
-
* Finds node after that is a selectable block container node, starting
|
|
41
|
-
* from $pos.depth + 1 and working in
|
|
42
|
-
* If it finds a node that is not selectable but supports gap cursor, will
|
|
43
|
-
* return undefined
|
|
44
|
-
*/
|
|
45
|
-
export declare const findSelectableContainerAfter: ($pos: ResolvedPos, doc: PmNode) => NodeWithPos | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* Finds first child node that is a selectable block container node OR that
|
|
48
|
-
* supports gap cursor
|
|
49
|
-
*/
|
|
50
|
-
export declare const findFirstChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Finds last child node that is a selectable block container node OR that
|
|
53
|
-
* supports gap cursor
|
|
54
|
-
*/
|
|
55
|
-
export declare const findLastChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
|
|
56
|
-
export declare const isSelectionAtStartOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
57
|
-
export declare const isSelectionAtEndOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
58
|
-
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, createSelectionClickHandler, };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { RelativeSelectionPos } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import type { SelectionPluginState } from '../plugins/selection/types';
|
|
4
|
-
export type EditorSelectionAPI = {
|
|
5
|
-
setSelectionRelativeToNode: (props: {
|
|
6
|
-
selectionRelativeToNode?: RelativeSelectionPos;
|
|
7
|
-
selection?: Selection | null;
|
|
8
|
-
}) => (state: EditorState) => Transaction;
|
|
9
|
-
getSelectionPluginState: (state: EditorState) => SelectionPluginState;
|
|
10
|
-
};
|
|
11
|
-
export declare const createEditorSelectionAPI: () => EditorSelectionAPI;
|